aitable-workflow-cli 0.1.18 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var tA=Object.defineProperty;var nA=(e,t,n)=>t in e?tA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var le=(e,t,n)=>nA(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function yb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xb={exports:{}},Gu={},_b={exports:{}},ce={};/**
1
+ var JP=Object.defineProperty;var eA=(e,t,n)=>t in e?JP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var le=(e,t,n)=>eA(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function mb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gb={exports:{}},Gu={},vb={exports:{}},ce={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ var tA=Object.defineProperty;var nA=(e,t,n)=>t in e?tA(e,t,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ya=Symbol.for("react.element"),rA=Symbol.for("react.portal"),sA=Symbol.for("react.fragment"),iA=Symbol.for("react.strict_mode"),oA=Symbol.for("react.profiler"),aA=Symbol.for("react.provider"),lA=Symbol.for("react.context"),cA=Symbol.for("react.forward_ref"),uA=Symbol.for("react.suspense"),dA=Symbol.for("react.memo"),fA=Symbol.for("react.lazy"),xy=Symbol.iterator;function hA(e){return e===null||typeof e!="object"?null:(e=xy&&e[xy]||e["@@iterator"],typeof e=="function"?e:null)}var wb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},bb=Object.assign,jb={};function no(e,t,n){this.props=e,this.context=t,this.refs=jb,this.updater=n||wb}no.prototype.isReactComponent={};no.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};no.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Sb(){}Sb.prototype=no.prototype;function Cm(e,t,n){this.props=e,this.context=t,this.refs=jb,this.updater=n||wb}var Tm=Cm.prototype=new Sb;Tm.constructor=Cm;bb(Tm,no.prototype);Tm.isPureReactComponent=!0;var _y=Array.isArray,kb=Object.prototype.hasOwnProperty,Pm={current:null},Nb={key:!0,ref:!0,__self:!0,__source:!0};function Eb(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)kb.call(t,r)&&!Nb.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:Ya,type:e,key:i,ref:o,props:s,_owner:Pm.current}}function pA(e,t){return{$$typeof:Ya,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Am(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ya}function mA(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var wy=/\/+/g;function Qd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?mA(""+e.key):t.toString(36)}function cc(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Ya:case rA:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Qd(o,0):r,_y(s)?(n="",e!=null&&(n=e.replace(wy,"$&/")+"/"),cc(s,t,n,"",function(u){return u})):s!=null&&(Am(s)&&(s=pA(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(wy,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",_y(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Qd(i,l);o+=cc(i,t,n,c,s)}else if(c=hA(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Qd(i,l++),o+=cc(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function wl(e,t,n){if(e==null)return e;var r=[],s=0;return cc(e,r,"","",function(i){return t.call(n,i,s++)}),r}function gA(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ht={current:null},uc={transition:null},vA={ReactCurrentDispatcher:ht,ReactCurrentBatchConfig:uc,ReactCurrentOwner:Pm};function Cb(){throw Error("act(...) is not supported in production builds of React.")}ce.Children={map:wl,forEach:function(e,t,n){wl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return wl(e,function(){t++}),t},toArray:function(e){return wl(e,function(t){return t})||[]},only:function(e){if(!Am(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ce.Component=no;ce.Fragment=sA;ce.Profiler=oA;ce.PureComponent=Cm;ce.StrictMode=iA;ce.Suspense=uA;ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vA;ce.act=Cb;ce.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=bb({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Pm.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)kb.call(t,c)&&!Nb.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:Ya,type:e.type,key:s,ref:i,props:r,_owner:o}};ce.createContext=function(e){return e={$$typeof:lA,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:aA,_context:e},e.Consumer=e};ce.createElement=Eb;ce.createFactory=function(e){var t=Eb.bind(null,e);return t.type=e,t};ce.createRef=function(){return{current:null}};ce.forwardRef=function(e){return{$$typeof:cA,render:e}};ce.isValidElement=Am;ce.lazy=function(e){return{$$typeof:fA,_payload:{_status:-1,_result:e},_init:gA}};ce.memo=function(e,t){return{$$typeof:dA,type:e,compare:t===void 0?null:t}};ce.startTransition=function(e){var t=uc.transition;uc.transition={};try{e()}finally{uc.transition=t}};ce.unstable_act=Cb;ce.useCallback=function(e,t){return ht.current.useCallback(e,t)};ce.useContext=function(e){return ht.current.useContext(e)};ce.useDebugValue=function(){};ce.useDeferredValue=function(e){return ht.current.useDeferredValue(e)};ce.useEffect=function(e,t){return ht.current.useEffect(e,t)};ce.useId=function(){return ht.current.useId()};ce.useImperativeHandle=function(e,t,n){return ht.current.useImperativeHandle(e,t,n)};ce.useInsertionEffect=function(e,t){return ht.current.useInsertionEffect(e,t)};ce.useLayoutEffect=function(e,t){return ht.current.useLayoutEffect(e,t)};ce.useMemo=function(e,t){return ht.current.useMemo(e,t)};ce.useReducer=function(e,t,n){return ht.current.useReducer(e,t,n)};ce.useRef=function(e){return ht.current.useRef(e)};ce.useState=function(e){return ht.current.useState(e)};ce.useSyncExternalStore=function(e,t,n){return ht.current.useSyncExternalStore(e,t,n)};ce.useTransition=function(){return ht.current.useTransition()};ce.version="18.3.1";_b.exports=ce;var w=_b.exports;const or=yb(w);/**
9
+ */var Ya=Symbol.for("react.element"),tA=Symbol.for("react.portal"),nA=Symbol.for("react.fragment"),rA=Symbol.for("react.strict_mode"),sA=Symbol.for("react.profiler"),iA=Symbol.for("react.provider"),oA=Symbol.for("react.context"),aA=Symbol.for("react.forward_ref"),lA=Symbol.for("react.suspense"),cA=Symbol.for("react.memo"),uA=Symbol.for("react.lazy"),gy=Symbol.iterator;function dA(e){return e===null||typeof e!="object"?null:(e=gy&&e[gy]||e["@@iterator"],typeof e=="function"?e:null)}var yb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xb=Object.assign,_b={};function no(e,t,n){this.props=e,this.context=t,this.refs=_b,this.updater=n||yb}no.prototype.isReactComponent={};no.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};no.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function wb(){}wb.prototype=no.prototype;function Cm(e,t,n){this.props=e,this.context=t,this.refs=_b,this.updater=n||yb}var Tm=Cm.prototype=new wb;Tm.constructor=Cm;xb(Tm,no.prototype);Tm.isPureReactComponent=!0;var vy=Array.isArray,bb=Object.prototype.hasOwnProperty,Pm={current:null},jb={key:!0,ref:!0,__self:!0,__source:!0};function Sb(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)bb.call(t,r)&&!jb.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:Ya,type:e,key:i,ref:o,props:s,_owner:Pm.current}}function fA(e,t){return{$$typeof:Ya,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Am(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ya}function hA(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var yy=/\/+/g;function Qd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?hA(""+e.key):t.toString(36)}function cc(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Ya:case tA:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Qd(o,0):r,vy(s)?(n="",e!=null&&(n=e.replace(yy,"$&/")+"/"),cc(s,t,n,"",function(u){return u})):s!=null&&(Am(s)&&(s=fA(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(yy,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",vy(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Qd(i,l);o+=cc(i,t,n,c,s)}else if(c=dA(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Qd(i,l++),o+=cc(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function wl(e,t,n){if(e==null)return e;var r=[],s=0;return cc(e,r,"","",function(i){return t.call(n,i,s++)}),r}function pA(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ht={current:null},uc={transition:null},mA={ReactCurrentDispatcher:ht,ReactCurrentBatchConfig:uc,ReactCurrentOwner:Pm};function kb(){throw Error("act(...) is not supported in production builds of React.")}ce.Children={map:wl,forEach:function(e,t,n){wl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return wl(e,function(){t++}),t},toArray:function(e){return wl(e,function(t){return t})||[]},only:function(e){if(!Am(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ce.Component=no;ce.Fragment=nA;ce.Profiler=sA;ce.PureComponent=Cm;ce.StrictMode=rA;ce.Suspense=lA;ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mA;ce.act=kb;ce.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=xb({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Pm.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)bb.call(t,c)&&!jb.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:Ya,type:e.type,key:s,ref:i,props:r,_owner:o}};ce.createContext=function(e){return e={$$typeof:oA,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:iA,_context:e},e.Consumer=e};ce.createElement=Sb;ce.createFactory=function(e){var t=Sb.bind(null,e);return t.type=e,t};ce.createRef=function(){return{current:null}};ce.forwardRef=function(e){return{$$typeof:aA,render:e}};ce.isValidElement=Am;ce.lazy=function(e){return{$$typeof:uA,_payload:{_status:-1,_result:e},_init:pA}};ce.memo=function(e,t){return{$$typeof:cA,type:e,compare:t===void 0?null:t}};ce.startTransition=function(e){var t=uc.transition;uc.transition={};try{e()}finally{uc.transition=t}};ce.unstable_act=kb;ce.useCallback=function(e,t){return ht.current.useCallback(e,t)};ce.useContext=function(e){return ht.current.useContext(e)};ce.useDebugValue=function(){};ce.useDeferredValue=function(e){return ht.current.useDeferredValue(e)};ce.useEffect=function(e,t){return ht.current.useEffect(e,t)};ce.useId=function(){return ht.current.useId()};ce.useImperativeHandle=function(e,t,n){return ht.current.useImperativeHandle(e,t,n)};ce.useInsertionEffect=function(e,t){return ht.current.useInsertionEffect(e,t)};ce.useLayoutEffect=function(e,t){return ht.current.useLayoutEffect(e,t)};ce.useMemo=function(e,t){return ht.current.useMemo(e,t)};ce.useReducer=function(e,t,n){return ht.current.useReducer(e,t,n)};ce.useRef=function(e){return ht.current.useRef(e)};ce.useState=function(e){return ht.current.useState(e)};ce.useSyncExternalStore=function(e,t,n){return ht.current.useSyncExternalStore(e,t,n)};ce.useTransition=function(){return ht.current.useTransition()};ce.version="18.3.1";vb.exports=ce;var w=vb.exports;const or=mb(w);/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@ var tA=Object.defineProperty;var nA=(e,t,n)=>t in e?tA(e,t,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var yA=w,xA=Symbol.for("react.element"),_A=Symbol.for("react.fragment"),wA=Object.prototype.hasOwnProperty,bA=yA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,jA={key:!0,ref:!0,__self:!0,__source:!0};function Tb(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)wA.call(t,r)&&!jA.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:xA,type:e,key:i,ref:o,props:s,_owner:bA.current}}Gu.Fragment=_A;Gu.jsx=Tb;Gu.jsxs=Tb;xb.exports=Gu;var a=xb.exports,Pb={exports:{}},Ot={},Ab={exports:{}},Rb={};/**
17
+ */var gA=w,vA=Symbol.for("react.element"),yA=Symbol.for("react.fragment"),xA=Object.prototype.hasOwnProperty,_A=gA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,wA={key:!0,ref:!0,__self:!0,__source:!0};function Nb(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)xA.call(t,r)&&!wA.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:vA,type:e,key:i,ref:o,props:s,_owner:_A.current}}Gu.Fragment=yA;Gu.jsx=Nb;Gu.jsxs=Nb;gb.exports=Gu;var a=gb.exports,Eb={exports:{}},Ot={},Cb={exports:{}},Tb={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@ var tA=Object.defineProperty;var nA=(e,t,n)=>t in e?tA(e,t,{enumerable:!0,config
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
- */(function(e){function t(I,C){var L=I.length;I.push(C);e:for(;0<L;){var F=L-1>>>1,V=I[F];if(0<s(V,C))I[F]=C,I[L]=V,L=F;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var C=I[0],L=I.pop();if(L!==C){I[0]=L;e:for(var F=0,V=I.length,H=V>>>1;F<H;){var U=2*(F+1)-1,W=I[U],G=U+1,Y=I[G];if(0>s(W,L))G<V&&0>s(Y,W)?(I[F]=Y,I[G]=L,F=G):(I[F]=W,I[U]=L,F=U);else if(G<V&&0>s(Y,L))I[F]=Y,I[G]=L,F=G;else break e}}return C}function s(I,C){var L=I.sortIndex-C.sortIndex;return L!==0?L:I.id-C.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(I){for(var C=n(u);C!==null;){if(C.callback===null)r(u);else if(C.startTime<=I)r(u),C.sortIndex=C.expirationTime,t(c,C);else break;C=n(u)}}function b(I){if(x=!1,m(I),!g)if(n(c)!==null)g=!0,A(j);else{var C=n(u);C!==null&&P(b,C.startTime-I)}}function j(I,C){g=!1,x&&(x=!1,v(N),N=-1),p=!0;var L=h;try{for(m(C),f=n(c);f!==null&&(!(f.expirationTime>C)||I&&!D());){var F=f.callback;if(typeof F=="function"){f.callback=null,h=f.priorityLevel;var V=F(f.expirationTime<=C);C=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(c)&&r(c),m(C)}else r(c);f=n(c)}if(f!==null)var H=!0;else{var U=n(u);U!==null&&P(b,U.startTime-C),H=!1}return H}finally{f=null,h=L,p=!1}}var k=!1,S=null,N=-1,R=5,O=-1;function D(){return!(e.unstable_now()-O<R)}function M(){if(S!==null){var I=e.unstable_now();O=I;var C=!0;try{C=S(!0,I)}finally{C?z():(k=!1,S=null)}}else k=!1}var z;if(typeof y=="function")z=function(){y(M)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,E=T.port2;T.port1.onmessage=M,z=function(){E.postMessage(null)}}else z=function(){_(M,0)};function A(I){S=I,k||(k=!0,z())}function P(I,C){N=_(function(){I(e.unstable_now())},C)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_continueExecution=function(){g||p||(g=!0,A(j))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(I){switch(h){case 1:case 2:case 3:var C=3;break;default:C=h}var L=h;h=C;try{return I()}finally{h=L}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,C){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var L=h;h=I;try{return C()}finally{h=L}},e.unstable_scheduleCallback=function(I,C,L){var F=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?F+L:F):L=F,I){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=L+V,I={id:d++,callback:C,priorityLevel:I,startTime:L,expirationTime:V,sortIndex:-1},L>F?(I.sortIndex=L,t(u,I),n(c)===null&&I===n(u)&&(x?(v(N),N=-1):x=!0,P(b,L-F))):(I.sortIndex=V,t(c,I),g||p||(g=!0,A(j))),I},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(I){var C=h;return function(){var L=h;h=C;try{return I.apply(this,arguments)}finally{h=L}}}})(Rb);Ab.exports=Rb;var SA=Ab.exports;/**
25
+ */(function(e){function t(I,C){var L=I.length;I.push(C);e:for(;0<L;){var F=L-1>>>1,V=I[F];if(0<s(V,C))I[F]=C,I[L]=V,L=F;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var C=I[0],L=I.pop();if(L!==C){I[0]=L;e:for(var F=0,V=I.length,H=V>>>1;F<H;){var U=2*(F+1)-1,W=I[U],G=U+1,Y=I[G];if(0>s(W,L))G<V&&0>s(Y,W)?(I[F]=Y,I[G]=L,F=G):(I[F]=W,I[U]=L,F=U);else if(G<V&&0>s(Y,L))I[F]=Y,I[G]=L,F=G;else break e}}return C}function s(I,C){var L=I.sortIndex-C.sortIndex;return L!==0?L:I.id-C.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(I){for(var C=n(u);C!==null;){if(C.callback===null)r(u);else if(C.startTime<=I)r(u),C.sortIndex=C.expirationTime,t(c,C);else break;C=n(u)}}function b(I){if(x=!1,m(I),!g)if(n(c)!==null)g=!0,A(j);else{var C=n(u);C!==null&&P(b,C.startTime-I)}}function j(I,C){g=!1,x&&(x=!1,v(N),N=-1),p=!0;var L=h;try{for(m(C),f=n(c);f!==null&&(!(f.expirationTime>C)||I&&!D());){var F=f.callback;if(typeof F=="function"){f.callback=null,h=f.priorityLevel;var V=F(f.expirationTime<=C);C=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(c)&&r(c),m(C)}else r(c);f=n(c)}if(f!==null)var H=!0;else{var U=n(u);U!==null&&P(b,U.startTime-C),H=!1}return H}finally{f=null,h=L,p=!1}}var k=!1,S=null,N=-1,R=5,O=-1;function D(){return!(e.unstable_now()-O<R)}function M(){if(S!==null){var I=e.unstable_now();O=I;var C=!0;try{C=S(!0,I)}finally{C?z():(k=!1,S=null)}}else k=!1}var z;if(typeof y=="function")z=function(){y(M)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,E=T.port2;T.port1.onmessage=M,z=function(){E.postMessage(null)}}else z=function(){_(M,0)};function A(I){S=I,k||(k=!0,z())}function P(I,C){N=_(function(){I(e.unstable_now())},C)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_continueExecution=function(){g||p||(g=!0,A(j))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(I){switch(h){case 1:case 2:case 3:var C=3;break;default:C=h}var L=h;h=C;try{return I()}finally{h=L}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,C){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var L=h;h=I;try{return C()}finally{h=L}},e.unstable_scheduleCallback=function(I,C,L){var F=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?F+L:F):L=F,I){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=L+V,I={id:d++,callback:C,priorityLevel:I,startTime:L,expirationTime:V,sortIndex:-1},L>F?(I.sortIndex=L,t(u,I),n(c)===null&&I===n(u)&&(x?(v(N),N=-1):x=!0,P(b,L-F))):(I.sortIndex=V,t(c,I),g||p||(g=!0,A(j))),I},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(I){var C=h;return function(){var L=h;h=C;try{return I.apply(this,arguments)}finally{h=L}}}})(Tb);Cb.exports=Tb;var bA=Cb.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@ var tA=Object.defineProperty;var nA=(e,t,n)=>t in e?tA(e,t,{enumerable:!0,config
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 kA=w,Rt=SA;function q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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."}var Ib=new Set,la={};function Bs(e,t){Ii(e,t),Ii(e+"Capture",t)}function Ii(e,t){for(la[e]=t,e=0;e<t.length;e++)Ib.add(t[e])}var pr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wh=Object.prototype.hasOwnProperty,NA=/^[: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]*$/,by={},jy={};function EA(e){return wh.call(jy,e)?!0:wh.call(by,e)?!1:NA.test(e)?jy[e]=!0:(by[e]=!0,!1)}function CA(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function TA(e,t,n,r){if(t===null||typeof t>"u"||CA(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function pt(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var et={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){et[e]=new pt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];et[t]=new pt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){et[e]=new pt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){et[e]=new pt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){et[e]=new pt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){et[e]=new pt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){et[e]=new pt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){et[e]=new pt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){et[e]=new pt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Rm=/[\-:]([a-z])/g;function Im(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Rm,Im);et[t]=new pt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Rm,Im);et[t]=new pt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Rm,Im);et[t]=new pt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){et[e]=new pt(e,1,!1,e.toLowerCase(),null,!1,!1)});et.xlinkHref=new pt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){et[e]=new pt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mm(e,t,n,r){var s=et.hasOwnProperty(t)?et[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(TA(t,n,s,r)&&(n=null),r||s===null?EA(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var jr=kA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,bl=Symbol.for("react.element"),ni=Symbol.for("react.portal"),ri=Symbol.for("react.fragment"),Om=Symbol.for("react.strict_mode"),bh=Symbol.for("react.profiler"),Mb=Symbol.for("react.provider"),Ob=Symbol.for("react.context"),Lm=Symbol.for("react.forward_ref"),jh=Symbol.for("react.suspense"),Sh=Symbol.for("react.suspense_list"),$m=Symbol.for("react.memo"),Pr=Symbol.for("react.lazy"),Lb=Symbol.for("react.offscreen"),Sy=Symbol.iterator;function vo(e){return e===null||typeof e!="object"?null:(e=Sy&&e[Sy]||e["@@iterator"],typeof e=="function"?e:null)}var Me=Object.assign,Zd;function Ro(e){if(Zd===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Zd=t&&t[1]||""}return`
33
+ */var jA=w,Rt=bA;function q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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."}var Pb=new Set,la={};function Bs(e,t){Ii(e,t),Ii(e+"Capture",t)}function Ii(e,t){for(la[e]=t,e=0;e<t.length;e++)Pb.add(t[e])}var pr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wh=Object.prototype.hasOwnProperty,SA=/^[: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]*$/,xy={},_y={};function kA(e){return wh.call(_y,e)?!0:wh.call(xy,e)?!1:SA.test(e)?_y[e]=!0:(xy[e]=!0,!1)}function NA(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function EA(e,t,n,r){if(t===null||typeof t>"u"||NA(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function pt(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var et={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){et[e]=new pt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];et[t]=new pt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){et[e]=new pt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){et[e]=new pt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){et[e]=new pt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){et[e]=new pt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){et[e]=new pt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){et[e]=new pt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){et[e]=new pt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Rm=/[\-:]([a-z])/g;function Im(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Rm,Im);et[t]=new pt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Rm,Im);et[t]=new pt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Rm,Im);et[t]=new pt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){et[e]=new pt(e,1,!1,e.toLowerCase(),null,!1,!1)});et.xlinkHref=new pt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){et[e]=new pt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mm(e,t,n,r){var s=et.hasOwnProperty(t)?et[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(EA(t,n,s,r)&&(n=null),r||s===null?kA(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var jr=jA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,bl=Symbol.for("react.element"),ni=Symbol.for("react.portal"),ri=Symbol.for("react.fragment"),Om=Symbol.for("react.strict_mode"),bh=Symbol.for("react.profiler"),Ab=Symbol.for("react.provider"),Rb=Symbol.for("react.context"),Lm=Symbol.for("react.forward_ref"),jh=Symbol.for("react.suspense"),Sh=Symbol.for("react.suspense_list"),$m=Symbol.for("react.memo"),Pr=Symbol.for("react.lazy"),Ib=Symbol.for("react.offscreen"),wy=Symbol.iterator;function vo(e){return e===null||typeof e!="object"?null:(e=wy&&e[wy]||e["@@iterator"],typeof e=="function"?e:null)}var Me=Object.assign,Zd;function Ro(e){if(Zd===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Zd=t&&t[1]||""}return`
34
34
  `+Zd+e}var Jd=!1;function ef(e,t){if(!e||Jd)return"";Jd=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
35
35
  `),i=r.stack.split(`
36
36
  `),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
37
- `+s[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Jd=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ro(e):""}function PA(e){switch(e.tag){case 5:return Ro(e.type);case 16:return Ro("Lazy");case 13:return Ro("Suspense");case 19:return Ro("SuspenseList");case 0:case 2:case 15:return e=ef(e.type,!1),e;case 11:return e=ef(e.type.render,!1),e;case 1:return e=ef(e.type,!0),e;default:return""}}function kh(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ri:return"Fragment";case ni:return"Portal";case bh:return"Profiler";case Om:return"StrictMode";case jh:return"Suspense";case Sh:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ob:return(e.displayName||"Context")+".Consumer";case Mb:return(e._context.displayName||"Context")+".Provider";case Lm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $m:return t=e.displayName||null,t!==null?t:kh(e.type)||"Memo";case Pr:t=e._payload,e=e._init;try{return kh(e(t))}catch{}}return null}function AA(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return kh(t);case 8:return t===Om?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Gr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $b(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function RA(e){var t=$b(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jl(e){e._valueTracker||(e._valueTracker=RA(e))}function Db(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$b(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Vc(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}}function Nh(e,t){var n=t.checked;return Me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ky(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Gr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function zb(e,t){t=t.checked,t!=null&&Mm(e,"checked",t,!1)}function Eh(e,t){zb(e,t);var n=Gr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ch(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ch(e,t.type,Gr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ny(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ch(e,t,n){(t!=="number"||Vc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Io=Array.isArray;function Si(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Gr(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Th(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(q(91));return Me({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ey(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(q(92));if(Io(n)){if(1<n.length)throw Error(q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Gr(n)}}function Fb(e,t){var n=Gr(t.value),r=Gr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Cy(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Vb(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ph(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Vb(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Sl,Bb=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Sl=Sl||document.createElement("div"),Sl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Sl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ca(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Uo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},IA=["Webkit","ms","Moz","O"];Object.keys(Uo).forEach(function(e){IA.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Uo[t]=Uo[e]})});function Ub(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Uo.hasOwnProperty(e)&&Uo[e]?(""+t).trim():t+"px"}function Hb(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Ub(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var MA=Me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ah(e,t){if(t){if(MA[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(q(62))}}function Rh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Ih=null;function Dm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Mh=null,ki=null,Ni=null;function Ty(e){if(e=Za(e)){if(typeof Mh!="function")throw Error(q(280));var t=e.stateNode;t&&(t=Zu(t),Mh(e.stateNode,e.type,t))}}function Wb(e){ki?Ni?Ni.push(e):Ni=[e]:ki=e}function Kb(){if(ki){var e=ki,t=Ni;if(Ni=ki=null,Ty(e),t)for(e=0;e<t.length;e++)Ty(t[e])}}function Gb(e,t){return e(t)}function qb(){}var tf=!1;function Yb(e,t,n){if(tf)return e(t,n);tf=!0;try{return Gb(e,t,n)}finally{tf=!1,(ki!==null||Ni!==null)&&(qb(),Kb())}}function ua(e,t){var n=e.stateNode;if(n===null)return null;var r=Zu(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(q(231,t,typeof n));return n}var Oh=!1;if(pr)try{var yo={};Object.defineProperty(yo,"passive",{get:function(){Oh=!0}}),window.addEventListener("test",yo,yo),window.removeEventListener("test",yo,yo)}catch{Oh=!1}function OA(e,t,n,r,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var Ho=!1,Bc=null,Uc=!1,Lh=null,LA={onError:function(e){Ho=!0,Bc=e}};function $A(e,t,n,r,s,i,o,l,c){Ho=!1,Bc=null,OA.apply(LA,arguments)}function DA(e,t,n,r,s,i,o,l,c){if($A.apply(this,arguments),Ho){if(Ho){var u=Bc;Ho=!1,Bc=null}else throw Error(q(198));Uc||(Uc=!0,Lh=u)}}function Us(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Xb(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 Py(e){if(Us(e)!==e)throw Error(q(188))}function zA(e){var t=e.alternate;if(!t){if(t=Us(e),t===null)throw Error(q(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Py(s),e;if(i===r)return Py(s),t;i=i.sibling}throw Error(q(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(q(189))}}if(n.alternate!==r)throw Error(q(190))}if(n.tag!==3)throw Error(q(188));return n.stateNode.current===n?e:t}function Qb(e){return e=zA(e),e!==null?Zb(e):null}function Zb(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Zb(e);if(t!==null)return t;e=e.sibling}return null}var Jb=Rt.unstable_scheduleCallback,Ay=Rt.unstable_cancelCallback,FA=Rt.unstable_shouldYield,VA=Rt.unstable_requestPaint,Ve=Rt.unstable_now,BA=Rt.unstable_getCurrentPriorityLevel,zm=Rt.unstable_ImmediatePriority,ej=Rt.unstable_UserBlockingPriority,Hc=Rt.unstable_NormalPriority,UA=Rt.unstable_LowPriority,tj=Rt.unstable_IdlePriority,qu=null,Ln=null;function HA(e){if(Ln&&typeof Ln.onCommitFiberRoot=="function")try{Ln.onCommitFiberRoot(qu,e,void 0,(e.current.flags&128)===128)}catch{}}var gn=Math.clz32?Math.clz32:GA,WA=Math.log,KA=Math.LN2;function GA(e){return e>>>=0,e===0?32:31-(WA(e)/KA|0)|0}var kl=64,Nl=4194304;function Mo(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Wc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=Mo(l):(i&=o,i!==0&&(r=Mo(i)))}else o=n&~s,o!==0?r=Mo(o):i!==0&&(r=Mo(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-gn(t),s=1<<n,r|=e[n],t&=~s;return r}function qA(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function YA(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-gn(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=qA(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function $h(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function nj(){var e=kl;return kl<<=1,!(kl&4194240)&&(kl=64),e}function nf(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-gn(t),e[t]=n}function XA(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-gn(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Fm(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-gn(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var xe=0;function rj(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var sj,Vm,ij,oj,aj,Dh=!1,El=[],Dr=null,zr=null,Fr=null,da=new Map,fa=new Map,Rr=[],QA="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 submit".split(" ");function Ry(e,t){switch(e){case"focusin":case"focusout":Dr=null;break;case"dragenter":case"dragleave":zr=null;break;case"mouseover":case"mouseout":Fr=null;break;case"pointerover":case"pointerout":da.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":fa.delete(t.pointerId)}}function xo(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Za(t),t!==null&&Vm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function ZA(e,t,n,r,s){switch(t){case"focusin":return Dr=xo(Dr,e,t,n,r,s),!0;case"dragenter":return zr=xo(zr,e,t,n,r,s),!0;case"mouseover":return Fr=xo(Fr,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return da.set(i,xo(da.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,fa.set(i,xo(fa.get(i)||null,e,t,n,r,s)),!0}return!1}function lj(e){var t=gs(e.target);if(t!==null){var n=Us(t);if(n!==null){if(t=n.tag,t===13){if(t=Xb(n),t!==null){e.blockedOn=t,aj(e.priority,function(){ij(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function dc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=zh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ih=r,n.target.dispatchEvent(r),Ih=null}else return t=Za(n),t!==null&&Vm(t),e.blockedOn=n,!1;t.shift()}return!0}function Iy(e,t,n){dc(e)&&n.delete(t)}function JA(){Dh=!1,Dr!==null&&dc(Dr)&&(Dr=null),zr!==null&&dc(zr)&&(zr=null),Fr!==null&&dc(Fr)&&(Fr=null),da.forEach(Iy),fa.forEach(Iy)}function _o(e,t){e.blockedOn===t&&(e.blockedOn=null,Dh||(Dh=!0,Rt.unstable_scheduleCallback(Rt.unstable_NormalPriority,JA)))}function ha(e){function t(s){return _o(s,e)}if(0<El.length){_o(El[0],e);for(var n=1;n<El.length;n++){var r=El[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Dr!==null&&_o(Dr,e),zr!==null&&_o(zr,e),Fr!==null&&_o(Fr,e),da.forEach(t),fa.forEach(t),n=0;n<Rr.length;n++)r=Rr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Rr.length&&(n=Rr[0],n.blockedOn===null);)lj(n),n.blockedOn===null&&Rr.shift()}var Ei=jr.ReactCurrentBatchConfig,Kc=!0;function eR(e,t,n,r){var s=xe,i=Ei.transition;Ei.transition=null;try{xe=1,Bm(e,t,n,r)}finally{xe=s,Ei.transition=i}}function tR(e,t,n,r){var s=xe,i=Ei.transition;Ei.transition=null;try{xe=4,Bm(e,t,n,r)}finally{xe=s,Ei.transition=i}}function Bm(e,t,n,r){if(Kc){var s=zh(e,t,n,r);if(s===null)hf(e,t,r,Gc,n),Ry(e,r);else if(ZA(s,e,t,n,r))r.stopPropagation();else if(Ry(e,r),t&4&&-1<QA.indexOf(e)){for(;s!==null;){var i=Za(s);if(i!==null&&sj(i),i=zh(e,t,n,r),i===null&&hf(e,t,r,Gc,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else hf(e,t,r,null,n)}}var Gc=null;function zh(e,t,n,r){if(Gc=null,e=Dm(r),e=gs(e),e!==null)if(t=Us(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Xb(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Gc=e,null}function cj(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(BA()){case zm:return 1;case ej:return 4;case Hc:case UA:return 16;case tj:return 536870912;default:return 16}default:return 16}}var Or=null,Um=null,fc=null;function uj(){if(fc)return fc;var e,t=Um,n=t.length,r,s="value"in Or?Or.value:Or.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return fc=s.slice(e,1<r?1-r:void 0)}function hc(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 Cl(){return!0}function My(){return!1}function Lt(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Cl:My,this.isPropagationStopped=My,this}return Me(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Cl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Cl)},persist:function(){},isPersistent:Cl}),t}var ro={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hm=Lt(ro),Qa=Me({},ro,{view:0,detail:0}),nR=Lt(Qa),rf,sf,wo,Yu=Me({},Qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wm,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!==wo&&(wo&&e.type==="mousemove"?(rf=e.screenX-wo.screenX,sf=e.screenY-wo.screenY):sf=rf=0,wo=e),rf)},movementY:function(e){return"movementY"in e?e.movementY:sf}}),Oy=Lt(Yu),rR=Me({},Yu,{dataTransfer:0}),sR=Lt(rR),iR=Me({},Qa,{relatedTarget:0}),of=Lt(iR),oR=Me({},ro,{animationName:0,elapsedTime:0,pseudoElement:0}),aR=Lt(oR),lR=Me({},ro,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),cR=Lt(lR),uR=Me({},ro,{data:0}),Ly=Lt(uR),dR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fR={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"},hR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=hR[e])?!!t[e]:!1}function Wm(){return pR}var mR=Me({},Qa,{key:function(e){if(e.key){var t=dR[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?fR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wm,charCode:function(e){return e.type==="keypress"?hc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),gR=Lt(mR),vR=Me({},Yu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$y=Lt(vR),yR=Me({},Qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wm}),xR=Lt(yR),_R=Me({},ro,{propertyName:0,elapsedTime:0,pseudoElement:0}),wR=Lt(_R),bR=Me({},Yu,{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}),jR=Lt(bR),SR=[9,13,27,32],Km=pr&&"CompositionEvent"in window,Wo=null;pr&&"documentMode"in document&&(Wo=document.documentMode);var kR=pr&&"TextEvent"in window&&!Wo,dj=pr&&(!Km||Wo&&8<Wo&&11>=Wo),Dy=" ",zy=!1;function fj(e,t){switch(e){case"keyup":return SR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var si=!1;function NR(e,t){switch(e){case"compositionend":return hj(t);case"keypress":return t.which!==32?null:(zy=!0,Dy);case"textInput":return e=t.data,e===Dy&&zy?null:e;default:return null}}function ER(e,t){if(si)return e==="compositionend"||!Km&&fj(e,t)?(e=uj(),fc=Um=Or=null,si=!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 dj&&t.locale!=="ko"?null:t.data;default:return null}}var CR={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 Fy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!CR[e.type]:t==="textarea"}function pj(e,t,n,r){Wb(r),t=qc(t,"onChange"),0<t.length&&(n=new Hm("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ko=null,pa=null;function TR(e){kj(e,0)}function Xu(e){var t=ai(e);if(Db(t))return e}function PR(e,t){if(e==="change")return t}var mj=!1;if(pr){var af;if(pr){var lf="oninput"in document;if(!lf){var Vy=document.createElement("div");Vy.setAttribute("oninput","return;"),lf=typeof Vy.oninput=="function"}af=lf}else af=!1;mj=af&&(!document.documentMode||9<document.documentMode)}function By(){Ko&&(Ko.detachEvent("onpropertychange",gj),pa=Ko=null)}function gj(e){if(e.propertyName==="value"&&Xu(pa)){var t=[];pj(t,pa,e,Dm(e)),Yb(TR,t)}}function AR(e,t,n){e==="focusin"?(By(),Ko=t,pa=n,Ko.attachEvent("onpropertychange",gj)):e==="focusout"&&By()}function RR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Xu(pa)}function IR(e,t){if(e==="click")return Xu(t)}function MR(e,t){if(e==="input"||e==="change")return Xu(t)}function OR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wn=typeof Object.is=="function"?Object.is:OR;function ma(e,t){if(wn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!wh.call(t,s)||!wn(e[s],t[s]))return!1}return!0}function Uy(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hy(e,t){var n=Uy(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Uy(n)}}function vj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yj(){for(var e=window,t=Vc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Vc(e.document)}return t}function Gm(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")}function LR(e){var t=yj(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&vj(n.ownerDocument.documentElement,n)){if(r!==null&&Gm(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Hy(n,i);var o=Hy(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var $R=pr&&"documentMode"in document&&11>=document.documentMode,ii=null,Fh=null,Go=null,Vh=!1;function Wy(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vh||ii==null||ii!==Vc(r)||(r=ii,"selectionStart"in r&&Gm(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Go&&ma(Go,r)||(Go=r,r=qc(Fh,"onSelect"),0<r.length&&(t=new Hm("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ii)))}function Tl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var oi={animationend:Tl("Animation","AnimationEnd"),animationiteration:Tl("Animation","AnimationIteration"),animationstart:Tl("Animation","AnimationStart"),transitionend:Tl("Transition","TransitionEnd")},cf={},xj={};pr&&(xj=document.createElement("div").style,"AnimationEvent"in window||(delete oi.animationend.animation,delete oi.animationiteration.animation,delete oi.animationstart.animation),"TransitionEvent"in window||delete oi.transitionend.transition);function Qu(e){if(cf[e])return cf[e];if(!oi[e])return e;var t=oi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in xj)return cf[e]=t[n];return e}var _j=Qu("animationend"),wj=Qu("animationiteration"),bj=Qu("animationstart"),jj=Qu("transitionend"),Sj=new Map,Ky="abort auxClick 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(" ");function Zr(e,t){Sj.set(e,t),Bs(t,[e])}for(var uf=0;uf<Ky.length;uf++){var df=Ky[uf],DR=df.toLowerCase(),zR=df[0].toUpperCase()+df.slice(1);Zr(DR,"on"+zR)}Zr(_j,"onAnimationEnd");Zr(wj,"onAnimationIteration");Zr(bj,"onAnimationStart");Zr("dblclick","onDoubleClick");Zr("focusin","onFocus");Zr("focusout","onBlur");Zr(jj,"onTransitionEnd");Ii("onMouseEnter",["mouseout","mouseover"]);Ii("onMouseLeave",["mouseout","mouseover"]);Ii("onPointerEnter",["pointerout","pointerover"]);Ii("onPointerLeave",["pointerout","pointerover"]);Bs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Bs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Bs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Bs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Bs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Bs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oo="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(" "),FR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Oo));function Gy(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,DA(r,t,void 0,e),e.currentTarget=null}function kj(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;Gy(s,l,u),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;Gy(s,l,u),i=c}}}if(Uc)throw e=Lh,Uc=!1,Lh=null,e}function be(e,t){var n=t[Kh];n===void 0&&(n=t[Kh]=new Set);var r=e+"__bubble";n.has(r)||(Nj(t,e,2,!1),n.add(r))}function ff(e,t,n){var r=0;t&&(r|=4),Nj(n,e,r,t)}var Pl="_reactListening"+Math.random().toString(36).slice(2);function ga(e){if(!e[Pl]){e[Pl]=!0,Ib.forEach(function(n){n!=="selectionchange"&&(FR.has(n)||ff(n,!1,e),ff(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Pl]||(t[Pl]=!0,ff("selectionchange",!1,t))}}function Nj(e,t,n,r){switch(cj(t)){case 1:var s=eR;break;case 4:s=tR;break;default:s=Bm}n=s.bind(null,t,n,e),s=void 0,!Oh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function hf(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=gs(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}Yb(function(){var u=i,d=Dm(n),f=[];e:{var h=Sj.get(e);if(h!==void 0){var p=Hm,g=e;switch(e){case"keypress":if(hc(n)===0)break e;case"keydown":case"keyup":p=gR;break;case"focusin":g="focus",p=of;break;case"focusout":g="blur",p=of;break;case"beforeblur":case"afterblur":p=of;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Oy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=sR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=xR;break;case _j:case wj:case bj:p=aR;break;case jj:p=wR;break;case"scroll":p=nR;break;case"wheel":p=jR;break;case"copy":case"cut":case"paste":p=cR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=$y}var x=(t&4)!==0,_=!x&&e==="scroll",v=x?h!==null?h+"Capture":null:h;x=[];for(var y=u,m;y!==null;){m=y;var b=m.stateNode;if(m.tag===5&&b!==null&&(m=b,v!==null&&(b=ua(y,v),b!=null&&x.push(va(y,b,m)))),_)break;y=y.return}0<x.length&&(h=new p(h,g,null,n,d),f.push({event:h,listeners:x}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==Ih&&(g=n.relatedTarget||n.fromElement)&&(gs(g)||g[mr]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=u,g=g?gs(g):null,g!==null&&(_=Us(g),g!==_||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=u),p!==g)){if(x=Oy,b="onMouseLeave",v="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(x=$y,b="onPointerLeave",v="onPointerEnter",y="pointer"),_=p==null?h:ai(p),m=g==null?h:ai(g),h=new x(b,y+"leave",p,n,d),h.target=_,h.relatedTarget=m,b=null,gs(d)===u&&(x=new x(v,y+"enter",g,n,d),x.target=m,x.relatedTarget=_,b=x),_=b,p&&g)t:{for(x=p,v=g,y=0,m=x;m;m=Qs(m))y++;for(m=0,b=v;b;b=Qs(b))m++;for(;0<y-m;)x=Qs(x),y--;for(;0<m-y;)v=Qs(v),m--;for(;y--;){if(x===v||v!==null&&x===v.alternate)break t;x=Qs(x),v=Qs(v)}x=null}else x=null;p!==null&&qy(f,h,p,x,!1),g!==null&&_!==null&&qy(f,_,g,x,!0)}}e:{if(h=u?ai(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var j=PR;else if(Fy(h))if(mj)j=MR;else{j=RR;var k=AR}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(j=IR);if(j&&(j=j(e,u))){pj(f,j,n,d);break e}k&&k(e,h,u),e==="focusout"&&(k=h._wrapperState)&&k.controlled&&h.type==="number"&&Ch(h,"number",h.value)}switch(k=u?ai(u):window,e){case"focusin":(Fy(k)||k.contentEditable==="true")&&(ii=k,Fh=u,Go=null);break;case"focusout":Go=Fh=ii=null;break;case"mousedown":Vh=!0;break;case"contextmenu":case"mouseup":case"dragend":Vh=!1,Wy(f,n,d);break;case"selectionchange":if($R)break;case"keydown":case"keyup":Wy(f,n,d)}var S;if(Km)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else si?fj(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(dj&&n.locale!=="ko"&&(si||N!=="onCompositionStart"?N==="onCompositionEnd"&&si&&(S=uj()):(Or=d,Um="value"in Or?Or.value:Or.textContent,si=!0)),k=qc(u,N),0<k.length&&(N=new Ly(N,e,null,n,d),f.push({event:N,listeners:k}),S?N.data=S:(S=hj(n),S!==null&&(N.data=S)))),(S=kR?NR(e,n):ER(e,n))&&(u=qc(u,"onBeforeInput"),0<u.length&&(d=new Ly("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=S))}kj(f,t)})}function va(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qc(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=ua(e,n),i!=null&&r.unshift(va(e,i,s)),i=ua(e,t),i!=null&&r.push(va(e,i,s))),e=e.return}return r}function Qs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function qy(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=ua(n,i),c!=null&&o.unshift(va(n,c,l))):s||(c=ua(n,i),c!=null&&o.push(va(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var VR=/\r\n?/g,BR=/\u0000|\uFFFD/g;function Yy(e){return(typeof e=="string"?e:""+e).replace(VR,`
38
- `).replace(BR,"")}function Al(e,t,n){if(t=Yy(t),Yy(e)!==t&&n)throw Error(q(425))}function Yc(){}var Bh=null,Uh=null;function Hh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wh=typeof setTimeout=="function"?setTimeout:void 0,UR=typeof clearTimeout=="function"?clearTimeout:void 0,Xy=typeof Promise=="function"?Promise:void 0,HR=typeof queueMicrotask=="function"?queueMicrotask:typeof Xy<"u"?function(e){return Xy.resolve(null).then(e).catch(WR)}:Wh;function WR(e){setTimeout(function(){throw e})}function pf(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),ha(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);ha(t)}function Vr(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==="$?")break;if(t==="/$")return null}}return e}function Qy(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var so=Math.random().toString(36).slice(2),Rn="__reactFiber$"+so,ya="__reactProps$"+so,mr="__reactContainer$"+so,Kh="__reactEvents$"+so,KR="__reactListeners$"+so,GR="__reactHandles$"+so;function gs(e){var t=e[Rn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mr]||n[Rn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Qy(e);e!==null;){if(n=e[Rn])return n;e=Qy(e)}return t}e=n,n=e.parentNode}return null}function Za(e){return e=e[Rn]||e[mr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ai(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(q(33))}function Zu(e){return e[ya]||null}var Gh=[],li=-1;function Jr(e){return{current:e}}function Se(e){0>li||(e.current=Gh[li],Gh[li]=null,li--)}function _e(e,t){li++,Gh[li]=e.current,e.current=t}var qr={},at=Jr(qr),yt=Jr(!1),Es=qr;function Mi(e,t){var n=e.type.contextTypes;if(!n)return qr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function xt(e){return e=e.childContextTypes,e!=null}function Xc(){Se(yt),Se(at)}function Zy(e,t,n){if(at.current!==qr)throw Error(q(168));_e(at,t),_e(yt,n)}function Ej(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(q(108,AA(e)||"Unknown",s));return Me({},n,r)}function Qc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qr,Es=at.current,_e(at,e),_e(yt,yt.current),!0}function Jy(e,t,n){var r=e.stateNode;if(!r)throw Error(q(169));n?(e=Ej(e,t,Es),r.__reactInternalMemoizedMergedChildContext=e,Se(yt),Se(at),_e(at,e)):Se(yt),_e(yt,n)}var Qn=null,Ju=!1,mf=!1;function Cj(e){Qn===null?Qn=[e]:Qn.push(e)}function qR(e){Ju=!0,Cj(e)}function es(){if(!mf&&Qn!==null){mf=!0;var e=0,t=xe;try{var n=Qn;for(xe=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Qn=null,Ju=!1}catch(s){throw Qn!==null&&(Qn=Qn.slice(e+1)),Jb(zm,es),s}finally{xe=t,mf=!1}}return null}var ci=[],ui=0,Zc=null,Jc=0,Wt=[],Kt=0,Cs=null,nr=1,rr="";function ls(e,t){ci[ui++]=Jc,ci[ui++]=Zc,Zc=e,Jc=t}function Tj(e,t,n){Wt[Kt++]=nr,Wt[Kt++]=rr,Wt[Kt++]=Cs,Cs=e;var r=nr;e=rr;var s=32-gn(r)-1;r&=~(1<<s),n+=1;var i=32-gn(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,nr=1<<32-gn(t)+s|n<<s|r,rr=i+e}else nr=1<<i|n<<s|r,rr=e}function qm(e){e.return!==null&&(ls(e,1),Tj(e,1,0))}function Ym(e){for(;e===Zc;)Zc=ci[--ui],ci[ui]=null,Jc=ci[--ui],ci[ui]=null;for(;e===Cs;)Cs=Wt[--Kt],Wt[Kt]=null,rr=Wt[--Kt],Wt[Kt]=null,nr=Wt[--Kt],Wt[Kt]=null}var Tt=null,Et=null,Te=!1,dn=null;function Pj(e,t){var n=Yt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ex(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Tt=e,Et=Vr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Tt=e,Et=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Cs!==null?{id:nr,overflow:rr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Yt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Tt=e,Et=null,!0):!1;default:return!1}}function qh(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Yh(e){if(Te){var t=Et;if(t){var n=t;if(!ex(e,t)){if(qh(e))throw Error(q(418));t=Vr(n.nextSibling);var r=Tt;t&&ex(e,t)?Pj(r,n):(e.flags=e.flags&-4097|2,Te=!1,Tt=e)}}else{if(qh(e))throw Error(q(418));e.flags=e.flags&-4097|2,Te=!1,Tt=e}}}function tx(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Tt=e}function Rl(e){if(e!==Tt)return!1;if(!Te)return tx(e),Te=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Hh(e.type,e.memoizedProps)),t&&(t=Et)){if(qh(e))throw Aj(),Error(q(418));for(;t;)Pj(e,t),t=Vr(t.nextSibling)}if(tx(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Et=Vr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Et=null}}else Et=Tt?Vr(e.stateNode.nextSibling):null;return!0}function Aj(){for(var e=Et;e;)e=Vr(e.nextSibling)}function Oi(){Et=Tt=null,Te=!1}function Xm(e){dn===null?dn=[e]:dn.push(e)}var YR=jr.ReactCurrentBatchConfig;function bo(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(q(309));var r=n.stateNode}if(!r)throw Error(q(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(q(284));if(!n._owner)throw Error(q(290,e))}return e}function Il(e,t){throw e=Object.prototype.toString.call(t),Error(q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function nx(e){var t=e._init;return t(e._payload)}function Rj(e){function t(v,y){if(e){var m=v.deletions;m===null?(v.deletions=[y],v.flags|=16):m.push(y)}}function n(v,y){if(!e)return null;for(;y!==null;)t(v,y),y=y.sibling;return null}function r(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function s(v,y){return v=Wr(v,y),v.index=0,v.sibling=null,v}function i(v,y,m){return v.index=m,e?(m=v.alternate,m!==null?(m=m.index,m<y?(v.flags|=2,y):m):(v.flags|=2,y)):(v.flags|=1048576,y)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,y,m,b){return y===null||y.tag!==6?(y=bf(m,v.mode,b),y.return=v,y):(y=s(y,m),y.return=v,y)}function c(v,y,m,b){var j=m.type;return j===ri?d(v,y,m.props.children,b,m.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Pr&&nx(j)===y.type)?(b=s(y,m.props),b.ref=bo(v,y,m),b.return=v,b):(b=_c(m.type,m.key,m.props,null,v.mode,b),b.ref=bo(v,y,m),b.return=v,b)}function u(v,y,m,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==m.containerInfo||y.stateNode.implementation!==m.implementation?(y=jf(m,v.mode,b),y.return=v,y):(y=s(y,m.children||[]),y.return=v,y)}function d(v,y,m,b,j){return y===null||y.tag!==7?(y=bs(m,v.mode,b,j),y.return=v,y):(y=s(y,m),y.return=v,y)}function f(v,y,m){if(typeof y=="string"&&y!==""||typeof y=="number")return y=bf(""+y,v.mode,m),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case bl:return m=_c(y.type,y.key,y.props,null,v.mode,m),m.ref=bo(v,null,y),m.return=v,m;case ni:return y=jf(y,v.mode,m),y.return=v,y;case Pr:var b=y._init;return f(v,b(y._payload),m)}if(Io(y)||vo(y))return y=bs(y,v.mode,m,null),y.return=v,y;Il(v,y)}return null}function h(v,y,m,b){var j=y!==null?y.key:null;if(typeof m=="string"&&m!==""||typeof m=="number")return j!==null?null:l(v,y,""+m,b);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case bl:return m.key===j?c(v,y,m,b):null;case ni:return m.key===j?u(v,y,m,b):null;case Pr:return j=m._init,h(v,y,j(m._payload),b)}if(Io(m)||vo(m))return j!==null?null:d(v,y,m,b,null);Il(v,m)}return null}function p(v,y,m,b,j){if(typeof b=="string"&&b!==""||typeof b=="number")return v=v.get(m)||null,l(y,v,""+b,j);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case bl:return v=v.get(b.key===null?m:b.key)||null,c(y,v,b,j);case ni:return v=v.get(b.key===null?m:b.key)||null,u(y,v,b,j);case Pr:var k=b._init;return p(v,y,m,k(b._payload),j)}if(Io(b)||vo(b))return v=v.get(m)||null,d(y,v,b,j,null);Il(y,b)}return null}function g(v,y,m,b){for(var j=null,k=null,S=y,N=y=0,R=null;S!==null&&N<m.length;N++){S.index>N?(R=S,S=null):R=S.sibling;var O=h(v,S,m[N],b);if(O===null){S===null&&(S=R);break}e&&S&&O.alternate===null&&t(v,S),y=i(O,y,N),k===null?j=O:k.sibling=O,k=O,S=R}if(N===m.length)return n(v,S),Te&&ls(v,N),j;if(S===null){for(;N<m.length;N++)S=f(v,m[N],b),S!==null&&(y=i(S,y,N),k===null?j=S:k.sibling=S,k=S);return Te&&ls(v,N),j}for(S=r(v,S);N<m.length;N++)R=p(S,v,N,m[N],b),R!==null&&(e&&R.alternate!==null&&S.delete(R.key===null?N:R.key),y=i(R,y,N),k===null?j=R:k.sibling=R,k=R);return e&&S.forEach(function(D){return t(v,D)}),Te&&ls(v,N),j}function x(v,y,m,b){var j=vo(m);if(typeof j!="function")throw Error(q(150));if(m=j.call(m),m==null)throw Error(q(151));for(var k=j=null,S=y,N=y=0,R=null,O=m.next();S!==null&&!O.done;N++,O=m.next()){S.index>N?(R=S,S=null):R=S.sibling;var D=h(v,S,O.value,b);if(D===null){S===null&&(S=R);break}e&&S&&D.alternate===null&&t(v,S),y=i(D,y,N),k===null?j=D:k.sibling=D,k=D,S=R}if(O.done)return n(v,S),Te&&ls(v,N),j;if(S===null){for(;!O.done;N++,O=m.next())O=f(v,O.value,b),O!==null&&(y=i(O,y,N),k===null?j=O:k.sibling=O,k=O);return Te&&ls(v,N),j}for(S=r(v,S);!O.done;N++,O=m.next())O=p(S,v,N,O.value,b),O!==null&&(e&&O.alternate!==null&&S.delete(O.key===null?N:O.key),y=i(O,y,N),k===null?j=O:k.sibling=O,k=O);return e&&S.forEach(function(M){return t(v,M)}),Te&&ls(v,N),j}function _(v,y,m,b){if(typeof m=="object"&&m!==null&&m.type===ri&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case bl:e:{for(var j=m.key,k=y;k!==null;){if(k.key===j){if(j=m.type,j===ri){if(k.tag===7){n(v,k.sibling),y=s(k,m.props.children),y.return=v,v=y;break e}}else if(k.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Pr&&nx(j)===k.type){n(v,k.sibling),y=s(k,m.props),y.ref=bo(v,k,m),y.return=v,v=y;break e}n(v,k);break}else t(v,k);k=k.sibling}m.type===ri?(y=bs(m.props.children,v.mode,b,m.key),y.return=v,v=y):(b=_c(m.type,m.key,m.props,null,v.mode,b),b.ref=bo(v,y,m),b.return=v,v=b)}return o(v);case ni:e:{for(k=m.key;y!==null;){if(y.key===k)if(y.tag===4&&y.stateNode.containerInfo===m.containerInfo&&y.stateNode.implementation===m.implementation){n(v,y.sibling),y=s(y,m.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else t(v,y);y=y.sibling}y=jf(m,v.mode,b),y.return=v,v=y}return o(v);case Pr:return k=m._init,_(v,y,k(m._payload),b)}if(Io(m))return g(v,y,m,b);if(vo(m))return x(v,y,m,b);Il(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,y!==null&&y.tag===6?(n(v,y.sibling),y=s(y,m),y.return=v,v=y):(n(v,y),y=bf(m,v.mode,b),y.return=v,v=y),o(v)):n(v,y)}return _}var Li=Rj(!0),Ij=Rj(!1),eu=Jr(null),tu=null,di=null,Qm=null;function Zm(){Qm=di=tu=null}function Jm(e){var t=eu.current;Se(eu),e._currentValue=t}function Xh(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ci(e,t){tu=e,Qm=di=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(gt=!0),e.firstContext=null)}function en(e){var t=e._currentValue;if(Qm!==e)if(e={context:e,memoizedValue:t,next:null},di===null){if(tu===null)throw Error(q(308));di=e,tu.dependencies={lanes:0,firstContext:e}}else di=di.next=e;return t}var vs=null;function eg(e){vs===null?vs=[e]:vs.push(e)}function Mj(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,eg(t)):(n.next=s.next,s.next=n),t.interleaved=n,gr(e,r)}function gr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ar=!1;function tg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Oj(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ar(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Br(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,de&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,gr(e,n)}return s=r.interleaved,s===null?(t.next=t,eg(r)):(t.next=s.next,s.next=t),r.interleaved=t,gr(e,n)}function pc(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fm(e,n)}}function rx(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function nu(e,t,n,r){var s=e.updateQueue;Ar=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,l=i;do{var h=l.lane,p=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,x=l;switch(h=t,p=n,x.tag){case 1:if(g=x.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=x.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=Me({},f,h);break e;case 2:Ar=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;h=l,l=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Ps|=o,e.lanes=o,e.memoizedState=f}}function sx(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(q(191,s));s.call(r)}}}var Ja={},$n=Jr(Ja),xa=Jr(Ja),_a=Jr(Ja);function ys(e){if(e===Ja)throw Error(q(174));return e}function ng(e,t){switch(_e(_a,t),_e(xa,e),_e($n,Ja),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ph(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ph(t,e)}Se($n),_e($n,t)}function $i(){Se($n),Se(xa),Se(_a)}function Lj(e){ys(_a.current);var t=ys($n.current),n=Ph(t,e.type);t!==n&&(_e(xa,e),_e($n,n))}function rg(e){xa.current===e&&(Se($n),Se(xa))}var Ae=Jr(0);function ru(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)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}var gf=[];function sg(){for(var e=0;e<gf.length;e++)gf[e]._workInProgressVersionPrimary=null;gf.length=0}var mc=jr.ReactCurrentDispatcher,vf=jr.ReactCurrentBatchConfig,Ts=0,Ie=null,We=null,Ge=null,su=!1,qo=!1,wa=0,XR=0;function tt(){throw Error(q(321))}function ig(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wn(e[n],t[n]))return!1;return!0}function og(e,t,n,r,s,i){if(Ts=i,Ie=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,mc.current=e===null||e.memoizedState===null?eI:tI,e=n(r,s),qo){i=0;do{if(qo=!1,wa=0,25<=i)throw Error(q(301));i+=1,Ge=We=null,t.updateQueue=null,mc.current=nI,e=n(r,s)}while(qo)}if(mc.current=iu,t=We!==null&&We.next!==null,Ts=0,Ge=We=Ie=null,su=!1,t)throw Error(q(300));return e}function ag(){var e=wa!==0;return wa=0,e}function Pn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ge===null?Ie.memoizedState=Ge=e:Ge=Ge.next=e,Ge}function tn(){if(We===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=We.next;var t=Ge===null?Ie.memoizedState:Ge.next;if(t!==null)Ge=t,We=e;else{if(e===null)throw Error(q(310));We=e,e={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},Ge===null?Ie.memoizedState=Ge=e:Ge=Ge.next=e}return Ge}function ba(e,t){return typeof t=="function"?t(e):t}function yf(e){var t=tn(),n=t.queue;if(n===null)throw Error(q(311));n.lastRenderedReducer=e;var r=We,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,u=i;do{var d=u.lane;if((Ts&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,o=r):c=c.next=f,Ie.lanes|=d,Ps|=d}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,wn(r,t.memoizedState)||(gt=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Ie.lanes|=i,Ps|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function xf(e){var t=tn(),n=t.queue;if(n===null)throw Error(q(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);wn(i,t.memoizedState)||(gt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function $j(){}function Dj(e,t){var n=Ie,r=tn(),s=t(),i=!wn(r.memoizedState,s);if(i&&(r.memoizedState=s,gt=!0),r=r.queue,lg(Vj.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Ge!==null&&Ge.memoizedState.tag&1){if(n.flags|=2048,ja(9,Fj.bind(null,n,r,s,t),void 0,null),qe===null)throw Error(q(349));Ts&30||zj(n,t,s)}return s}function zj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ie.updateQueue,t===null?(t={lastEffect:null,stores:null},Ie.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Fj(e,t,n,r){t.value=n,t.getSnapshot=r,Bj(t)&&Uj(e)}function Vj(e,t,n){return n(function(){Bj(t)&&Uj(e)})}function Bj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wn(e,n)}catch{return!0}}function Uj(e){var t=gr(e,1);t!==null&&vn(t,e,1,-1)}function ix(e){var t=Pn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ba,lastRenderedState:e},t.queue=e,e=e.dispatch=JR.bind(null,Ie,e),[t.memoizedState,e]}function ja(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ie.updateQueue,t===null?(t={lastEffect:null,stores:null},Ie.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Hj(){return tn().memoizedState}function gc(e,t,n,r){var s=Pn();Ie.flags|=e,s.memoizedState=ja(1|t,n,void 0,r===void 0?null:r)}function ed(e,t,n,r){var s=tn();r=r===void 0?null:r;var i=void 0;if(We!==null){var o=We.memoizedState;if(i=o.destroy,r!==null&&ig(r,o.deps)){s.memoizedState=ja(t,n,i,r);return}}Ie.flags|=e,s.memoizedState=ja(1|t,n,i,r)}function ox(e,t){return gc(8390656,8,e,t)}function lg(e,t){return ed(2048,8,e,t)}function Wj(e,t){return ed(4,2,e,t)}function Kj(e,t){return ed(4,4,e,t)}function Gj(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function qj(e,t,n){return n=n!=null?n.concat([e]):null,ed(4,4,Gj.bind(null,t,e),n)}function cg(){}function Yj(e,t){var n=tn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ig(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Xj(e,t){var n=tn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ig(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Qj(e,t,n){return Ts&21?(wn(n,t)||(n=nj(),Ie.lanes|=n,Ps|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,gt=!0),e.memoizedState=n)}function QR(e,t){var n=xe;xe=n!==0&&4>n?n:4,e(!0);var r=vf.transition;vf.transition={};try{e(!1),t()}finally{xe=n,vf.transition=r}}function Zj(){return tn().memoizedState}function ZR(e,t,n){var r=Hr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Jj(e))eS(t,n);else if(n=Mj(e,t,n,r),n!==null){var s=ft();vn(n,e,r,s),tS(n,t,r)}}function JR(e,t,n){var r=Hr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Jj(e))eS(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,wn(l,o)){var c=t.interleaved;c===null?(s.next=s,eg(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=Mj(e,t,s,r),n!==null&&(s=ft(),vn(n,e,r,s),tS(n,t,r))}}function Jj(e){var t=e.alternate;return e===Ie||t!==null&&t===Ie}function eS(e,t){qo=su=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tS(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fm(e,n)}}var iu={readContext:en,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},eI={readContext:en,useCallback:function(e,t){return Pn().memoizedState=[e,t===void 0?null:t],e},useContext:en,useEffect:ox,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,gc(4194308,4,Gj.bind(null,t,e),n)},useLayoutEffect:function(e,t){return gc(4194308,4,e,t)},useInsertionEffect:function(e,t){return gc(4,2,e,t)},useMemo:function(e,t){var n=Pn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Pn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ZR.bind(null,Ie,e),[r.memoizedState,e]},useRef:function(e){var t=Pn();return e={current:e},t.memoizedState=e},useState:ix,useDebugValue:cg,useDeferredValue:function(e){return Pn().memoizedState=e},useTransition:function(){var e=ix(!1),t=e[0];return e=QR.bind(null,e[1]),Pn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ie,s=Pn();if(Te){if(n===void 0)throw Error(q(407));n=n()}else{if(n=t(),qe===null)throw Error(q(349));Ts&30||zj(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,ox(Vj.bind(null,r,i,e),[e]),r.flags|=2048,ja(9,Fj.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Pn(),t=qe.identifierPrefix;if(Te){var n=rr,r=nr;n=(r&~(1<<32-gn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=wa++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=XR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},tI={readContext:en,useCallback:Yj,useContext:en,useEffect:lg,useImperativeHandle:qj,useInsertionEffect:Wj,useLayoutEffect:Kj,useMemo:Xj,useReducer:yf,useRef:Hj,useState:function(){return yf(ba)},useDebugValue:cg,useDeferredValue:function(e){var t=tn();return Qj(t,We.memoizedState,e)},useTransition:function(){var e=yf(ba)[0],t=tn().memoizedState;return[e,t]},useMutableSource:$j,useSyncExternalStore:Dj,useId:Zj,unstable_isNewReconciler:!1},nI={readContext:en,useCallback:Yj,useContext:en,useEffect:lg,useImperativeHandle:qj,useInsertionEffect:Wj,useLayoutEffect:Kj,useMemo:Xj,useReducer:xf,useRef:Hj,useState:function(){return xf(ba)},useDebugValue:cg,useDeferredValue:function(e){var t=tn();return We===null?t.memoizedState=e:Qj(t,We.memoizedState,e)},useTransition:function(){var e=xf(ba)[0],t=tn().memoizedState;return[e,t]},useMutableSource:$j,useSyncExternalStore:Dj,useId:Zj,unstable_isNewReconciler:!1};function ln(e,t){if(e&&e.defaultProps){t=Me({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Qh(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Me({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var td={isMounted:function(e){return(e=e._reactInternals)?Us(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ft(),s=Hr(e),i=ar(r,s);i.payload=t,n!=null&&(i.callback=n),t=Br(e,i,s),t!==null&&(vn(t,e,s,r),pc(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ft(),s=Hr(e),i=ar(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Br(e,i,s),t!==null&&(vn(t,e,s,r),pc(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ft(),r=Hr(e),s=ar(n,r);s.tag=2,t!=null&&(s.callback=t),t=Br(e,s,r),t!==null&&(vn(t,e,r,n),pc(t,e,r))}};function ax(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!ma(n,r)||!ma(s,i):!0}function nS(e,t,n){var r=!1,s=qr,i=t.contextType;return typeof i=="object"&&i!==null?i=en(i):(s=xt(t)?Es:at.current,r=t.contextTypes,i=(r=r!=null)?Mi(e,s):qr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=td,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function lx(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&td.enqueueReplaceState(t,t.state,null)}function Zh(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},tg(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=en(i):(i=xt(t)?Es:at.current,s.context=Mi(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Qh(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&td.enqueueReplaceState(s,s.state,null),nu(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Di(e,t){try{var n="",r=t;do n+=PA(r),r=r.return;while(r);var s=n}catch(i){s=`
37
+ `+s[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Jd=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ro(e):""}function CA(e){switch(e.tag){case 5:return Ro(e.type);case 16:return Ro("Lazy");case 13:return Ro("Suspense");case 19:return Ro("SuspenseList");case 0:case 2:case 15:return e=ef(e.type,!1),e;case 11:return e=ef(e.type.render,!1),e;case 1:return e=ef(e.type,!0),e;default:return""}}function kh(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ri:return"Fragment";case ni:return"Portal";case bh:return"Profiler";case Om:return"StrictMode";case jh:return"Suspense";case Sh:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Rb:return(e.displayName||"Context")+".Consumer";case Ab:return(e._context.displayName||"Context")+".Provider";case Lm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $m:return t=e.displayName||null,t!==null?t:kh(e.type)||"Memo";case Pr:t=e._payload,e=e._init;try{return kh(e(t))}catch{}}return null}function TA(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return kh(t);case 8:return t===Om?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Gr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Mb(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function PA(e){var t=Mb(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jl(e){e._valueTracker||(e._valueTracker=PA(e))}function Ob(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Mb(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Vc(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}}function Nh(e,t){var n=t.checked;return Me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function by(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Gr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Lb(e,t){t=t.checked,t!=null&&Mm(e,"checked",t,!1)}function Eh(e,t){Lb(e,t);var n=Gr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ch(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ch(e,t.type,Gr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function jy(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ch(e,t,n){(t!=="number"||Vc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Io=Array.isArray;function Si(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Gr(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Th(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(q(91));return Me({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Sy(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(q(92));if(Io(n)){if(1<n.length)throw Error(q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Gr(n)}}function $b(e,t){var n=Gr(t.value),r=Gr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function ky(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Db(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ph(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Db(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Sl,zb=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Sl=Sl||document.createElement("div"),Sl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Sl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ca(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Uo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},AA=["Webkit","ms","Moz","O"];Object.keys(Uo).forEach(function(e){AA.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Uo[t]=Uo[e]})});function Fb(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Uo.hasOwnProperty(e)&&Uo[e]?(""+t).trim():t+"px"}function Vb(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Fb(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var RA=Me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ah(e,t){if(t){if(RA[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(q(62))}}function Rh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Ih=null;function Dm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Mh=null,ki=null,Ni=null;function Ny(e){if(e=Za(e)){if(typeof Mh!="function")throw Error(q(280));var t=e.stateNode;t&&(t=Zu(t),Mh(e.stateNode,e.type,t))}}function Bb(e){ki?Ni?Ni.push(e):Ni=[e]:ki=e}function Ub(){if(ki){var e=ki,t=Ni;if(Ni=ki=null,Ny(e),t)for(e=0;e<t.length;e++)Ny(t[e])}}function Hb(e,t){return e(t)}function Wb(){}var tf=!1;function Kb(e,t,n){if(tf)return e(t,n);tf=!0;try{return Hb(e,t,n)}finally{tf=!1,(ki!==null||Ni!==null)&&(Wb(),Ub())}}function ua(e,t){var n=e.stateNode;if(n===null)return null;var r=Zu(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(q(231,t,typeof n));return n}var Oh=!1;if(pr)try{var yo={};Object.defineProperty(yo,"passive",{get:function(){Oh=!0}}),window.addEventListener("test",yo,yo),window.removeEventListener("test",yo,yo)}catch{Oh=!1}function IA(e,t,n,r,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var Ho=!1,Bc=null,Uc=!1,Lh=null,MA={onError:function(e){Ho=!0,Bc=e}};function OA(e,t,n,r,s,i,o,l,c){Ho=!1,Bc=null,IA.apply(MA,arguments)}function LA(e,t,n,r,s,i,o,l,c){if(OA.apply(this,arguments),Ho){if(Ho){var u=Bc;Ho=!1,Bc=null}else throw Error(q(198));Uc||(Uc=!0,Lh=u)}}function Us(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Gb(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 Ey(e){if(Us(e)!==e)throw Error(q(188))}function $A(e){var t=e.alternate;if(!t){if(t=Us(e),t===null)throw Error(q(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Ey(s),e;if(i===r)return Ey(s),t;i=i.sibling}throw Error(q(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(q(189))}}if(n.alternate!==r)throw Error(q(190))}if(n.tag!==3)throw Error(q(188));return n.stateNode.current===n?e:t}function qb(e){return e=$A(e),e!==null?Yb(e):null}function Yb(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Yb(e);if(t!==null)return t;e=e.sibling}return null}var Xb=Rt.unstable_scheduleCallback,Cy=Rt.unstable_cancelCallback,DA=Rt.unstable_shouldYield,zA=Rt.unstable_requestPaint,Ve=Rt.unstable_now,FA=Rt.unstable_getCurrentPriorityLevel,zm=Rt.unstable_ImmediatePriority,Qb=Rt.unstable_UserBlockingPriority,Hc=Rt.unstable_NormalPriority,VA=Rt.unstable_LowPriority,Zb=Rt.unstable_IdlePriority,qu=null,Ln=null;function BA(e){if(Ln&&typeof Ln.onCommitFiberRoot=="function")try{Ln.onCommitFiberRoot(qu,e,void 0,(e.current.flags&128)===128)}catch{}}var gn=Math.clz32?Math.clz32:WA,UA=Math.log,HA=Math.LN2;function WA(e){return e>>>=0,e===0?32:31-(UA(e)/HA|0)|0}var kl=64,Nl=4194304;function Mo(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Wc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=Mo(l):(i&=o,i!==0&&(r=Mo(i)))}else o=n&~s,o!==0?r=Mo(o):i!==0&&(r=Mo(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-gn(t),s=1<<n,r|=e[n],t&=~s;return r}function KA(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function GA(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-gn(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=KA(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function $h(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Jb(){var e=kl;return kl<<=1,!(kl&4194240)&&(kl=64),e}function nf(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-gn(t),e[t]=n}function qA(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-gn(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Fm(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-gn(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var xe=0;function ej(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var tj,Vm,nj,rj,sj,Dh=!1,El=[],Dr=null,zr=null,Fr=null,da=new Map,fa=new Map,Rr=[],YA="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 submit".split(" ");function Ty(e,t){switch(e){case"focusin":case"focusout":Dr=null;break;case"dragenter":case"dragleave":zr=null;break;case"mouseover":case"mouseout":Fr=null;break;case"pointerover":case"pointerout":da.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":fa.delete(t.pointerId)}}function xo(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Za(t),t!==null&&Vm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function XA(e,t,n,r,s){switch(t){case"focusin":return Dr=xo(Dr,e,t,n,r,s),!0;case"dragenter":return zr=xo(zr,e,t,n,r,s),!0;case"mouseover":return Fr=xo(Fr,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return da.set(i,xo(da.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,fa.set(i,xo(fa.get(i)||null,e,t,n,r,s)),!0}return!1}function ij(e){var t=gs(e.target);if(t!==null){var n=Us(t);if(n!==null){if(t=n.tag,t===13){if(t=Gb(n),t!==null){e.blockedOn=t,sj(e.priority,function(){nj(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function dc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=zh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ih=r,n.target.dispatchEvent(r),Ih=null}else return t=Za(n),t!==null&&Vm(t),e.blockedOn=n,!1;t.shift()}return!0}function Py(e,t,n){dc(e)&&n.delete(t)}function QA(){Dh=!1,Dr!==null&&dc(Dr)&&(Dr=null),zr!==null&&dc(zr)&&(zr=null),Fr!==null&&dc(Fr)&&(Fr=null),da.forEach(Py),fa.forEach(Py)}function _o(e,t){e.blockedOn===t&&(e.blockedOn=null,Dh||(Dh=!0,Rt.unstable_scheduleCallback(Rt.unstable_NormalPriority,QA)))}function ha(e){function t(s){return _o(s,e)}if(0<El.length){_o(El[0],e);for(var n=1;n<El.length;n++){var r=El[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Dr!==null&&_o(Dr,e),zr!==null&&_o(zr,e),Fr!==null&&_o(Fr,e),da.forEach(t),fa.forEach(t),n=0;n<Rr.length;n++)r=Rr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Rr.length&&(n=Rr[0],n.blockedOn===null);)ij(n),n.blockedOn===null&&Rr.shift()}var Ei=jr.ReactCurrentBatchConfig,Kc=!0;function ZA(e,t,n,r){var s=xe,i=Ei.transition;Ei.transition=null;try{xe=1,Bm(e,t,n,r)}finally{xe=s,Ei.transition=i}}function JA(e,t,n,r){var s=xe,i=Ei.transition;Ei.transition=null;try{xe=4,Bm(e,t,n,r)}finally{xe=s,Ei.transition=i}}function Bm(e,t,n,r){if(Kc){var s=zh(e,t,n,r);if(s===null)hf(e,t,r,Gc,n),Ty(e,r);else if(XA(s,e,t,n,r))r.stopPropagation();else if(Ty(e,r),t&4&&-1<YA.indexOf(e)){for(;s!==null;){var i=Za(s);if(i!==null&&tj(i),i=zh(e,t,n,r),i===null&&hf(e,t,r,Gc,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else hf(e,t,r,null,n)}}var Gc=null;function zh(e,t,n,r){if(Gc=null,e=Dm(r),e=gs(e),e!==null)if(t=Us(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Gb(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Gc=e,null}function oj(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(FA()){case zm:return 1;case Qb:return 4;case Hc:case VA:return 16;case Zb:return 536870912;default:return 16}default:return 16}}var Or=null,Um=null,fc=null;function aj(){if(fc)return fc;var e,t=Um,n=t.length,r,s="value"in Or?Or.value:Or.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return fc=s.slice(e,1<r?1-r:void 0)}function hc(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 Cl(){return!0}function Ay(){return!1}function Lt(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Cl:Ay,this.isPropagationStopped=Ay,this}return Me(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Cl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Cl)},persist:function(){},isPersistent:Cl}),t}var ro={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hm=Lt(ro),Qa=Me({},ro,{view:0,detail:0}),eR=Lt(Qa),rf,sf,wo,Yu=Me({},Qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wm,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!==wo&&(wo&&e.type==="mousemove"?(rf=e.screenX-wo.screenX,sf=e.screenY-wo.screenY):sf=rf=0,wo=e),rf)},movementY:function(e){return"movementY"in e?e.movementY:sf}}),Ry=Lt(Yu),tR=Me({},Yu,{dataTransfer:0}),nR=Lt(tR),rR=Me({},Qa,{relatedTarget:0}),of=Lt(rR),sR=Me({},ro,{animationName:0,elapsedTime:0,pseudoElement:0}),iR=Lt(sR),oR=Me({},ro,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),aR=Lt(oR),lR=Me({},ro,{data:0}),Iy=Lt(lR),cR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uR={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"},dR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=dR[e])?!!t[e]:!1}function Wm(){return fR}var hR=Me({},Qa,{key:function(e){if(e.key){var t=cR[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?uR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wm,charCode:function(e){return e.type==="keypress"?hc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),pR=Lt(hR),mR=Me({},Yu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),My=Lt(mR),gR=Me({},Qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wm}),vR=Lt(gR),yR=Me({},ro,{propertyName:0,elapsedTime:0,pseudoElement:0}),xR=Lt(yR),_R=Me({},Yu,{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}),wR=Lt(_R),bR=[9,13,27,32],Km=pr&&"CompositionEvent"in window,Wo=null;pr&&"documentMode"in document&&(Wo=document.documentMode);var jR=pr&&"TextEvent"in window&&!Wo,lj=pr&&(!Km||Wo&&8<Wo&&11>=Wo),Oy=" ",Ly=!1;function cj(e,t){switch(e){case"keyup":return bR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var si=!1;function SR(e,t){switch(e){case"compositionend":return uj(t);case"keypress":return t.which!==32?null:(Ly=!0,Oy);case"textInput":return e=t.data,e===Oy&&Ly?null:e;default:return null}}function kR(e,t){if(si)return e==="compositionend"||!Km&&cj(e,t)?(e=aj(),fc=Um=Or=null,si=!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 lj&&t.locale!=="ko"?null:t.data;default:return null}}var NR={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 $y(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!NR[e.type]:t==="textarea"}function dj(e,t,n,r){Bb(r),t=qc(t,"onChange"),0<t.length&&(n=new Hm("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ko=null,pa=null;function ER(e){bj(e,0)}function Xu(e){var t=ai(e);if(Ob(t))return e}function CR(e,t){if(e==="change")return t}var fj=!1;if(pr){var af;if(pr){var lf="oninput"in document;if(!lf){var Dy=document.createElement("div");Dy.setAttribute("oninput","return;"),lf=typeof Dy.oninput=="function"}af=lf}else af=!1;fj=af&&(!document.documentMode||9<document.documentMode)}function zy(){Ko&&(Ko.detachEvent("onpropertychange",hj),pa=Ko=null)}function hj(e){if(e.propertyName==="value"&&Xu(pa)){var t=[];dj(t,pa,e,Dm(e)),Kb(ER,t)}}function TR(e,t,n){e==="focusin"?(zy(),Ko=t,pa=n,Ko.attachEvent("onpropertychange",hj)):e==="focusout"&&zy()}function PR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Xu(pa)}function AR(e,t){if(e==="click")return Xu(t)}function RR(e,t){if(e==="input"||e==="change")return Xu(t)}function IR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wn=typeof Object.is=="function"?Object.is:IR;function ma(e,t){if(wn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!wh.call(t,s)||!wn(e[s],t[s]))return!1}return!0}function Fy(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vy(e,t){var n=Fy(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fy(n)}}function pj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mj(){for(var e=window,t=Vc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Vc(e.document)}return t}function Gm(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")}function MR(e){var t=mj(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&pj(n.ownerDocument.documentElement,n)){if(r!==null&&Gm(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Vy(n,i);var o=Vy(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var OR=pr&&"documentMode"in document&&11>=document.documentMode,ii=null,Fh=null,Go=null,Vh=!1;function By(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vh||ii==null||ii!==Vc(r)||(r=ii,"selectionStart"in r&&Gm(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Go&&ma(Go,r)||(Go=r,r=qc(Fh,"onSelect"),0<r.length&&(t=new Hm("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ii)))}function Tl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var oi={animationend:Tl("Animation","AnimationEnd"),animationiteration:Tl("Animation","AnimationIteration"),animationstart:Tl("Animation","AnimationStart"),transitionend:Tl("Transition","TransitionEnd")},cf={},gj={};pr&&(gj=document.createElement("div").style,"AnimationEvent"in window||(delete oi.animationend.animation,delete oi.animationiteration.animation,delete oi.animationstart.animation),"TransitionEvent"in window||delete oi.transitionend.transition);function Qu(e){if(cf[e])return cf[e];if(!oi[e])return e;var t=oi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in gj)return cf[e]=t[n];return e}var vj=Qu("animationend"),yj=Qu("animationiteration"),xj=Qu("animationstart"),_j=Qu("transitionend"),wj=new Map,Uy="abort auxClick 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(" ");function Zr(e,t){wj.set(e,t),Bs(t,[e])}for(var uf=0;uf<Uy.length;uf++){var df=Uy[uf],LR=df.toLowerCase(),$R=df[0].toUpperCase()+df.slice(1);Zr(LR,"on"+$R)}Zr(vj,"onAnimationEnd");Zr(yj,"onAnimationIteration");Zr(xj,"onAnimationStart");Zr("dblclick","onDoubleClick");Zr("focusin","onFocus");Zr("focusout","onBlur");Zr(_j,"onTransitionEnd");Ii("onMouseEnter",["mouseout","mouseover"]);Ii("onMouseLeave",["mouseout","mouseover"]);Ii("onPointerEnter",["pointerout","pointerover"]);Ii("onPointerLeave",["pointerout","pointerover"]);Bs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Bs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Bs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Bs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Bs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Bs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oo="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(" "),DR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Oo));function Hy(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,LA(r,t,void 0,e),e.currentTarget=null}function bj(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;Hy(s,l,u),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;Hy(s,l,u),i=c}}}if(Uc)throw e=Lh,Uc=!1,Lh=null,e}function be(e,t){var n=t[Kh];n===void 0&&(n=t[Kh]=new Set);var r=e+"__bubble";n.has(r)||(jj(t,e,2,!1),n.add(r))}function ff(e,t,n){var r=0;t&&(r|=4),jj(n,e,r,t)}var Pl="_reactListening"+Math.random().toString(36).slice(2);function ga(e){if(!e[Pl]){e[Pl]=!0,Pb.forEach(function(n){n!=="selectionchange"&&(DR.has(n)||ff(n,!1,e),ff(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Pl]||(t[Pl]=!0,ff("selectionchange",!1,t))}}function jj(e,t,n,r){switch(oj(t)){case 1:var s=ZA;break;case 4:s=JA;break;default:s=Bm}n=s.bind(null,t,n,e),s=void 0,!Oh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function hf(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=gs(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}Kb(function(){var u=i,d=Dm(n),f=[];e:{var h=wj.get(e);if(h!==void 0){var p=Hm,g=e;switch(e){case"keypress":if(hc(n)===0)break e;case"keydown":case"keyup":p=pR;break;case"focusin":g="focus",p=of;break;case"focusout":g="blur",p=of;break;case"beforeblur":case"afterblur":p=of;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Ry;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=nR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=vR;break;case vj:case yj:case xj:p=iR;break;case _j:p=xR;break;case"scroll":p=eR;break;case"wheel":p=wR;break;case"copy":case"cut":case"paste":p=aR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=My}var x=(t&4)!==0,_=!x&&e==="scroll",v=x?h!==null?h+"Capture":null:h;x=[];for(var y=u,m;y!==null;){m=y;var b=m.stateNode;if(m.tag===5&&b!==null&&(m=b,v!==null&&(b=ua(y,v),b!=null&&x.push(va(y,b,m)))),_)break;y=y.return}0<x.length&&(h=new p(h,g,null,n,d),f.push({event:h,listeners:x}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==Ih&&(g=n.relatedTarget||n.fromElement)&&(gs(g)||g[mr]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=u,g=g?gs(g):null,g!==null&&(_=Us(g),g!==_||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=u),p!==g)){if(x=Ry,b="onMouseLeave",v="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(x=My,b="onPointerLeave",v="onPointerEnter",y="pointer"),_=p==null?h:ai(p),m=g==null?h:ai(g),h=new x(b,y+"leave",p,n,d),h.target=_,h.relatedTarget=m,b=null,gs(d)===u&&(x=new x(v,y+"enter",g,n,d),x.target=m,x.relatedTarget=_,b=x),_=b,p&&g)t:{for(x=p,v=g,y=0,m=x;m;m=Qs(m))y++;for(m=0,b=v;b;b=Qs(b))m++;for(;0<y-m;)x=Qs(x),y--;for(;0<m-y;)v=Qs(v),m--;for(;y--;){if(x===v||v!==null&&x===v.alternate)break t;x=Qs(x),v=Qs(v)}x=null}else x=null;p!==null&&Wy(f,h,p,x,!1),g!==null&&_!==null&&Wy(f,_,g,x,!0)}}e:{if(h=u?ai(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var j=CR;else if($y(h))if(fj)j=RR;else{j=PR;var k=TR}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(j=AR);if(j&&(j=j(e,u))){dj(f,j,n,d);break e}k&&k(e,h,u),e==="focusout"&&(k=h._wrapperState)&&k.controlled&&h.type==="number"&&Ch(h,"number",h.value)}switch(k=u?ai(u):window,e){case"focusin":($y(k)||k.contentEditable==="true")&&(ii=k,Fh=u,Go=null);break;case"focusout":Go=Fh=ii=null;break;case"mousedown":Vh=!0;break;case"contextmenu":case"mouseup":case"dragend":Vh=!1,By(f,n,d);break;case"selectionchange":if(OR)break;case"keydown":case"keyup":By(f,n,d)}var S;if(Km)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else si?cj(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(lj&&n.locale!=="ko"&&(si||N!=="onCompositionStart"?N==="onCompositionEnd"&&si&&(S=aj()):(Or=d,Um="value"in Or?Or.value:Or.textContent,si=!0)),k=qc(u,N),0<k.length&&(N=new Iy(N,e,null,n,d),f.push({event:N,listeners:k}),S?N.data=S:(S=uj(n),S!==null&&(N.data=S)))),(S=jR?SR(e,n):kR(e,n))&&(u=qc(u,"onBeforeInput"),0<u.length&&(d=new Iy("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=S))}bj(f,t)})}function va(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qc(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=ua(e,n),i!=null&&r.unshift(va(e,i,s)),i=ua(e,t),i!=null&&r.push(va(e,i,s))),e=e.return}return r}function Qs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Wy(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=ua(n,i),c!=null&&o.unshift(va(n,c,l))):s||(c=ua(n,i),c!=null&&o.push(va(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var zR=/\r\n?/g,FR=/\u0000|\uFFFD/g;function Ky(e){return(typeof e=="string"?e:""+e).replace(zR,`
38
+ `).replace(FR,"")}function Al(e,t,n){if(t=Ky(t),Ky(e)!==t&&n)throw Error(q(425))}function Yc(){}var Bh=null,Uh=null;function Hh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wh=typeof setTimeout=="function"?setTimeout:void 0,VR=typeof clearTimeout=="function"?clearTimeout:void 0,Gy=typeof Promise=="function"?Promise:void 0,BR=typeof queueMicrotask=="function"?queueMicrotask:typeof Gy<"u"?function(e){return Gy.resolve(null).then(e).catch(UR)}:Wh;function UR(e){setTimeout(function(){throw e})}function pf(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),ha(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);ha(t)}function Vr(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==="$?")break;if(t==="/$")return null}}return e}function qy(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var so=Math.random().toString(36).slice(2),Rn="__reactFiber$"+so,ya="__reactProps$"+so,mr="__reactContainer$"+so,Kh="__reactEvents$"+so,HR="__reactListeners$"+so,WR="__reactHandles$"+so;function gs(e){var t=e[Rn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mr]||n[Rn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=qy(e);e!==null;){if(n=e[Rn])return n;e=qy(e)}return t}e=n,n=e.parentNode}return null}function Za(e){return e=e[Rn]||e[mr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ai(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(q(33))}function Zu(e){return e[ya]||null}var Gh=[],li=-1;function Jr(e){return{current:e}}function Se(e){0>li||(e.current=Gh[li],Gh[li]=null,li--)}function _e(e,t){li++,Gh[li]=e.current,e.current=t}var qr={},at=Jr(qr),yt=Jr(!1),Es=qr;function Mi(e,t){var n=e.type.contextTypes;if(!n)return qr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function xt(e){return e=e.childContextTypes,e!=null}function Xc(){Se(yt),Se(at)}function Yy(e,t,n){if(at.current!==qr)throw Error(q(168));_e(at,t),_e(yt,n)}function Sj(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(q(108,TA(e)||"Unknown",s));return Me({},n,r)}function Qc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qr,Es=at.current,_e(at,e),_e(yt,yt.current),!0}function Xy(e,t,n){var r=e.stateNode;if(!r)throw Error(q(169));n?(e=Sj(e,t,Es),r.__reactInternalMemoizedMergedChildContext=e,Se(yt),Se(at),_e(at,e)):Se(yt),_e(yt,n)}var Qn=null,Ju=!1,mf=!1;function kj(e){Qn===null?Qn=[e]:Qn.push(e)}function KR(e){Ju=!0,kj(e)}function es(){if(!mf&&Qn!==null){mf=!0;var e=0,t=xe;try{var n=Qn;for(xe=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Qn=null,Ju=!1}catch(s){throw Qn!==null&&(Qn=Qn.slice(e+1)),Xb(zm,es),s}finally{xe=t,mf=!1}}return null}var ci=[],ui=0,Zc=null,Jc=0,Wt=[],Kt=0,Cs=null,nr=1,rr="";function ls(e,t){ci[ui++]=Jc,ci[ui++]=Zc,Zc=e,Jc=t}function Nj(e,t,n){Wt[Kt++]=nr,Wt[Kt++]=rr,Wt[Kt++]=Cs,Cs=e;var r=nr;e=rr;var s=32-gn(r)-1;r&=~(1<<s),n+=1;var i=32-gn(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,nr=1<<32-gn(t)+s|n<<s|r,rr=i+e}else nr=1<<i|n<<s|r,rr=e}function qm(e){e.return!==null&&(ls(e,1),Nj(e,1,0))}function Ym(e){for(;e===Zc;)Zc=ci[--ui],ci[ui]=null,Jc=ci[--ui],ci[ui]=null;for(;e===Cs;)Cs=Wt[--Kt],Wt[Kt]=null,rr=Wt[--Kt],Wt[Kt]=null,nr=Wt[--Kt],Wt[Kt]=null}var Tt=null,Et=null,Te=!1,dn=null;function Ej(e,t){var n=Yt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Qy(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Tt=e,Et=Vr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Tt=e,Et=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Cs!==null?{id:nr,overflow:rr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Yt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Tt=e,Et=null,!0):!1;default:return!1}}function qh(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Yh(e){if(Te){var t=Et;if(t){var n=t;if(!Qy(e,t)){if(qh(e))throw Error(q(418));t=Vr(n.nextSibling);var r=Tt;t&&Qy(e,t)?Ej(r,n):(e.flags=e.flags&-4097|2,Te=!1,Tt=e)}}else{if(qh(e))throw Error(q(418));e.flags=e.flags&-4097|2,Te=!1,Tt=e}}}function Zy(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Tt=e}function Rl(e){if(e!==Tt)return!1;if(!Te)return Zy(e),Te=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Hh(e.type,e.memoizedProps)),t&&(t=Et)){if(qh(e))throw Cj(),Error(q(418));for(;t;)Ej(e,t),t=Vr(t.nextSibling)}if(Zy(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Et=Vr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Et=null}}else Et=Tt?Vr(e.stateNode.nextSibling):null;return!0}function Cj(){for(var e=Et;e;)e=Vr(e.nextSibling)}function Oi(){Et=Tt=null,Te=!1}function Xm(e){dn===null?dn=[e]:dn.push(e)}var GR=jr.ReactCurrentBatchConfig;function bo(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(q(309));var r=n.stateNode}if(!r)throw Error(q(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(q(284));if(!n._owner)throw Error(q(290,e))}return e}function Il(e,t){throw e=Object.prototype.toString.call(t),Error(q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Jy(e){var t=e._init;return t(e._payload)}function Tj(e){function t(v,y){if(e){var m=v.deletions;m===null?(v.deletions=[y],v.flags|=16):m.push(y)}}function n(v,y){if(!e)return null;for(;y!==null;)t(v,y),y=y.sibling;return null}function r(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function s(v,y){return v=Wr(v,y),v.index=0,v.sibling=null,v}function i(v,y,m){return v.index=m,e?(m=v.alternate,m!==null?(m=m.index,m<y?(v.flags|=2,y):m):(v.flags|=2,y)):(v.flags|=1048576,y)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,y,m,b){return y===null||y.tag!==6?(y=bf(m,v.mode,b),y.return=v,y):(y=s(y,m),y.return=v,y)}function c(v,y,m,b){var j=m.type;return j===ri?d(v,y,m.props.children,b,m.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Pr&&Jy(j)===y.type)?(b=s(y,m.props),b.ref=bo(v,y,m),b.return=v,b):(b=_c(m.type,m.key,m.props,null,v.mode,b),b.ref=bo(v,y,m),b.return=v,b)}function u(v,y,m,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==m.containerInfo||y.stateNode.implementation!==m.implementation?(y=jf(m,v.mode,b),y.return=v,y):(y=s(y,m.children||[]),y.return=v,y)}function d(v,y,m,b,j){return y===null||y.tag!==7?(y=bs(m,v.mode,b,j),y.return=v,y):(y=s(y,m),y.return=v,y)}function f(v,y,m){if(typeof y=="string"&&y!==""||typeof y=="number")return y=bf(""+y,v.mode,m),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case bl:return m=_c(y.type,y.key,y.props,null,v.mode,m),m.ref=bo(v,null,y),m.return=v,m;case ni:return y=jf(y,v.mode,m),y.return=v,y;case Pr:var b=y._init;return f(v,b(y._payload),m)}if(Io(y)||vo(y))return y=bs(y,v.mode,m,null),y.return=v,y;Il(v,y)}return null}function h(v,y,m,b){var j=y!==null?y.key:null;if(typeof m=="string"&&m!==""||typeof m=="number")return j!==null?null:l(v,y,""+m,b);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case bl:return m.key===j?c(v,y,m,b):null;case ni:return m.key===j?u(v,y,m,b):null;case Pr:return j=m._init,h(v,y,j(m._payload),b)}if(Io(m)||vo(m))return j!==null?null:d(v,y,m,b,null);Il(v,m)}return null}function p(v,y,m,b,j){if(typeof b=="string"&&b!==""||typeof b=="number")return v=v.get(m)||null,l(y,v,""+b,j);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case bl:return v=v.get(b.key===null?m:b.key)||null,c(y,v,b,j);case ni:return v=v.get(b.key===null?m:b.key)||null,u(y,v,b,j);case Pr:var k=b._init;return p(v,y,m,k(b._payload),j)}if(Io(b)||vo(b))return v=v.get(m)||null,d(y,v,b,j,null);Il(y,b)}return null}function g(v,y,m,b){for(var j=null,k=null,S=y,N=y=0,R=null;S!==null&&N<m.length;N++){S.index>N?(R=S,S=null):R=S.sibling;var O=h(v,S,m[N],b);if(O===null){S===null&&(S=R);break}e&&S&&O.alternate===null&&t(v,S),y=i(O,y,N),k===null?j=O:k.sibling=O,k=O,S=R}if(N===m.length)return n(v,S),Te&&ls(v,N),j;if(S===null){for(;N<m.length;N++)S=f(v,m[N],b),S!==null&&(y=i(S,y,N),k===null?j=S:k.sibling=S,k=S);return Te&&ls(v,N),j}for(S=r(v,S);N<m.length;N++)R=p(S,v,N,m[N],b),R!==null&&(e&&R.alternate!==null&&S.delete(R.key===null?N:R.key),y=i(R,y,N),k===null?j=R:k.sibling=R,k=R);return e&&S.forEach(function(D){return t(v,D)}),Te&&ls(v,N),j}function x(v,y,m,b){var j=vo(m);if(typeof j!="function")throw Error(q(150));if(m=j.call(m),m==null)throw Error(q(151));for(var k=j=null,S=y,N=y=0,R=null,O=m.next();S!==null&&!O.done;N++,O=m.next()){S.index>N?(R=S,S=null):R=S.sibling;var D=h(v,S,O.value,b);if(D===null){S===null&&(S=R);break}e&&S&&D.alternate===null&&t(v,S),y=i(D,y,N),k===null?j=D:k.sibling=D,k=D,S=R}if(O.done)return n(v,S),Te&&ls(v,N),j;if(S===null){for(;!O.done;N++,O=m.next())O=f(v,O.value,b),O!==null&&(y=i(O,y,N),k===null?j=O:k.sibling=O,k=O);return Te&&ls(v,N),j}for(S=r(v,S);!O.done;N++,O=m.next())O=p(S,v,N,O.value,b),O!==null&&(e&&O.alternate!==null&&S.delete(O.key===null?N:O.key),y=i(O,y,N),k===null?j=O:k.sibling=O,k=O);return e&&S.forEach(function(M){return t(v,M)}),Te&&ls(v,N),j}function _(v,y,m,b){if(typeof m=="object"&&m!==null&&m.type===ri&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case bl:e:{for(var j=m.key,k=y;k!==null;){if(k.key===j){if(j=m.type,j===ri){if(k.tag===7){n(v,k.sibling),y=s(k,m.props.children),y.return=v,v=y;break e}}else if(k.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Pr&&Jy(j)===k.type){n(v,k.sibling),y=s(k,m.props),y.ref=bo(v,k,m),y.return=v,v=y;break e}n(v,k);break}else t(v,k);k=k.sibling}m.type===ri?(y=bs(m.props.children,v.mode,b,m.key),y.return=v,v=y):(b=_c(m.type,m.key,m.props,null,v.mode,b),b.ref=bo(v,y,m),b.return=v,v=b)}return o(v);case ni:e:{for(k=m.key;y!==null;){if(y.key===k)if(y.tag===4&&y.stateNode.containerInfo===m.containerInfo&&y.stateNode.implementation===m.implementation){n(v,y.sibling),y=s(y,m.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else t(v,y);y=y.sibling}y=jf(m,v.mode,b),y.return=v,v=y}return o(v);case Pr:return k=m._init,_(v,y,k(m._payload),b)}if(Io(m))return g(v,y,m,b);if(vo(m))return x(v,y,m,b);Il(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,y!==null&&y.tag===6?(n(v,y.sibling),y=s(y,m),y.return=v,v=y):(n(v,y),y=bf(m,v.mode,b),y.return=v,v=y),o(v)):n(v,y)}return _}var Li=Tj(!0),Pj=Tj(!1),eu=Jr(null),tu=null,di=null,Qm=null;function Zm(){Qm=di=tu=null}function Jm(e){var t=eu.current;Se(eu),e._currentValue=t}function Xh(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ci(e,t){tu=e,Qm=di=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(gt=!0),e.firstContext=null)}function en(e){var t=e._currentValue;if(Qm!==e)if(e={context:e,memoizedValue:t,next:null},di===null){if(tu===null)throw Error(q(308));di=e,tu.dependencies={lanes:0,firstContext:e}}else di=di.next=e;return t}var vs=null;function eg(e){vs===null?vs=[e]:vs.push(e)}function Aj(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,eg(t)):(n.next=s.next,s.next=n),t.interleaved=n,gr(e,r)}function gr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ar=!1;function tg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Rj(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ar(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Br(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,de&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,gr(e,n)}return s=r.interleaved,s===null?(t.next=t,eg(r)):(t.next=s.next,s.next=t),r.interleaved=t,gr(e,n)}function pc(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fm(e,n)}}function ex(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function nu(e,t,n,r){var s=e.updateQueue;Ar=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,l=i;do{var h=l.lane,p=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,x=l;switch(h=t,p=n,x.tag){case 1:if(g=x.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=x.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=Me({},f,h);break e;case 2:Ar=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;h=l,l=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Ps|=o,e.lanes=o,e.memoizedState=f}}function tx(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(q(191,s));s.call(r)}}}var Ja={},$n=Jr(Ja),xa=Jr(Ja),_a=Jr(Ja);function ys(e){if(e===Ja)throw Error(q(174));return e}function ng(e,t){switch(_e(_a,t),_e(xa,e),_e($n,Ja),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ph(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ph(t,e)}Se($n),_e($n,t)}function $i(){Se($n),Se(xa),Se(_a)}function Ij(e){ys(_a.current);var t=ys($n.current),n=Ph(t,e.type);t!==n&&(_e(xa,e),_e($n,n))}function rg(e){xa.current===e&&(Se($n),Se(xa))}var Ae=Jr(0);function ru(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)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}var gf=[];function sg(){for(var e=0;e<gf.length;e++)gf[e]._workInProgressVersionPrimary=null;gf.length=0}var mc=jr.ReactCurrentDispatcher,vf=jr.ReactCurrentBatchConfig,Ts=0,Ie=null,We=null,Ge=null,su=!1,qo=!1,wa=0,qR=0;function tt(){throw Error(q(321))}function ig(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wn(e[n],t[n]))return!1;return!0}function og(e,t,n,r,s,i){if(Ts=i,Ie=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,mc.current=e===null||e.memoizedState===null?ZR:JR,e=n(r,s),qo){i=0;do{if(qo=!1,wa=0,25<=i)throw Error(q(301));i+=1,Ge=We=null,t.updateQueue=null,mc.current=eI,e=n(r,s)}while(qo)}if(mc.current=iu,t=We!==null&&We.next!==null,Ts=0,Ge=We=Ie=null,su=!1,t)throw Error(q(300));return e}function ag(){var e=wa!==0;return wa=0,e}function Pn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ge===null?Ie.memoizedState=Ge=e:Ge=Ge.next=e,Ge}function tn(){if(We===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=We.next;var t=Ge===null?Ie.memoizedState:Ge.next;if(t!==null)Ge=t,We=e;else{if(e===null)throw Error(q(310));We=e,e={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},Ge===null?Ie.memoizedState=Ge=e:Ge=Ge.next=e}return Ge}function ba(e,t){return typeof t=="function"?t(e):t}function yf(e){var t=tn(),n=t.queue;if(n===null)throw Error(q(311));n.lastRenderedReducer=e;var r=We,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,u=i;do{var d=u.lane;if((Ts&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,o=r):c=c.next=f,Ie.lanes|=d,Ps|=d}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,wn(r,t.memoizedState)||(gt=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Ie.lanes|=i,Ps|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function xf(e){var t=tn(),n=t.queue;if(n===null)throw Error(q(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);wn(i,t.memoizedState)||(gt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Mj(){}function Oj(e,t){var n=Ie,r=tn(),s=t(),i=!wn(r.memoizedState,s);if(i&&(r.memoizedState=s,gt=!0),r=r.queue,lg(Dj.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Ge!==null&&Ge.memoizedState.tag&1){if(n.flags|=2048,ja(9,$j.bind(null,n,r,s,t),void 0,null),qe===null)throw Error(q(349));Ts&30||Lj(n,t,s)}return s}function Lj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ie.updateQueue,t===null?(t={lastEffect:null,stores:null},Ie.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function $j(e,t,n,r){t.value=n,t.getSnapshot=r,zj(t)&&Fj(e)}function Dj(e,t,n){return n(function(){zj(t)&&Fj(e)})}function zj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wn(e,n)}catch{return!0}}function Fj(e){var t=gr(e,1);t!==null&&vn(t,e,1,-1)}function nx(e){var t=Pn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ba,lastRenderedState:e},t.queue=e,e=e.dispatch=QR.bind(null,Ie,e),[t.memoizedState,e]}function ja(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ie.updateQueue,t===null?(t={lastEffect:null,stores:null},Ie.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Vj(){return tn().memoizedState}function gc(e,t,n,r){var s=Pn();Ie.flags|=e,s.memoizedState=ja(1|t,n,void 0,r===void 0?null:r)}function ed(e,t,n,r){var s=tn();r=r===void 0?null:r;var i=void 0;if(We!==null){var o=We.memoizedState;if(i=o.destroy,r!==null&&ig(r,o.deps)){s.memoizedState=ja(t,n,i,r);return}}Ie.flags|=e,s.memoizedState=ja(1|t,n,i,r)}function rx(e,t){return gc(8390656,8,e,t)}function lg(e,t){return ed(2048,8,e,t)}function Bj(e,t){return ed(4,2,e,t)}function Uj(e,t){return ed(4,4,e,t)}function Hj(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Wj(e,t,n){return n=n!=null?n.concat([e]):null,ed(4,4,Hj.bind(null,t,e),n)}function cg(){}function Kj(e,t){var n=tn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ig(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Gj(e,t){var n=tn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ig(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function qj(e,t,n){return Ts&21?(wn(n,t)||(n=Jb(),Ie.lanes|=n,Ps|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,gt=!0),e.memoizedState=n)}function YR(e,t){var n=xe;xe=n!==0&&4>n?n:4,e(!0);var r=vf.transition;vf.transition={};try{e(!1),t()}finally{xe=n,vf.transition=r}}function Yj(){return tn().memoizedState}function XR(e,t,n){var r=Hr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Xj(e))Qj(t,n);else if(n=Aj(e,t,n,r),n!==null){var s=ft();vn(n,e,r,s),Zj(n,t,r)}}function QR(e,t,n){var r=Hr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Xj(e))Qj(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,wn(l,o)){var c=t.interleaved;c===null?(s.next=s,eg(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=Aj(e,t,s,r),n!==null&&(s=ft(),vn(n,e,r,s),Zj(n,t,r))}}function Xj(e){var t=e.alternate;return e===Ie||t!==null&&t===Ie}function Qj(e,t){qo=su=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Zj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fm(e,n)}}var iu={readContext:en,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},ZR={readContext:en,useCallback:function(e,t){return Pn().memoizedState=[e,t===void 0?null:t],e},useContext:en,useEffect:rx,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,gc(4194308,4,Hj.bind(null,t,e),n)},useLayoutEffect:function(e,t){return gc(4194308,4,e,t)},useInsertionEffect:function(e,t){return gc(4,2,e,t)},useMemo:function(e,t){var n=Pn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Pn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=XR.bind(null,Ie,e),[r.memoizedState,e]},useRef:function(e){var t=Pn();return e={current:e},t.memoizedState=e},useState:nx,useDebugValue:cg,useDeferredValue:function(e){return Pn().memoizedState=e},useTransition:function(){var e=nx(!1),t=e[0];return e=YR.bind(null,e[1]),Pn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ie,s=Pn();if(Te){if(n===void 0)throw Error(q(407));n=n()}else{if(n=t(),qe===null)throw Error(q(349));Ts&30||Lj(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,rx(Dj.bind(null,r,i,e),[e]),r.flags|=2048,ja(9,$j.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Pn(),t=qe.identifierPrefix;if(Te){var n=rr,r=nr;n=(r&~(1<<32-gn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=wa++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=qR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},JR={readContext:en,useCallback:Kj,useContext:en,useEffect:lg,useImperativeHandle:Wj,useInsertionEffect:Bj,useLayoutEffect:Uj,useMemo:Gj,useReducer:yf,useRef:Vj,useState:function(){return yf(ba)},useDebugValue:cg,useDeferredValue:function(e){var t=tn();return qj(t,We.memoizedState,e)},useTransition:function(){var e=yf(ba)[0],t=tn().memoizedState;return[e,t]},useMutableSource:Mj,useSyncExternalStore:Oj,useId:Yj,unstable_isNewReconciler:!1},eI={readContext:en,useCallback:Kj,useContext:en,useEffect:lg,useImperativeHandle:Wj,useInsertionEffect:Bj,useLayoutEffect:Uj,useMemo:Gj,useReducer:xf,useRef:Vj,useState:function(){return xf(ba)},useDebugValue:cg,useDeferredValue:function(e){var t=tn();return We===null?t.memoizedState=e:qj(t,We.memoizedState,e)},useTransition:function(){var e=xf(ba)[0],t=tn().memoizedState;return[e,t]},useMutableSource:Mj,useSyncExternalStore:Oj,useId:Yj,unstable_isNewReconciler:!1};function ln(e,t){if(e&&e.defaultProps){t=Me({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Qh(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Me({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var td={isMounted:function(e){return(e=e._reactInternals)?Us(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ft(),s=Hr(e),i=ar(r,s);i.payload=t,n!=null&&(i.callback=n),t=Br(e,i,s),t!==null&&(vn(t,e,s,r),pc(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ft(),s=Hr(e),i=ar(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Br(e,i,s),t!==null&&(vn(t,e,s,r),pc(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ft(),r=Hr(e),s=ar(n,r);s.tag=2,t!=null&&(s.callback=t),t=Br(e,s,r),t!==null&&(vn(t,e,r,n),pc(t,e,r))}};function sx(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!ma(n,r)||!ma(s,i):!0}function Jj(e,t,n){var r=!1,s=qr,i=t.contextType;return typeof i=="object"&&i!==null?i=en(i):(s=xt(t)?Es:at.current,r=t.contextTypes,i=(r=r!=null)?Mi(e,s):qr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=td,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function ix(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&td.enqueueReplaceState(t,t.state,null)}function Zh(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},tg(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=en(i):(i=xt(t)?Es:at.current,s.context=Mi(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Qh(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&td.enqueueReplaceState(s,s.state,null),nu(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Di(e,t){try{var n="",r=t;do n+=CA(r),r=r.return;while(r);var s=n}catch(i){s=`
39
39
  Error generating stack: `+i.message+`
40
- `+i.stack}return{value:e,source:t,stack:s,digest:null}}function _f(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Jh(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var rI=typeof WeakMap=="function"?WeakMap:Map;function rS(e,t,n){n=ar(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){au||(au=!0,cp=r),Jh(e,t)},n}function sS(e,t,n){n=ar(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){Jh(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Jh(e,t),typeof r!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function cx(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new rI;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=vI.bind(null,e,t,n),t.then(e,e))}function ux(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function dx(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ar(-1,1),t.tag=2,Br(n,t,1))),n.lanes|=1),e)}var sI=jr.ReactCurrentOwner,gt=!1;function ut(e,t,n,r){t.child=e===null?Ij(t,null,n,r):Li(t,e.child,n,r)}function fx(e,t,n,r,s){n=n.render;var i=t.ref;return Ci(t,s),r=og(e,t,n,r,i,s),n=ag(),e!==null&&!gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vr(e,t,s)):(Te&&n&&qm(t),t.flags|=1,ut(e,t,r,s),t.child)}function hx(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!vg(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,iS(e,t,i,r,s)):(e=_c(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:ma,n(o,r)&&e.ref===t.ref)return vr(e,t,s)}return t.flags|=1,e=Wr(i,r),e.ref=t.ref,e.return=t,t.child=e}function iS(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(ma(i,r)&&e.ref===t.ref)if(gt=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(gt=!0);else return t.lanes=e.lanes,vr(e,t,s)}return ep(e,t,n,r,s)}function oS(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},_e(hi,bt),bt|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,_e(hi,bt),bt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,_e(hi,bt),bt|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,_e(hi,bt),bt|=r;return ut(e,t,s,n),t.child}function aS(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ep(e,t,n,r,s){var i=xt(n)?Es:at.current;return i=Mi(t,i),Ci(t,s),n=og(e,t,n,r,i,s),r=ag(),e!==null&&!gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vr(e,t,s)):(Te&&r&&qm(t),t.flags|=1,ut(e,t,n,s),t.child)}function px(e,t,n,r,s){if(xt(n)){var i=!0;Qc(t)}else i=!1;if(Ci(t,s),t.stateNode===null)vc(e,t),nS(t,n,r),Zh(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=en(u):(u=xt(n)?Es:at.current,u=Mi(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&lx(t,o,r,u),Ar=!1;var h=t.memoizedState;o.state=h,nu(t,r,o,s),c=t.memoizedState,l!==r||h!==c||yt.current||Ar?(typeof d=="function"&&(Qh(t,n,d,r),c=t.memoizedState),(l=Ar||ax(t,n,l,r,h,c,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Oj(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ln(t.type,l),o.props=u,f=t.pendingProps,h=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=en(c):(c=xt(n)?Es:at.current,c=Mi(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||h!==c)&&lx(t,o,r,c),Ar=!1,h=t.memoizedState,o.state=h,nu(t,r,o,s);var g=t.memoizedState;l!==f||h!==g||yt.current||Ar?(typeof p=="function"&&(Qh(t,n,p,r),g=t.memoizedState),(u=Ar||ax(t,n,u,r,h,g,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return tp(e,t,n,r,i,s)}function tp(e,t,n,r,s,i){aS(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&Jy(t,n,!1),vr(e,t,i);r=t.stateNode,sI.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Li(t,e.child,null,i),t.child=Li(t,null,l,i)):ut(e,t,l,i),t.memoizedState=r.state,s&&Jy(t,n,!0),t.child}function lS(e){var t=e.stateNode;t.pendingContext?Zy(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zy(e,t.context,!1),ng(e,t.containerInfo)}function mx(e,t,n,r,s){return Oi(),Xm(s),t.flags|=256,ut(e,t,n,r),t.child}var np={dehydrated:null,treeContext:null,retryLane:0};function rp(e){return{baseLanes:e,cachePool:null,transitions:null}}function cS(e,t,n){var r=t.pendingProps,s=Ae.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),_e(Ae,s&1),e===null)return Yh(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=sd(o,r,0,null),e=bs(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=rp(n),t.memoizedState=np,e):ug(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return iI(e,t,o,r,l,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Wr(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Wr(l,i):(i=bs(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?rp(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=np,r}return i=e.child,e=i.sibling,r=Wr(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ug(e,t){return t=sd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ml(e,t,n,r){return r!==null&&Xm(r),Li(t,e.child,null,n),e=ug(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function iI(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=_f(Error(q(422))),Ml(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=sd({mode:"visible",children:r.children},s,0,null),i=bs(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Li(t,e.child,null,o),t.child.memoizedState=rp(o),t.memoizedState=np,i);if(!(t.mode&1))return Ml(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(q(419)),r=_f(i,r,void 0),Ml(e,t,o,r)}if(l=(o&e.childLanes)!==0,gt||l){if(r=qe,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,gr(e,s),vn(r,e,s,-1))}return gg(),r=_f(Error(q(421))),Ml(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=yI.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Et=Vr(s.nextSibling),Tt=t,Te=!0,dn=null,e!==null&&(Wt[Kt++]=nr,Wt[Kt++]=rr,Wt[Kt++]=Cs,nr=e.id,rr=e.overflow,Cs=t),t=ug(t,r.children),t.flags|=4096,t)}function gx(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xh(e.return,t,n)}function wf(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function uS(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(ut(e,t,r.children,n),r=Ae.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gx(e,n,t);else if(e.tag===19)gx(e,n,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}r&=1}if(_e(Ae,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&ru(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),wf(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&ru(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}wf(t,!0,n,null,i);break;case"together":wf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function vc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function vr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ps|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(q(153));if(t.child!==null){for(e=t.child,n=Wr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Wr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function oI(e,t,n){switch(t.tag){case 3:lS(t),Oi();break;case 5:Lj(t);break;case 1:xt(t.type)&&Qc(t);break;case 4:ng(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;_e(eu,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(_e(Ae,Ae.current&1),t.flags|=128,null):n&t.child.childLanes?cS(e,t,n):(_e(Ae,Ae.current&1),e=vr(e,t,n),e!==null?e.sibling:null);_e(Ae,Ae.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return uS(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),_e(Ae,Ae.current),r)break;return null;case 22:case 23:return t.lanes=0,oS(e,t,n)}return vr(e,t,n)}var dS,sp,fS,hS;dS=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};sp=function(){};fS=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,ys($n.current);var i=null;switch(n){case"input":s=Nh(e,s),r=Nh(e,r),i=[];break;case"select":s=Me({},s,{value:void 0}),r=Me({},r,{value:void 0}),i=[];break;case"textarea":s=Th(e,s),r=Th(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Yc)}Ah(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(la.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(la.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&be("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};hS=function(e,t,n,r){n!==r&&(t.flags|=4)};function jo(e,t){if(!Te)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function nt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function aI(e,t,n){var r=t.pendingProps;switch(Ym(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nt(t),null;case 1:return xt(t.type)&&Xc(),nt(t),null;case 3:return r=t.stateNode,$i(),Se(yt),Se(at),sg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Rl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,dn!==null&&(fp(dn),dn=null))),sp(e,t),nt(t),null;case 5:rg(t);var s=ys(_a.current);if(n=t.type,e!==null&&t.stateNode!=null)fS(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(q(166));return nt(t),null}if(e=ys($n.current),Rl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Rn]=t,r[ya]=i,e=(t.mode&1)!==0,n){case"dialog":be("cancel",r),be("close",r);break;case"iframe":case"object":case"embed":be("load",r);break;case"video":case"audio":for(s=0;s<Oo.length;s++)be(Oo[s],r);break;case"source":be("error",r);break;case"img":case"image":case"link":be("error",r),be("load",r);break;case"details":be("toggle",r);break;case"input":ky(r,i),be("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},be("invalid",r);break;case"textarea":Ey(r,i),be("invalid",r)}Ah(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Al(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Al(r.textContent,l,e),s=["children",""+l]):la.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&be("scroll",r)}switch(n){case"input":jl(r),Ny(r,i,!0);break;case"textarea":jl(r),Cy(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Yc)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Vb(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Rn]=t,e[ya]=r,dS(e,t,!1,!1),t.stateNode=e;e:{switch(o=Rh(n,r),n){case"dialog":be("cancel",e),be("close",e),s=r;break;case"iframe":case"object":case"embed":be("load",e),s=r;break;case"video":case"audio":for(s=0;s<Oo.length;s++)be(Oo[s],e);s=r;break;case"source":be("error",e),s=r;break;case"img":case"image":case"link":be("error",e),be("load",e),s=r;break;case"details":be("toggle",e),s=r;break;case"input":ky(e,r),s=Nh(e,r),be("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Me({},r,{value:void 0}),be("invalid",e);break;case"textarea":Ey(e,r),s=Th(e,r),be("invalid",e);break;default:s=r}Ah(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Hb(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Bb(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&ca(e,c):typeof c=="number"&&ca(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(la.hasOwnProperty(i)?c!=null&&i==="onScroll"&&be("scroll",e):c!=null&&Mm(e,i,c,o))}switch(n){case"input":jl(e),Ny(e,r,!1);break;case"textarea":jl(e),Cy(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Gr(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Si(e,!!r.multiple,i,!1):r.defaultValue!=null&&Si(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Yc)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return nt(t),null;case 6:if(e&&t.stateNode!=null)hS(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(q(166));if(n=ys(_a.current),ys($n.current),Rl(t)){if(r=t.stateNode,n=t.memoizedProps,r[Rn]=t,(i=r.nodeValue!==n)&&(e=Tt,e!==null))switch(e.tag){case 3:Al(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Al(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Rn]=t,t.stateNode=r}return nt(t),null;case 13:if(Se(Ae),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Te&&Et!==null&&t.mode&1&&!(t.flags&128))Aj(),Oi(),t.flags|=98560,i=!1;else if(i=Rl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(q(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(q(317));i[Rn]=t}else Oi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;nt(t),i=!1}else dn!==null&&(fp(dn),dn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ae.current&1?Ke===0&&(Ke=3):gg())),t.updateQueue!==null&&(t.flags|=4),nt(t),null);case 4:return $i(),sp(e,t),e===null&&ga(t.stateNode.containerInfo),nt(t),null;case 10:return Jm(t.type._context),nt(t),null;case 17:return xt(t.type)&&Xc(),nt(t),null;case 19:if(Se(Ae),i=t.memoizedState,i===null)return nt(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)jo(i,!1);else{if(Ke!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ru(e),o!==null){for(t.flags|=128,jo(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return _e(Ae,Ae.current&1|2),t.child}e=e.sibling}i.tail!==null&&Ve()>zi&&(t.flags|=128,r=!0,jo(i,!1),t.lanes=4194304)}else{if(!r)if(e=ru(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),jo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Te)return nt(t),null}else 2*Ve()-i.renderingStartTime>zi&&n!==1073741824&&(t.flags|=128,r=!0,jo(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ve(),t.sibling=null,n=Ae.current,_e(Ae,r?n&1|2:n&1),t):(nt(t),null);case 22:case 23:return mg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?bt&1073741824&&(nt(t),t.subtreeFlags&6&&(t.flags|=8192)):nt(t),null;case 24:return null;case 25:return null}throw Error(q(156,t.tag))}function lI(e,t){switch(Ym(t),t.tag){case 1:return xt(t.type)&&Xc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $i(),Se(yt),Se(at),sg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return rg(t),null;case 13:if(Se(Ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(q(340));Oi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Se(Ae),null;case 4:return $i(),null;case 10:return Jm(t.type._context),null;case 22:case 23:return mg(),null;case 24:return null;default:return null}}var Ol=!1,it=!1,cI=typeof WeakSet=="function"?WeakSet:Set,J=null;function fi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){De(e,t,r)}else n.current=null}function ip(e,t,n){try{n()}catch(r){De(e,t,r)}}var vx=!1;function uI(e,t){if(Bh=Kc,e=yj(),Gm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(l=o),h===i&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Uh={focusedElem:e,selectionRange:n},Kc=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,_=g.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?x:ln(t.type,x),_);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(b){De(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return g=vx,vx=!1,g}function Yo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&ip(t,n,i)}s=s.next}while(s!==r)}}function nd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function op(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function pS(e){var t=e.alternate;t!==null&&(e.alternate=null,pS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Rn],delete t[ya],delete t[Kh],delete t[KR],delete t[GR])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function mS(e){return e.tag===5||e.tag===3||e.tag===4}function yx(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mS(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.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 ap(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yc));else if(r!==4&&(e=e.child,e!==null))for(ap(e,t,n),e=e.sibling;e!==null;)ap(e,t,n),e=e.sibling}function lp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(lp(e,t,n),e=e.sibling;e!==null;)lp(e,t,n),e=e.sibling}var Ye=null,cn=!1;function kr(e,t,n){for(n=n.child;n!==null;)gS(e,t,n),n=n.sibling}function gS(e,t,n){if(Ln&&typeof Ln.onCommitFiberUnmount=="function")try{Ln.onCommitFiberUnmount(qu,n)}catch{}switch(n.tag){case 5:it||fi(n,t);case 6:var r=Ye,s=cn;Ye=null,kr(e,t,n),Ye=r,cn=s,Ye!==null&&(cn?(e=Ye,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ye.removeChild(n.stateNode));break;case 18:Ye!==null&&(cn?(e=Ye,n=n.stateNode,e.nodeType===8?pf(e.parentNode,n):e.nodeType===1&&pf(e,n),ha(e)):pf(Ye,n.stateNode));break;case 4:r=Ye,s=cn,Ye=n.stateNode.containerInfo,cn=!0,kr(e,t,n),Ye=r,cn=s;break;case 0:case 11:case 14:case 15:if(!it&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&ip(n,t,o),s=s.next}while(s!==r)}kr(e,t,n);break;case 1:if(!it&&(fi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){De(n,t,l)}kr(e,t,n);break;case 21:kr(e,t,n);break;case 22:n.mode&1?(it=(r=it)||n.memoizedState!==null,kr(e,t,n),it=r):kr(e,t,n);break;default:kr(e,t,n)}}function xx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new cI),t.forEach(function(r){var s=xI.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function on(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ye=l.stateNode,cn=!1;break e;case 3:Ye=l.stateNode.containerInfo,cn=!0;break e;case 4:Ye=l.stateNode.containerInfo,cn=!0;break e}l=l.return}if(Ye===null)throw Error(q(160));gS(i,o,s),Ye=null,cn=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){De(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)vS(t,e),t=t.sibling}function vS(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(on(t,e),Cn(e),r&4){try{Yo(3,e,e.return),nd(3,e)}catch(x){De(e,e.return,x)}try{Yo(5,e,e.return)}catch(x){De(e,e.return,x)}}break;case 1:on(t,e),Cn(e),r&512&&n!==null&&fi(n,n.return);break;case 5:if(on(t,e),Cn(e),r&512&&n!==null&&fi(n,n.return),e.flags&32){var s=e.stateNode;try{ca(s,"")}catch(x){De(e,e.return,x)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&zb(s,i),Rh(l,o);var u=Rh(l,i);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?Hb(s,f):d==="dangerouslySetInnerHTML"?Bb(s,f):d==="children"?ca(s,f):Mm(s,d,f,u)}switch(l){case"input":Eh(s,i);break;case"textarea":Fb(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Si(s,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Si(s,!!i.multiple,i.defaultValue,!0):Si(s,!!i.multiple,i.multiple?[]:"",!1))}s[ya]=i}catch(x){De(e,e.return,x)}}break;case 6:if(on(t,e),Cn(e),r&4){if(e.stateNode===null)throw Error(q(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(x){De(e,e.return,x)}}break;case 3:if(on(t,e),Cn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ha(t.containerInfo)}catch(x){De(e,e.return,x)}break;case 4:on(t,e),Cn(e);break;case 13:on(t,e),Cn(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(hg=Ve())),r&4&&xx(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(it=(u=it)||d,on(t,e),it=u):on(t,e),Cn(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(J=e,d=e.child;d!==null;){for(f=J=d;J!==null;){switch(h=J,p=h.child,h.tag){case 0:case 11:case 14:case 15:Yo(4,h,h.return);break;case 1:fi(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(x){De(r,n,x)}}break;case 5:fi(h,h.return);break;case 22:if(h.memoizedState!==null){wx(f);continue}}p!==null?(p.return=h,J=p):wx(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Ub("display",o))}catch(x){De(e,e.return,x)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(x){De(e,e.return,x)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:on(t,e),Cn(e),r&4&&xx(e);break;case 21:break;default:on(t,e),Cn(e)}}function Cn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(mS(n)){var r=n;break e}n=n.return}throw Error(q(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(ca(s,""),r.flags&=-33);var i=yx(e);lp(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=yx(e);ap(e,l,o);break;default:throw Error(q(161))}}catch(c){De(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function dI(e,t,n){J=e,yS(e)}function yS(e,t,n){for(var r=(e.mode&1)!==0;J!==null;){var s=J,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Ol;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||it;l=Ol;var u=it;if(Ol=o,(it=c)&&!u)for(J=s;J!==null;)o=J,c=o.child,o.tag===22&&o.memoizedState!==null?bx(s):c!==null?(c.return=o,J=c):bx(s);for(;i!==null;)J=i,yS(i),i=i.sibling;J=s,Ol=l,it=u}_x(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,J=i):_x(e)}}function _x(e){for(;J!==null;){var t=J;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:it||nd(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!it)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:ln(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&sx(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}sx(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&ha(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(q(163))}it||t.flags&512&&op(t)}catch(h){De(t,t.return,h)}}if(t===e){J=null;break}if(n=t.sibling,n!==null){n.return=t.return,J=n;break}J=t.return}}function wx(e){for(;J!==null;){var t=J;if(t===e){J=null;break}var n=t.sibling;if(n!==null){n.return=t.return,J=n;break}J=t.return}}function bx(e){for(;J!==null;){var t=J;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{nd(4,t)}catch(c){De(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){De(t,s,c)}}var i=t.return;try{op(t)}catch(c){De(t,i,c)}break;case 5:var o=t.return;try{op(t)}catch(c){De(t,o,c)}}}catch(c){De(t,t.return,c)}if(t===e){J=null;break}var l=t.sibling;if(l!==null){l.return=t.return,J=l;break}J=t.return}}var fI=Math.ceil,ou=jr.ReactCurrentDispatcher,dg=jr.ReactCurrentOwner,Zt=jr.ReactCurrentBatchConfig,de=0,qe=null,Be=null,Je=0,bt=0,hi=Jr(0),Ke=0,Sa=null,Ps=0,rd=0,fg=0,Xo=null,mt=null,hg=0,zi=1/0,Xn=null,au=!1,cp=null,Ur=null,Ll=!1,Lr=null,lu=0,Qo=0,up=null,yc=-1,xc=0;function ft(){return de&6?Ve():yc!==-1?yc:yc=Ve()}function Hr(e){return e.mode&1?de&2&&Je!==0?Je&-Je:YR.transition!==null?(xc===0&&(xc=nj()),xc):(e=xe,e!==0||(e=window.event,e=e===void 0?16:cj(e.type)),e):1}function vn(e,t,n,r){if(50<Qo)throw Qo=0,up=null,Error(q(185));Xa(e,n,r),(!(de&2)||e!==qe)&&(e===qe&&(!(de&2)&&(rd|=n),Ke===4&&Ir(e,Je)),_t(e,r),n===1&&de===0&&!(t.mode&1)&&(zi=Ve()+500,Ju&&es()))}function _t(e,t){var n=e.callbackNode;YA(e,t);var r=Wc(e,e===qe?Je:0);if(r===0)n!==null&&Ay(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ay(n),t===1)e.tag===0?qR(jx.bind(null,e)):Cj(jx.bind(null,e)),HR(function(){!(de&6)&&es()}),n=null;else{switch(rj(r)){case 1:n=zm;break;case 4:n=ej;break;case 16:n=Hc;break;case 536870912:n=tj;break;default:n=Hc}n=NS(n,xS.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function xS(e,t){if(yc=-1,xc=0,de&6)throw Error(q(327));var n=e.callbackNode;if(Ti()&&e.callbackNode!==n)return null;var r=Wc(e,e===qe?Je:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=cu(e,r);else{t=r;var s=de;de|=2;var i=wS();(qe!==e||Je!==t)&&(Xn=null,zi=Ve()+500,ws(e,t));do try{mI();break}catch(l){_S(e,l)}while(!0);Zm(),ou.current=i,de=s,Be!==null?t=0:(qe=null,Je=0,t=Ke)}if(t!==0){if(t===2&&(s=$h(e),s!==0&&(r=s,t=dp(e,s))),t===1)throw n=Sa,ws(e,0),Ir(e,r),_t(e,Ve()),n;if(t===6)Ir(e,r);else{if(s=e.current.alternate,!(r&30)&&!hI(s)&&(t=cu(e,r),t===2&&(i=$h(e),i!==0&&(r=i,t=dp(e,i))),t===1))throw n=Sa,ws(e,0),Ir(e,r),_t(e,Ve()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(q(345));case 2:cs(e,mt,Xn);break;case 3:if(Ir(e,r),(r&130023424)===r&&(t=hg+500-Ve(),10<t)){if(Wc(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){ft(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Wh(cs.bind(null,e,mt,Xn),t);break}cs(e,mt,Xn);break;case 4:if(Ir(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-gn(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=Ve()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*fI(r/1960))-r,10<r){e.timeoutHandle=Wh(cs.bind(null,e,mt,Xn),r);break}cs(e,mt,Xn);break;case 5:cs(e,mt,Xn);break;default:throw Error(q(329))}}}return _t(e,Ve()),e.callbackNode===n?xS.bind(null,e):null}function dp(e,t){var n=Xo;return e.current.memoizedState.isDehydrated&&(ws(e,t).flags|=256),e=cu(e,t),e!==2&&(t=mt,mt=n,t!==null&&fp(t)),e}function fp(e){mt===null?mt=e:mt.push.apply(mt,e)}function hI(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!wn(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 Ir(e,t){for(t&=~fg,t&=~rd,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-gn(t),r=1<<n;e[n]=-1,t&=~r}}function jx(e){if(de&6)throw Error(q(327));Ti();var t=Wc(e,0);if(!(t&1))return _t(e,Ve()),null;var n=cu(e,t);if(e.tag!==0&&n===2){var r=$h(e);r!==0&&(t=r,n=dp(e,r))}if(n===1)throw n=Sa,ws(e,0),Ir(e,t),_t(e,Ve()),n;if(n===6)throw Error(q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,cs(e,mt,Xn),_t(e,Ve()),null}function pg(e,t){var n=de;de|=1;try{return e(t)}finally{de=n,de===0&&(zi=Ve()+500,Ju&&es())}}function As(e){Lr!==null&&Lr.tag===0&&!(de&6)&&Ti();var t=de;de|=1;var n=Zt.transition,r=xe;try{if(Zt.transition=null,xe=1,e)return e()}finally{xe=r,Zt.transition=n,de=t,!(de&6)&&es()}}function mg(){bt=hi.current,Se(hi)}function ws(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,UR(n)),Be!==null)for(n=Be.return;n!==null;){var r=n;switch(Ym(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xc();break;case 3:$i(),Se(yt),Se(at),sg();break;case 5:rg(r);break;case 4:$i();break;case 13:Se(Ae);break;case 19:Se(Ae);break;case 10:Jm(r.type._context);break;case 22:case 23:mg()}n=n.return}if(qe=e,Be=e=Wr(e.current,null),Je=bt=t,Ke=0,Sa=null,fg=rd=Ps=0,mt=Xo=null,vs!==null){for(t=0;t<vs.length;t++)if(n=vs[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}vs=null}return e}function _S(e,t){do{var n=Be;try{if(Zm(),mc.current=iu,su){for(var r=Ie.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}su=!1}if(Ts=0,Ge=We=Ie=null,qo=!1,wa=0,dg.current=null,n===null||n.return===null){Ke=1,Sa=t,Be=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=Je,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=ux(o);if(p!==null){p.flags&=-257,dx(p,o,l,i,t),p.mode&1&&cx(i,u,t),t=p,c=u;var g=t.updateQueue;if(g===null){var x=new Set;x.add(c),t.updateQueue=x}else g.add(c);break e}else{if(!(t&1)){cx(i,u,t),gg();break e}c=Error(q(426))}}else if(Te&&l.mode&1){var _=ux(o);if(_!==null){!(_.flags&65536)&&(_.flags|=256),dx(_,o,l,i,t),Xm(Di(c,l));break e}}i=c=Di(c,l),Ke!==4&&(Ke=2),Xo===null?Xo=[i]:Xo.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=rS(i,c,t);rx(i,v);break e;case 1:l=c;var y=i.type,m=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Ur===null||!Ur.has(m)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=sS(i,l,t);rx(i,b);break e}}i=i.return}while(i!==null)}jS(n)}catch(j){t=j,Be===n&&n!==null&&(Be=n=n.return);continue}break}while(!0)}function wS(){var e=ou.current;return ou.current=iu,e===null?iu:e}function gg(){(Ke===0||Ke===3||Ke===2)&&(Ke=4),qe===null||!(Ps&268435455)&&!(rd&268435455)||Ir(qe,Je)}function cu(e,t){var n=de;de|=2;var r=wS();(qe!==e||Je!==t)&&(Xn=null,ws(e,t));do try{pI();break}catch(s){_S(e,s)}while(!0);if(Zm(),de=n,ou.current=r,Be!==null)throw Error(q(261));return qe=null,Je=0,Ke}function pI(){for(;Be!==null;)bS(Be)}function mI(){for(;Be!==null&&!FA();)bS(Be)}function bS(e){var t=kS(e.alternate,e,bt);e.memoizedProps=e.pendingProps,t===null?jS(e):Be=t,dg.current=null}function jS(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=lI(n,t),n!==null){n.flags&=32767,Be=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ke=6,Be=null;return}}else if(n=aI(n,t,bt),n!==null){Be=n;return}if(t=t.sibling,t!==null){Be=t;return}Be=t=e}while(t!==null);Ke===0&&(Ke=5)}function cs(e,t,n){var r=xe,s=Zt.transition;try{Zt.transition=null,xe=1,gI(e,t,n,r)}finally{Zt.transition=s,xe=r}return null}function gI(e,t,n,r){do Ti();while(Lr!==null);if(de&6)throw Error(q(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(q(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(XA(e,i),e===qe&&(Be=qe=null,Je=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ll||(Ll=!0,NS(Hc,function(){return Ti(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Zt.transition,Zt.transition=null;var o=xe;xe=1;var l=de;de|=4,dg.current=null,uI(e,n),vS(n,e),LR(Uh),Kc=!!Bh,Uh=Bh=null,e.current=n,dI(n),VA(),de=l,xe=o,Zt.transition=i}else e.current=n;if(Ll&&(Ll=!1,Lr=e,lu=s),i=e.pendingLanes,i===0&&(Ur=null),HA(n.stateNode),_t(e,Ve()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(au)throw au=!1,e=cp,cp=null,e;return lu&1&&e.tag!==0&&Ti(),i=e.pendingLanes,i&1?e===up?Qo++:(Qo=0,up=e):Qo=0,es(),null}function Ti(){if(Lr!==null){var e=rj(lu),t=Zt.transition,n=xe;try{if(Zt.transition=null,xe=16>e?16:e,Lr===null)var r=!1;else{if(e=Lr,Lr=null,lu=0,de&6)throw Error(q(331));var s=de;for(de|=4,J=e.current;J!==null;){var i=J,o=i.child;if(J.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(J=u;J!==null;){var d=J;switch(d.tag){case 0:case 11:case 15:Yo(8,d,i)}var f=d.child;if(f!==null)f.return=d,J=f;else for(;J!==null;){d=J;var h=d.sibling,p=d.return;if(pS(d),d===u){J=null;break}if(h!==null){h.return=p,J=h;break}J=p}}}var g=i.alternate;if(g!==null){var x=g.child;if(x!==null){g.child=null;do{var _=x.sibling;x.sibling=null,x=_}while(x!==null)}}J=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,J=o;else e:for(;J!==null;){if(i=J,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Yo(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,J=v;break e}J=i.return}}var y=e.current;for(J=y;J!==null;){o=J;var m=o.child;if(o.subtreeFlags&2064&&m!==null)m.return=o,J=m;else e:for(o=y;J!==null;){if(l=J,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:nd(9,l)}}catch(j){De(l,l.return,j)}if(l===o){J=null;break e}var b=l.sibling;if(b!==null){b.return=l.return,J=b;break e}J=l.return}}if(de=s,es(),Ln&&typeof Ln.onPostCommitFiberRoot=="function")try{Ln.onPostCommitFiberRoot(qu,e)}catch{}r=!0}return r}finally{xe=n,Zt.transition=t}}return!1}function Sx(e,t,n){t=Di(n,t),t=rS(e,t,1),e=Br(e,t,1),t=ft(),e!==null&&(Xa(e,1,t),_t(e,t))}function De(e,t,n){if(e.tag===3)Sx(e,e,n);else for(;t!==null;){if(t.tag===3){Sx(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ur===null||!Ur.has(r))){e=Di(n,e),e=sS(t,e,1),t=Br(t,e,1),e=ft(),t!==null&&(Xa(t,1,e),_t(t,e));break}}t=t.return}}function vI(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ft(),e.pingedLanes|=e.suspendedLanes&n,qe===e&&(Je&n)===n&&(Ke===4||Ke===3&&(Je&130023424)===Je&&500>Ve()-hg?ws(e,0):fg|=n),_t(e,t)}function SS(e,t){t===0&&(e.mode&1?(t=Nl,Nl<<=1,!(Nl&130023424)&&(Nl=4194304)):t=1);var n=ft();e=gr(e,t),e!==null&&(Xa(e,t,n),_t(e,n))}function yI(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),SS(e,n)}function xI(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(q(314))}r!==null&&r.delete(t),SS(e,n)}var kS;kS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||yt.current)gt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return gt=!1,oI(e,t,n);gt=!!(e.flags&131072)}else gt=!1,Te&&t.flags&1048576&&Tj(t,Jc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;vc(e,t),e=t.pendingProps;var s=Mi(t,at.current);Ci(t,n),s=og(null,t,r,e,s,n);var i=ag();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xt(r)?(i=!0,Qc(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,tg(t),s.updater=td,t.stateNode=s,s._reactInternals=t,Zh(t,r,e,n),t=tp(null,t,r,!0,i,n)):(t.tag=0,Te&&i&&qm(t),ut(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(vc(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=wI(r),e=ln(r,e),s){case 0:t=ep(null,t,r,e,n);break e;case 1:t=px(null,t,r,e,n);break e;case 11:t=fx(null,t,r,e,n);break e;case 14:t=hx(null,t,r,ln(r.type,e),n);break e}throw Error(q(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),ep(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),px(e,t,r,s,n);case 3:e:{if(lS(t),e===null)throw Error(q(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Oj(e,t),nu(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Di(Error(q(423)),t),t=mx(e,t,r,n,s);break e}else if(r!==s){s=Di(Error(q(424)),t),t=mx(e,t,r,n,s);break e}else for(Et=Vr(t.stateNode.containerInfo.firstChild),Tt=t,Te=!0,dn=null,n=Ij(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Oi(),r===s){t=vr(e,t,n);break e}ut(e,t,r,n)}t=t.child}return t;case 5:return Lj(t),e===null&&Yh(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Hh(r,s)?o=null:i!==null&&Hh(r,i)&&(t.flags|=32),aS(e,t),ut(e,t,o,n),t.child;case 6:return e===null&&Yh(t),null;case 13:return cS(e,t,n);case 4:return ng(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Li(t,null,r,n):ut(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),fx(e,t,r,s,n);case 7:return ut(e,t,t.pendingProps,n),t.child;case 8:return ut(e,t,t.pendingProps.children,n),t.child;case 12:return ut(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,_e(eu,r._currentValue),r._currentValue=o,i!==null)if(wn(i.value,o)){if(i.children===s.children&&!yt.current){t=vr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=ar(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Xh(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(q(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Xh(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ut(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Ci(t,n),s=en(s),r=r(s),t.flags|=1,ut(e,t,r,n),t.child;case 14:return r=t.type,s=ln(r,t.pendingProps),s=ln(r.type,s),hx(e,t,r,s,n);case 15:return iS(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),vc(e,t),t.tag=1,xt(r)?(e=!0,Qc(t)):e=!1,Ci(t,n),nS(t,r,s),Zh(t,r,s,n),tp(null,t,r,!0,e,n);case 19:return uS(e,t,n);case 22:return oS(e,t,n)}throw Error(q(156,t.tag))};function NS(e,t){return Jb(e,t)}function _I(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yt(e,t,n,r){return new _I(e,t,n,r)}function vg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function wI(e){if(typeof e=="function")return vg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Lm)return 11;if(e===$m)return 14}return 2}function Wr(e,t){var n=e.alternate;return n===null?(n=Yt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function _c(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")vg(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ri:return bs(n.children,s,i,t);case Om:o=8,s|=8;break;case bh:return e=Yt(12,n,t,s|2),e.elementType=bh,e.lanes=i,e;case jh:return e=Yt(13,n,t,s),e.elementType=jh,e.lanes=i,e;case Sh:return e=Yt(19,n,t,s),e.elementType=Sh,e.lanes=i,e;case Lb:return sd(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Mb:o=10;break e;case Ob:o=9;break e;case Lm:o=11;break e;case $m:o=14;break e;case Pr:o=16,r=null;break e}throw Error(q(130,e==null?e:typeof e,""))}return t=Yt(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function bs(e,t,n,r){return e=Yt(7,e,r,t),e.lanes=n,e}function sd(e,t,n,r){return e=Yt(22,e,r,t),e.elementType=Lb,e.lanes=n,e.stateNode={isHidden:!1},e}function bf(e,t,n){return e=Yt(6,e,null,t),e.lanes=n,e}function jf(e,t,n){return t=Yt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function bI(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=nf(0),this.expirationTimes=nf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nf(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function yg(e,t,n,r,s,i,o,l,c){return e=new bI(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Yt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tg(i),e}function jI(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ni,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function ES(e){if(!e)return qr;e=e._reactInternals;e:{if(Us(e)!==e||e.tag!==1)throw Error(q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(xt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(q(171))}if(e.tag===1){var n=e.type;if(xt(n))return Ej(e,n,t)}return t}function CS(e,t,n,r,s,i,o,l,c){return e=yg(n,r,!0,e,s,i,o,l,c),e.context=ES(null),n=e.current,r=ft(),s=Hr(n),i=ar(r,s),i.callback=t??null,Br(n,i,s),e.current.lanes=s,Xa(e,s,r),_t(e,r),e}function id(e,t,n,r){var s=t.current,i=ft(),o=Hr(s);return n=ES(n),t.context===null?t.context=n:t.pendingContext=n,t=ar(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Br(s,t,o),e!==null&&(vn(e,s,o,i),pc(e,s,o)),o}function uu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function kx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xg(e,t){kx(e,t),(e=e.alternate)&&kx(e,t)}function SI(){return null}var TS=typeof reportError=="function"?reportError:function(e){console.error(e)};function _g(e){this._internalRoot=e}od.prototype.render=_g.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(q(409));id(e,t,null,null)};od.prototype.unmount=_g.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;As(function(){id(null,e,null,null)}),t[mr]=null}};function od(e){this._internalRoot=e}od.prototype.unstable_scheduleHydration=function(e){if(e){var t=oj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Rr.length&&t!==0&&t<Rr[n].priority;n++);Rr.splice(n,0,e),n===0&&lj(e)}};function wg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ad(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Nx(){}function kI(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=uu(o);i.call(u)}}var o=CS(t,r,e,0,null,!1,!1,"",Nx);return e._reactRootContainer=o,e[mr]=o.current,ga(e.nodeType===8?e.parentNode:e),As(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=uu(c);l.call(u)}}var c=yg(e,0,!1,null,null,!1,!1,"",Nx);return e._reactRootContainer=c,e[mr]=c.current,ga(e.nodeType===8?e.parentNode:e),As(function(){id(t,c,n,r)}),c}function ld(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=uu(o);l.call(c)}}id(t,o,e,s)}else o=kI(n,t,e,s,r);return uu(o)}sj=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Mo(t.pendingLanes);n!==0&&(Fm(t,n|1),_t(t,Ve()),!(de&6)&&(zi=Ve()+500,es()))}break;case 13:As(function(){var r=gr(e,1);if(r!==null){var s=ft();vn(r,e,1,s)}}),xg(e,1)}};Vm=function(e){if(e.tag===13){var t=gr(e,134217728);if(t!==null){var n=ft();vn(t,e,134217728,n)}xg(e,134217728)}};ij=function(e){if(e.tag===13){var t=Hr(e),n=gr(e,t);if(n!==null){var r=ft();vn(n,e,t,r)}xg(e,t)}};oj=function(){return xe};aj=function(e,t){var n=xe;try{return xe=e,t()}finally{xe=n}};Mh=function(e,t,n){switch(t){case"input":if(Eh(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Zu(r);if(!s)throw Error(q(90));Db(r),Eh(r,s)}}}break;case"textarea":Fb(e,n);break;case"select":t=n.value,t!=null&&Si(e,!!n.multiple,t,!1)}};Gb=pg;qb=As;var NI={usingClientEntryPoint:!1,Events:[Za,ai,Zu,Wb,Kb,pg]},So={findFiberByHostInstance:gs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},EI={bundleType:So.bundleType,version:So.version,rendererPackageName:So.rendererPackageName,rendererConfig:So.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:jr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Qb(e),e===null?null:e.stateNode},findFiberByHostInstance:So.findFiberByHostInstance||SI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$l.isDisabled&&$l.supportsFiber)try{qu=$l.inject(EI),Ln=$l}catch{}}Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=NI;Ot.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wg(t))throw Error(q(200));return jI(e,t,null,n)};Ot.createRoot=function(e,t){if(!wg(e))throw Error(q(299));var n=!1,r="",s=TS;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=yg(e,1,!1,null,null,n,!1,r,s),e[mr]=t.current,ga(e.nodeType===8?e.parentNode:e),new _g(t)};Ot.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(q(188)):(e=Object.keys(e).join(","),Error(q(268,e)));return e=Qb(t),e=e===null?null:e.stateNode,e};Ot.flushSync=function(e){return As(e)};Ot.hydrate=function(e,t,n){if(!ad(t))throw Error(q(200));return ld(null,e,t,!0,n)};Ot.hydrateRoot=function(e,t,n){if(!wg(e))throw Error(q(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=TS;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=CS(t,null,e,1,n??null,s,!1,i,o),e[mr]=t.current,ga(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new od(t)};Ot.render=function(e,t,n){if(!ad(t))throw Error(q(200));return ld(null,e,t,!1,n)};Ot.unmountComponentAtNode=function(e){if(!ad(e))throw Error(q(40));return e._reactRootContainer?(As(function(){ld(null,null,e,!1,function(){e._reactRootContainer=null,e[mr]=null})}),!0):!1};Ot.unstable_batchedUpdates=pg;Ot.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ad(n))throw Error(q(200));if(e==null||e._reactInternals===void 0)throw Error(q(38));return ld(e,t,n,!1,r)};Ot.version="18.3.1-next-f1338f8080-20240426";function PS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PS)}catch(e){console.error(e)}}PS(),Pb.exports=Ot;var AS=Pb.exports,RS,Ex=AS;RS=Ex.createRoot,Ex.hydrateRoot;/**
40
+ `+i.stack}return{value:e,source:t,stack:s,digest:null}}function _f(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Jh(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var tI=typeof WeakMap=="function"?WeakMap:Map;function eS(e,t,n){n=ar(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){au||(au=!0,cp=r),Jh(e,t)},n}function tS(e,t,n){n=ar(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){Jh(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Jh(e,t),typeof r!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function ox(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new tI;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=mI.bind(null,e,t,n),t.then(e,e))}function ax(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function lx(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ar(-1,1),t.tag=2,Br(n,t,1))),n.lanes|=1),e)}var nI=jr.ReactCurrentOwner,gt=!1;function ut(e,t,n,r){t.child=e===null?Pj(t,null,n,r):Li(t,e.child,n,r)}function cx(e,t,n,r,s){n=n.render;var i=t.ref;return Ci(t,s),r=og(e,t,n,r,i,s),n=ag(),e!==null&&!gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vr(e,t,s)):(Te&&n&&qm(t),t.flags|=1,ut(e,t,r,s),t.child)}function ux(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!vg(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,nS(e,t,i,r,s)):(e=_c(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:ma,n(o,r)&&e.ref===t.ref)return vr(e,t,s)}return t.flags|=1,e=Wr(i,r),e.ref=t.ref,e.return=t,t.child=e}function nS(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(ma(i,r)&&e.ref===t.ref)if(gt=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(gt=!0);else return t.lanes=e.lanes,vr(e,t,s)}return ep(e,t,n,r,s)}function rS(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},_e(hi,bt),bt|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,_e(hi,bt),bt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,_e(hi,bt),bt|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,_e(hi,bt),bt|=r;return ut(e,t,s,n),t.child}function sS(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ep(e,t,n,r,s){var i=xt(n)?Es:at.current;return i=Mi(t,i),Ci(t,s),n=og(e,t,n,r,i,s),r=ag(),e!==null&&!gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vr(e,t,s)):(Te&&r&&qm(t),t.flags|=1,ut(e,t,n,s),t.child)}function dx(e,t,n,r,s){if(xt(n)){var i=!0;Qc(t)}else i=!1;if(Ci(t,s),t.stateNode===null)vc(e,t),Jj(t,n,r),Zh(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=en(u):(u=xt(n)?Es:at.current,u=Mi(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&ix(t,o,r,u),Ar=!1;var h=t.memoizedState;o.state=h,nu(t,r,o,s),c=t.memoizedState,l!==r||h!==c||yt.current||Ar?(typeof d=="function"&&(Qh(t,n,d,r),c=t.memoizedState),(l=Ar||sx(t,n,l,r,h,c,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Rj(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ln(t.type,l),o.props=u,f=t.pendingProps,h=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=en(c):(c=xt(n)?Es:at.current,c=Mi(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||h!==c)&&ix(t,o,r,c),Ar=!1,h=t.memoizedState,o.state=h,nu(t,r,o,s);var g=t.memoizedState;l!==f||h!==g||yt.current||Ar?(typeof p=="function"&&(Qh(t,n,p,r),g=t.memoizedState),(u=Ar||sx(t,n,u,r,h,g,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return tp(e,t,n,r,i,s)}function tp(e,t,n,r,s,i){sS(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&Xy(t,n,!1),vr(e,t,i);r=t.stateNode,nI.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Li(t,e.child,null,i),t.child=Li(t,null,l,i)):ut(e,t,l,i),t.memoizedState=r.state,s&&Xy(t,n,!0),t.child}function iS(e){var t=e.stateNode;t.pendingContext?Yy(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Yy(e,t.context,!1),ng(e,t.containerInfo)}function fx(e,t,n,r,s){return Oi(),Xm(s),t.flags|=256,ut(e,t,n,r),t.child}var np={dehydrated:null,treeContext:null,retryLane:0};function rp(e){return{baseLanes:e,cachePool:null,transitions:null}}function oS(e,t,n){var r=t.pendingProps,s=Ae.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),_e(Ae,s&1),e===null)return Yh(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=sd(o,r,0,null),e=bs(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=rp(n),t.memoizedState=np,e):ug(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return rI(e,t,o,r,l,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Wr(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Wr(l,i):(i=bs(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?rp(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=np,r}return i=e.child,e=i.sibling,r=Wr(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ug(e,t){return t=sd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ml(e,t,n,r){return r!==null&&Xm(r),Li(t,e.child,null,n),e=ug(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function rI(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=_f(Error(q(422))),Ml(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=sd({mode:"visible",children:r.children},s,0,null),i=bs(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Li(t,e.child,null,o),t.child.memoizedState=rp(o),t.memoizedState=np,i);if(!(t.mode&1))return Ml(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(q(419)),r=_f(i,r,void 0),Ml(e,t,o,r)}if(l=(o&e.childLanes)!==0,gt||l){if(r=qe,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,gr(e,s),vn(r,e,s,-1))}return gg(),r=_f(Error(q(421))),Ml(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=gI.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Et=Vr(s.nextSibling),Tt=t,Te=!0,dn=null,e!==null&&(Wt[Kt++]=nr,Wt[Kt++]=rr,Wt[Kt++]=Cs,nr=e.id,rr=e.overflow,Cs=t),t=ug(t,r.children),t.flags|=4096,t)}function hx(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xh(e.return,t,n)}function wf(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function aS(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(ut(e,t,r.children,n),r=Ae.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&hx(e,n,t);else if(e.tag===19)hx(e,n,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}r&=1}if(_e(Ae,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&ru(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),wf(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&ru(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}wf(t,!0,n,null,i);break;case"together":wf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function vc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function vr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ps|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(q(153));if(t.child!==null){for(e=t.child,n=Wr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Wr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function sI(e,t,n){switch(t.tag){case 3:iS(t),Oi();break;case 5:Ij(t);break;case 1:xt(t.type)&&Qc(t);break;case 4:ng(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;_e(eu,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(_e(Ae,Ae.current&1),t.flags|=128,null):n&t.child.childLanes?oS(e,t,n):(_e(Ae,Ae.current&1),e=vr(e,t,n),e!==null?e.sibling:null);_e(Ae,Ae.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return aS(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),_e(Ae,Ae.current),r)break;return null;case 22:case 23:return t.lanes=0,rS(e,t,n)}return vr(e,t,n)}var lS,sp,cS,uS;lS=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};sp=function(){};cS=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,ys($n.current);var i=null;switch(n){case"input":s=Nh(e,s),r=Nh(e,r),i=[];break;case"select":s=Me({},s,{value:void 0}),r=Me({},r,{value:void 0}),i=[];break;case"textarea":s=Th(e,s),r=Th(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Yc)}Ah(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(la.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(la.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&be("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};uS=function(e,t,n,r){n!==r&&(t.flags|=4)};function jo(e,t){if(!Te)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function nt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function iI(e,t,n){var r=t.pendingProps;switch(Ym(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nt(t),null;case 1:return xt(t.type)&&Xc(),nt(t),null;case 3:return r=t.stateNode,$i(),Se(yt),Se(at),sg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Rl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,dn!==null&&(fp(dn),dn=null))),sp(e,t),nt(t),null;case 5:rg(t);var s=ys(_a.current);if(n=t.type,e!==null&&t.stateNode!=null)cS(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(q(166));return nt(t),null}if(e=ys($n.current),Rl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Rn]=t,r[ya]=i,e=(t.mode&1)!==0,n){case"dialog":be("cancel",r),be("close",r);break;case"iframe":case"object":case"embed":be("load",r);break;case"video":case"audio":for(s=0;s<Oo.length;s++)be(Oo[s],r);break;case"source":be("error",r);break;case"img":case"image":case"link":be("error",r),be("load",r);break;case"details":be("toggle",r);break;case"input":by(r,i),be("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},be("invalid",r);break;case"textarea":Sy(r,i),be("invalid",r)}Ah(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Al(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Al(r.textContent,l,e),s=["children",""+l]):la.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&be("scroll",r)}switch(n){case"input":jl(r),jy(r,i,!0);break;case"textarea":jl(r),ky(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Yc)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Db(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Rn]=t,e[ya]=r,lS(e,t,!1,!1),t.stateNode=e;e:{switch(o=Rh(n,r),n){case"dialog":be("cancel",e),be("close",e),s=r;break;case"iframe":case"object":case"embed":be("load",e),s=r;break;case"video":case"audio":for(s=0;s<Oo.length;s++)be(Oo[s],e);s=r;break;case"source":be("error",e),s=r;break;case"img":case"image":case"link":be("error",e),be("load",e),s=r;break;case"details":be("toggle",e),s=r;break;case"input":by(e,r),s=Nh(e,r),be("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Me({},r,{value:void 0}),be("invalid",e);break;case"textarea":Sy(e,r),s=Th(e,r),be("invalid",e);break;default:s=r}Ah(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Vb(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&zb(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&ca(e,c):typeof c=="number"&&ca(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(la.hasOwnProperty(i)?c!=null&&i==="onScroll"&&be("scroll",e):c!=null&&Mm(e,i,c,o))}switch(n){case"input":jl(e),jy(e,r,!1);break;case"textarea":jl(e),ky(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Gr(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Si(e,!!r.multiple,i,!1):r.defaultValue!=null&&Si(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Yc)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return nt(t),null;case 6:if(e&&t.stateNode!=null)uS(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(q(166));if(n=ys(_a.current),ys($n.current),Rl(t)){if(r=t.stateNode,n=t.memoizedProps,r[Rn]=t,(i=r.nodeValue!==n)&&(e=Tt,e!==null))switch(e.tag){case 3:Al(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Al(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Rn]=t,t.stateNode=r}return nt(t),null;case 13:if(Se(Ae),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Te&&Et!==null&&t.mode&1&&!(t.flags&128))Cj(),Oi(),t.flags|=98560,i=!1;else if(i=Rl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(q(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(q(317));i[Rn]=t}else Oi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;nt(t),i=!1}else dn!==null&&(fp(dn),dn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ae.current&1?Ke===0&&(Ke=3):gg())),t.updateQueue!==null&&(t.flags|=4),nt(t),null);case 4:return $i(),sp(e,t),e===null&&ga(t.stateNode.containerInfo),nt(t),null;case 10:return Jm(t.type._context),nt(t),null;case 17:return xt(t.type)&&Xc(),nt(t),null;case 19:if(Se(Ae),i=t.memoizedState,i===null)return nt(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)jo(i,!1);else{if(Ke!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ru(e),o!==null){for(t.flags|=128,jo(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return _e(Ae,Ae.current&1|2),t.child}e=e.sibling}i.tail!==null&&Ve()>zi&&(t.flags|=128,r=!0,jo(i,!1),t.lanes=4194304)}else{if(!r)if(e=ru(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),jo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Te)return nt(t),null}else 2*Ve()-i.renderingStartTime>zi&&n!==1073741824&&(t.flags|=128,r=!0,jo(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ve(),t.sibling=null,n=Ae.current,_e(Ae,r?n&1|2:n&1),t):(nt(t),null);case 22:case 23:return mg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?bt&1073741824&&(nt(t),t.subtreeFlags&6&&(t.flags|=8192)):nt(t),null;case 24:return null;case 25:return null}throw Error(q(156,t.tag))}function oI(e,t){switch(Ym(t),t.tag){case 1:return xt(t.type)&&Xc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $i(),Se(yt),Se(at),sg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return rg(t),null;case 13:if(Se(Ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(q(340));Oi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Se(Ae),null;case 4:return $i(),null;case 10:return Jm(t.type._context),null;case 22:case 23:return mg(),null;case 24:return null;default:return null}}var Ol=!1,it=!1,aI=typeof WeakSet=="function"?WeakSet:Set,J=null;function fi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){De(e,t,r)}else n.current=null}function ip(e,t,n){try{n()}catch(r){De(e,t,r)}}var px=!1;function lI(e,t){if(Bh=Kc,e=mj(),Gm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(l=o),h===i&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Uh={focusedElem:e,selectionRange:n},Kc=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,_=g.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?x:ln(t.type,x),_);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(b){De(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return g=px,px=!1,g}function Yo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&ip(t,n,i)}s=s.next}while(s!==r)}}function nd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function op(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function dS(e){var t=e.alternate;t!==null&&(e.alternate=null,dS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Rn],delete t[ya],delete t[Kh],delete t[HR],delete t[WR])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function fS(e){return e.tag===5||e.tag===3||e.tag===4}function mx(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fS(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.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 ap(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yc));else if(r!==4&&(e=e.child,e!==null))for(ap(e,t,n),e=e.sibling;e!==null;)ap(e,t,n),e=e.sibling}function lp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(lp(e,t,n),e=e.sibling;e!==null;)lp(e,t,n),e=e.sibling}var Ye=null,cn=!1;function kr(e,t,n){for(n=n.child;n!==null;)hS(e,t,n),n=n.sibling}function hS(e,t,n){if(Ln&&typeof Ln.onCommitFiberUnmount=="function")try{Ln.onCommitFiberUnmount(qu,n)}catch{}switch(n.tag){case 5:it||fi(n,t);case 6:var r=Ye,s=cn;Ye=null,kr(e,t,n),Ye=r,cn=s,Ye!==null&&(cn?(e=Ye,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ye.removeChild(n.stateNode));break;case 18:Ye!==null&&(cn?(e=Ye,n=n.stateNode,e.nodeType===8?pf(e.parentNode,n):e.nodeType===1&&pf(e,n),ha(e)):pf(Ye,n.stateNode));break;case 4:r=Ye,s=cn,Ye=n.stateNode.containerInfo,cn=!0,kr(e,t,n),Ye=r,cn=s;break;case 0:case 11:case 14:case 15:if(!it&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&ip(n,t,o),s=s.next}while(s!==r)}kr(e,t,n);break;case 1:if(!it&&(fi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){De(n,t,l)}kr(e,t,n);break;case 21:kr(e,t,n);break;case 22:n.mode&1?(it=(r=it)||n.memoizedState!==null,kr(e,t,n),it=r):kr(e,t,n);break;default:kr(e,t,n)}}function gx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new aI),t.forEach(function(r){var s=vI.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function on(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ye=l.stateNode,cn=!1;break e;case 3:Ye=l.stateNode.containerInfo,cn=!0;break e;case 4:Ye=l.stateNode.containerInfo,cn=!0;break e}l=l.return}if(Ye===null)throw Error(q(160));hS(i,o,s),Ye=null,cn=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){De(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)pS(t,e),t=t.sibling}function pS(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(on(t,e),Cn(e),r&4){try{Yo(3,e,e.return),nd(3,e)}catch(x){De(e,e.return,x)}try{Yo(5,e,e.return)}catch(x){De(e,e.return,x)}}break;case 1:on(t,e),Cn(e),r&512&&n!==null&&fi(n,n.return);break;case 5:if(on(t,e),Cn(e),r&512&&n!==null&&fi(n,n.return),e.flags&32){var s=e.stateNode;try{ca(s,"")}catch(x){De(e,e.return,x)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Lb(s,i),Rh(l,o);var u=Rh(l,i);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?Vb(s,f):d==="dangerouslySetInnerHTML"?zb(s,f):d==="children"?ca(s,f):Mm(s,d,f,u)}switch(l){case"input":Eh(s,i);break;case"textarea":$b(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Si(s,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Si(s,!!i.multiple,i.defaultValue,!0):Si(s,!!i.multiple,i.multiple?[]:"",!1))}s[ya]=i}catch(x){De(e,e.return,x)}}break;case 6:if(on(t,e),Cn(e),r&4){if(e.stateNode===null)throw Error(q(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(x){De(e,e.return,x)}}break;case 3:if(on(t,e),Cn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ha(t.containerInfo)}catch(x){De(e,e.return,x)}break;case 4:on(t,e),Cn(e);break;case 13:on(t,e),Cn(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(hg=Ve())),r&4&&gx(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(it=(u=it)||d,on(t,e),it=u):on(t,e),Cn(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(J=e,d=e.child;d!==null;){for(f=J=d;J!==null;){switch(h=J,p=h.child,h.tag){case 0:case 11:case 14:case 15:Yo(4,h,h.return);break;case 1:fi(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(x){De(r,n,x)}}break;case 5:fi(h,h.return);break;case 22:if(h.memoizedState!==null){yx(f);continue}}p!==null?(p.return=h,J=p):yx(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Fb("display",o))}catch(x){De(e,e.return,x)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(x){De(e,e.return,x)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:on(t,e),Cn(e),r&4&&gx(e);break;case 21:break;default:on(t,e),Cn(e)}}function Cn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(fS(n)){var r=n;break e}n=n.return}throw Error(q(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(ca(s,""),r.flags&=-33);var i=mx(e);lp(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=mx(e);ap(e,l,o);break;default:throw Error(q(161))}}catch(c){De(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function cI(e,t,n){J=e,mS(e)}function mS(e,t,n){for(var r=(e.mode&1)!==0;J!==null;){var s=J,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Ol;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||it;l=Ol;var u=it;if(Ol=o,(it=c)&&!u)for(J=s;J!==null;)o=J,c=o.child,o.tag===22&&o.memoizedState!==null?xx(s):c!==null?(c.return=o,J=c):xx(s);for(;i!==null;)J=i,mS(i),i=i.sibling;J=s,Ol=l,it=u}vx(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,J=i):vx(e)}}function vx(e){for(;J!==null;){var t=J;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:it||nd(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!it)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:ln(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&tx(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}tx(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&ha(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(q(163))}it||t.flags&512&&op(t)}catch(h){De(t,t.return,h)}}if(t===e){J=null;break}if(n=t.sibling,n!==null){n.return=t.return,J=n;break}J=t.return}}function yx(e){for(;J!==null;){var t=J;if(t===e){J=null;break}var n=t.sibling;if(n!==null){n.return=t.return,J=n;break}J=t.return}}function xx(e){for(;J!==null;){var t=J;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{nd(4,t)}catch(c){De(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){De(t,s,c)}}var i=t.return;try{op(t)}catch(c){De(t,i,c)}break;case 5:var o=t.return;try{op(t)}catch(c){De(t,o,c)}}}catch(c){De(t,t.return,c)}if(t===e){J=null;break}var l=t.sibling;if(l!==null){l.return=t.return,J=l;break}J=t.return}}var uI=Math.ceil,ou=jr.ReactCurrentDispatcher,dg=jr.ReactCurrentOwner,Zt=jr.ReactCurrentBatchConfig,de=0,qe=null,Be=null,Je=0,bt=0,hi=Jr(0),Ke=0,Sa=null,Ps=0,rd=0,fg=0,Xo=null,mt=null,hg=0,zi=1/0,Xn=null,au=!1,cp=null,Ur=null,Ll=!1,Lr=null,lu=0,Qo=0,up=null,yc=-1,xc=0;function ft(){return de&6?Ve():yc!==-1?yc:yc=Ve()}function Hr(e){return e.mode&1?de&2&&Je!==0?Je&-Je:GR.transition!==null?(xc===0&&(xc=Jb()),xc):(e=xe,e!==0||(e=window.event,e=e===void 0?16:oj(e.type)),e):1}function vn(e,t,n,r){if(50<Qo)throw Qo=0,up=null,Error(q(185));Xa(e,n,r),(!(de&2)||e!==qe)&&(e===qe&&(!(de&2)&&(rd|=n),Ke===4&&Ir(e,Je)),_t(e,r),n===1&&de===0&&!(t.mode&1)&&(zi=Ve()+500,Ju&&es()))}function _t(e,t){var n=e.callbackNode;GA(e,t);var r=Wc(e,e===qe?Je:0);if(r===0)n!==null&&Cy(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Cy(n),t===1)e.tag===0?KR(_x.bind(null,e)):kj(_x.bind(null,e)),BR(function(){!(de&6)&&es()}),n=null;else{switch(ej(r)){case 1:n=zm;break;case 4:n=Qb;break;case 16:n=Hc;break;case 536870912:n=Zb;break;default:n=Hc}n=jS(n,gS.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function gS(e,t){if(yc=-1,xc=0,de&6)throw Error(q(327));var n=e.callbackNode;if(Ti()&&e.callbackNode!==n)return null;var r=Wc(e,e===qe?Je:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=cu(e,r);else{t=r;var s=de;de|=2;var i=yS();(qe!==e||Je!==t)&&(Xn=null,zi=Ve()+500,ws(e,t));do try{hI();break}catch(l){vS(e,l)}while(!0);Zm(),ou.current=i,de=s,Be!==null?t=0:(qe=null,Je=0,t=Ke)}if(t!==0){if(t===2&&(s=$h(e),s!==0&&(r=s,t=dp(e,s))),t===1)throw n=Sa,ws(e,0),Ir(e,r),_t(e,Ve()),n;if(t===6)Ir(e,r);else{if(s=e.current.alternate,!(r&30)&&!dI(s)&&(t=cu(e,r),t===2&&(i=$h(e),i!==0&&(r=i,t=dp(e,i))),t===1))throw n=Sa,ws(e,0),Ir(e,r),_t(e,Ve()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(q(345));case 2:cs(e,mt,Xn);break;case 3:if(Ir(e,r),(r&130023424)===r&&(t=hg+500-Ve(),10<t)){if(Wc(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){ft(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Wh(cs.bind(null,e,mt,Xn),t);break}cs(e,mt,Xn);break;case 4:if(Ir(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-gn(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=Ve()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*uI(r/1960))-r,10<r){e.timeoutHandle=Wh(cs.bind(null,e,mt,Xn),r);break}cs(e,mt,Xn);break;case 5:cs(e,mt,Xn);break;default:throw Error(q(329))}}}return _t(e,Ve()),e.callbackNode===n?gS.bind(null,e):null}function dp(e,t){var n=Xo;return e.current.memoizedState.isDehydrated&&(ws(e,t).flags|=256),e=cu(e,t),e!==2&&(t=mt,mt=n,t!==null&&fp(t)),e}function fp(e){mt===null?mt=e:mt.push.apply(mt,e)}function dI(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!wn(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 Ir(e,t){for(t&=~fg,t&=~rd,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-gn(t),r=1<<n;e[n]=-1,t&=~r}}function _x(e){if(de&6)throw Error(q(327));Ti();var t=Wc(e,0);if(!(t&1))return _t(e,Ve()),null;var n=cu(e,t);if(e.tag!==0&&n===2){var r=$h(e);r!==0&&(t=r,n=dp(e,r))}if(n===1)throw n=Sa,ws(e,0),Ir(e,t),_t(e,Ve()),n;if(n===6)throw Error(q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,cs(e,mt,Xn),_t(e,Ve()),null}function pg(e,t){var n=de;de|=1;try{return e(t)}finally{de=n,de===0&&(zi=Ve()+500,Ju&&es())}}function As(e){Lr!==null&&Lr.tag===0&&!(de&6)&&Ti();var t=de;de|=1;var n=Zt.transition,r=xe;try{if(Zt.transition=null,xe=1,e)return e()}finally{xe=r,Zt.transition=n,de=t,!(de&6)&&es()}}function mg(){bt=hi.current,Se(hi)}function ws(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,VR(n)),Be!==null)for(n=Be.return;n!==null;){var r=n;switch(Ym(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xc();break;case 3:$i(),Se(yt),Se(at),sg();break;case 5:rg(r);break;case 4:$i();break;case 13:Se(Ae);break;case 19:Se(Ae);break;case 10:Jm(r.type._context);break;case 22:case 23:mg()}n=n.return}if(qe=e,Be=e=Wr(e.current,null),Je=bt=t,Ke=0,Sa=null,fg=rd=Ps=0,mt=Xo=null,vs!==null){for(t=0;t<vs.length;t++)if(n=vs[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}vs=null}return e}function vS(e,t){do{var n=Be;try{if(Zm(),mc.current=iu,su){for(var r=Ie.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}su=!1}if(Ts=0,Ge=We=Ie=null,qo=!1,wa=0,dg.current=null,n===null||n.return===null){Ke=1,Sa=t,Be=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=Je,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=ax(o);if(p!==null){p.flags&=-257,lx(p,o,l,i,t),p.mode&1&&ox(i,u,t),t=p,c=u;var g=t.updateQueue;if(g===null){var x=new Set;x.add(c),t.updateQueue=x}else g.add(c);break e}else{if(!(t&1)){ox(i,u,t),gg();break e}c=Error(q(426))}}else if(Te&&l.mode&1){var _=ax(o);if(_!==null){!(_.flags&65536)&&(_.flags|=256),lx(_,o,l,i,t),Xm(Di(c,l));break e}}i=c=Di(c,l),Ke!==4&&(Ke=2),Xo===null?Xo=[i]:Xo.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=eS(i,c,t);ex(i,v);break e;case 1:l=c;var y=i.type,m=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Ur===null||!Ur.has(m)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=tS(i,l,t);ex(i,b);break e}}i=i.return}while(i!==null)}_S(n)}catch(j){t=j,Be===n&&n!==null&&(Be=n=n.return);continue}break}while(!0)}function yS(){var e=ou.current;return ou.current=iu,e===null?iu:e}function gg(){(Ke===0||Ke===3||Ke===2)&&(Ke=4),qe===null||!(Ps&268435455)&&!(rd&268435455)||Ir(qe,Je)}function cu(e,t){var n=de;de|=2;var r=yS();(qe!==e||Je!==t)&&(Xn=null,ws(e,t));do try{fI();break}catch(s){vS(e,s)}while(!0);if(Zm(),de=n,ou.current=r,Be!==null)throw Error(q(261));return qe=null,Je=0,Ke}function fI(){for(;Be!==null;)xS(Be)}function hI(){for(;Be!==null&&!DA();)xS(Be)}function xS(e){var t=bS(e.alternate,e,bt);e.memoizedProps=e.pendingProps,t===null?_S(e):Be=t,dg.current=null}function _S(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=oI(n,t),n!==null){n.flags&=32767,Be=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ke=6,Be=null;return}}else if(n=iI(n,t,bt),n!==null){Be=n;return}if(t=t.sibling,t!==null){Be=t;return}Be=t=e}while(t!==null);Ke===0&&(Ke=5)}function cs(e,t,n){var r=xe,s=Zt.transition;try{Zt.transition=null,xe=1,pI(e,t,n,r)}finally{Zt.transition=s,xe=r}return null}function pI(e,t,n,r){do Ti();while(Lr!==null);if(de&6)throw Error(q(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(q(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(qA(e,i),e===qe&&(Be=qe=null,Je=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ll||(Ll=!0,jS(Hc,function(){return Ti(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Zt.transition,Zt.transition=null;var o=xe;xe=1;var l=de;de|=4,dg.current=null,lI(e,n),pS(n,e),MR(Uh),Kc=!!Bh,Uh=Bh=null,e.current=n,cI(n),zA(),de=l,xe=o,Zt.transition=i}else e.current=n;if(Ll&&(Ll=!1,Lr=e,lu=s),i=e.pendingLanes,i===0&&(Ur=null),BA(n.stateNode),_t(e,Ve()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(au)throw au=!1,e=cp,cp=null,e;return lu&1&&e.tag!==0&&Ti(),i=e.pendingLanes,i&1?e===up?Qo++:(Qo=0,up=e):Qo=0,es(),null}function Ti(){if(Lr!==null){var e=ej(lu),t=Zt.transition,n=xe;try{if(Zt.transition=null,xe=16>e?16:e,Lr===null)var r=!1;else{if(e=Lr,Lr=null,lu=0,de&6)throw Error(q(331));var s=de;for(de|=4,J=e.current;J!==null;){var i=J,o=i.child;if(J.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(J=u;J!==null;){var d=J;switch(d.tag){case 0:case 11:case 15:Yo(8,d,i)}var f=d.child;if(f!==null)f.return=d,J=f;else for(;J!==null;){d=J;var h=d.sibling,p=d.return;if(dS(d),d===u){J=null;break}if(h!==null){h.return=p,J=h;break}J=p}}}var g=i.alternate;if(g!==null){var x=g.child;if(x!==null){g.child=null;do{var _=x.sibling;x.sibling=null,x=_}while(x!==null)}}J=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,J=o;else e:for(;J!==null;){if(i=J,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Yo(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,J=v;break e}J=i.return}}var y=e.current;for(J=y;J!==null;){o=J;var m=o.child;if(o.subtreeFlags&2064&&m!==null)m.return=o,J=m;else e:for(o=y;J!==null;){if(l=J,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:nd(9,l)}}catch(j){De(l,l.return,j)}if(l===o){J=null;break e}var b=l.sibling;if(b!==null){b.return=l.return,J=b;break e}J=l.return}}if(de=s,es(),Ln&&typeof Ln.onPostCommitFiberRoot=="function")try{Ln.onPostCommitFiberRoot(qu,e)}catch{}r=!0}return r}finally{xe=n,Zt.transition=t}}return!1}function wx(e,t,n){t=Di(n,t),t=eS(e,t,1),e=Br(e,t,1),t=ft(),e!==null&&(Xa(e,1,t),_t(e,t))}function De(e,t,n){if(e.tag===3)wx(e,e,n);else for(;t!==null;){if(t.tag===3){wx(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ur===null||!Ur.has(r))){e=Di(n,e),e=tS(t,e,1),t=Br(t,e,1),e=ft(),t!==null&&(Xa(t,1,e),_t(t,e));break}}t=t.return}}function mI(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ft(),e.pingedLanes|=e.suspendedLanes&n,qe===e&&(Je&n)===n&&(Ke===4||Ke===3&&(Je&130023424)===Je&&500>Ve()-hg?ws(e,0):fg|=n),_t(e,t)}function wS(e,t){t===0&&(e.mode&1?(t=Nl,Nl<<=1,!(Nl&130023424)&&(Nl=4194304)):t=1);var n=ft();e=gr(e,t),e!==null&&(Xa(e,t,n),_t(e,n))}function gI(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),wS(e,n)}function vI(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(q(314))}r!==null&&r.delete(t),wS(e,n)}var bS;bS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||yt.current)gt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return gt=!1,sI(e,t,n);gt=!!(e.flags&131072)}else gt=!1,Te&&t.flags&1048576&&Nj(t,Jc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;vc(e,t),e=t.pendingProps;var s=Mi(t,at.current);Ci(t,n),s=og(null,t,r,e,s,n);var i=ag();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xt(r)?(i=!0,Qc(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,tg(t),s.updater=td,t.stateNode=s,s._reactInternals=t,Zh(t,r,e,n),t=tp(null,t,r,!0,i,n)):(t.tag=0,Te&&i&&qm(t),ut(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(vc(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=xI(r),e=ln(r,e),s){case 0:t=ep(null,t,r,e,n);break e;case 1:t=dx(null,t,r,e,n);break e;case 11:t=cx(null,t,r,e,n);break e;case 14:t=ux(null,t,r,ln(r.type,e),n);break e}throw Error(q(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),ep(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),dx(e,t,r,s,n);case 3:e:{if(iS(t),e===null)throw Error(q(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Rj(e,t),nu(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Di(Error(q(423)),t),t=fx(e,t,r,n,s);break e}else if(r!==s){s=Di(Error(q(424)),t),t=fx(e,t,r,n,s);break e}else for(Et=Vr(t.stateNode.containerInfo.firstChild),Tt=t,Te=!0,dn=null,n=Pj(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Oi(),r===s){t=vr(e,t,n);break e}ut(e,t,r,n)}t=t.child}return t;case 5:return Ij(t),e===null&&Yh(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Hh(r,s)?o=null:i!==null&&Hh(r,i)&&(t.flags|=32),sS(e,t),ut(e,t,o,n),t.child;case 6:return e===null&&Yh(t),null;case 13:return oS(e,t,n);case 4:return ng(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Li(t,null,r,n):ut(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),cx(e,t,r,s,n);case 7:return ut(e,t,t.pendingProps,n),t.child;case 8:return ut(e,t,t.pendingProps.children,n),t.child;case 12:return ut(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,_e(eu,r._currentValue),r._currentValue=o,i!==null)if(wn(i.value,o)){if(i.children===s.children&&!yt.current){t=vr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=ar(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Xh(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(q(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Xh(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ut(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Ci(t,n),s=en(s),r=r(s),t.flags|=1,ut(e,t,r,n),t.child;case 14:return r=t.type,s=ln(r,t.pendingProps),s=ln(r.type,s),ux(e,t,r,s,n);case 15:return nS(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),vc(e,t),t.tag=1,xt(r)?(e=!0,Qc(t)):e=!1,Ci(t,n),Jj(t,r,s),Zh(t,r,s,n),tp(null,t,r,!0,e,n);case 19:return aS(e,t,n);case 22:return rS(e,t,n)}throw Error(q(156,t.tag))};function jS(e,t){return Xb(e,t)}function yI(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yt(e,t,n,r){return new yI(e,t,n,r)}function vg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xI(e){if(typeof e=="function")return vg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Lm)return 11;if(e===$m)return 14}return 2}function Wr(e,t){var n=e.alternate;return n===null?(n=Yt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function _c(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")vg(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ri:return bs(n.children,s,i,t);case Om:o=8,s|=8;break;case bh:return e=Yt(12,n,t,s|2),e.elementType=bh,e.lanes=i,e;case jh:return e=Yt(13,n,t,s),e.elementType=jh,e.lanes=i,e;case Sh:return e=Yt(19,n,t,s),e.elementType=Sh,e.lanes=i,e;case Ib:return sd(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ab:o=10;break e;case Rb:o=9;break e;case Lm:o=11;break e;case $m:o=14;break e;case Pr:o=16,r=null;break e}throw Error(q(130,e==null?e:typeof e,""))}return t=Yt(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function bs(e,t,n,r){return e=Yt(7,e,r,t),e.lanes=n,e}function sd(e,t,n,r){return e=Yt(22,e,r,t),e.elementType=Ib,e.lanes=n,e.stateNode={isHidden:!1},e}function bf(e,t,n){return e=Yt(6,e,null,t),e.lanes=n,e}function jf(e,t,n){return t=Yt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function _I(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=nf(0),this.expirationTimes=nf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nf(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function yg(e,t,n,r,s,i,o,l,c){return e=new _I(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Yt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tg(i),e}function wI(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ni,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function SS(e){if(!e)return qr;e=e._reactInternals;e:{if(Us(e)!==e||e.tag!==1)throw Error(q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(xt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(q(171))}if(e.tag===1){var n=e.type;if(xt(n))return Sj(e,n,t)}return t}function kS(e,t,n,r,s,i,o,l,c){return e=yg(n,r,!0,e,s,i,o,l,c),e.context=SS(null),n=e.current,r=ft(),s=Hr(n),i=ar(r,s),i.callback=t??null,Br(n,i,s),e.current.lanes=s,Xa(e,s,r),_t(e,r),e}function id(e,t,n,r){var s=t.current,i=ft(),o=Hr(s);return n=SS(n),t.context===null?t.context=n:t.pendingContext=n,t=ar(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Br(s,t,o),e!==null&&(vn(e,s,o,i),pc(e,s,o)),o}function uu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function bx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xg(e,t){bx(e,t),(e=e.alternate)&&bx(e,t)}function bI(){return null}var NS=typeof reportError=="function"?reportError:function(e){console.error(e)};function _g(e){this._internalRoot=e}od.prototype.render=_g.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(q(409));id(e,t,null,null)};od.prototype.unmount=_g.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;As(function(){id(null,e,null,null)}),t[mr]=null}};function od(e){this._internalRoot=e}od.prototype.unstable_scheduleHydration=function(e){if(e){var t=rj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Rr.length&&t!==0&&t<Rr[n].priority;n++);Rr.splice(n,0,e),n===0&&ij(e)}};function wg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ad(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function jx(){}function jI(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=uu(o);i.call(u)}}var o=kS(t,r,e,0,null,!1,!1,"",jx);return e._reactRootContainer=o,e[mr]=o.current,ga(e.nodeType===8?e.parentNode:e),As(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=uu(c);l.call(u)}}var c=yg(e,0,!1,null,null,!1,!1,"",jx);return e._reactRootContainer=c,e[mr]=c.current,ga(e.nodeType===8?e.parentNode:e),As(function(){id(t,c,n,r)}),c}function ld(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=uu(o);l.call(c)}}id(t,o,e,s)}else o=jI(n,t,e,s,r);return uu(o)}tj=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Mo(t.pendingLanes);n!==0&&(Fm(t,n|1),_t(t,Ve()),!(de&6)&&(zi=Ve()+500,es()))}break;case 13:As(function(){var r=gr(e,1);if(r!==null){var s=ft();vn(r,e,1,s)}}),xg(e,1)}};Vm=function(e){if(e.tag===13){var t=gr(e,134217728);if(t!==null){var n=ft();vn(t,e,134217728,n)}xg(e,134217728)}};nj=function(e){if(e.tag===13){var t=Hr(e),n=gr(e,t);if(n!==null){var r=ft();vn(n,e,t,r)}xg(e,t)}};rj=function(){return xe};sj=function(e,t){var n=xe;try{return xe=e,t()}finally{xe=n}};Mh=function(e,t,n){switch(t){case"input":if(Eh(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Zu(r);if(!s)throw Error(q(90));Ob(r),Eh(r,s)}}}break;case"textarea":$b(e,n);break;case"select":t=n.value,t!=null&&Si(e,!!n.multiple,t,!1)}};Hb=pg;Wb=As;var SI={usingClientEntryPoint:!1,Events:[Za,ai,Zu,Bb,Ub,pg]},So={findFiberByHostInstance:gs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},kI={bundleType:So.bundleType,version:So.version,rendererPackageName:So.rendererPackageName,rendererConfig:So.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:jr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=qb(e),e===null?null:e.stateNode},findFiberByHostInstance:So.findFiberByHostInstance||bI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$l.isDisabled&&$l.supportsFiber)try{qu=$l.inject(kI),Ln=$l}catch{}}Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=SI;Ot.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wg(t))throw Error(q(200));return wI(e,t,null,n)};Ot.createRoot=function(e,t){if(!wg(e))throw Error(q(299));var n=!1,r="",s=NS;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=yg(e,1,!1,null,null,n,!1,r,s),e[mr]=t.current,ga(e.nodeType===8?e.parentNode:e),new _g(t)};Ot.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(q(188)):(e=Object.keys(e).join(","),Error(q(268,e)));return e=qb(t),e=e===null?null:e.stateNode,e};Ot.flushSync=function(e){return As(e)};Ot.hydrate=function(e,t,n){if(!ad(t))throw Error(q(200));return ld(null,e,t,!0,n)};Ot.hydrateRoot=function(e,t,n){if(!wg(e))throw Error(q(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=NS;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=kS(t,null,e,1,n??null,s,!1,i,o),e[mr]=t.current,ga(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new od(t)};Ot.render=function(e,t,n){if(!ad(t))throw Error(q(200));return ld(null,e,t,!1,n)};Ot.unmountComponentAtNode=function(e){if(!ad(e))throw Error(q(40));return e._reactRootContainer?(As(function(){ld(null,null,e,!1,function(){e._reactRootContainer=null,e[mr]=null})}),!0):!1};Ot.unstable_batchedUpdates=pg;Ot.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ad(n))throw Error(q(200));if(e==null||e._reactInternals===void 0)throw Error(q(38));return ld(e,t,n,!1,r)};Ot.version="18.3.1-next-f1338f8080-20240426";function ES(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ES)}catch(e){console.error(e)}}ES(),Eb.exports=Ot;var CS=Eb.exports,TS,Sx=CS;TS=Sx.createRoot,Sx.hydrateRoot;/**
41
41
  * react-router v7.18.2
42
42
  *
43
43
  * Copyright (c) Remix Software Inc.
@@ -46,11 +46,11 @@ Error generating stack: `+i.message+`
46
46
  * LICENSE.md file in the root directory of this source tree.
47
47
  *
48
48
  * @license MIT
49
- */var bg=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,IS=/^[\\/]{2}/;function CI(e,t){return t+e.replace(/\\/g,"/")}var Cx="popstate";function Tx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function TI(e={}){function t(r,s){var u;let i=(u=s.state)==null?void 0:u.masked,{pathname:o,search:l,hash:c}=i||r.location;return hp("",{pathname:o,search:l,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:ka(s)}return AI(t,n,null,e)}function ke(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function nn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function PI(){return Math.random().toString(36).substring(2,10)}function Px(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function hp(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?io(t):t,state:n,key:t&&t.key||r||PI(),mask:s}}function ka({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function io(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function AI(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l="POP",c=null,u=d();u==null&&(u=0,o.replaceState({...o.state,idx:u},""));function d(){return(o.state||{idx:null}).idx}function f(){l="POP";let _=d(),v=_==null?null:_-u;u=_,c&&c({action:l,location:x.location,delta:v})}function h(_,v){l="PUSH";let y=Tx(_)?_:hp(x.location,_,v);u=d()+1;let m=Px(y,u),b=x.createHref(y.mask||y);try{o.pushState(m,"",b)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(b)}i&&c&&c({action:l,location:x.location,delta:1})}function p(_,v){l="REPLACE";let y=Tx(_)?_:hp(x.location,_,v);u=d();let m=Px(y,u),b=x.createHref(y.mask||y);o.replaceState(m,"",b),i&&c&&c({action:l,location:x.location,delta:0})}function g(_){return RI(s,_)}let x={get action(){return l},get location(){return e(s,o)},listen(_){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Cx,f),c=_,()=>{s.removeEventListener(Cx,f),c=null}},createHref(_){return t(s,_)},createURL:g,encodeLocation(_){let v=g(_);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:h,replace:p,go(_){return o.go(_)}};return x}function RI(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),ke(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:ka(t);return s=s.replace(/ $/,"%20"),!n&&IS.test(s)&&(s=r+s),new URL(s,r)}function MS(e,t,n="/"){return II(e,t,n,!1)}function II(e,t,n,r,s){let i=typeof t=="string"?io(t):t,o=yr(i.pathname||"/",n);if(o==null)return null;let l=MI(e),c=null,u=zS(o);for(let d=0;c==null&&d<l.length;++d)c=HI(l[d],u,r);return c}function MI(e){let t=OS(e);return OI(t),t}function OS(e,t=[],n=[],r="",s=!1){let i=(o,l,c=s,u)=>{let d={relativePath:u===void 0?o.path||"":u,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&c)return;ke(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let f=yn([r,d.relativePath]),h=n.concat(d);o.children&&o.children.length>0&&(ke(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),OS(o.children,t,h,f,c)),!(o.path==null&&!o.index)&&t.push({path:f,score:BI(f,o.index),routesMeta:h.map((p,g)=>{let[x,_]=DS(p.relativePath,p.caseSensitive,g===h.length-1);return{...p,matcher:x,compiledParams:_}})})};return e.forEach((o,l)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))i(o,l);else for(let u of LS(o.path))i(o,l,!0,u)}),t}function LS(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=LS(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function OI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:UI(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var LI=/^:[\w-]+$/,$I=3,DI=2,zI=1,FI=10,VI=-2,Ax=e=>e==="*";function BI(e,t){let n=e.split("/"),r=n.length;return n.some(Ax)&&(r+=VI),t&&(r+=DI),n.filter(s=>!Ax(s)).reduce((s,i)=>s+(LI.test(i)?$I:i===""?zI:FI),r)}function UI(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function HI(e,t,n=!1){let{routesMeta:r}=e,s={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=i==="/"?t:t.slice(i.length)||"/",f={path:c.relativePath,caseSensitive:c.caseSensitive,end:u},h=c.matcher&&c.compiledParams?$S(f,d,c.matcher,c.compiledParams):Na(f,d),p=c.route;if(!h&&u&&n&&!r[r.length-1].route.index&&(h=Na({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:yn([i,h.pathname]),pathnameBase:GI(yn([i,h.pathnameBase])),route:p}),h.pathnameBase!=="/"&&(i=yn([i,h.pathnameBase]))}return o}function Na(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=DS(e.path,e.caseSensitive,e.end);return $S(e,t,n,r)}function $S(e,t,n,r){let s=t.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,{paramName:d,isOptional:f},h)=>{if(d==="*"){let g=l[h]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const p=l[h];return f&&!p?u[d]=void 0:u[d]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function DS(e,t=!1,n=!0){nn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c,u,d)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let f=d.charAt(u+o.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function zS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return nn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function yr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function WI(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?io(e):e,i;return n?(n=FS(n),n.startsWith("/")?i=Rx(n.substring(1),"/"):i=Rx(n,t)):i=t,{pathname:i,search:qI(r),hash:YI(s)}}function Rx(e,t){let n=du(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Sf(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function KI(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function jg(e){let t=KI(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function cd(e,t,n,r=!1){let s;typeof e=="string"?s=io(e):(s={...e},ke(!s.pathname||!s.pathname.includes("?"),Sf("?","pathname","search",s)),ke(!s.pathname||!s.pathname.includes("#"),Sf("#","pathname","hash",s)),ke(!s.search||!s.search.includes("#"),Sf("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=WI(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}var FS=e=>e.replace(/[\\/]{2,}/g,"/"),yn=e=>FS(e.join("/")),du=e=>e.replace(/\/+$/,""),GI=e=>du(e).replace(/^\/*/,"/"),qI=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,YI=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,XI=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function QI(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ZI(e){let t=e.map(n=>n.route.path).filter(Boolean);return yn(t)||"/"}var VS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function BS(e,t){let n=e;if(typeof n!="string"||!bg.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(VS)try{let i=new URL(window.location.href),o=IS.test(n)?new URL(CI(n,i.protocol)):new URL(n),l=yr(o.pathname,t);o.origin===i.origin&&l!=null?n=l+o.search+o.hash:s=!0}catch{nn(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var US=["POST","PUT","PATCH","DELETE"];new Set(US);var JI=["GET",...US];new Set(JI);var e2=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function t2(e){try{return e2.includes(new URL(e).protocol)}catch{return!1}}var oo=w.createContext(null);oo.displayName="DataRouter";var ud=w.createContext(null);ud.displayName="DataRouterState";var HS=w.createContext(!1);function n2(){return w.useContext(HS)}var WS=w.createContext({isTransitioning:!1});WS.displayName="ViewTransition";var r2=w.createContext(new Map);r2.displayName="Fetchers";var s2=w.createContext(null);s2.displayName="Await";var $t=w.createContext(null);$t.displayName="Navigation";var el=w.createContext(null);el.displayName="Location";var rn=w.createContext({outlet:null,matches:[],isDataRoute:!1});rn.displayName="Route";var Sg=w.createContext(null);Sg.displayName="RouteError";var KS="REACT_ROUTER_ERROR",i2="REDIRECT",o2="ROUTE_ERROR_RESPONSE";function a2(e){if(e.startsWith(`${KS}:${i2}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function l2(e){if(e.startsWith(`${KS}:${o2}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new XI(t.status,t.statusText,t.data)}catch{}}function c2(e,{relative:t}={}){ke(Hs(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext($t),{hash:s,pathname:i,search:o}=tl(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:yn([n,i])),r.createHref({pathname:l,search:o,hash:s})}function Hs(){return w.useContext(el)!=null}function Dt(){return ke(Hs(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(el).location}function wc(e){ke(Hs(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Dt();return w.useMemo(()=>Na(e,zS(t)),[t,e])}var GS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function qS(e){w.useContext($t).static||w.useLayoutEffect(e)}function Sr(){let{isDataRoute:e}=w.useContext(rn);return e?S2():u2()}function u2(){ke(Hs(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(oo),{basename:t,navigator:n}=w.useContext($t),{matches:r}=w.useContext(rn),{pathname:s}=Dt(),i=JSON.stringify(jg(r)),o=w.useRef(!1);return qS(()=>{o.current=!0}),w.useCallback((c,u={})=>{if(nn(o.current,GS),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=cd(c,JSON.parse(i),s,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:yn([t,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[t,n,i,s,e])}var d2=w.createContext(null);function f2(e){let t=w.useContext(rn).outlet;return w.useMemo(()=>t&&w.createElement(d2.Provider,{value:e},t),[t,e])}function YS(){let{matches:e}=w.useContext(rn),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function tl(e,{relative:t}={}){let{matches:n}=w.useContext(rn),{pathname:r}=Dt(),s=JSON.stringify(jg(n));return w.useMemo(()=>cd(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function h2(e,t){return XS(e,t)}function XS(e,t,n){var _;ke(Hs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext($t),{matches:s}=w.useContext(rn),i=s[s.length-1],o=i?i.params:{},l=i?i.pathname:"/",c=i?i.pathnameBase:"/",u=i&&i.route;{let v=u&&u.path||"";ZS(l,!u||v.endsWith("*")||v.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${v}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
49
+ */var bg=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,PS=/^[\\/]{2}/;function NI(e,t){return t+e.replace(/\\/g,"/")}var kx="popstate";function Nx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function EI(e={}){function t(r,s){var u;let i=(u=s.state)==null?void 0:u.masked,{pathname:o,search:l,hash:c}=i||r.location;return hp("",{pathname:o,search:l,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:ka(s)}return TI(t,n,null,e)}function ke(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function nn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function CI(){return Math.random().toString(36).substring(2,10)}function Ex(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function hp(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?io(t):t,state:n,key:t&&t.key||r||CI(),mask:s}}function ka({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function io(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function TI(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l="POP",c=null,u=d();u==null&&(u=0,o.replaceState({...o.state,idx:u},""));function d(){return(o.state||{idx:null}).idx}function f(){l="POP";let _=d(),v=_==null?null:_-u;u=_,c&&c({action:l,location:x.location,delta:v})}function h(_,v){l="PUSH";let y=Nx(_)?_:hp(x.location,_,v);u=d()+1;let m=Ex(y,u),b=x.createHref(y.mask||y);try{o.pushState(m,"",b)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(b)}i&&c&&c({action:l,location:x.location,delta:1})}function p(_,v){l="REPLACE";let y=Nx(_)?_:hp(x.location,_,v);u=d();let m=Ex(y,u),b=x.createHref(y.mask||y);o.replaceState(m,"",b),i&&c&&c({action:l,location:x.location,delta:0})}function g(_){return PI(s,_)}let x={get action(){return l},get location(){return e(s,o)},listen(_){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(kx,f),c=_,()=>{s.removeEventListener(kx,f),c=null}},createHref(_){return t(s,_)},createURL:g,encodeLocation(_){let v=g(_);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:h,replace:p,go(_){return o.go(_)}};return x}function PI(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),ke(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:ka(t);return s=s.replace(/ $/,"%20"),!n&&PS.test(s)&&(s=r+s),new URL(s,r)}function AS(e,t,n="/"){return AI(e,t,n,!1)}function AI(e,t,n,r,s){let i=typeof t=="string"?io(t):t,o=yr(i.pathname||"/",n);if(o==null)return null;let l=RI(e),c=null,u=LS(o);for(let d=0;c==null&&d<l.length;++d)c=BI(l[d],u,r);return c}function RI(e){let t=RS(e);return II(t),t}function RS(e,t=[],n=[],r="",s=!1){let i=(o,l,c=s,u)=>{let d={relativePath:u===void 0?o.path||"":u,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&c)return;ke(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let f=yn([r,d.relativePath]),h=n.concat(d);o.children&&o.children.length>0&&(ke(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),RS(o.children,t,h,f,c)),!(o.path==null&&!o.index)&&t.push({path:f,score:FI(f,o.index),routesMeta:h.map((p,g)=>{let[x,_]=OS(p.relativePath,p.caseSensitive,g===h.length-1);return{...p,matcher:x,compiledParams:_}})})};return e.forEach((o,l)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))i(o,l);else for(let u of IS(o.path))i(o,l,!0,u)}),t}function IS(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=IS(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function II(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:VI(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var MI=/^:[\w-]+$/,OI=3,LI=2,$I=1,DI=10,zI=-2,Cx=e=>e==="*";function FI(e,t){let n=e.split("/"),r=n.length;return n.some(Cx)&&(r+=zI),t&&(r+=LI),n.filter(s=>!Cx(s)).reduce((s,i)=>s+(MI.test(i)?OI:i===""?$I:DI),r)}function VI(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function BI(e,t,n=!1){let{routesMeta:r}=e,s={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=i==="/"?t:t.slice(i.length)||"/",f={path:c.relativePath,caseSensitive:c.caseSensitive,end:u},h=c.matcher&&c.compiledParams?MS(f,d,c.matcher,c.compiledParams):Na(f,d),p=c.route;if(!h&&u&&n&&!r[r.length-1].route.index&&(h=Na({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:yn([i,h.pathname]),pathnameBase:WI(yn([i,h.pathnameBase])),route:p}),h.pathnameBase!=="/"&&(i=yn([i,h.pathnameBase]))}return o}function Na(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=OS(e.path,e.caseSensitive,e.end);return MS(e,t,n,r)}function MS(e,t,n,r){let s=t.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,{paramName:d,isOptional:f},h)=>{if(d==="*"){let g=l[h]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const p=l[h];return f&&!p?u[d]=void 0:u[d]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function OS(e,t=!1,n=!0){nn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c,u,d)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let f=d.charAt(u+o.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function LS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return nn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function yr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function UI(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?io(e):e,i;return n?(n=$S(n),n.startsWith("/")?i=Tx(n.substring(1),"/"):i=Tx(n,t)):i=t,{pathname:i,search:KI(r),hash:GI(s)}}function Tx(e,t){let n=du(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Sf(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function HI(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function jg(e){let t=HI(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function cd(e,t,n,r=!1){let s;typeof e=="string"?s=io(e):(s={...e},ke(!s.pathname||!s.pathname.includes("?"),Sf("?","pathname","search",s)),ke(!s.pathname||!s.pathname.includes("#"),Sf("#","pathname","hash",s)),ke(!s.search||!s.search.includes("#"),Sf("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=UI(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}var $S=e=>e.replace(/[\\/]{2,}/g,"/"),yn=e=>$S(e.join("/")),du=e=>e.replace(/\/+$/,""),WI=e=>du(e).replace(/^\/*/,"/"),KI=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,GI=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,qI=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function YI(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function XI(e){let t=e.map(n=>n.route.path).filter(Boolean);return yn(t)||"/"}var DS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function zS(e,t){let n=e;if(typeof n!="string"||!bg.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(DS)try{let i=new URL(window.location.href),o=PS.test(n)?new URL(NI(n,i.protocol)):new URL(n),l=yr(o.pathname,t);o.origin===i.origin&&l!=null?n=l+o.search+o.hash:s=!0}catch{nn(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var FS=["POST","PUT","PATCH","DELETE"];new Set(FS);var QI=["GET",...FS];new Set(QI);var ZI=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function JI(e){try{return ZI.includes(new URL(e).protocol)}catch{return!1}}var oo=w.createContext(null);oo.displayName="DataRouter";var ud=w.createContext(null);ud.displayName="DataRouterState";var VS=w.createContext(!1);function e2(){return w.useContext(VS)}var BS=w.createContext({isTransitioning:!1});BS.displayName="ViewTransition";var t2=w.createContext(new Map);t2.displayName="Fetchers";var n2=w.createContext(null);n2.displayName="Await";var $t=w.createContext(null);$t.displayName="Navigation";var el=w.createContext(null);el.displayName="Location";var rn=w.createContext({outlet:null,matches:[],isDataRoute:!1});rn.displayName="Route";var Sg=w.createContext(null);Sg.displayName="RouteError";var US="REACT_ROUTER_ERROR",r2="REDIRECT",s2="ROUTE_ERROR_RESPONSE";function i2(e){if(e.startsWith(`${US}:${r2}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function o2(e){if(e.startsWith(`${US}:${s2}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new qI(t.status,t.statusText,t.data)}catch{}}function a2(e,{relative:t}={}){ke(Hs(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext($t),{hash:s,pathname:i,search:o}=tl(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:yn([n,i])),r.createHref({pathname:l,search:o,hash:s})}function Hs(){return w.useContext(el)!=null}function Dt(){return ke(Hs(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(el).location}function wc(e){ke(Hs(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Dt();return w.useMemo(()=>Na(e,LS(t)),[t,e])}var HS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function WS(e){w.useContext($t).static||w.useLayoutEffect(e)}function Sr(){let{isDataRoute:e}=w.useContext(rn);return e?b2():l2()}function l2(){ke(Hs(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(oo),{basename:t,navigator:n}=w.useContext($t),{matches:r}=w.useContext(rn),{pathname:s}=Dt(),i=JSON.stringify(jg(r)),o=w.useRef(!1);return WS(()=>{o.current=!0}),w.useCallback((c,u={})=>{if(nn(o.current,HS),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=cd(c,JSON.parse(i),s,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:yn([t,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[t,n,i,s,e])}var c2=w.createContext(null);function u2(e){let t=w.useContext(rn).outlet;return w.useMemo(()=>t&&w.createElement(c2.Provider,{value:e},t),[t,e])}function KS(){let{matches:e}=w.useContext(rn),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function tl(e,{relative:t}={}){let{matches:n}=w.useContext(rn),{pathname:r}=Dt(),s=JSON.stringify(jg(n));return w.useMemo(()=>cd(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function d2(e,t){return GS(e,t)}function GS(e,t,n){var _;ke(Hs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext($t),{matches:s}=w.useContext(rn),i=s[s.length-1],o=i?i.params:{},l=i?i.pathname:"/",c=i?i.pathnameBase:"/",u=i&&i.route;{let v=u&&u.path||"";YS(l,!u||v.endsWith("*")||v.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${v}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
50
 
51
- Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let d=Dt(),f;if(t){let v=typeof t=="string"?io(t):t;ke(c==="/"||((_=v.pathname)==null?void 0:_.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${v.pathname}" was given in the \`location\` prop.`),f=v}else f=d;let h=f.pathname||"/",p=h;if(c!=="/"){let v=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(v.length).join("/")}let g=n&&n.state.matches.length?n.state.matches.map(v=>Object.assign(v,{route:n.manifest[v.route.id]||v.route})):MS(e,{pathname:p});nn(u||g!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),nn(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=y2(g&&g.map(v=>Object.assign({},v,{params:Object.assign({},o,v.params),pathname:yn([c,r.encodeLocation?r.encodeLocation(v.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:yn([c,r.encodeLocation?r.encodeLocation(v.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathnameBase])})),s,n);return t&&x?w.createElement(el.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},x):x}function p2(){let e=j2(),t=QI(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:i},"ErrorBoundary")," or"," ",w.createElement("code",{style:i},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:s},n):null,o)}var m2=w.createElement(p2,null),QS=class extends w.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=l2(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(rn.Provider,{value:this.props.routeContext},w.createElement(Sg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(g2,{error:e},t):t}};QS.contextType=HS;var kf=new WeakMap;function g2({children:e,error:t}){let{basename:n}=w.useContext($t);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=a2(t.digest);if(r){let s=kf.get(t);if(s)throw s;let i=BS(r.location,n),o=i.absoluteURL||i.to;if(t2(o))throw new Error("Invalid redirect location");if(VS&&!kf.get(t))if(i.isExternal||r.reloadDocument)window.location.href=o;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw kf.set(t,l),l}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return e}function v2({routeContext:e,match:t,children:n}){let r=w.useContext(oo);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(rn.Provider,{value:e},n)}function y2(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,i=r==null?void 0:r.errors;if(i!=null){let d=s.findIndex(f=>f.route.id&&(i==null?void 0:i[f.route.id])!==void 0);ke(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,d+1))}let o=!1,l=-1;if(n&&r){o=r.renderFallback;for(let d=0;d<s.length;d++){let f=s[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=d),f.route.id){let{loaderData:h,errors:p}=r,g=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!p||p[f.route.id]===void 0);if(f.route.lazy||g){n.isStatic&&(o=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(d,f)=>{var h,p;c(d,{location:r.location,params:((p=(h=r.matches)==null?void 0:h[0])==null?void 0:p.params)??{},pattern:ZI(r.matches),errorInfo:f})}:void 0;return s.reduceRight((d,f,h)=>{let p,g=!1,x=null,_=null;r&&(p=i&&f.route.id?i[f.route.id]:void 0,x=f.route.errorElement||m2,o&&(l<0&&h===0?(ZS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,_=null):l===h&&(g=!0,_=f.route.hydrateFallbackElement||null)));let v=t.concat(s.slice(0,h+1)),y=()=>{let m;return p?m=x:g?m=_:f.route.Component?m=w.createElement(f.route.Component,null):f.route.element?m=f.route.element:m=d,w.createElement(v2,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:r!=null},children:m})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?w.createElement(QS,{location:r.location,revalidation:r.revalidation,component:x,error:p,children:y(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:u}):y()},null)}function kg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function x2(e){let t=w.useContext(oo);return ke(t,kg(e)),t}function _2(e){let t=w.useContext(ud);return ke(t,kg(e)),t}function w2(e){let t=w.useContext(rn);return ke(t,kg(e)),t}function Ng(e){let t=w2(e),n=t.matches[t.matches.length-1];return ke(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function b2(){return Ng("useRouteId")}function j2(){var r;let e=w.useContext(Sg),t=_2("useRouteError"),n=Ng("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function S2(){let{router:e}=x2("useNavigate"),t=Ng("useNavigate"),n=w.useRef(!1);return qS(()=>{n.current=!0}),w.useCallback(async(s,i={})=>{nn(n.current,GS),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...i}))},[e,t])}var Ix={};function ZS(e,t,n){!t&&!Ix[e]&&(Ix[e]=!0,nn(!1,n))}w.memo(k2);function k2({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:i}){return XS(e,void 0,{manifest:t,state:r,isStatic:s,onError:i})}function Eg({to:e,replace:t,state:n,relative:r}){ke(Hs(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=w.useContext($t);nn(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=w.useContext(rn),{pathname:o}=Dt(),l=Sr(),c=cd(e,jg(i),o,r==="path"),u=JSON.stringify(c);return w.useEffect(()=>{l(JSON.parse(u),{replace:t,state:n,relative:r})},[l,u,r,t,n]),null}function JS(e){return f2(e.context)}function ct(e){ke(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function N2({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:i=!1,useTransitions:o}){ke(!Hs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:l,navigator:s,static:i,useTransitions:o,future:{}}),[l,s,i,o]);typeof n=="string"&&(n=io(n));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:p="default",mask:g}=n,x=w.useMemo(()=>{let _=yr(u,l);return _==null?null:{location:{pathname:_,search:d,hash:f,state:h,key:p,mask:g},navigationType:r}},[l,u,d,f,h,p,r,g]);return nn(x!=null,`<Router basename="${l}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:w.createElement($t.Provider,{value:c},w.createElement(el.Provider,{children:t,value:x}))}function E2({children:e,location:t}){return h2(pp(e),t)}function pp(e,t=[]){let n=[];return w.Children.forEach(e,(r,s)=>{if(!w.isValidElement(r))return;let i=[...t,s];if(r.type===w.Fragment){n.push.apply(n,pp(r.props.children,i));return}ke(r.type===ct,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ke(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=pp(r.props.children,i)),n.push(o)}),n}var bc="get",jc="application/x-www-form-urlencoded";function dd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function C2(e){return dd(e)&&e.tagName.toLowerCase()==="button"}function T2(e){return dd(e)&&e.tagName.toLowerCase()==="form"}function P2(e){return dd(e)&&e.tagName.toLowerCase()==="input"}function A2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function R2(e,t){return e.button===0&&(!t||t==="_self")&&!A2(e)}function mp(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function I2(e,t){let n=mp(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(i=>{n.append(s,i)})}),n}var Dl=null;function M2(){if(Dl===null)try{new FormData(document.createElement("form"),0),Dl=!1}catch{Dl=!0}return Dl}var O2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Nf(e){return e!=null&&!O2.has(e)?(nn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${jc}"`),null):e}function L2(e,t){let n,r,s,i,o;if(T2(e)){let l=e.getAttribute("action");r=l?yr(l,t):null,n=e.getAttribute("method")||bc,s=Nf(e.getAttribute("enctype"))||jc,i=new FormData(e)}else if(C2(e)||P2(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?yr(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||bc,s=Nf(e.getAttribute("formenctype"))||Nf(l.getAttribute("enctype"))||jc,i=new FormData(l,e),!M2()){let{name:u,type:d,value:f}=e;if(d==="image"){let h=u?`${u}.`:"";i.append(`${h}x`,"0"),i.append(`${h}y`,"0")}else u&&i.append(u,f)}}else{if(dd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=bc,r=null,s=jc,o=e}return i&&s==="text/plain"&&(o=i,i=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Cg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function e1(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&yr(s.pathname,t)==="/"?s.pathname=`${du(t)}/_root.${r}`:s.pathname=`${du(s.pathname)}.${r}`,s}async function $2(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function D2(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function z2(e,t,n){let r=await Promise.all(e.map(async s=>{let i=t.routes[s.route.id];if(i){let o=await $2(i,n);return o.links?o.links():[]}return[]}));return U2(r.flat(1).filter(D2).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Mx(e,t,n,r,s,i){let o=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var d;return n[u].pathname!==c.pathname||((d=n[u].route.path)==null?void 0:d.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,u)=>o(c,u)||l(c,u)):i==="data"?t.filter((c,u)=>{var f;let d=r.routes[c.route.id];if(!d||!d.hasLoader)return!1;if(o(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let h=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function F2(e,t,{includeHydrateFallback:n}={}){return V2(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function V2(e){return[...new Set(e)]}function B2(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function U2(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let i=JSON.stringify(B2(s));return n.has(i)||(n.add(i),r.push({key:i,link:s})),r},[])}function Tg(){let e=w.useContext(oo);return Cg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function H2(){let e=w.useContext(ud);return Cg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Pg=w.createContext(void 0);Pg.displayName="FrameworkContext";function fd(){let e=w.useContext(Pg);return Cg(e,"You must render this element inside a <HydratedRouter> element"),e}function W2(e,t){let n=w.useContext(Pg),[r,s]=w.useState(!1),[i,o]=w.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,h=w.useRef(null);w.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let x=v=>{v.forEach(y=>{o(y.isIntersecting)})},_=new IntersectionObserver(x,{threshold:.5});return h.current&&_.observe(h.current),()=>{_.disconnect()}}},[e]),w.useEffect(()=>{if(r){let x=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(x)}}},[r]);let p=()=>{s(!0)},g=()=>{s(!1),o(!1)};return n?e!=="intent"?[i,h,{}]:[i,h,{onFocus:ko(l,p),onBlur:ko(c,g),onMouseEnter:ko(u,p),onMouseLeave:ko(d,g),onTouchStart:ko(f,p)}]:[!1,h,{}]}function ko(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function K2({page:e,...t}){let n=n2(),{nonce:r}=fd(),{router:s}=Tg(),i=w.useMemo(()=>MS(s.routes,e,s.basename),[s.routes,e,s.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?w.createElement(q2,{page:e,matches:i,...t}):w.createElement(Y2,{page:e,matches:i,...t})):null}function G2(e){let{manifest:t,routeModules:n}=fd(),[r,s]=w.useState([]);return w.useEffect(()=>{let i=!1;return z2(e,t,n).then(o=>{i||s(o)}),()=>{i=!0}},[e,t,n]),r}function q2({page:e,matches:t,...n}){let r=Dt(),{future:s}=fd(),{basename:i}=Tg(),o=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let l=e1(e,i,s.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,u=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?c=!0:u.push(d.route.id);return c&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[i,s.v8_trailingSlashAwareDataRequests,e,r,t]);return w.createElement(w.Fragment,null,o.map(l=>w.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...n})))}function Y2({page:e,matches:t,...n}){let r=Dt(),{future:s,manifest:i,routeModules:o}=fd(),{basename:l}=Tg(),{loaderData:c,matches:u}=H2(),d=w.useMemo(()=>Mx(e,t,u,i,r,"data"),[e,t,u,i,r]),f=w.useMemo(()=>Mx(e,t,u,i,r,"assets"),[e,t,u,i,r]),h=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let x=new Set,_=!1;if(t.forEach(y=>{var b;let m=i.routes[y.route.id];!m||!m.hasLoader||(!d.some(j=>j.route.id===y.route.id)&&y.route.id in c&&((b=o[y.route.id])!=null&&b.shouldRevalidate)||m.hasClientLoader?_=!0:x.add(y.route.id))}),x.size===0)return[];let v=e1(e,l,s.v8_trailingSlashAwareDataRequests,"data");return _&&x.size>0&&v.searchParams.set("_routes",t.filter(y=>x.has(y.route.id)).map(y=>y.route.id).join(",")),[v.pathname+v.search]},[l,s.v8_trailingSlashAwareDataRequests,c,r,i,d,t,e,o]),p=w.useMemo(()=>F2(f,i),[f,i]),g=G2(f);return w.createElement(w.Fragment,null,h.map(x=>w.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),p.map(x=>w.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),g.map(({key:x,link:_})=>w.createElement("link",{key:x,nonce:n.nonce,..._,crossOrigin:_.crossOrigin??n.crossOrigin})))}function X2(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Q2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Q2&&(window.__reactRouterVersion="7.18.2")}catch{}function Z2({basename:e,children:t,useTransitions:n,window:r}){let s=w.useRef();s.current==null&&(s.current=TI({window:r,v5Compat:!0}));let i=s.current,[o,l]=w.useState({action:i.action,location:i.location}),c=w.useCallback(u=>{n===!1?l(u):w.startTransition(()=>l(u))},[n]);return w.useLayoutEffect(()=>i.listen(c),[i,c]),w.createElement(N2,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:i,useTransitions:n})}var Ue=w.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:i,replace:o,mask:l,state:c,target:u,to:d,preventScrollReset:f,viewTransition:h,defaultShouldRevalidate:p,...g},x){let{basename:_,navigator:v,useTransitions:y}=w.useContext($t),m=typeof d=="string"&&bg.test(d),b=BS(d,_);d=b.to;let j=c2(d,{relative:s}),k=Dt(),S=null;if(l){let E=cd(l,[],k.mask?k.mask.pathname:"/",!0);_!=="/"&&(E.pathname=E.pathname==="/"?_:yn([_,E.pathname])),S=v.createHref(E)}let[N,R,O]=W2(r,g),D=tM(d,{replace:o,mask:l,state:c,target:u,preventScrollReset:f,relative:s,viewTransition:h,defaultShouldRevalidate:p,useTransitions:y});function M(E){t&&t(E),E.defaultPrevented||D(E)}let z=!(b.isExternal||i),T=w.createElement("a",{...g,...O,href:(z?S:void 0)||b.absoluteURL||j,onClick:z?M:t,ref:X2(x,R),target:u,"data-discover":!m&&n==="render"?"true":void 0});return N&&!m?w.createElement(w.Fragment,null,T,w.createElement(K2,{page:j})):T});Ue.displayName="Link";var t1=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:i,to:o,viewTransition:l,children:c,...u},d){let f=tl(o,{relative:u.relative}),h=Dt(),p=w.useContext(ud),{navigator:g,basename:x}=w.useContext($t),_=p!=null&&oM(f)&&l===!0,v=g.encodeLocation?g.encodeLocation(f).pathname:f.pathname,y=h.pathname,m=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(y=y.toLowerCase(),m=m?m.toLowerCase():null,v=v.toLowerCase()),m&&x&&(m=yr(m,x)||m);const b=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let j=y===v||!s&&y.startsWith(v)&&y.charAt(b)==="/",k=m!=null&&(m===v||!s&&m.startsWith(v)&&m.charAt(v.length)==="/"),S={isActive:j,isPending:k,isTransitioning:_},N=j?t:void 0,R;typeof r=="function"?R=r(S):R=[r,j?"active":null,k?"pending":null,_?"transitioning":null].filter(Boolean).join(" ");let O=typeof i=="function"?i(S):i;return w.createElement(Ue,{...u,"aria-current":N,className:R,ref:d,style:O,to:o,viewTransition:l},typeof c=="function"?c(S):c)});t1.displayName="NavLink";var J2=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:i,method:o=bc,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:h,...p},g)=>{let{useTransitions:x}=w.useContext($t),_=sM(),v=iM(l,{relative:u}),y=o.toLowerCase()==="get"?"get":"post",m=typeof l=="string"&&bg.test(l),b=j=>{if(c&&c(j),j.defaultPrevented)return;j.preventDefault();let k=j.nativeEvent.submitter,S=(k==null?void 0:k.getAttribute("formmethod"))||o,N=()=>_(k||j.currentTarget,{fetcherKey:t,method:S,navigate:n,replace:s,state:i,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:h});x&&n!==!1?w.startTransition(()=>N()):N()};return w.createElement("form",{ref:g,method:y,action:v,onSubmit:r?c:b,...p,"data-discover":!m&&e==="render"?"true":void 0})});J2.displayName="Form";function eM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function n1(e){let t=w.useContext(oo);return ke(t,eM(e)),t}function tM(e,{target:t,replace:n,mask:r,state:s,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c,useTransitions:u}={}){let d=Sr(),f=Dt(),h=tl(e,{relative:o});return w.useCallback(p=>{if(R2(p,t)){p.preventDefault();let g=n!==void 0?n:ka(f)===ka(h),x=()=>d(e,{replace:g,mask:r,state:s,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c});u?w.startTransition(()=>x()):x()}},[f,d,h,n,r,s,t,e,i,o,l,c,u])}function Ag(e){nn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=w.useRef(mp(e)),n=w.useRef(!1),r=Dt(),s=w.useMemo(()=>I2(r.search,n.current?null:t.current),[r.search]),i=Sr(),o=w.useCallback((l,c)=>{const u=mp(typeof l=="function"?l(new URLSearchParams(s)):l);n.current=!0,i("?"+u,c)},[i,s]);return[s,o]}var nM=0,rM=()=>`__${String(++nM)}__`;function sM(){let{router:e}=n1("useSubmit"),{basename:t}=w.useContext($t),n=b2(),r=e.fetch,s=e.navigate;return w.useCallback(async(i,o={})=>{let{action:l,method:c,encType:u,formData:d,body:f}=L2(i,t);if(o.navigate===!1){let h=o.fetcherKey||rM();await r(h,n,o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:f,formMethod:o.method||c,formEncType:o.encType||u,flushSync:o.flushSync})}else await s(o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:f,formMethod:o.method||c,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,s,t,n])}function iM(e,{relative:t}={}){let{basename:n}=w.useContext($t),r=w.useContext(rn);ke(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),i={...tl(e||".",{relative:t})},o=Dt();if(e==null){i.search=o.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(d=>d==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let d=l.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:yn([n,i.pathname])),ka(i)}function oM(e,{relative:t}={}){let n=w.useContext(WS);ke(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=n1("useViewTransitionState"),s=tl(e,{relative:t});if(!n.isTransitioning)return!1;let i=yr(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=yr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Na(s.pathname,o)!=null||Na(s.pathname,i)!=null}function fe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var aM={};function hd(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:aM}var r1=Object.assign,fu=Object.getOwnPropertyDescriptor,Dn=Object.defineProperty,pd=Object.prototype,gp=[];Object.freeze(gp);var s1={};Object.freeze(s1);var lM=typeof Proxy<"u",cM=Object.toString();function i1(){lM||fe("Proxy not available")}function o1(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var pi=function(){};function bn(e){return typeof e=="function"}function Rs(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function md(e){return e!==null&&typeof e=="object"}function Yr(e){if(!md(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===cM}function a1(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function gd(e,t,n){Dn(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function l1(e,t,n){Dn(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Ws(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return md(r)&&r[n]===!0}}function ao(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function uM(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Jn(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var c1=typeof Object.getOwnPropertySymbols<"u";function dM(e){var t=Object.keys(e);if(!c1)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return pd.propertyIsEnumerable.call(e,r)})):t}var vd=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:c1?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function u1(e){return e===null?null:typeof e=="object"?""+e:e}function lr(e,t){return pd.hasOwnProperty.call(e,t)}var fM=Object.getOwnPropertyDescriptors||function(t){var n={};return vd(t).forEach(function(r){n[r]=fu(t,r)}),n};function St(e,t){return!!(e&t)}function kt(e,t,n){return n?e|=t:e&=~t,e}function Ox(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hM(e,t,n){if(d1())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var s=new(e.bind.apply(e,r));return n&&Ea(s,n.prototype),s}function pM(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,vM(r.key),r)}}function lo(e,t,n){return t&&pM(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mi(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=yM(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
52
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Is(){return Is=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Is.apply(null,arguments)}function vp(e){return vp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vp(e)}function Rg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ea(e,t)}function mM(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function d1(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(d1=function(){return!!e})()}function Ea(e,t){return Ea=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ea(e,t)}function gM(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function vM(e){var t=gM(e,"string");return typeof t=="symbol"?t:t+""}function yM(e,t){if(e){if(typeof e=="string")return Ox(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ox(e,t):void 0}}function yp(e){var t=typeof Map=="function"?new Map:void 0;return yp=function(n){if(n===null||!mM(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(n))return t.get(n);t.set(n,r)}function r(){return hM(n,arguments,vp(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ea(r,n)},yp(e)}var On=Symbol("mobx-stored-annotations");function zn(e){function t(n,r){if(rl(r))return e.decorate_20223_(n,r);nl(n,r,e)}return Object.assign(t,e)}function nl(e,t,n){lr(e,On)||gd(e,On,Is({},e[On])),kM(n)||(e[On][t]=n)}function xM(e){return lr(e,On)||gd(e,On,Is({},e[On])),e[On]}function rl(e){return typeof e=="object"&&typeof e.kind=="string"}var ae=Symbol("mobx administration"),ts=function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return C1(this)},t.reportChanged=function(){Xt(),T1(this),Qt()},t.toString=function(){return this.name_},lo(e,[{key:"isBeingObserved",get:function(){return St(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=kt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return St(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=kt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return St(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=kt(this.flags_,e.diffValueMask_,r===1)}}])}();ts.isBeingObservedMask_=1;ts.isPendingUnobservationMask_=2;ts.diffValueMask_=4;var Ig=Ws("Atom",ts);function f1(e,t,n){t===void 0&&(t=pi),n===void 0&&(n=pi);var r=new ts(e);return t!==pi&&EO(r,t),n!==pi&&L1(r,n),r}function _M(e,t){return Y1(e,t)}function wM(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var hu={structural:_M,default:wM};function Ms(e,t,n){return F1(e)?e:Array.isArray(e)?ye.array(e,{name:n}):Yr(e)?ye.object(e,void 0,{name:n}):ao(e)?ye.map(e,{name:n}):Jn(e)?ye.set(e,{name:n}):typeof e=="function"&&!Fi(e)&&!Ta(e)?a1(e)?Vi(e):Ca(n,e):e}function bM(e,t,n){if(e==null||bd(e)||wd(e)||Gs(e)||In(e))return e;if(Array.isArray(e))return ye.array(e,{name:n,deep:!1});if(Yr(e))return ye.object(e,void 0,{name:n,deep:!1});if(ao(e))return ye.map(e,{name:n,deep:!1});if(Jn(e))return ye.set(e,{name:n,deep:!1})}function yd(e){return e}function jM(e,t){return Y1(e,t)?t:e}var SM="override";function kM(e){return e.annotationType_===SM}function sl(e,t){return{annotationType_:e,options_:t,make_:NM,extend_:EM,decorate_20223_:CM}}function NM(e,t,n,r){var s;if((s=this.options_)!=null&&s.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Fi(n.value))return 1;var i=h1(e,this,t,n,!1);return Dn(r,t,i),2}function EM(e,t,n,r){var s=h1(e,this,t,n);return e.defineProperty_(t,s,r)}function CM(e,t){var n=t.kind,r=t.name,s=t.addInitializer,i=this,o=function(u){var d,f,h,p;return Os((d=(f=i.options_)==null?void 0:f.name)!=null?d:r.toString(),u,(h=(p=i.options_)==null?void 0:p.autoAction)!=null?h:!1)};if(n=="field")return function(c){var u,d=c;return Fi(d)||(d=o(d)),(u=i.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var l;return Fi(e)||(e=o(e)),(l=this.options_)!=null&&l.bound&&s(function(){var c=this,u=c[r].bind(c);u.isMobxAction=!0,c[r]=u}),e}fe("Cannot apply '"+i.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
53
- '`+i.annotationType_+"' can only be used on properties with a function value."))}function TM(e,t,n,r){t.annotationType_,r.value}function h1(e,t,n,r,s){var i,o,l,c,u,d,f;s===void 0&&(s=Q.safeDescriptors),TM(e,t,n,r);var h=r.value;if((i=t.options_)!=null&&i.bound){var p;h=h.bind((p=e.proxy_)!=null?p:e.target_)}return{value:Os((o=(l=t.options_)==null?void 0:l.name)!=null?o:n.toString(),h,(c=(u=t.options_)==null?void 0:u.autoAction)!=null?c:!1,(d=t.options_)!=null&&d.bound?(f=e.proxy_)!=null?f:e.target_:void 0),configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function p1(e,t){return{annotationType_:e,options_:t,make_:PM,extend_:AM,decorate_20223_:RM}}function PM(e,t,n,r){var s;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((s=this.options_)!=null&&s.bound&&(!lr(e.target_,t)||!Ta(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Ta(n.value))return 1;var i=m1(e,this,t,n,!1,!1);return Dn(r,t,i),2}function AM(e,t,n,r){var s,i=m1(e,this,t,n,(s=this.options_)==null?void 0:s.bound);return e.defineProperty_(t,i,r)}function RM(e,t){var n,r=t.name,s=t.addInitializer;return Ta(e)||(e=Vi(e)),(n=this.options_)!=null&&n.bound&&s(function(){var i=this,o=i[r].bind(i);o.isMobXFlow=!0,i[r]=o}),e}function IM(e,t,n,r){t.annotationType_,r.value}function m1(e,t,n,r,s,i){i===void 0&&(i=Q.safeDescriptors),IM(e,t,n,r);var o=r.value;if(Ta(o)||(o=Vi(o)),s){var l;o=o.bind((l=e.proxy_)!=null?l:e.target_),o.isMobXFlow=!0}return{value:o,configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Mg(e,t){return{annotationType_:e,options_:t,make_:MM,extend_:OM,decorate_20223_:LM}}function MM(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function OM(e,t,n,r){return $M(e,this,t,n),e.defineComputedProperty_(t,Is({},this.options_,{get:n.get,set:n.set}),r)}function LM(e,t){var n=this,r=t.name,s=t.addInitializer,i;function o(l,c){var u=Is({},n.options_,{get:e,context:l});return u.name||(u.name="ObservableObject."+r.toString()),new Pt(u)}return s(function(){var l,c=co(this)[ae],u=this,d=c.values_.get(r);d instanceof Pt&&d.derivation!==e&&c.values_.delete(r),((l=c.lazyComputedKeys_)!=null?l:c.lazyComputedKeys_=new Map).set(r,function(){return o(u)})}),function(){var l=this[ae],c=l.values_.get(r);if(c instanceof Pt&&c.derivation!==e){var u,d=(u=i)==null?void 0:u.get(this);if(!d){var f;d=o(this),((f=i)!=null?f:i=new WeakMap).set(this,d)}return d.get()}return l.getObservablePropValue_(r)}}function $M(e,t,n,r){t.annotationType_,r.get}function xd(e,t){return{annotationType_:e,options_:t,make_:DM,extend_:zM,decorate_20223_:FM}}function DM(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function zM(e,t,n,r){var s,i;return VM(e,this),e.defineObservableProperty_(t,n.value,(s=(i=this.options_)==null?void 0:i.enhancer)!=null?s:Ms,r)}function FM(e,t){var n=this,r=t.kind,s=t.name;if(r!=="accessor")return;function i(o,l){var c,u=co(o)[ae];return((c=u.lazyObservableKeys_)!=null?c:u.lazyObservableKeys_=new Map).set(s,function(){var d,f;return new js(l,(d=(f=n.options_)==null?void 0:f.enhancer)!=null?d:Ms,"ObservableObject."+s.toString(),!1)}),u}return{get:function(){var l,c=(l=this[ae])!=null?l:i(this,e.get.call(this));return c.getObservablePropValue_(s)},set:function(l){var c,u=(c=this[ae])!=null?c:i(this,l);return u.setObservablePropValue_(s,l)},init:function(l){return i(this,l),l}}}function VM(e,t,n,r){t.annotationType_}var BM="true",UM=g1();function g1(e){return{annotationType_:BM,options_:e,make_:HM,extend_:WM,decorate_20223_:KM}}function HM(e,t,n,r){var s,i;if(n.get)return er.make_(e,t,n,r);if(n.set){var o=Fi(n.set)?n.set:Os(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:Q.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(Dn(r,t,{configurable:!0,set:o}),2)}if(r!==e.target_&&typeof n.value=="function"){var l;if(a1(n.value)){var c,u=(c=this.options_)!=null&&c.autoBind?Vi.bound:Vi;return u.make_(e,t,n,r)}var d=(l=this.options_)!=null&&l.autoBind?Ca.bound:Ca;return d.make_(e,t,n,r)}var f=((s=this.options_)==null?void 0:s.deep)===!1?ye.ref:ye;if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var h;n.value=n.value.bind((h=e.proxy_)!=null?h:e.target_)}return f.make_(e,t,n,r)}function WM(e,t,n,r){var s,i;if(n.get)return er.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:Q.safeDescriptors?e.isPlainObject_:!0,set:Os(t.toString(),n.set)},r);if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var o;n.value=n.value.bind((o=e.proxy_)!=null?o:e.target_)}var l=((i=this.options_)==null?void 0:i.deep)===!1?ye.ref:ye;return l.extend_(e,t,n,r)}function KM(e,t){fe("'"+this.annotationType_+"' cannot be used as a decorator")}var GM="observable",qM="observable.ref",YM="observable.shallow",XM="observable.struct",v1={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(v1);function zl(e){return e||v1}var xp=xd(GM),QM=xd(qM,{enhancer:yd}),ZM=xd(YM,{enhancer:bM}),JM=xd(XM,{enhancer:jM}),y1=zn(xp);function Fl(e){return e.deep===!0?Ms:e.deep===!1?yd:tO(e.defaultDecorator)}function eO(e){var t;return e?(t=e.defaultDecorator)!=null?t:g1(e):void 0}function tO(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Ms}function x1(e,t,n){if(rl(t))return xp.decorate_20223_(e,t);if(Rs(t)){nl(e,t,xp);return}return F1(e)?e:Yr(e)?ye.object(e,t,n):Array.isArray(e)?ye.array(e,t):ao(e)?ye.map(e,t):Jn(e)?ye.set(e,t):typeof e=="object"&&e!==null?e:ye.box(e,t)}r1(x1,y1);var nO={box:function(t,n){var r=zl(n);return new js(t,Fl(r),r.name,!0,r.equals)},array:function(t,n){var r=zl(n);return(Q.useProxies===!1||r.proxy===!1?QO:VO)(t,Fl(r),r.name)},map:function(t,n){var r=zl(n);return new U1(t,Fl(r),r.name)},set:function(t,n){var r=zl(n);return new H1(t,Fl(r),r.name)},object:function(t,n,r){return qs(function(){return PO(Q.useProxies===!1||(r==null?void 0:r.proxy)===!1?co({},r):DO({},r),t,n)})},ref:zn(QM),shallow:zn(ZM),deep:y1,struct:zn(JM)},ye=r1(x1,nO),_1="computed",rO="computed.struct",_p=Mg(_1),sO=Mg(rO,{equals:hu.structural}),er=function(t,n){if(rl(n))return _p.decorate_20223_(t,n);if(Rs(n))return nl(t,n,_p);if(Yr(t))return zn(Mg(_1,t));var r=Yr(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new Pt(r)};Object.assign(er,_p);er.struct=zn(sO);var Lx,$x,pu=0,iO=1,oO=(Lx=($x=fu(function(){},"name"))==null?void 0:$x.configurable)!=null?Lx:!1,Dx={value:"action",configurable:!0,writable:!1,enumerable:!1};function Os(e,t,n,r){n===void 0&&(n=!1);function s(){return w1(e,n,t,r||this,arguments)}return s.isMobxAction=!0,s.toString=function(){return t.toString()},oO&&(Dx.value=e,Dn(s,"name",Dx)),s}function w1(e,t,n,r,s){var i=aO(e,t);try{return n.apply(r,s)}catch(o){throw i.error_=o,o}finally{lO(i)}}function aO(e,t,n,r){var s=!1,i=0,o=Q.trackingDerivation,l=!t||!o;Xt();var c=Q.allowStateChanges;l&&(Ks(),c=Og(!0));var u=$g(!0),d={runAsAction_:l,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:u,notifySpy_:s,startTime_:i,actionId_:iO++,parentActionId_:pu};return pu=d.actionId_,d}function lO(e){pu!==e.actionId_&&fe(30),pu=e.parentActionId_,e.error_!==void 0&&(Q.suppressReactionErrors=!0),Lg(e.prevAllowStateChanges_),Zo(e.prevAllowStateReads_),Qt(),e.runAsAction_&&cr(e.prevDerivation_),Q.suppressReactionErrors=!1}function Og(e){var t=Q.allowStateChanges;return Q.allowStateChanges=e,t}function Lg(e){Q.allowStateChanges=e}var js=function(e){function t(r,s,i,o,l){var c;return i===void 0&&(i="ObservableValue"),l===void 0&&(l=hu.default),c=e.call(this,i)||this,c.enhancer=void 0,c.name_=void 0,c.equals=void 0,c.hasUnreportedChange_=!1,c.interceptors_=void 0,c.changeListeners_=void 0,c.value_=void 0,c.dehancer=void 0,c.enhancer=s,c.name_=i,c.equals=l,c.value_=s(r,void 0,i),c}Rg(t,e);var n=t.prototype;return n.dehanceValue=function(s){return this.dehancer!==void 0?this.dehancer(s):s},n.set=function(s){this.value_,s=this.prepareNewValue_(s),s!==Q.UNCHANGED&&this.setNewValue_(s)},n.prepareNewValue_=function(s){if(Gt(this)){var i=qt(this,{object:this,type:Fn,newValue:s});if(!i)return Q.UNCHANGED;s=i.newValue}return s=this.enhancer(s,this.value_,this.name_),this.equals(this.value_,s)?Q.UNCHANGED:s},n.setNewValue_=function(s){var i=this.value_;this.value_=s,this.reportChanged(),xn(this)&&_n(this,{type:Fn,object:this,newValue:s,oldValue:i})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(s){return il(this,s)},n.observe_=function(s,i){return i&&s({observableKind:"value",debugObjectName:this.name_,object:this,type:Fn,newValue:this.value_,oldValue:void 0}),ol(this,s)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return u1(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(ts),Pt=function(){function e(n){this.dependenciesState_=ge.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=ge.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new gu(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=mu.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||fe(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Os("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?hu.structural:hu.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){hO(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&fe(32,this.name_,this.derivation),Q.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)wp(this)&&(this.warnAboutUntrackedRead_(),Xt(),this.value_=this.computeValue_(!1),Qt());else if(C1(this),wp(this)){var r=Q.trackingContext;this.keepAlive_&&!r&&(Q.trackingContext=this),this.trackAndCompute()&&fO(this),Q.trackingContext=r}var s=this.value_;if(Sc(s))throw s.cause;return s},t.set=function(r){if(this.setter_){this.isRunningSetter&&fe(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else fe(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,s=this.dependenciesState_===ge.NOT_TRACKING_,i=this.computeValue_(!0),o=s||Sc(r)||Sc(i)||!this.equals_(r,i);return o&&(this.value_=i),o},t.computeValue_=function(r){this.isComputing=!0;var s=Og(!1),i;if(r)i=b1(this,this.derivation,this.scope_);else if(Q.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new gu(o)}return Lg(s),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(bp(this),this.value_=void 0)},t.observe_=function(r,s){var i=this,o=!0,l=void 0;return O1(function(){var c=i.get();if(!o||s){var u=Ks();r({observableKind:"computed",debugObjectName:i.name_,type:Fn,object:i,newValue:c,oldValue:l}),cr(u)}o=!1,l=c})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return u1(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},lo(e,[{key:"isComputing",get:function(){return St(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=kt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return St(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=kt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return St(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=kt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return St(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=kt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return St(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=kt(this.flags_,e.diffValueMask_,r===1)}}])}();Pt.isComputingMask_=1;Pt.isRunningSetterMask_=2;Pt.isBeingObservedMask_=4;Pt.isPendingUnobservationMask_=8;Pt.diffValueMask_=16;var _d=Ws("ComputedValue",Pt),ge;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(ge||(ge={}));var mu;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(mu||(mu={}));var gu=function(t){this.cause=void 0,this.cause=t};function Sc(e){return e instanceof gu}function wp(e){switch(e.dependenciesState_){case ge.UP_TO_DATE_:return!1;case ge.NOT_TRACKING_:case ge.STALE_:return!0;case ge.POSSIBLY_STALE_:{for(var t=$g(!0),n=Ks(),r=e.observing_,s=r.length,i=0;i<s;i++){var o=r[i];if(_d(o)){if(Q.disableErrorBoundaries)o.get();else try{o.get()}catch{return cr(n),Zo(t),!0}if(e.dependenciesState_===ge.STALE_)return cr(n),Zo(t),!0}}return S1(e),cr(n),Zo(t),!1}}}function b1(e,t,n){var r=$g(!0);S1(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Q.runId;var s=Q.trackingDerivation;Q.trackingDerivation=e,Q.inBatch++;var i;if(Q.disableErrorBoundaries===!0)i=t.call(n);else try{i=t.call(n)}catch(o){i=new gu(o)}return Q.inBatch--,Q.trackingDerivation=s,cO(e),Zo(r),i}function cO(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=ge.UP_TO_DATE_,s=0,i=e.unboundDepsCount_,o=0;o<i;o++){var l=n[o];l.diffValue===0&&(l.diffValue=1,s!==o&&(n[s]=l),s++),l.dependenciesState_>r&&(r=l.dependenciesState_)}for(n.length=s,e.newObserving_=null,i=t.length;i--;){var c=t[i];c.diffValue===0&&N1(c,e),c.diffValue=0}for(;s--;){var u=n[s];u.diffValue===1&&(u.diffValue=0,dO(u,e))}r!==ge.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function bp(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)N1(t[n],e);e.dependenciesState_=ge.NOT_TRACKING_}function j1(e){var t=Ks();try{return e()}finally{cr(t)}}function Ks(){var e=Q.trackingDerivation;return Q.trackingDerivation=null,e}function cr(e){Q.trackingDerivation=e}function $g(e){var t=Q.allowStateReads;return Q.allowStateReads=e,t}function Zo(e){Q.allowStateReads=e}function S1(e){if(e.dependenciesState_!==ge.UP_TO_DATE_){e.dependenciesState_=ge.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=ge.UP_TO_DATE_}}var kc=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Nc=!0,k1=!1,Q=function(){var e=hd();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Nc=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new kc().version&&(Nc=!1),Nc?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new kc):(setTimeout(function(){k1||fe(35)},1),new kc)}();function uO(){if((Q.pendingReactions.length||Q.inBatch||Q.isRunningReactions)&&fe(36),k1=!0,Nc){var e=hd();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Q=new kc}}function dO(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function N1(e,t){e.observers_.delete(t),e.observers_.size===0&&E1(e)}function E1(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,Q.pendingUnobservations.push(e))}function Xt(){Q.inBatch++}function Qt(){if(--Q.inBatch===0){P1();for(var e=Q.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof Pt&&n.suspend_())}Q.pendingUnobservations=[]}}function C1(e){var t=Q.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Q.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&Q.inBatch>0&&E1(e),!1)}function T1(e){e.lowestObserverState_!==ge.STALE_&&(e.lowestObserverState_=ge.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ge.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=ge.STALE_}))}function fO(e){e.lowestObserverState_!==ge.STALE_&&(e.lowestObserverState_=ge.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ge.POSSIBLY_STALE_?t.dependenciesState_=ge.STALE_:t.dependenciesState_===ge.UP_TO_DATE_&&(e.lowestObserverState_=ge.UP_TO_DATE_)}))}function hO(e){e.lowestObserverState_===ge.UP_TO_DATE_&&(e.lowestObserverState_=ge.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ge.UP_TO_DATE_&&(t.dependenciesState_=ge.POSSIBLY_STALE_,t.onBecomeStale_())}))}var xr=function(){function e(n,r,s,i){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=ge.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=mu.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=s,this.requiresObservable_=i}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Q.pendingReactions.push(this),P1())},t.runReaction_=function(){if(!this.isDisposed){Xt(),this.isScheduled=!1;var r=Q.trackingContext;if(Q.trackingContext=this,wp(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(s){this.reportExceptionInDerivation_(s)}}Q.trackingContext=r,Qt()}},t.track=function(r){if(!this.isDisposed){Xt(),this.isRunning=!0;var s=Q.trackingContext;Q.trackingContext=this;var i=b1(this,r,void 0);Q.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&bp(this),Sc(i)&&this.reportExceptionInDerivation_(i.cause),Qt()}},t.reportExceptionInDerivation_=function(r){var s=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(Q.disableErrorBoundaries)throw r;var i="[mobx] uncaught error in '"+this+"'";Q.suppressReactionErrors||console.error(i,r),Q.globalReactionErrorHandlers.forEach(function(o){return o(r,s)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Xt(),bp(this),Qt()))},t.getDisposer_=function(r){var s=this,i=function o(){s.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",o)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[ae]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(i[Symbol.dispose]=i),i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},lo(e,[{key:"isDisposed",get:function(){return St(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=kt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return St(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=kt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return St(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=kt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return St(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=kt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return St(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=kt(this.flags_,e.diffValueMask_,r===1)}}])}();xr.isDisposedMask_=1;xr.isScheduledMask_=2;xr.isTrackPendingMask_=4;xr.isRunningMask_=8;xr.diffValueMask_=16;var pO=100,jp=function(t){return t()};function P1(){Q.inBatch>0||Q.isRunningReactions||jp(mO)}function mO(){Q.isRunningReactions=!0;for(var e=Q.pendingReactions,t=0;e.length>0;){++t===pO&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,s=n.length;r<s;r++)n[r].runReaction_()}Q.isRunningReactions=!1}var vu=Ws("Reaction",xr);function gO(e){var t=jp;jp=function(r){return e(function(){return t(r)})}}function Jo(){return!1}function vO(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var A1="action",yO="action.bound",R1="autoAction",xO="autoAction.bound",I1="<unnamed action>",Sp=sl(A1),_O=sl(yO,{bound:!0}),kp=sl(R1,{autoAction:!0}),wO=sl(xO,{autoAction:!0,bound:!0});function M1(e){var t=function(r,s){if(bn(r))return Os(r.name||I1,r,e);if(bn(s))return Os(r,s,e);if(rl(s))return(e?kp:Sp).decorate_20223_(r,s);if(Rs(s))return nl(r,s,e?kp:Sp);if(Rs(r))return zn(sl(e?R1:A1,{name:r,autoAction:e}))};return t}var oe=M1(!1);Object.assign(oe,Sp);var Ca=M1(!0);Object.assign(Ca,kp);oe.bound=zn(_O);Ca.bound=zn(wO);function bO(e){return w1(e.name||I1,!1,e,this,void 0)}function Fi(e){return bn(e)&&e.isMobxAction===!0}function O1(e,t){var n,r,s,i;t===void 0&&(t=s1);var o=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",l=!t.scheduler&&!t.delay,c;if(l)c=new xr(o,function(){this.track(f)},t.onError,t.requiresObservable);else{var u=SO(t),d=!1;c=new xr(o,function(){d||(d=!0,u(function(){d=!1,c.isDisposed||c.track(f)}))},t.onError,t.requiresObservable)}function f(){e(c)}return(s=t)!=null&&(s=s.signal)!=null&&s.aborted||c.schedule_(),c.getDisposer_((i=t)==null?void 0:i.signal)}var jO=function(t){return t()};function SO(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:jO}var kO="onBO",NO="onBUO";function EO(e,t,n){return $1(kO,e,t,n)}function L1(e,t,n){return $1(NO,e,t,n)}function $1(e,t,n,r){var s=_u(t),i=bn(r)?r:n,o=e+"L";return s[o]?s[o].add(i):s[o]=new Set([i]),function(){var l=s[o];l&&(l.delete(i),l.size===0&&delete s[o])}}var CO="never",Vl="always",TO="observed";function D1(e){e.isolateGlobalState===!0&&uO();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(Q.useProxies=t===Vl?!0:t===CO?!1:typeof Proxy<"u"),t==="ifavailable"&&(Q.verifyProxies=!0),n!==void 0){var r=n===Vl?Vl:n===TO;Q.enforceActions=r,Q.allowStateChanges=!(r===!0||r===Vl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(s){s in e&&(Q[s]=!!e[s])}),Q.allowStateReads=!Q.observableRequiresReaction,e.reactionScheduler&&gO(e.reactionScheduler)}function PO(e,t,n,r){var s=fM(t);return qs(function(){var i=co(e,r)[ae];vd(s).forEach(function(o){i.extend_(o,s[o],n&&o in n?n[o]:!0)})}),e}function AO(e,t){return z1(_u(e,t))}function z1(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=RO(e.observing_).map(z1)),t}function RO(e){return Array.from(new Set(e))}var IO=0,MO=function(e){function t(){var r;return r=e.call(this,"FLOW_CANCELLED")||this,Object.setPrototypeOf(r,(this instanceof t?this.constructor:void 0).prototype),r.name="FlowCancellationError",r}Rg(t,e);var n=t.prototype;return n.toString=function(){return"Error: "+this.message},t}(yp(Error)),Ef=p1("flow"),OO=p1("flow.bound",{bound:!0}),Vi=Object.assign(function(t,n){if(rl(n))return Ef.decorate_20223_(t,n);if(Rs(n))return nl(t,n,Ef);var r=t,s=r.name||"<unnamed flow>",i=function(){var l=this,c=arguments,u=++IO,d=oe(s+" - runid: "+u+" - init",r).apply(l,c),f,h=void 0,p=new Promise(function(g,x){var _=0;f=x;function v(b){h=void 0;var j;try{j=oe(s+" - runid: "+u+" - yield "+_++,d.next).call(d,b)}catch(k){return x(k)}m(j)}function y(b){h=void 0;var j;try{j=oe(s+" - runid: "+u+" - yield "+_++,d.throw).call(d,b)}catch(k){return x(k)}m(j)}function m(b){if(bn(b==null?void 0:b.then)){b.then(m,x);return}return b.done?g(b.value):(h=Promise.resolve(b.value),h.then(v,y))}v(void 0)});return p.cancel=oe(s+" - runid: "+u+" - cancel",function(){try{h&&zx(h);var g=d.return(void 0),x=Promise.resolve(g.value);x.then(pi,pi),zx(x),f(new MO)}catch(_){f(_)}}),p};return i.isMobXFlow=!0,i},Ef);Vi.bound=zn(OO);function zx(e){bn(e.cancel)&&e.cancel()}function Ta(e){return(e==null?void 0:e.isMobXFlow)===!0}function LO(e,t){return e?bd(e)||!!e[ae]||Ig(e)||vu(e)||_d(e):!1}function F1(e){return LO(e)}function tr(e,t){t===void 0&&(t=void 0),Xt();try{return e.apply(t)}finally{Qt()}}function Zs(e){return e[ae]}var $O={has:function(t,n){return Zs(t).has_(n)},get:function(t,n){return Zs(t).get_(n)},set:function(t,n,r){var s;return Rs(n)?(s=Zs(t).set_(n,r,!0))!=null?s:!0:!1},deleteProperty:function(t,n){var r;return Rs(n)?(r=Zs(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var s;return(s=Zs(t).defineProperty_(n,r))!=null?s:!0},ownKeys:function(t){return Zs(t).ownKeys_()},preventExtensions:function(t){fe(13)}};function DO(e,t){var n,r;return i1(),e=co(e,t),(r=(n=e[ae]).proxy_)!=null?r:n.proxy_=new Proxy(e,$O)}function Gt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function il(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),o1(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function qt(e,t){var n=Ks();try{for(var r=[].concat(e.interceptors_||[]),s=0,i=r.length;s<i&&(t=r[s](t),t&&!t.type&&fe(14),!!t);s++);return t}finally{cr(n)}}function xn(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ol(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),o1(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function _n(e,t){var n=Ks(),r=e.changeListeners_;if(r){r=r.slice();for(var s=0,i=r.length;s<i;s++)r[s](t);cr(n)}}function V1(e,t,n){return qs(function(){var r,s=co(e,n)[ae];(r=t)!=null||(t=xM(e)),vd(t).forEach(function(i){return s.make_(i,t[i])})}),e}var Fx="splice",Fn="update",zO=1e4,FO={get:function(t,n){var r=t[ae];return n===ae?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):lr(yu,n)?yu[n]:t[n]},set:function(t,n,r){var s=t[ae];return n==="length"&&s.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:s.set_(parseInt(n),r),!0},preventExtensions:function(){fe(15)}},Dg=function(){function e(n,r,s,i){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=s,this.legacyMode_=i,this.atom_=new ts(n),this.enhancer_=function(o,l){return r(o,l,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return il(this,r)},t.observe_=function(r,s){return s===void 0&&(s=!1),s&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),ol(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&fe("Out of range: "+r);var s=this.values_.length;if(r!==s)if(r>s){for(var i=new Array(r-s),o=0;o<r-s;o++)i[o]=void 0;this.spliceWithArray_(s,0,i)}else this.spliceWithArray_(r,s-r)},t.updateArrayLength_=function(r,s){r!==this.lastKnownLength_&&fe(16),this.lastKnownLength_+=s,this.legacyMode_&&s>0&&q1(r+s+1)},t.spliceWithArray_=function(r,s,i){var o=this;this.atom_;var l=this.values_.length;if(r===void 0?r=0:r>l?r=l:r<0&&(r=Math.max(0,l+r)),arguments.length===1?s=l-r:s==null?s=0:s=Math.max(0,Math.min(s,l-r)),i===void 0&&(i=gp),Gt(this)){var c=qt(this,{object:this.proxy_,type:Fx,index:r,removedCount:s,added:i});if(!c)return gp;s=c.removedCount,i=c.added}if(i=i.length===0?i:i.map(function(f){return o.enhancer_(f,void 0)}),this.legacyMode_){var u=i.length-s;this.updateArrayLength_(l,u)}var d=this.spliceItemsIntoValues_(r,s,i);return(s!==0||i.length!==0)&&this.notifyArraySplice_(r,i,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,s,i){if(i.length<zO){var o;return(o=this.values_).splice.apply(o,[r,s].concat(i))}else{var l=this.values_.slice(r,r+s),c=this.values_.slice(r+s);this.values_.length+=i.length-s;for(var u=0;u<i.length;u++)this.values_[r+u]=i[u];for(var d=0;d<c.length;d++)this.values_[r+i.length+d]=c[d];return l}},t.notifyArrayChildUpdate_=function(r,s,i){var o=!this.owned_&&Jo(),l=xn(this),c=l||o?{observableKind:"array",object:this.proxy_,type:Fn,debugObjectName:this.atom_.name_,index:r,newValue:s,oldValue:i}:null;this.atom_.reportChanged(),l&&_n(this,c)},t.notifyArraySplice_=function(r,s,i){var o=!this.owned_&&Jo(),l=xn(this),c=l||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Fx,index:r,removed:i,added:s,removedCount:i.length,addedCount:s.length}:null;this.atom_.reportChanged(),l&&_n(this,c)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,s){var i=this.values_;if(this.legacyMode_&&r>i.length&&fe(17,r,i.length),r<i.length){this.atom_;var o=i[r];if(Gt(this)){var l=qt(this,{type:Fn,object:this.proxy_,index:r,newValue:s});if(!l)return;s=l.newValue}s=this.enhancer_(s,o);var c=s!==o;c&&(i[r]=s,this.notifyArrayChildUpdate_(r,s,o))}else{for(var u=new Array(r+1-i.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=s,this.spliceWithArray_(i.length,0,u)}},e}();function VO(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),i1(),qs(function(){var s=new Dg(n,t,r,!1);l1(s.values_,ae,s);var i=new Proxy(s.values_,FO);return s.proxy_=i,e&&e.length&&s.spliceWithArray_(0,0,e),i})}var yu={clear:function(){return this.splice(0)},replace:function(t){var n=this[ae];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];var o=this[ae];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(t);case 2:return o.spliceWithArray_(t,n)}return o.spliceWithArray_(t,n,s)},spliceWithArray:function(t,n,r){return this[ae].spliceWithArray_(t,n,r)},push:function(){for(var t=this[ae],n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[ae].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[ae],n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return Q.trackingDerivation&&fe(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Q.trackingDerivation&&fe(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[ae],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};we("at",zt);we("concat",zt);we("flat",zt);we("includes",zt);we("indexOf",zt);we("join",zt);we("lastIndexOf",zt);we("slice",zt);we("toString",zt);we("toLocaleString",zt);we("toSorted",zt);we("toSpliced",zt);we("with",zt);we("every",Sn);we("filter",Sn);we("find",Sn);we("findIndex",Sn);we("findLast",Sn);we("findLastIndex",Sn);we("flatMap",Sn);we("forEach",Sn);we("map",Sn);we("some",Sn);we("toReversed",Sn);we("reduce",B1);we("reduceRight",B1);function we(e,t){typeof Array.prototype[e]=="function"&&(yu[e]=t(e))}function zt(e){return function(){var t=this[ae];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Sn(e){return function(t,n){var r=this,s=this[ae];s.atom_.reportObserved();var i=s.dehanceValues_(s.values_);return i[e](function(o,l){return t.call(n,o,l,r)})}}function B1(e){return function(){var t=this,n=this[ae];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),s=arguments[0];return arguments[0]=function(i,o,l){return s(i,o,l,t)},r[e].apply(r,arguments)}}var BO=Ws("ObservableArrayAdministration",Dg);function wd(e){return md(e)&&BO(e[ae])}var UO={},$r="add",xu="delete",U1=function(){function e(n,r,s){var i=this;r===void 0&&(r=Ms),s===void 0&&(s="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[ae]=UO,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=s,bn(Map)||fe(18),qs(function(){i.keysAtom_=f1("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,n&&i.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var s=this;if(!Q.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new js(this.has_(r),yd,"ObservableMap.key?",!1);this.hasMap_.set(r,o),L1(o,function(){return s.hasMap_.delete(r)})}return i.get()},t.set=function(r,s){var i=this.has_(r);if(Gt(this)){var o=qt(this,{type:i?Fn:$r,object:this,newValue:s,name:r});if(!o)return this;s=o.newValue}return i?this.updateValue_(r,s):this.addValue_(r,s),this},t.delete=function(r){var s=this;if(this.keysAtom_,Gt(this)){var i=qt(this,{type:xu,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=Jo(),l=xn(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:xu,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return tr(function(){var u;s.keysAtom_.reportChanged(),(u=s.hasMap_.get(r))==null||u.setNewValue_(!1);var d=s.data_.get(r);d.setNewValue_(void 0),s.data_.delete(r)}),l&&_n(this,c),!0}return!1},t.updateValue_=function(r,s){var i=this.data_.get(r);if(s=i.prepareNewValue_(s),s!==Q.UNCHANGED){var o=Jo(),l=xn(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:Fn,object:this,oldValue:i.value_,name:r,newValue:s}:null;i.setNewValue_(s),l&&_n(this,c)}},t.addValue_=function(r,s){var i=this;this.keysAtom_,tr(function(){var u,d=new js(s,i.enhancer_,"ObservableMap.key",!1);i.data_.set(r,d),s=d.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=Jo(),l=xn(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:$r,object:this,name:r,newValue:s}:null;l&&_n(this,c)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.getOrInsert=function(r,s){return this.has(r)||this.set(r,s),this.get(r)},t.getOrInsertComputed=function(r,s){return this.has(r)||this.set(r,s(r)),this.get(r)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,s=this.keys();return Vx({next:function(){var o=s.next(),l=o.done,c=o.value;return{done:l,value:l?void 0:r.get(c)}}})},t.entries=function(){var r=this,s=this.keys();return Vx({next:function(){var o=s.next(),l=o.done,c=o.value;return{done:l,value:l?void 0:[c,r.get(c)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,s){for(var i=mi(this),o;!(o=i()).done;){var l=o.value,c=l[0],u=l[1];r.call(s,u,c,this)}},t.merge=function(r){var s=this;return Gs(r)&&(r=new Map(r)),tr(function(){Yr(r)?dM(r).forEach(function(i){return s.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var o=i[0],l=i[1];return s.set(o,l)}):ao(r)?(uM(r)||fe(19,r),r.forEach(function(i,o){return s.set(o,i)})):r!=null&&fe(20,r)}),this},t.clear=function(){var r=this;tr(function(){j1(function(){for(var s=mi(r.keys()),i;!(i=s()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var s=this;return tr(function(){for(var i=HO(r),o=new Map,l=!1,c=mi(s.data_.keys()),u;!(u=c()).done;){var d=u.value;if(!i.has(d)){var f=s.delete(d);if(f)l=!0;else{var h=s.data_.get(d);o.set(d,h)}}}for(var p=mi(i.entries()),g;!(g=p()).done;){var x=g.value,_=x[0],v=x[1],y=s.data_.has(_);if(s.set(_,v),s.data_.has(_)){var m=s.data_.get(_);o.set(_,m),y||(l=!0)}}if(!l)if(s.data_.size!==o.size)s.keysAtom_.reportChanged();else for(var b=s.data_.keys(),j=o.keys(),k=b.next(),S=j.next();!k.done;){if(k.value!==S.value){s.keysAtom_.reportChanged();break}k=b.next(),S=j.next()}s.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,s){return ol(this,r)},t.intercept_=function(r){return il(this,r)},lo(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Gs=Ws("ObservableMap",U1);function Vx(e){return e[Symbol.toStringTag]="MapIterator",Fg(e)}function HO(e){if(ao(e)||Gs(e))return e;if(Array.isArray(e))return new Map(e);if(Yr(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return fe(21,e)}var WO={},H1=function(){function e(n,r,s){var i=this;r===void 0&&(r=Ms),s===void 0&&(s="ObservableSet"),this.name_=void 0,this[ae]=WO,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=s,bn(Set)||fe(22),this.enhancer_=function(o,l){return r(o,l,s)},qs(function(){i.atom_=f1(i.name_),n&&i.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;tr(function(){j1(function(){for(var s=mi(r.data_.values()),i;!(i=s()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,s){for(var i=mi(this),o;!(o=i()).done;){var l=o.value;r.call(s,l,l,this)}},t.add=function(r){var s=this;if(this.atom_,Gt(this)){var i=qt(this,{type:$r,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){tr(function(){s.data_.add(s.enhancer_(r,void 0)),s.atom_.reportChanged()});var o=!1,l=xn(this),c=l||o?{observableKind:"set",debugObjectName:this.name_,type:$r,object:this,newValue:r}:null;l&&_n(this,c)}return this},t.delete=function(r){var s=this;if(Gt(this)){var i=qt(this,{type:xu,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=!1,l=xn(this),c=l||o?{observableKind:"set",debugObjectName:this.name_,type:xu,object:this,oldValue:r}:null;return tr(function(){s.atom_.reportChanged(),s.data_.delete(r)}),l&&_n(this,c),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return Bx({next:function(){var i=r.next(),o=i.value,l=i.done;return l?{value:void 0,done:l}:{value:[o,o],done:l}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,s=this.data_.values();return Bx({next:function(){var o=s.next(),l=o.value,c=o.done;return c?{value:void 0,done:c}:{value:r.dehanceValue_(l),done:c}}})},t.intersection=function(r){if(Jn(r)&&!In(r))return r.intersection(this);var s=new Set(this);return s.intersection(r)},t.union=function(r){if(Jn(r)&&!In(r))return r.union(this);var s=new Set(this);return s.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Jn(r)&&!In(r))return r.symmetricDifference(this);var s=new Set(this);return s.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Jn(r)&&!In(r))return r.isDisjointFrom(this);var s=new Set(this);return s.isDisjointFrom(r)},t.replace=function(r){var s=this;return In(r)&&(r=new Set(r)),tr(function(){Array.isArray(r)?(s.clear(),r.forEach(function(i){return s.add(i)})):Jn(r)?(s.clear(),r.forEach(function(i){return s.add(i)})):r!=null&&fe("Cannot initialize set from "+r)}),this},t.observe_=function(r,s){return ol(this,r)},t.intercept_=function(r){return il(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},lo(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),In=Ws("ObservableSet",H1);function Bx(e){return e[Symbol.toStringTag]="SetIterator",Fg(e)}var Ux=Object.create(null),Hx="remove",W1=function(){function e(n,r,s,i){r===void 0&&(r=new Map),i===void 0&&(i=UM),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=n,this.values_=r,this.name_=s,this.defaultAnnotation_=i,this.keysAtom_=new ts("ObservableObject.keys"),this.isPlainObject_=Yr(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){var s,i,o=(s=(i=this.values_.get(r))!=null?i:this.materializeLazyComputed_(r))!=null?s:this.materializeLazyObservable_(r);return o.get()},t.materializeLazyComputed_=function(r){var s,i=(s=this.lazyComputedKeys_)==null?void 0:s.get(r);if(i){this.lazyComputedKeys_.delete(r),this.lazyComputedKeys_.size===0&&(this.lazyComputedKeys_=void 0);var o=i();return this.values_.set(r,o),o}},t.materializeLazyObservable_=function(r){var s,i=(s=this.lazyObservableKeys_)==null?void 0:s.get(r);if(i){this.lazyObservableKeys_.delete(r),this.lazyObservableKeys_.size===0&&(this.lazyObservableKeys_=void 0);var o=i();return this.values_.set(r,o),o}},t.setObservablePropValue_=function(r,s){var i,o,l=(i=(o=this.values_.get(r))!=null?o:this.materializeLazyComputed_(r))!=null?i:this.materializeLazyObservable_(r);if(l instanceof Pt)return l.set(s),!0;if(Gt(this)){var c=qt(this,{type:Fn,object:this.proxy_||this.target_,name:r,newValue:s});if(!c)return null;s=c.newValue}if(s=l.prepareNewValue_(s),s!==Q.UNCHANGED){var u=xn(this),d=!1,f=u||d?{type:Fn,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:l.value_,name:r,newValue:s}:null;l.setNewValue_(s),u&&_n(this,f)}return!0},t.get_=function(r){return Q.trackingDerivation&&!lr(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,s,i){return i===void 0&&(i=!1),lr(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,s):i?Reflect.set(this.target_,r,s):(this.target_[r]=s,!0):this.extend_(r,{value:s,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!Q.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var s=this.pendingKeys_.get(r);return s||(s=new js(r in this.target_,yd,"ObservableObject.key?",!1),this.pendingKeys_.set(r,s)),s.get()},t.make_=function(r,s){if(s===!0&&(s=this.defaultAnnotation_),s!==!1){if(!(r in this.target_)){var i;if((i=this.target_[On])!=null&&i[r])return;fe(1,s.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==pd;){var l=fu(o,r);if(l){var c=s.make_(this,r,l,o);if(c===0)return;if(c===1)break}o=Object.getPrototypeOf(o)}Kx(this,s,r)}},t.extend_=function(r,s,i,o){if(o===void 0&&(o=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,s,o);var l=i.extend_(this,r,s,o);return l&&Kx(this,i,r),l},t.defineProperty_=function(r,s,i){i===void 0&&(i=!1),this.keysAtom_;try{Xt();var o=this.delete_(r);if(!o)return o;if(Gt(this)){var l=qt(this,{object:this.proxy_||this.target_,name:r,type:$r,newValue:s.value});if(!l)return null;var c=l.newValue;s.value!==c&&(s=Is({},s,{value:c}))}if(i){if(!Reflect.defineProperty(this.target_,r,s))return!1}else Dn(this.target_,r,s);this.notifyPropertyAddition_(r,s.value)}finally{Qt()}return!0},t.defineObservableProperty_=function(r,s,i,o){o===void 0&&(o=!1),this.keysAtom_;try{Xt();var l=this.delete_(r);if(!l)return l;if(Gt(this)){var c=qt(this,{object:this.proxy_||this.target_,name:r,type:$r,newValue:s});if(!c)return null;s=c.newValue}var u=Wx(r),d={configurable:Q.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,d))return!1}else Dn(this.target_,r,d);var f=new js(s,i,"ObservableObject.key",!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Qt()}return!0},t.defineComputedProperty_=function(r,s,i){i===void 0&&(i=!1),this.keysAtom_;try{Xt();var o=this.delete_(r);if(!o)return o;if(Gt(this)){var l=qt(this,{object:this.proxy_||this.target_,name:r,type:$r,newValue:void 0});if(!l)return null}s.name||(s.name="ObservableObject.key"),s.context=this.proxy_||this.target_;var c=Wx(r),u={configurable:Q.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:c.get,set:c.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Dn(this.target_,r,u);this.values_.set(r,new Pt(s)),this.notifyPropertyAddition_(r,void 0)}finally{Qt()}return!0},t.delete_=function(r,s){if(s===void 0&&(s=!1),this.keysAtom_,!lr(this.target_,r))return!0;if(Gt(this)){var i=qt(this,{object:this.proxy_||this.target_,name:r,type:Hx});if(!i)return null}try{var o;Xt();var l=xn(this),c=!1,u=this.values_.get(r),d=void 0;if(!u&&(l||c)){var f;d=(f=fu(this.target_,r))==null?void 0:f.value}if(s){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(u&&(this.values_.delete(r),u instanceof js&&(d=u.value_),T1(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),l||c){var h={type:Hx,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};l&&_n(this,h)}}finally{Qt()}return!0},t.observe_=function(r,s){return ol(this,r)},t.intercept_=function(r){return il(this,r)},t.notifyPropertyAddition_=function(r,s){var i,o=xn(this),l=!1;if(o||l){var c=o||l?{type:$r,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:s}:null;o&&_n(this,c)}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),vd(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function co(e,t){var n;if(lr(e,ae))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",s=new W1(e,new Map,String(r),eO(t));return gd(e,ae,s),e}var KO=Ws("ObservableObjectAdministration",W1);function Wx(e){return Ux[e]||(Ux[e]={get:function(){return this[ae].getObservablePropValue_(e)},set:function(n){return this[ae].setObservablePropValue_(e,n)}})}function bd(e){return md(e)?KO(e[ae]):!1}function Kx(e,t,n){var r;(r=e.target_[On])==null||delete r[n]}var GO=G1(0),qO=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Cf=0,K1=function(){};function YO(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}YO(K1,Array.prototype);var zg=function(e){function t(r,s,i,o){var l;return i===void 0&&(i="ObservableArray"),o===void 0&&(o=!1),l=e.call(this)||this,qs(function(){var c=new Dg(i,s,o,!0);c.proxy_=l,l1(l,ae,c),r&&r.length&&l.spliceWithArray(0,0,r),qO&&Object.defineProperty(l,"0",GO)}),l}Rg(t,e);var n=t.prototype;return n.concat=function(){this[ae].atom_.reportObserved();for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),i.map(function(l){return wd(l)?l.slice():l}))},n[Symbol.iterator]=function(){var r=this,s=0;return Fg({next:function(){return s<r.length?{value:r[s++],done:!1}:{done:!0,value:void 0}}})},lo(t,[{key:"length",get:function(){return this[ae].getArrayLength_()},set:function(s){this[ae].setArrayLength_(s)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(K1);Object.entries(yu).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&gd(zg.prototype,t,n)});function G1(e){return{enumerable:!1,configurable:!0,get:function(){return this[ae].get_(e)},set:function(n){this[ae].set_(e,n)}}}function XO(e){Dn(zg.prototype,""+e,G1(e))}function q1(e){if(e>Cf){for(var t=Cf;t<e+100;t++)XO(t);Cf=e}}q1(1e3);function QO(e,t,n){return new zg(e,t,n)}function _u(e,t){if(typeof e=="object"&&e!==null){if(wd(e))return t!==void 0&&fe(23),e[ae].atom_;if(In(e))return e.atom_;if(Gs(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||fe(25,t,Np(e)),n}if(bd(e)){var r,s;if(!t)return fe(26);var i=e[ae],o=(r=(s=i.values_.get(t))!=null?s:i.materializeLazyComputed_(t))!=null?r:i.materializeLazyObservable_(t);return o||fe(27,t,Np(e)),o}if(Ig(e)||_d(e)||vu(e))return e}else if(bn(e)&&vu(e[ae]))return e[ae];fe(28)}function ZO(e,t){if(e||fe(29),Ig(e)||_d(e)||vu(e)||Gs(e)||In(e))return e;if(e[ae])return e[ae];fe(24,e)}function Np(e,t){var n;if(t!==void 0)n=_u(e,t);else{if(Fi(e))return e.name;bd(e)||Gs(e)||In(e)?n=ZO(e):n=_u(e)}return n.name_}function qs(e){var t=Ks(),n=Og(!0);Xt();try{return e()}finally{Qt(),Lg(n),cr(t)}}var Gx=pd.toString;function Y1(e,t,n){return n===void 0&&(n=-1),Ep(e,t,n)}function Ep(e,t,n,r,s){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var i=typeof e;if(i!=="function"&&i!=="object"&&typeof t!="object")return!1;var o=Gx.call(e);if(o!==Gx.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=qx(e),t=qx(t);var l=o==="[object Array]";if(!l){if(typeof e!="object"||typeof t!="object")return!1;var c=e.constructor,u=t.constructor;if(c!==u&&!(bn(c)&&c instanceof c&&bn(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],s=s||[];for(var d=r.length;d--;)if(r[d]===e)return s[d]===t;if(r.push(e),s.push(t),l){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!Ep(e[d],t[d],n-1,r,s))return!1}else{var f=Object.keys(e),h=f.length;if(Object.keys(t).length!==h)return!1;for(var p=0;p<h;p++){var g=f[p];if(!(lr(t,g)&&Ep(e[g],t[g],n-1,r,s)))return!1}}return r.pop(),s.pop(),!0}function qx(e){return wd(e)?e.slice():ao(e)||Gs(e)||Jn(e)||In(e)?Array.from(e.entries()):e}var Yx,JO=hd(),eL=((Yx=JO.Iterator)==null?void 0:Yx.prototype)||{};function Fg(e){return e[Symbol.iterator]=tL,Object.assign(Object.create(eL),e)}function tL(){return this}["Symbol","Map","Set"].forEach(function(e){var t=hd();typeof t[e]>"u"&&fe("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:vO,extras:{getDebugName:Np},$mobx:ae});if(!w.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!V1)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function nL(e){e()}function rL(e){e||(e=nL),D1({reactionScheduler:e})}function sL(e){return AO(e)}var iL=1e4,oL=1e4,aL=function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=iL),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var s=Date.now();n.registrations.forEach(function(i,o){s-i.registeredAt>=r&&(n.finalize(i.value),n.registrations.delete(o))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,oL))}}),e}(),lL=typeof FinalizationRegistry<"u"?FinalizationRegistry:aL,Cp=new lL(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),X1={exports:{}},Q1={};/**
51
+ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let d=Dt(),f;if(t){let v=typeof t=="string"?io(t):t;ke(c==="/"||((_=v.pathname)==null?void 0:_.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${v.pathname}" was given in the \`location\` prop.`),f=v}else f=d;let h=f.pathname||"/",p=h;if(c!=="/"){let v=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(v.length).join("/")}let g=n&&n.state.matches.length?n.state.matches.map(v=>Object.assign(v,{route:n.manifest[v.route.id]||v.route})):AS(e,{pathname:p});nn(u||g!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),nn(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=g2(g&&g.map(v=>Object.assign({},v,{params:Object.assign({},o,v.params),pathname:yn([c,r.encodeLocation?r.encodeLocation(v.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:yn([c,r.encodeLocation?r.encodeLocation(v.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathnameBase])})),s,n);return t&&x?w.createElement(el.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},x):x}function f2(){let e=w2(),t=YI(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:i},"ErrorBoundary")," or"," ",w.createElement("code",{style:i},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:s},n):null,o)}var h2=w.createElement(f2,null),qS=class extends w.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=o2(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(rn.Provider,{value:this.props.routeContext},w.createElement(Sg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(p2,{error:e},t):t}};qS.contextType=VS;var kf=new WeakMap;function p2({children:e,error:t}){let{basename:n}=w.useContext($t);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=i2(t.digest);if(r){let s=kf.get(t);if(s)throw s;let i=zS(r.location,n),o=i.absoluteURL||i.to;if(JI(o))throw new Error("Invalid redirect location");if(DS&&!kf.get(t))if(i.isExternal||r.reloadDocument)window.location.href=o;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw kf.set(t,l),l}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return e}function m2({routeContext:e,match:t,children:n}){let r=w.useContext(oo);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(rn.Provider,{value:e},n)}function g2(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,i=r==null?void 0:r.errors;if(i!=null){let d=s.findIndex(f=>f.route.id&&(i==null?void 0:i[f.route.id])!==void 0);ke(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,d+1))}let o=!1,l=-1;if(n&&r){o=r.renderFallback;for(let d=0;d<s.length;d++){let f=s[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=d),f.route.id){let{loaderData:h,errors:p}=r,g=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!p||p[f.route.id]===void 0);if(f.route.lazy||g){n.isStatic&&(o=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(d,f)=>{var h,p;c(d,{location:r.location,params:((p=(h=r.matches)==null?void 0:h[0])==null?void 0:p.params)??{},pattern:XI(r.matches),errorInfo:f})}:void 0;return s.reduceRight((d,f,h)=>{let p,g=!1,x=null,_=null;r&&(p=i&&f.route.id?i[f.route.id]:void 0,x=f.route.errorElement||h2,o&&(l<0&&h===0?(YS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,_=null):l===h&&(g=!0,_=f.route.hydrateFallbackElement||null)));let v=t.concat(s.slice(0,h+1)),y=()=>{let m;return p?m=x:g?m=_:f.route.Component?m=w.createElement(f.route.Component,null):f.route.element?m=f.route.element:m=d,w.createElement(m2,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:r!=null},children:m})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?w.createElement(qS,{location:r.location,revalidation:r.revalidation,component:x,error:p,children:y(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:u}):y()},null)}function kg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function v2(e){let t=w.useContext(oo);return ke(t,kg(e)),t}function y2(e){let t=w.useContext(ud);return ke(t,kg(e)),t}function x2(e){let t=w.useContext(rn);return ke(t,kg(e)),t}function Ng(e){let t=x2(e),n=t.matches[t.matches.length-1];return ke(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function _2(){return Ng("useRouteId")}function w2(){var r;let e=w.useContext(Sg),t=y2("useRouteError"),n=Ng("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function b2(){let{router:e}=v2("useNavigate"),t=Ng("useNavigate"),n=w.useRef(!1);return WS(()=>{n.current=!0}),w.useCallback(async(s,i={})=>{nn(n.current,HS),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...i}))},[e,t])}var Px={};function YS(e,t,n){!t&&!Px[e]&&(Px[e]=!0,nn(!1,n))}w.memo(j2);function j2({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:i}){return GS(e,void 0,{manifest:t,state:r,isStatic:s,onError:i})}function XS({to:e,replace:t,state:n,relative:r}){ke(Hs(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=w.useContext($t);nn(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=w.useContext(rn),{pathname:o}=Dt(),l=Sr(),c=cd(e,jg(i),o,r==="path"),u=JSON.stringify(c);return w.useEffect(()=>{l(JSON.parse(u),{replace:t,state:n,relative:r})},[l,u,r,t,n]),null}function QS(e){return u2(e.context)}function ct(e){ke(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function S2({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:i=!1,useTransitions:o}){ke(!Hs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:l,navigator:s,static:i,useTransitions:o,future:{}}),[l,s,i,o]);typeof n=="string"&&(n=io(n));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:p="default",mask:g}=n,x=w.useMemo(()=>{let _=yr(u,l);return _==null?null:{location:{pathname:_,search:d,hash:f,state:h,key:p,mask:g},navigationType:r}},[l,u,d,f,h,p,r,g]);return nn(x!=null,`<Router basename="${l}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:w.createElement($t.Provider,{value:c},w.createElement(el.Provider,{children:t,value:x}))}function k2({children:e,location:t}){return d2(pp(e),t)}function pp(e,t=[]){let n=[];return w.Children.forEach(e,(r,s)=>{if(!w.isValidElement(r))return;let i=[...t,s];if(r.type===w.Fragment){n.push.apply(n,pp(r.props.children,i));return}ke(r.type===ct,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ke(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=pp(r.props.children,i)),n.push(o)}),n}var bc="get",jc="application/x-www-form-urlencoded";function dd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function N2(e){return dd(e)&&e.tagName.toLowerCase()==="button"}function E2(e){return dd(e)&&e.tagName.toLowerCase()==="form"}function C2(e){return dd(e)&&e.tagName.toLowerCase()==="input"}function T2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function P2(e,t){return e.button===0&&(!t||t==="_self")&&!T2(e)}function mp(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function A2(e,t){let n=mp(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(i=>{n.append(s,i)})}),n}var Dl=null;function R2(){if(Dl===null)try{new FormData(document.createElement("form"),0),Dl=!1}catch{Dl=!0}return Dl}var I2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Nf(e){return e!=null&&!I2.has(e)?(nn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${jc}"`),null):e}function M2(e,t){let n,r,s,i,o;if(E2(e)){let l=e.getAttribute("action");r=l?yr(l,t):null,n=e.getAttribute("method")||bc,s=Nf(e.getAttribute("enctype"))||jc,i=new FormData(e)}else if(N2(e)||C2(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?yr(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||bc,s=Nf(e.getAttribute("formenctype"))||Nf(l.getAttribute("enctype"))||jc,i=new FormData(l,e),!R2()){let{name:u,type:d,value:f}=e;if(d==="image"){let h=u?`${u}.`:"";i.append(`${h}x`,"0"),i.append(`${h}y`,"0")}else u&&i.append(u,f)}}else{if(dd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=bc,r=null,s=jc,o=e}return i&&s==="text/plain"&&(o=i,i=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Eg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ZS(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&yr(s.pathname,t)==="/"?s.pathname=`${du(t)}/_root.${r}`:s.pathname=`${du(s.pathname)}.${r}`,s}async function O2(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function L2(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function $2(e,t,n){let r=await Promise.all(e.map(async s=>{let i=t.routes[s.route.id];if(i){let o=await O2(i,n);return o.links?o.links():[]}return[]}));return V2(r.flat(1).filter(L2).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Ax(e,t,n,r,s,i){let o=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var d;return n[u].pathname!==c.pathname||((d=n[u].route.path)==null?void 0:d.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,u)=>o(c,u)||l(c,u)):i==="data"?t.filter((c,u)=>{var f;let d=r.routes[c.route.id];if(!d||!d.hasLoader)return!1;if(o(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let h=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function D2(e,t,{includeHydrateFallback:n}={}){return z2(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function z2(e){return[...new Set(e)]}function F2(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function V2(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let i=JSON.stringify(F2(s));return n.has(i)||(n.add(i),r.push({key:i,link:s})),r},[])}function Cg(){let e=w.useContext(oo);return Eg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function B2(){let e=w.useContext(ud);return Eg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Tg=w.createContext(void 0);Tg.displayName="FrameworkContext";function fd(){let e=w.useContext(Tg);return Eg(e,"You must render this element inside a <HydratedRouter> element"),e}function U2(e,t){let n=w.useContext(Tg),[r,s]=w.useState(!1),[i,o]=w.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,h=w.useRef(null);w.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let x=v=>{v.forEach(y=>{o(y.isIntersecting)})},_=new IntersectionObserver(x,{threshold:.5});return h.current&&_.observe(h.current),()=>{_.disconnect()}}},[e]),w.useEffect(()=>{if(r){let x=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(x)}}},[r]);let p=()=>{s(!0)},g=()=>{s(!1),o(!1)};return n?e!=="intent"?[i,h,{}]:[i,h,{onFocus:ko(l,p),onBlur:ko(c,g),onMouseEnter:ko(u,p),onMouseLeave:ko(d,g),onTouchStart:ko(f,p)}]:[!1,h,{}]}function ko(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function H2({page:e,...t}){let n=e2(),{nonce:r}=fd(),{router:s}=Cg(),i=w.useMemo(()=>AS(s.routes,e,s.basename),[s.routes,e,s.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?w.createElement(K2,{page:e,matches:i,...t}):w.createElement(G2,{page:e,matches:i,...t})):null}function W2(e){let{manifest:t,routeModules:n}=fd(),[r,s]=w.useState([]);return w.useEffect(()=>{let i=!1;return $2(e,t,n).then(o=>{i||s(o)}),()=>{i=!0}},[e,t,n]),r}function K2({page:e,matches:t,...n}){let r=Dt(),{future:s}=fd(),{basename:i}=Cg(),o=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let l=ZS(e,i,s.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,u=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?c=!0:u.push(d.route.id);return c&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[i,s.v8_trailingSlashAwareDataRequests,e,r,t]);return w.createElement(w.Fragment,null,o.map(l=>w.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...n})))}function G2({page:e,matches:t,...n}){let r=Dt(),{future:s,manifest:i,routeModules:o}=fd(),{basename:l}=Cg(),{loaderData:c,matches:u}=B2(),d=w.useMemo(()=>Ax(e,t,u,i,r,"data"),[e,t,u,i,r]),f=w.useMemo(()=>Ax(e,t,u,i,r,"assets"),[e,t,u,i,r]),h=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let x=new Set,_=!1;if(t.forEach(y=>{var b;let m=i.routes[y.route.id];!m||!m.hasLoader||(!d.some(j=>j.route.id===y.route.id)&&y.route.id in c&&((b=o[y.route.id])!=null&&b.shouldRevalidate)||m.hasClientLoader?_=!0:x.add(y.route.id))}),x.size===0)return[];let v=ZS(e,l,s.v8_trailingSlashAwareDataRequests,"data");return _&&x.size>0&&v.searchParams.set("_routes",t.filter(y=>x.has(y.route.id)).map(y=>y.route.id).join(",")),[v.pathname+v.search]},[l,s.v8_trailingSlashAwareDataRequests,c,r,i,d,t,e,o]),p=w.useMemo(()=>D2(f,i),[f,i]),g=W2(f);return w.createElement(w.Fragment,null,h.map(x=>w.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),p.map(x=>w.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),g.map(({key:x,link:_})=>w.createElement("link",{key:x,nonce:n.nonce,..._,crossOrigin:_.crossOrigin??n.crossOrigin})))}function q2(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Y2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Y2&&(window.__reactRouterVersion="7.18.2")}catch{}function X2({basename:e,children:t,useTransitions:n,window:r}){let s=w.useRef();s.current==null&&(s.current=EI({window:r,v5Compat:!0}));let i=s.current,[o,l]=w.useState({action:i.action,location:i.location}),c=w.useCallback(u=>{n===!1?l(u):w.startTransition(()=>l(u))},[n]);return w.useLayoutEffect(()=>i.listen(c),[i,c]),w.createElement(S2,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:i,useTransitions:n})}var Ue=w.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:i,replace:o,mask:l,state:c,target:u,to:d,preventScrollReset:f,viewTransition:h,defaultShouldRevalidate:p,...g},x){let{basename:_,navigator:v,useTransitions:y}=w.useContext($t),m=typeof d=="string"&&bg.test(d),b=zS(d,_);d=b.to;let j=a2(d,{relative:s}),k=Dt(),S=null;if(l){let E=cd(l,[],k.mask?k.mask.pathname:"/",!0);_!=="/"&&(E.pathname=E.pathname==="/"?_:yn([_,E.pathname])),S=v.createHref(E)}let[N,R,O]=U2(r,g),D=J2(d,{replace:o,mask:l,state:c,target:u,preventScrollReset:f,relative:s,viewTransition:h,defaultShouldRevalidate:p,useTransitions:y});function M(E){t&&t(E),E.defaultPrevented||D(E)}let z=!(b.isExternal||i),T=w.createElement("a",{...g,...O,href:(z?S:void 0)||b.absoluteURL||j,onClick:z?M:t,ref:q2(x,R),target:u,"data-discover":!m&&n==="render"?"true":void 0});return N&&!m?w.createElement(w.Fragment,null,T,w.createElement(H2,{page:j})):T});Ue.displayName="Link";var JS=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:i,to:o,viewTransition:l,children:c,...u},d){let f=tl(o,{relative:u.relative}),h=Dt(),p=w.useContext(ud),{navigator:g,basename:x}=w.useContext($t),_=p!=null&&sM(f)&&l===!0,v=g.encodeLocation?g.encodeLocation(f).pathname:f.pathname,y=h.pathname,m=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(y=y.toLowerCase(),m=m?m.toLowerCase():null,v=v.toLowerCase()),m&&x&&(m=yr(m,x)||m);const b=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let j=y===v||!s&&y.startsWith(v)&&y.charAt(b)==="/",k=m!=null&&(m===v||!s&&m.startsWith(v)&&m.charAt(v.length)==="/"),S={isActive:j,isPending:k,isTransitioning:_},N=j?t:void 0,R;typeof r=="function"?R=r(S):R=[r,j?"active":null,k?"pending":null,_?"transitioning":null].filter(Boolean).join(" ");let O=typeof i=="function"?i(S):i;return w.createElement(Ue,{...u,"aria-current":N,className:R,ref:d,style:O,to:o,viewTransition:l},typeof c=="function"?c(S):c)});JS.displayName="NavLink";var Q2=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:i,method:o=bc,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:h,...p},g)=>{let{useTransitions:x}=w.useContext($t),_=nM(),v=rM(l,{relative:u}),y=o.toLowerCase()==="get"?"get":"post",m=typeof l=="string"&&bg.test(l),b=j=>{if(c&&c(j),j.defaultPrevented)return;j.preventDefault();let k=j.nativeEvent.submitter,S=(k==null?void 0:k.getAttribute("formmethod"))||o,N=()=>_(k||j.currentTarget,{fetcherKey:t,method:S,navigate:n,replace:s,state:i,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:h});x&&n!==!1?w.startTransition(()=>N()):N()};return w.createElement("form",{ref:g,method:y,action:v,onSubmit:r?c:b,...p,"data-discover":!m&&e==="render"?"true":void 0})});Q2.displayName="Form";function Z2(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function e1(e){let t=w.useContext(oo);return ke(t,Z2(e)),t}function J2(e,{target:t,replace:n,mask:r,state:s,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c,useTransitions:u}={}){let d=Sr(),f=Dt(),h=tl(e,{relative:o});return w.useCallback(p=>{if(P2(p,t)){p.preventDefault();let g=n!==void 0?n:ka(f)===ka(h),x=()=>d(e,{replace:g,mask:r,state:s,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c});u?w.startTransition(()=>x()):x()}},[f,d,h,n,r,s,t,e,i,o,l,c,u])}function t1(e){nn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=w.useRef(mp(e)),n=w.useRef(!1),r=Dt(),s=w.useMemo(()=>A2(r.search,n.current?null:t.current),[r.search]),i=Sr(),o=w.useCallback((l,c)=>{const u=mp(typeof l=="function"?l(new URLSearchParams(s)):l);n.current=!0,i("?"+u,c)},[i,s]);return[s,o]}var eM=0,tM=()=>`__${String(++eM)}__`;function nM(){let{router:e}=e1("useSubmit"),{basename:t}=w.useContext($t),n=_2(),r=e.fetch,s=e.navigate;return w.useCallback(async(i,o={})=>{let{action:l,method:c,encType:u,formData:d,body:f}=M2(i,t);if(o.navigate===!1){let h=o.fetcherKey||tM();await r(h,n,o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:f,formMethod:o.method||c,formEncType:o.encType||u,flushSync:o.flushSync})}else await s(o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:f,formMethod:o.method||c,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,s,t,n])}function rM(e,{relative:t}={}){let{basename:n}=w.useContext($t),r=w.useContext(rn);ke(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),i={...tl(e||".",{relative:t})},o=Dt();if(e==null){i.search=o.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(d=>d==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let d=l.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:yn([n,i.pathname])),ka(i)}function sM(e,{relative:t}={}){let n=w.useContext(BS);ke(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=e1("useViewTransitionState"),s=tl(e,{relative:t});if(!n.isTransitioning)return!1;let i=yr(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=yr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Na(s.pathname,o)!=null||Na(s.pathname,i)!=null}function fe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var iM={};function hd(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:iM}var n1=Object.assign,fu=Object.getOwnPropertyDescriptor,Dn=Object.defineProperty,pd=Object.prototype,gp=[];Object.freeze(gp);var r1={};Object.freeze(r1);var oM=typeof Proxy<"u",aM=Object.toString();function s1(){oM||fe("Proxy not available")}function i1(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var pi=function(){};function bn(e){return typeof e=="function"}function Rs(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function md(e){return e!==null&&typeof e=="object"}function Yr(e){if(!md(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===aM}function o1(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function gd(e,t,n){Dn(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function a1(e,t,n){Dn(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Ws(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return md(r)&&r[n]===!0}}function ao(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function lM(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Jn(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var l1=typeof Object.getOwnPropertySymbols<"u";function cM(e){var t=Object.keys(e);if(!l1)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return pd.propertyIsEnumerable.call(e,r)})):t}var vd=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:l1?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function c1(e){return e===null?null:typeof e=="object"?""+e:e}function lr(e,t){return pd.hasOwnProperty.call(e,t)}var uM=Object.getOwnPropertyDescriptors||function(t){var n={};return vd(t).forEach(function(r){n[r]=fu(t,r)}),n};function St(e,t){return!!(e&t)}function kt(e,t,n){return n?e|=t:e&=~t,e}function Rx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function dM(e,t,n){if(u1())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var s=new(e.bind.apply(e,r));return n&&Ea(s,n.prototype),s}function fM(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mM(r.key),r)}}function lo(e,t,n){return t&&fM(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mi(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=gM(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
52
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Is(){return Is=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Is.apply(null,arguments)}function vp(e){return vp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vp(e)}function Pg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ea(e,t)}function hM(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function u1(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(u1=function(){return!!e})()}function Ea(e,t){return Ea=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ea(e,t)}function pM(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function mM(e){var t=pM(e,"string");return typeof t=="symbol"?t:t+""}function gM(e,t){if(e){if(typeof e=="string")return Rx(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rx(e,t):void 0}}function yp(e){var t=typeof Map=="function"?new Map:void 0;return yp=function(n){if(n===null||!hM(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(n))return t.get(n);t.set(n,r)}function r(){return dM(n,arguments,vp(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ea(r,n)},yp(e)}var On=Symbol("mobx-stored-annotations");function zn(e){function t(n,r){if(rl(r))return e.decorate_20223_(n,r);nl(n,r,e)}return Object.assign(t,e)}function nl(e,t,n){lr(e,On)||gd(e,On,Is({},e[On])),jM(n)||(e[On][t]=n)}function vM(e){return lr(e,On)||gd(e,On,Is({},e[On])),e[On]}function rl(e){return typeof e=="object"&&typeof e.kind=="string"}var ae=Symbol("mobx administration"),ts=function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return E1(this)},t.reportChanged=function(){Xt(),C1(this),Qt()},t.toString=function(){return this.name_},lo(e,[{key:"isBeingObserved",get:function(){return St(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=kt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return St(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=kt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return St(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=kt(this.flags_,e.diffValueMask_,r===1)}}])}();ts.isBeingObservedMask_=1;ts.isPendingUnobservationMask_=2;ts.diffValueMask_=4;var Ag=Ws("Atom",ts);function d1(e,t,n){t===void 0&&(t=pi),n===void 0&&(n=pi);var r=new ts(e);return t!==pi&&kO(r,t),n!==pi&&O1(r,n),r}function yM(e,t){return q1(e,t)}function xM(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var hu={structural:yM,default:xM};function Ms(e,t,n){return z1(e)?e:Array.isArray(e)?ye.array(e,{name:n}):Yr(e)?ye.object(e,void 0,{name:n}):ao(e)?ye.map(e,{name:n}):Jn(e)?ye.set(e,{name:n}):typeof e=="function"&&!Fi(e)&&!Ta(e)?o1(e)?Vi(e):Ca(n,e):e}function _M(e,t,n){if(e==null||bd(e)||wd(e)||Gs(e)||In(e))return e;if(Array.isArray(e))return ye.array(e,{name:n,deep:!1});if(Yr(e))return ye.object(e,void 0,{name:n,deep:!1});if(ao(e))return ye.map(e,{name:n,deep:!1});if(Jn(e))return ye.set(e,{name:n,deep:!1})}function yd(e){return e}function wM(e,t){return q1(e,t)?t:e}var bM="override";function jM(e){return e.annotationType_===bM}function sl(e,t){return{annotationType_:e,options_:t,make_:SM,extend_:kM,decorate_20223_:NM}}function SM(e,t,n,r){var s;if((s=this.options_)!=null&&s.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Fi(n.value))return 1;var i=f1(e,this,t,n,!1);return Dn(r,t,i),2}function kM(e,t,n,r){var s=f1(e,this,t,n);return e.defineProperty_(t,s,r)}function NM(e,t){var n=t.kind,r=t.name,s=t.addInitializer,i=this,o=function(u){var d,f,h,p;return Os((d=(f=i.options_)==null?void 0:f.name)!=null?d:r.toString(),u,(h=(p=i.options_)==null?void 0:p.autoAction)!=null?h:!1)};if(n=="field")return function(c){var u,d=c;return Fi(d)||(d=o(d)),(u=i.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var l;return Fi(e)||(e=o(e)),(l=this.options_)!=null&&l.bound&&s(function(){var c=this,u=c[r].bind(c);u.isMobxAction=!0,c[r]=u}),e}fe("Cannot apply '"+i.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
53
+ '`+i.annotationType_+"' can only be used on properties with a function value."))}function EM(e,t,n,r){t.annotationType_,r.value}function f1(e,t,n,r,s){var i,o,l,c,u,d,f;s===void 0&&(s=Q.safeDescriptors),EM(e,t,n,r);var h=r.value;if((i=t.options_)!=null&&i.bound){var p;h=h.bind((p=e.proxy_)!=null?p:e.target_)}return{value:Os((o=(l=t.options_)==null?void 0:l.name)!=null?o:n.toString(),h,(c=(u=t.options_)==null?void 0:u.autoAction)!=null?c:!1,(d=t.options_)!=null&&d.bound?(f=e.proxy_)!=null?f:e.target_:void 0),configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function h1(e,t){return{annotationType_:e,options_:t,make_:CM,extend_:TM,decorate_20223_:PM}}function CM(e,t,n,r){var s;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((s=this.options_)!=null&&s.bound&&(!lr(e.target_,t)||!Ta(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Ta(n.value))return 1;var i=p1(e,this,t,n,!1,!1);return Dn(r,t,i),2}function TM(e,t,n,r){var s,i=p1(e,this,t,n,(s=this.options_)==null?void 0:s.bound);return e.defineProperty_(t,i,r)}function PM(e,t){var n,r=t.name,s=t.addInitializer;return Ta(e)||(e=Vi(e)),(n=this.options_)!=null&&n.bound&&s(function(){var i=this,o=i[r].bind(i);o.isMobXFlow=!0,i[r]=o}),e}function AM(e,t,n,r){t.annotationType_,r.value}function p1(e,t,n,r,s,i){i===void 0&&(i=Q.safeDescriptors),AM(e,t,n,r);var o=r.value;if(Ta(o)||(o=Vi(o)),s){var l;o=o.bind((l=e.proxy_)!=null?l:e.target_),o.isMobXFlow=!0}return{value:o,configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Rg(e,t){return{annotationType_:e,options_:t,make_:RM,extend_:IM,decorate_20223_:MM}}function RM(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function IM(e,t,n,r){return OM(e,this,t,n),e.defineComputedProperty_(t,Is({},this.options_,{get:n.get,set:n.set}),r)}function MM(e,t){var n=this,r=t.name,s=t.addInitializer,i;function o(l,c){var u=Is({},n.options_,{get:e,context:l});return u.name||(u.name="ObservableObject."+r.toString()),new Pt(u)}return s(function(){var l,c=co(this)[ae],u=this,d=c.values_.get(r);d instanceof Pt&&d.derivation!==e&&c.values_.delete(r),((l=c.lazyComputedKeys_)!=null?l:c.lazyComputedKeys_=new Map).set(r,function(){return o(u)})}),function(){var l=this[ae],c=l.values_.get(r);if(c instanceof Pt&&c.derivation!==e){var u,d=(u=i)==null?void 0:u.get(this);if(!d){var f;d=o(this),((f=i)!=null?f:i=new WeakMap).set(this,d)}return d.get()}return l.getObservablePropValue_(r)}}function OM(e,t,n,r){t.annotationType_,r.get}function xd(e,t){return{annotationType_:e,options_:t,make_:LM,extend_:$M,decorate_20223_:DM}}function LM(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function $M(e,t,n,r){var s,i;return zM(e,this),e.defineObservableProperty_(t,n.value,(s=(i=this.options_)==null?void 0:i.enhancer)!=null?s:Ms,r)}function DM(e,t){var n=this,r=t.kind,s=t.name;if(r!=="accessor")return;function i(o,l){var c,u=co(o)[ae];return((c=u.lazyObservableKeys_)!=null?c:u.lazyObservableKeys_=new Map).set(s,function(){var d,f;return new js(l,(d=(f=n.options_)==null?void 0:f.enhancer)!=null?d:Ms,"ObservableObject."+s.toString(),!1)}),u}return{get:function(){var l,c=(l=this[ae])!=null?l:i(this,e.get.call(this));return c.getObservablePropValue_(s)},set:function(l){var c,u=(c=this[ae])!=null?c:i(this,l);return u.setObservablePropValue_(s,l)},init:function(l){return i(this,l),l}}}function zM(e,t,n,r){t.annotationType_}var FM="true",VM=m1();function m1(e){return{annotationType_:FM,options_:e,make_:BM,extend_:UM,decorate_20223_:HM}}function BM(e,t,n,r){var s,i;if(n.get)return er.make_(e,t,n,r);if(n.set){var o=Fi(n.set)?n.set:Os(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:Q.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(Dn(r,t,{configurable:!0,set:o}),2)}if(r!==e.target_&&typeof n.value=="function"){var l;if(o1(n.value)){var c,u=(c=this.options_)!=null&&c.autoBind?Vi.bound:Vi;return u.make_(e,t,n,r)}var d=(l=this.options_)!=null&&l.autoBind?Ca.bound:Ca;return d.make_(e,t,n,r)}var f=((s=this.options_)==null?void 0:s.deep)===!1?ye.ref:ye;if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var h;n.value=n.value.bind((h=e.proxy_)!=null?h:e.target_)}return f.make_(e,t,n,r)}function UM(e,t,n,r){var s,i;if(n.get)return er.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:Q.safeDescriptors?e.isPlainObject_:!0,set:Os(t.toString(),n.set)},r);if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var o;n.value=n.value.bind((o=e.proxy_)!=null?o:e.target_)}var l=((i=this.options_)==null?void 0:i.deep)===!1?ye.ref:ye;return l.extend_(e,t,n,r)}function HM(e,t){fe("'"+this.annotationType_+"' cannot be used as a decorator")}var WM="observable",KM="observable.ref",GM="observable.shallow",qM="observable.struct",g1={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(g1);function zl(e){return e||g1}var xp=xd(WM),YM=xd(KM,{enhancer:yd}),XM=xd(GM,{enhancer:_M}),QM=xd(qM,{enhancer:wM}),v1=zn(xp);function Fl(e){return e.deep===!0?Ms:e.deep===!1?yd:JM(e.defaultDecorator)}function ZM(e){var t;return e?(t=e.defaultDecorator)!=null?t:m1(e):void 0}function JM(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Ms}function y1(e,t,n){if(rl(t))return xp.decorate_20223_(e,t);if(Rs(t)){nl(e,t,xp);return}return z1(e)?e:Yr(e)?ye.object(e,t,n):Array.isArray(e)?ye.array(e,t):ao(e)?ye.map(e,t):Jn(e)?ye.set(e,t):typeof e=="object"&&e!==null?e:ye.box(e,t)}n1(y1,v1);var eO={box:function(t,n){var r=zl(n);return new js(t,Fl(r),r.name,!0,r.equals)},array:function(t,n){var r=zl(n);return(Q.useProxies===!1||r.proxy===!1?YO:zO)(t,Fl(r),r.name)},map:function(t,n){var r=zl(n);return new B1(t,Fl(r),r.name)},set:function(t,n){var r=zl(n);return new U1(t,Fl(r),r.name)},object:function(t,n,r){return qs(function(){return CO(Q.useProxies===!1||(r==null?void 0:r.proxy)===!1?co({},r):LO({},r),t,n)})},ref:zn(YM),shallow:zn(XM),deep:v1,struct:zn(QM)},ye=n1(y1,eO),x1="computed",tO="computed.struct",_p=Rg(x1),nO=Rg(tO,{equals:hu.structural}),er=function(t,n){if(rl(n))return _p.decorate_20223_(t,n);if(Rs(n))return nl(t,n,_p);if(Yr(t))return zn(Rg(x1,t));var r=Yr(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new Pt(r)};Object.assign(er,_p);er.struct=zn(nO);var Ix,Mx,pu=0,rO=1,sO=(Ix=(Mx=fu(function(){},"name"))==null?void 0:Mx.configurable)!=null?Ix:!1,Ox={value:"action",configurable:!0,writable:!1,enumerable:!1};function Os(e,t,n,r){n===void 0&&(n=!1);function s(){return _1(e,n,t,r||this,arguments)}return s.isMobxAction=!0,s.toString=function(){return t.toString()},sO&&(Ox.value=e,Dn(s,"name",Ox)),s}function _1(e,t,n,r,s){var i=iO(e,t);try{return n.apply(r,s)}catch(o){throw i.error_=o,o}finally{oO(i)}}function iO(e,t,n,r){var s=!1,i=0,o=Q.trackingDerivation,l=!t||!o;Xt();var c=Q.allowStateChanges;l&&(Ks(),c=Ig(!0));var u=Og(!0),d={runAsAction_:l,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:u,notifySpy_:s,startTime_:i,actionId_:rO++,parentActionId_:pu};return pu=d.actionId_,d}function oO(e){pu!==e.actionId_&&fe(30),pu=e.parentActionId_,e.error_!==void 0&&(Q.suppressReactionErrors=!0),Mg(e.prevAllowStateChanges_),Zo(e.prevAllowStateReads_),Qt(),e.runAsAction_&&cr(e.prevDerivation_),Q.suppressReactionErrors=!1}function Ig(e){var t=Q.allowStateChanges;return Q.allowStateChanges=e,t}function Mg(e){Q.allowStateChanges=e}var js=function(e){function t(r,s,i,o,l){var c;return i===void 0&&(i="ObservableValue"),l===void 0&&(l=hu.default),c=e.call(this,i)||this,c.enhancer=void 0,c.name_=void 0,c.equals=void 0,c.hasUnreportedChange_=!1,c.interceptors_=void 0,c.changeListeners_=void 0,c.value_=void 0,c.dehancer=void 0,c.enhancer=s,c.name_=i,c.equals=l,c.value_=s(r,void 0,i),c}Pg(t,e);var n=t.prototype;return n.dehanceValue=function(s){return this.dehancer!==void 0?this.dehancer(s):s},n.set=function(s){this.value_,s=this.prepareNewValue_(s),s!==Q.UNCHANGED&&this.setNewValue_(s)},n.prepareNewValue_=function(s){if(Gt(this)){var i=qt(this,{object:this,type:Fn,newValue:s});if(!i)return Q.UNCHANGED;s=i.newValue}return s=this.enhancer(s,this.value_,this.name_),this.equals(this.value_,s)?Q.UNCHANGED:s},n.setNewValue_=function(s){var i=this.value_;this.value_=s,this.reportChanged(),xn(this)&&_n(this,{type:Fn,object:this,newValue:s,oldValue:i})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(s){return il(this,s)},n.observe_=function(s,i){return i&&s({observableKind:"value",debugObjectName:this.name_,object:this,type:Fn,newValue:this.value_,oldValue:void 0}),ol(this,s)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return c1(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(ts),Pt=function(){function e(n){this.dependenciesState_=ge.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=ge.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new gu(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=mu.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||fe(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Os("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?hu.structural:hu.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){dO(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&fe(32,this.name_,this.derivation),Q.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)wp(this)&&(this.warnAboutUntrackedRead_(),Xt(),this.value_=this.computeValue_(!1),Qt());else if(E1(this),wp(this)){var r=Q.trackingContext;this.keepAlive_&&!r&&(Q.trackingContext=this),this.trackAndCompute()&&uO(this),Q.trackingContext=r}var s=this.value_;if(Sc(s))throw s.cause;return s},t.set=function(r){if(this.setter_){this.isRunningSetter&&fe(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else fe(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,s=this.dependenciesState_===ge.NOT_TRACKING_,i=this.computeValue_(!0),o=s||Sc(r)||Sc(i)||!this.equals_(r,i);return o&&(this.value_=i),o},t.computeValue_=function(r){this.isComputing=!0;var s=Ig(!1),i;if(r)i=w1(this,this.derivation,this.scope_);else if(Q.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new gu(o)}return Mg(s),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(bp(this),this.value_=void 0)},t.observe_=function(r,s){var i=this,o=!0,l=void 0;return M1(function(){var c=i.get();if(!o||s){var u=Ks();r({observableKind:"computed",debugObjectName:i.name_,type:Fn,object:i,newValue:c,oldValue:l}),cr(u)}o=!1,l=c})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return c1(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},lo(e,[{key:"isComputing",get:function(){return St(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=kt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return St(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=kt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return St(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=kt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return St(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=kt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return St(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=kt(this.flags_,e.diffValueMask_,r===1)}}])}();Pt.isComputingMask_=1;Pt.isRunningSetterMask_=2;Pt.isBeingObservedMask_=4;Pt.isPendingUnobservationMask_=8;Pt.diffValueMask_=16;var _d=Ws("ComputedValue",Pt),ge;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(ge||(ge={}));var mu;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(mu||(mu={}));var gu=function(t){this.cause=void 0,this.cause=t};function Sc(e){return e instanceof gu}function wp(e){switch(e.dependenciesState_){case ge.UP_TO_DATE_:return!1;case ge.NOT_TRACKING_:case ge.STALE_:return!0;case ge.POSSIBLY_STALE_:{for(var t=Og(!0),n=Ks(),r=e.observing_,s=r.length,i=0;i<s;i++){var o=r[i];if(_d(o)){if(Q.disableErrorBoundaries)o.get();else try{o.get()}catch{return cr(n),Zo(t),!0}if(e.dependenciesState_===ge.STALE_)return cr(n),Zo(t),!0}}return j1(e),cr(n),Zo(t),!1}}}function w1(e,t,n){var r=Og(!0);j1(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Q.runId;var s=Q.trackingDerivation;Q.trackingDerivation=e,Q.inBatch++;var i;if(Q.disableErrorBoundaries===!0)i=t.call(n);else try{i=t.call(n)}catch(o){i=new gu(o)}return Q.inBatch--,Q.trackingDerivation=s,aO(e),Zo(r),i}function aO(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=ge.UP_TO_DATE_,s=0,i=e.unboundDepsCount_,o=0;o<i;o++){var l=n[o];l.diffValue===0&&(l.diffValue=1,s!==o&&(n[s]=l),s++),l.dependenciesState_>r&&(r=l.dependenciesState_)}for(n.length=s,e.newObserving_=null,i=t.length;i--;){var c=t[i];c.diffValue===0&&k1(c,e),c.diffValue=0}for(;s--;){var u=n[s];u.diffValue===1&&(u.diffValue=0,cO(u,e))}r!==ge.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function bp(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)k1(t[n],e);e.dependenciesState_=ge.NOT_TRACKING_}function b1(e){var t=Ks();try{return e()}finally{cr(t)}}function Ks(){var e=Q.trackingDerivation;return Q.trackingDerivation=null,e}function cr(e){Q.trackingDerivation=e}function Og(e){var t=Q.allowStateReads;return Q.allowStateReads=e,t}function Zo(e){Q.allowStateReads=e}function j1(e){if(e.dependenciesState_!==ge.UP_TO_DATE_){e.dependenciesState_=ge.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=ge.UP_TO_DATE_}}var kc=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Nc=!0,S1=!1,Q=function(){var e=hd();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Nc=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new kc().version&&(Nc=!1),Nc?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new kc):(setTimeout(function(){S1||fe(35)},1),new kc)}();function lO(){if((Q.pendingReactions.length||Q.inBatch||Q.isRunningReactions)&&fe(36),S1=!0,Nc){var e=hd();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Q=new kc}}function cO(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function k1(e,t){e.observers_.delete(t),e.observers_.size===0&&N1(e)}function N1(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,Q.pendingUnobservations.push(e))}function Xt(){Q.inBatch++}function Qt(){if(--Q.inBatch===0){T1();for(var e=Q.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof Pt&&n.suspend_())}Q.pendingUnobservations=[]}}function E1(e){var t=Q.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Q.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&Q.inBatch>0&&N1(e),!1)}function C1(e){e.lowestObserverState_!==ge.STALE_&&(e.lowestObserverState_=ge.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ge.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=ge.STALE_}))}function uO(e){e.lowestObserverState_!==ge.STALE_&&(e.lowestObserverState_=ge.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ge.POSSIBLY_STALE_?t.dependenciesState_=ge.STALE_:t.dependenciesState_===ge.UP_TO_DATE_&&(e.lowestObserverState_=ge.UP_TO_DATE_)}))}function dO(e){e.lowestObserverState_===ge.UP_TO_DATE_&&(e.lowestObserverState_=ge.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ge.UP_TO_DATE_&&(t.dependenciesState_=ge.POSSIBLY_STALE_,t.onBecomeStale_())}))}var xr=function(){function e(n,r,s,i){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=ge.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=mu.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=s,this.requiresObservable_=i}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Q.pendingReactions.push(this),T1())},t.runReaction_=function(){if(!this.isDisposed){Xt(),this.isScheduled=!1;var r=Q.trackingContext;if(Q.trackingContext=this,wp(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(s){this.reportExceptionInDerivation_(s)}}Q.trackingContext=r,Qt()}},t.track=function(r){if(!this.isDisposed){Xt(),this.isRunning=!0;var s=Q.trackingContext;Q.trackingContext=this;var i=w1(this,r,void 0);Q.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&bp(this),Sc(i)&&this.reportExceptionInDerivation_(i.cause),Qt()}},t.reportExceptionInDerivation_=function(r){var s=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(Q.disableErrorBoundaries)throw r;var i="[mobx] uncaught error in '"+this+"'";Q.suppressReactionErrors||console.error(i,r),Q.globalReactionErrorHandlers.forEach(function(o){return o(r,s)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Xt(),bp(this),Qt()))},t.getDisposer_=function(r){var s=this,i=function o(){s.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",o)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[ae]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(i[Symbol.dispose]=i),i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},lo(e,[{key:"isDisposed",get:function(){return St(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=kt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return St(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=kt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return St(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=kt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return St(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=kt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return St(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=kt(this.flags_,e.diffValueMask_,r===1)}}])}();xr.isDisposedMask_=1;xr.isScheduledMask_=2;xr.isTrackPendingMask_=4;xr.isRunningMask_=8;xr.diffValueMask_=16;var fO=100,jp=function(t){return t()};function T1(){Q.inBatch>0||Q.isRunningReactions||jp(hO)}function hO(){Q.isRunningReactions=!0;for(var e=Q.pendingReactions,t=0;e.length>0;){++t===fO&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,s=n.length;r<s;r++)n[r].runReaction_()}Q.isRunningReactions=!1}var vu=Ws("Reaction",xr);function pO(e){var t=jp;jp=function(r){return e(function(){return t(r)})}}function Jo(){return!1}function mO(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var P1="action",gO="action.bound",A1="autoAction",vO="autoAction.bound",R1="<unnamed action>",Sp=sl(P1),yO=sl(gO,{bound:!0}),kp=sl(A1,{autoAction:!0}),xO=sl(vO,{autoAction:!0,bound:!0});function I1(e){var t=function(r,s){if(bn(r))return Os(r.name||R1,r,e);if(bn(s))return Os(r,s,e);if(rl(s))return(e?kp:Sp).decorate_20223_(r,s);if(Rs(s))return nl(r,s,e?kp:Sp);if(Rs(r))return zn(sl(e?A1:P1,{name:r,autoAction:e}))};return t}var oe=I1(!1);Object.assign(oe,Sp);var Ca=I1(!0);Object.assign(Ca,kp);oe.bound=zn(yO);Ca.bound=zn(xO);function _O(e){return _1(e.name||R1,!1,e,this,void 0)}function Fi(e){return bn(e)&&e.isMobxAction===!0}function M1(e,t){var n,r,s,i;t===void 0&&(t=r1);var o=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",l=!t.scheduler&&!t.delay,c;if(l)c=new xr(o,function(){this.track(f)},t.onError,t.requiresObservable);else{var u=bO(t),d=!1;c=new xr(o,function(){d||(d=!0,u(function(){d=!1,c.isDisposed||c.track(f)}))},t.onError,t.requiresObservable)}function f(){e(c)}return(s=t)!=null&&(s=s.signal)!=null&&s.aborted||c.schedule_(),c.getDisposer_((i=t)==null?void 0:i.signal)}var wO=function(t){return t()};function bO(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:wO}var jO="onBO",SO="onBUO";function kO(e,t,n){return L1(jO,e,t,n)}function O1(e,t,n){return L1(SO,e,t,n)}function L1(e,t,n,r){var s=_u(t),i=bn(r)?r:n,o=e+"L";return s[o]?s[o].add(i):s[o]=new Set([i]),function(){var l=s[o];l&&(l.delete(i),l.size===0&&delete s[o])}}var NO="never",Vl="always",EO="observed";function $1(e){e.isolateGlobalState===!0&&lO();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(Q.useProxies=t===Vl?!0:t===NO?!1:typeof Proxy<"u"),t==="ifavailable"&&(Q.verifyProxies=!0),n!==void 0){var r=n===Vl?Vl:n===EO;Q.enforceActions=r,Q.allowStateChanges=!(r===!0||r===Vl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(s){s in e&&(Q[s]=!!e[s])}),Q.allowStateReads=!Q.observableRequiresReaction,e.reactionScheduler&&pO(e.reactionScheduler)}function CO(e,t,n,r){var s=uM(t);return qs(function(){var i=co(e,r)[ae];vd(s).forEach(function(o){i.extend_(o,s[o],n&&o in n?n[o]:!0)})}),e}function TO(e,t){return D1(_u(e,t))}function D1(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=PO(e.observing_).map(D1)),t}function PO(e){return Array.from(new Set(e))}var AO=0,RO=function(e){function t(){var r;return r=e.call(this,"FLOW_CANCELLED")||this,Object.setPrototypeOf(r,(this instanceof t?this.constructor:void 0).prototype),r.name="FlowCancellationError",r}Pg(t,e);var n=t.prototype;return n.toString=function(){return"Error: "+this.message},t}(yp(Error)),Ef=h1("flow"),IO=h1("flow.bound",{bound:!0}),Vi=Object.assign(function(t,n){if(rl(n))return Ef.decorate_20223_(t,n);if(Rs(n))return nl(t,n,Ef);var r=t,s=r.name||"<unnamed flow>",i=function(){var l=this,c=arguments,u=++AO,d=oe(s+" - runid: "+u+" - init",r).apply(l,c),f,h=void 0,p=new Promise(function(g,x){var _=0;f=x;function v(b){h=void 0;var j;try{j=oe(s+" - runid: "+u+" - yield "+_++,d.next).call(d,b)}catch(k){return x(k)}m(j)}function y(b){h=void 0;var j;try{j=oe(s+" - runid: "+u+" - yield "+_++,d.throw).call(d,b)}catch(k){return x(k)}m(j)}function m(b){if(bn(b==null?void 0:b.then)){b.then(m,x);return}return b.done?g(b.value):(h=Promise.resolve(b.value),h.then(v,y))}v(void 0)});return p.cancel=oe(s+" - runid: "+u+" - cancel",function(){try{h&&Lx(h);var g=d.return(void 0),x=Promise.resolve(g.value);x.then(pi,pi),Lx(x),f(new RO)}catch(_){f(_)}}),p};return i.isMobXFlow=!0,i},Ef);Vi.bound=zn(IO);function Lx(e){bn(e.cancel)&&e.cancel()}function Ta(e){return(e==null?void 0:e.isMobXFlow)===!0}function MO(e,t){return e?bd(e)||!!e[ae]||Ag(e)||vu(e)||_d(e):!1}function z1(e){return MO(e)}function tr(e,t){t===void 0&&(t=void 0),Xt();try{return e.apply(t)}finally{Qt()}}function Zs(e){return e[ae]}var OO={has:function(t,n){return Zs(t).has_(n)},get:function(t,n){return Zs(t).get_(n)},set:function(t,n,r){var s;return Rs(n)?(s=Zs(t).set_(n,r,!0))!=null?s:!0:!1},deleteProperty:function(t,n){var r;return Rs(n)?(r=Zs(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var s;return(s=Zs(t).defineProperty_(n,r))!=null?s:!0},ownKeys:function(t){return Zs(t).ownKeys_()},preventExtensions:function(t){fe(13)}};function LO(e,t){var n,r;return s1(),e=co(e,t),(r=(n=e[ae]).proxy_)!=null?r:n.proxy_=new Proxy(e,OO)}function Gt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function il(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),i1(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function qt(e,t){var n=Ks();try{for(var r=[].concat(e.interceptors_||[]),s=0,i=r.length;s<i&&(t=r[s](t),t&&!t.type&&fe(14),!!t);s++);return t}finally{cr(n)}}function xn(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ol(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),i1(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function _n(e,t){var n=Ks(),r=e.changeListeners_;if(r){r=r.slice();for(var s=0,i=r.length;s<i;s++)r[s](t);cr(n)}}function F1(e,t,n){return qs(function(){var r,s=co(e,n)[ae];(r=t)!=null||(t=vM(e)),vd(t).forEach(function(i){return s.make_(i,t[i])})}),e}var $x="splice",Fn="update",$O=1e4,DO={get:function(t,n){var r=t[ae];return n===ae?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):lr(yu,n)?yu[n]:t[n]},set:function(t,n,r){var s=t[ae];return n==="length"&&s.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:s.set_(parseInt(n),r),!0},preventExtensions:function(){fe(15)}},Lg=function(){function e(n,r,s,i){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=s,this.legacyMode_=i,this.atom_=new ts(n),this.enhancer_=function(o,l){return r(o,l,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return il(this,r)},t.observe_=function(r,s){return s===void 0&&(s=!1),s&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),ol(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&fe("Out of range: "+r);var s=this.values_.length;if(r!==s)if(r>s){for(var i=new Array(r-s),o=0;o<r-s;o++)i[o]=void 0;this.spliceWithArray_(s,0,i)}else this.spliceWithArray_(r,s-r)},t.updateArrayLength_=function(r,s){r!==this.lastKnownLength_&&fe(16),this.lastKnownLength_+=s,this.legacyMode_&&s>0&&G1(r+s+1)},t.spliceWithArray_=function(r,s,i){var o=this;this.atom_;var l=this.values_.length;if(r===void 0?r=0:r>l?r=l:r<0&&(r=Math.max(0,l+r)),arguments.length===1?s=l-r:s==null?s=0:s=Math.max(0,Math.min(s,l-r)),i===void 0&&(i=gp),Gt(this)){var c=qt(this,{object:this.proxy_,type:$x,index:r,removedCount:s,added:i});if(!c)return gp;s=c.removedCount,i=c.added}if(i=i.length===0?i:i.map(function(f){return o.enhancer_(f,void 0)}),this.legacyMode_){var u=i.length-s;this.updateArrayLength_(l,u)}var d=this.spliceItemsIntoValues_(r,s,i);return(s!==0||i.length!==0)&&this.notifyArraySplice_(r,i,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,s,i){if(i.length<$O){var o;return(o=this.values_).splice.apply(o,[r,s].concat(i))}else{var l=this.values_.slice(r,r+s),c=this.values_.slice(r+s);this.values_.length+=i.length-s;for(var u=0;u<i.length;u++)this.values_[r+u]=i[u];for(var d=0;d<c.length;d++)this.values_[r+i.length+d]=c[d];return l}},t.notifyArrayChildUpdate_=function(r,s,i){var o=!this.owned_&&Jo(),l=xn(this),c=l||o?{observableKind:"array",object:this.proxy_,type:Fn,debugObjectName:this.atom_.name_,index:r,newValue:s,oldValue:i}:null;this.atom_.reportChanged(),l&&_n(this,c)},t.notifyArraySplice_=function(r,s,i){var o=!this.owned_&&Jo(),l=xn(this),c=l||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:$x,index:r,removed:i,added:s,removedCount:i.length,addedCount:s.length}:null;this.atom_.reportChanged(),l&&_n(this,c)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,s){var i=this.values_;if(this.legacyMode_&&r>i.length&&fe(17,r,i.length),r<i.length){this.atom_;var o=i[r];if(Gt(this)){var l=qt(this,{type:Fn,object:this.proxy_,index:r,newValue:s});if(!l)return;s=l.newValue}s=this.enhancer_(s,o);var c=s!==o;c&&(i[r]=s,this.notifyArrayChildUpdate_(r,s,o))}else{for(var u=new Array(r+1-i.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=s,this.spliceWithArray_(i.length,0,u)}},e}();function zO(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),s1(),qs(function(){var s=new Lg(n,t,r,!1);a1(s.values_,ae,s);var i=new Proxy(s.values_,DO);return s.proxy_=i,e&&e.length&&s.spliceWithArray_(0,0,e),i})}var yu={clear:function(){return this.splice(0)},replace:function(t){var n=this[ae];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];var o=this[ae];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(t);case 2:return o.spliceWithArray_(t,n)}return o.spliceWithArray_(t,n,s)},spliceWithArray:function(t,n,r){return this[ae].spliceWithArray_(t,n,r)},push:function(){for(var t=this[ae],n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[ae].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[ae],n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return Q.trackingDerivation&&fe(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Q.trackingDerivation&&fe(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[ae],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};we("at",zt);we("concat",zt);we("flat",zt);we("includes",zt);we("indexOf",zt);we("join",zt);we("lastIndexOf",zt);we("slice",zt);we("toString",zt);we("toLocaleString",zt);we("toSorted",zt);we("toSpliced",zt);we("with",zt);we("every",Sn);we("filter",Sn);we("find",Sn);we("findIndex",Sn);we("findLast",Sn);we("findLastIndex",Sn);we("flatMap",Sn);we("forEach",Sn);we("map",Sn);we("some",Sn);we("toReversed",Sn);we("reduce",V1);we("reduceRight",V1);function we(e,t){typeof Array.prototype[e]=="function"&&(yu[e]=t(e))}function zt(e){return function(){var t=this[ae];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Sn(e){return function(t,n){var r=this,s=this[ae];s.atom_.reportObserved();var i=s.dehanceValues_(s.values_);return i[e](function(o,l){return t.call(n,o,l,r)})}}function V1(e){return function(){var t=this,n=this[ae];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),s=arguments[0];return arguments[0]=function(i,o,l){return s(i,o,l,t)},r[e].apply(r,arguments)}}var FO=Ws("ObservableArrayAdministration",Lg);function wd(e){return md(e)&&FO(e[ae])}var VO={},$r="add",xu="delete",B1=function(){function e(n,r,s){var i=this;r===void 0&&(r=Ms),s===void 0&&(s="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[ae]=VO,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=s,bn(Map)||fe(18),qs(function(){i.keysAtom_=d1("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,n&&i.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var s=this;if(!Q.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new js(this.has_(r),yd,"ObservableMap.key?",!1);this.hasMap_.set(r,o),O1(o,function(){return s.hasMap_.delete(r)})}return i.get()},t.set=function(r,s){var i=this.has_(r);if(Gt(this)){var o=qt(this,{type:i?Fn:$r,object:this,newValue:s,name:r});if(!o)return this;s=o.newValue}return i?this.updateValue_(r,s):this.addValue_(r,s),this},t.delete=function(r){var s=this;if(this.keysAtom_,Gt(this)){var i=qt(this,{type:xu,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=Jo(),l=xn(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:xu,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return tr(function(){var u;s.keysAtom_.reportChanged(),(u=s.hasMap_.get(r))==null||u.setNewValue_(!1);var d=s.data_.get(r);d.setNewValue_(void 0),s.data_.delete(r)}),l&&_n(this,c),!0}return!1},t.updateValue_=function(r,s){var i=this.data_.get(r);if(s=i.prepareNewValue_(s),s!==Q.UNCHANGED){var o=Jo(),l=xn(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:Fn,object:this,oldValue:i.value_,name:r,newValue:s}:null;i.setNewValue_(s),l&&_n(this,c)}},t.addValue_=function(r,s){var i=this;this.keysAtom_,tr(function(){var u,d=new js(s,i.enhancer_,"ObservableMap.key",!1);i.data_.set(r,d),s=d.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=Jo(),l=xn(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:$r,object:this,name:r,newValue:s}:null;l&&_n(this,c)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.getOrInsert=function(r,s){return this.has(r)||this.set(r,s),this.get(r)},t.getOrInsertComputed=function(r,s){return this.has(r)||this.set(r,s(r)),this.get(r)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,s=this.keys();return Dx({next:function(){var o=s.next(),l=o.done,c=o.value;return{done:l,value:l?void 0:r.get(c)}}})},t.entries=function(){var r=this,s=this.keys();return Dx({next:function(){var o=s.next(),l=o.done,c=o.value;return{done:l,value:l?void 0:[c,r.get(c)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,s){for(var i=mi(this),o;!(o=i()).done;){var l=o.value,c=l[0],u=l[1];r.call(s,u,c,this)}},t.merge=function(r){var s=this;return Gs(r)&&(r=new Map(r)),tr(function(){Yr(r)?cM(r).forEach(function(i){return s.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var o=i[0],l=i[1];return s.set(o,l)}):ao(r)?(lM(r)||fe(19,r),r.forEach(function(i,o){return s.set(o,i)})):r!=null&&fe(20,r)}),this},t.clear=function(){var r=this;tr(function(){b1(function(){for(var s=mi(r.keys()),i;!(i=s()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var s=this;return tr(function(){for(var i=BO(r),o=new Map,l=!1,c=mi(s.data_.keys()),u;!(u=c()).done;){var d=u.value;if(!i.has(d)){var f=s.delete(d);if(f)l=!0;else{var h=s.data_.get(d);o.set(d,h)}}}for(var p=mi(i.entries()),g;!(g=p()).done;){var x=g.value,_=x[0],v=x[1],y=s.data_.has(_);if(s.set(_,v),s.data_.has(_)){var m=s.data_.get(_);o.set(_,m),y||(l=!0)}}if(!l)if(s.data_.size!==o.size)s.keysAtom_.reportChanged();else for(var b=s.data_.keys(),j=o.keys(),k=b.next(),S=j.next();!k.done;){if(k.value!==S.value){s.keysAtom_.reportChanged();break}k=b.next(),S=j.next()}s.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,s){return ol(this,r)},t.intercept_=function(r){return il(this,r)},lo(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Gs=Ws("ObservableMap",B1);function Dx(e){return e[Symbol.toStringTag]="MapIterator",Dg(e)}function BO(e){if(ao(e)||Gs(e))return e;if(Array.isArray(e))return new Map(e);if(Yr(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return fe(21,e)}var UO={},U1=function(){function e(n,r,s){var i=this;r===void 0&&(r=Ms),s===void 0&&(s="ObservableSet"),this.name_=void 0,this[ae]=UO,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=s,bn(Set)||fe(22),this.enhancer_=function(o,l){return r(o,l,s)},qs(function(){i.atom_=d1(i.name_),n&&i.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;tr(function(){b1(function(){for(var s=mi(r.data_.values()),i;!(i=s()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,s){for(var i=mi(this),o;!(o=i()).done;){var l=o.value;r.call(s,l,l,this)}},t.add=function(r){var s=this;if(this.atom_,Gt(this)){var i=qt(this,{type:$r,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){tr(function(){s.data_.add(s.enhancer_(r,void 0)),s.atom_.reportChanged()});var o=!1,l=xn(this),c=l||o?{observableKind:"set",debugObjectName:this.name_,type:$r,object:this,newValue:r}:null;l&&_n(this,c)}return this},t.delete=function(r){var s=this;if(Gt(this)){var i=qt(this,{type:xu,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=!1,l=xn(this),c=l||o?{observableKind:"set",debugObjectName:this.name_,type:xu,object:this,oldValue:r}:null;return tr(function(){s.atom_.reportChanged(),s.data_.delete(r)}),l&&_n(this,c),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return zx({next:function(){var i=r.next(),o=i.value,l=i.done;return l?{value:void 0,done:l}:{value:[o,o],done:l}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,s=this.data_.values();return zx({next:function(){var o=s.next(),l=o.value,c=o.done;return c?{value:void 0,done:c}:{value:r.dehanceValue_(l),done:c}}})},t.intersection=function(r){if(Jn(r)&&!In(r))return r.intersection(this);var s=new Set(this);return s.intersection(r)},t.union=function(r){if(Jn(r)&&!In(r))return r.union(this);var s=new Set(this);return s.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Jn(r)&&!In(r))return r.symmetricDifference(this);var s=new Set(this);return s.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Jn(r)&&!In(r))return r.isDisjointFrom(this);var s=new Set(this);return s.isDisjointFrom(r)},t.replace=function(r){var s=this;return In(r)&&(r=new Set(r)),tr(function(){Array.isArray(r)?(s.clear(),r.forEach(function(i){return s.add(i)})):Jn(r)?(s.clear(),r.forEach(function(i){return s.add(i)})):r!=null&&fe("Cannot initialize set from "+r)}),this},t.observe_=function(r,s){return ol(this,r)},t.intercept_=function(r){return il(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},lo(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),In=Ws("ObservableSet",U1);function zx(e){return e[Symbol.toStringTag]="SetIterator",Dg(e)}var Fx=Object.create(null),Vx="remove",H1=function(){function e(n,r,s,i){r===void 0&&(r=new Map),i===void 0&&(i=VM),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=n,this.values_=r,this.name_=s,this.defaultAnnotation_=i,this.keysAtom_=new ts("ObservableObject.keys"),this.isPlainObject_=Yr(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){var s,i,o=(s=(i=this.values_.get(r))!=null?i:this.materializeLazyComputed_(r))!=null?s:this.materializeLazyObservable_(r);return o.get()},t.materializeLazyComputed_=function(r){var s,i=(s=this.lazyComputedKeys_)==null?void 0:s.get(r);if(i){this.lazyComputedKeys_.delete(r),this.lazyComputedKeys_.size===0&&(this.lazyComputedKeys_=void 0);var o=i();return this.values_.set(r,o),o}},t.materializeLazyObservable_=function(r){var s,i=(s=this.lazyObservableKeys_)==null?void 0:s.get(r);if(i){this.lazyObservableKeys_.delete(r),this.lazyObservableKeys_.size===0&&(this.lazyObservableKeys_=void 0);var o=i();return this.values_.set(r,o),o}},t.setObservablePropValue_=function(r,s){var i,o,l=(i=(o=this.values_.get(r))!=null?o:this.materializeLazyComputed_(r))!=null?i:this.materializeLazyObservable_(r);if(l instanceof Pt)return l.set(s),!0;if(Gt(this)){var c=qt(this,{type:Fn,object:this.proxy_||this.target_,name:r,newValue:s});if(!c)return null;s=c.newValue}if(s=l.prepareNewValue_(s),s!==Q.UNCHANGED){var u=xn(this),d=!1,f=u||d?{type:Fn,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:l.value_,name:r,newValue:s}:null;l.setNewValue_(s),u&&_n(this,f)}return!0},t.get_=function(r){return Q.trackingDerivation&&!lr(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,s,i){return i===void 0&&(i=!1),lr(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,s):i?Reflect.set(this.target_,r,s):(this.target_[r]=s,!0):this.extend_(r,{value:s,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!Q.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var s=this.pendingKeys_.get(r);return s||(s=new js(r in this.target_,yd,"ObservableObject.key?",!1),this.pendingKeys_.set(r,s)),s.get()},t.make_=function(r,s){if(s===!0&&(s=this.defaultAnnotation_),s!==!1){if(!(r in this.target_)){var i;if((i=this.target_[On])!=null&&i[r])return;fe(1,s.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==pd;){var l=fu(o,r);if(l){var c=s.make_(this,r,l,o);if(c===0)return;if(c===1)break}o=Object.getPrototypeOf(o)}Ux(this,s,r)}},t.extend_=function(r,s,i,o){if(o===void 0&&(o=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,s,o);var l=i.extend_(this,r,s,o);return l&&Ux(this,i,r),l},t.defineProperty_=function(r,s,i){i===void 0&&(i=!1),this.keysAtom_;try{Xt();var o=this.delete_(r);if(!o)return o;if(Gt(this)){var l=qt(this,{object:this.proxy_||this.target_,name:r,type:$r,newValue:s.value});if(!l)return null;var c=l.newValue;s.value!==c&&(s=Is({},s,{value:c}))}if(i){if(!Reflect.defineProperty(this.target_,r,s))return!1}else Dn(this.target_,r,s);this.notifyPropertyAddition_(r,s.value)}finally{Qt()}return!0},t.defineObservableProperty_=function(r,s,i,o){o===void 0&&(o=!1),this.keysAtom_;try{Xt();var l=this.delete_(r);if(!l)return l;if(Gt(this)){var c=qt(this,{object:this.proxy_||this.target_,name:r,type:$r,newValue:s});if(!c)return null;s=c.newValue}var u=Bx(r),d={configurable:Q.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,d))return!1}else Dn(this.target_,r,d);var f=new js(s,i,"ObservableObject.key",!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Qt()}return!0},t.defineComputedProperty_=function(r,s,i){i===void 0&&(i=!1),this.keysAtom_;try{Xt();var o=this.delete_(r);if(!o)return o;if(Gt(this)){var l=qt(this,{object:this.proxy_||this.target_,name:r,type:$r,newValue:void 0});if(!l)return null}s.name||(s.name="ObservableObject.key"),s.context=this.proxy_||this.target_;var c=Bx(r),u={configurable:Q.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:c.get,set:c.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Dn(this.target_,r,u);this.values_.set(r,new Pt(s)),this.notifyPropertyAddition_(r,void 0)}finally{Qt()}return!0},t.delete_=function(r,s){if(s===void 0&&(s=!1),this.keysAtom_,!lr(this.target_,r))return!0;if(Gt(this)){var i=qt(this,{object:this.proxy_||this.target_,name:r,type:Vx});if(!i)return null}try{var o;Xt();var l=xn(this),c=!1,u=this.values_.get(r),d=void 0;if(!u&&(l||c)){var f;d=(f=fu(this.target_,r))==null?void 0:f.value}if(s){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(u&&(this.values_.delete(r),u instanceof js&&(d=u.value_),C1(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),l||c){var h={type:Vx,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};l&&_n(this,h)}}finally{Qt()}return!0},t.observe_=function(r,s){return ol(this,r)},t.intercept_=function(r){return il(this,r)},t.notifyPropertyAddition_=function(r,s){var i,o=xn(this),l=!1;if(o||l){var c=o||l?{type:$r,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:s}:null;o&&_n(this,c)}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),vd(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function co(e,t){var n;if(lr(e,ae))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",s=new H1(e,new Map,String(r),ZM(t));return gd(e,ae,s),e}var HO=Ws("ObservableObjectAdministration",H1);function Bx(e){return Fx[e]||(Fx[e]={get:function(){return this[ae].getObservablePropValue_(e)},set:function(n){return this[ae].setObservablePropValue_(e,n)}})}function bd(e){return md(e)?HO(e[ae]):!1}function Ux(e,t,n){var r;(r=e.target_[On])==null||delete r[n]}var WO=K1(0),KO=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Cf=0,W1=function(){};function GO(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}GO(W1,Array.prototype);var $g=function(e){function t(r,s,i,o){var l;return i===void 0&&(i="ObservableArray"),o===void 0&&(o=!1),l=e.call(this)||this,qs(function(){var c=new Lg(i,s,o,!0);c.proxy_=l,a1(l,ae,c),r&&r.length&&l.spliceWithArray(0,0,r),KO&&Object.defineProperty(l,"0",WO)}),l}Pg(t,e);var n=t.prototype;return n.concat=function(){this[ae].atom_.reportObserved();for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),i.map(function(l){return wd(l)?l.slice():l}))},n[Symbol.iterator]=function(){var r=this,s=0;return Dg({next:function(){return s<r.length?{value:r[s++],done:!1}:{done:!0,value:void 0}}})},lo(t,[{key:"length",get:function(){return this[ae].getArrayLength_()},set:function(s){this[ae].setArrayLength_(s)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(W1);Object.entries(yu).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&gd($g.prototype,t,n)});function K1(e){return{enumerable:!1,configurable:!0,get:function(){return this[ae].get_(e)},set:function(n){this[ae].set_(e,n)}}}function qO(e){Dn($g.prototype,""+e,K1(e))}function G1(e){if(e>Cf){for(var t=Cf;t<e+100;t++)qO(t);Cf=e}}G1(1e3);function YO(e,t,n){return new $g(e,t,n)}function _u(e,t){if(typeof e=="object"&&e!==null){if(wd(e))return t!==void 0&&fe(23),e[ae].atom_;if(In(e))return e.atom_;if(Gs(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||fe(25,t,Np(e)),n}if(bd(e)){var r,s;if(!t)return fe(26);var i=e[ae],o=(r=(s=i.values_.get(t))!=null?s:i.materializeLazyComputed_(t))!=null?r:i.materializeLazyObservable_(t);return o||fe(27,t,Np(e)),o}if(Ag(e)||_d(e)||vu(e))return e}else if(bn(e)&&vu(e[ae]))return e[ae];fe(28)}function XO(e,t){if(e||fe(29),Ag(e)||_d(e)||vu(e)||Gs(e)||In(e))return e;if(e[ae])return e[ae];fe(24,e)}function Np(e,t){var n;if(t!==void 0)n=_u(e,t);else{if(Fi(e))return e.name;bd(e)||Gs(e)||In(e)?n=XO(e):n=_u(e)}return n.name_}function qs(e){var t=Ks(),n=Ig(!0);Xt();try{return e()}finally{Qt(),Mg(n),cr(t)}}var Hx=pd.toString;function q1(e,t,n){return n===void 0&&(n=-1),Ep(e,t,n)}function Ep(e,t,n,r,s){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var i=typeof e;if(i!=="function"&&i!=="object"&&typeof t!="object")return!1;var o=Hx.call(e);if(o!==Hx.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=Wx(e),t=Wx(t);var l=o==="[object Array]";if(!l){if(typeof e!="object"||typeof t!="object")return!1;var c=e.constructor,u=t.constructor;if(c!==u&&!(bn(c)&&c instanceof c&&bn(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],s=s||[];for(var d=r.length;d--;)if(r[d]===e)return s[d]===t;if(r.push(e),s.push(t),l){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!Ep(e[d],t[d],n-1,r,s))return!1}else{var f=Object.keys(e),h=f.length;if(Object.keys(t).length!==h)return!1;for(var p=0;p<h;p++){var g=f[p];if(!(lr(t,g)&&Ep(e[g],t[g],n-1,r,s)))return!1}}return r.pop(),s.pop(),!0}function Wx(e){return wd(e)?e.slice():ao(e)||Gs(e)||Jn(e)||In(e)?Array.from(e.entries()):e}var Kx,QO=hd(),ZO=((Kx=QO.Iterator)==null?void 0:Kx.prototype)||{};function Dg(e){return e[Symbol.iterator]=JO,Object.assign(Object.create(ZO),e)}function JO(){return this}["Symbol","Map","Set"].forEach(function(e){var t=hd();typeof t[e]>"u"&&fe("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:mO,extras:{getDebugName:Np},$mobx:ae});if(!w.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!F1)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function eL(e){e()}function tL(e){e||(e=eL),$1({reactionScheduler:e})}function nL(e){return TO(e)}var rL=1e4,sL=1e4,iL=function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=rL),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var s=Date.now();n.registrations.forEach(function(i,o){s-i.registeredAt>=r&&(n.finalize(i.value),n.registrations.delete(o))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,sL))}}),e}(),oL=typeof FinalizationRegistry<"u"?FinalizationRegistry:iL,Cp=new oL(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),Y1={exports:{}},X1={};/**
54
54
  * @license React
55
55
  * use-sync-external-store-shim.production.js
56
56
  *
@@ -58,14 +58,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
58
58
  *
59
59
  * This source code is licensed under the MIT license found in the
60
60
  * LICENSE file in the root directory of this source tree.
61
- */var Bi=w;function cL(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uL=typeof Object.is=="function"?Object.is:cL,dL=Bi.useState,fL=Bi.useEffect,hL=Bi.useLayoutEffect,pL=Bi.useDebugValue;function mL(e,t){var n=t(),r=dL({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return hL(function(){s.value=n,s.getSnapshot=t,Tf(s)&&i({inst:s})},[e,n,t]),fL(function(){return Tf(s)&&i({inst:s}),e(function(){Tf(s)&&i({inst:s})})},[e]),pL(n),n}function Tf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!uL(e,n)}catch{return!0}}function gL(e,t){return t()}var vL=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?gL:mL;Q1.useSyncExternalStore=Bi.useSyncExternalStore!==void 0?Bi.useSyncExternalStore:vL;X1.exports=Q1;var Z1=X1.exports;function Xx(e){e.reaction=new xr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function yL(e,t){t===void 0&&(t="observed");var n=or.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(l){return Cp.unregister(r),r.onStoreChange=l,r.reaction||(Xx(r),r.stateVersion=Symbol()),function(){var c;r.onStoreChange=null,(c=r.reaction)===null||c===void 0||c.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var s=n.current;s.reaction||(Xx(s),Cp.register(n,s,s)),or.useDebugValue(s.reaction,sL),Z1.useSyncExternalStore(s.subscribe,s.getSnapshot,s.getSnapshot);var i,o;if(s.reaction.track(function(){try{i=e()}catch(l){o=l}}),o)throw o;return i}var Pf,Af,J1=typeof Symbol=="function"&&Symbol.for,xL=(Af=(Pf=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Pf===void 0?void 0:Pf.configurable)!==null&&Af!==void 0?Af:!1,Qx=J1?Symbol.for("react.forward_ref"):typeof w.forwardRef=="function"&&w.forwardRef(function(e){return null}).$$typeof,Zx=J1?Symbol.for("react.memo"):typeof w.memo=="function"&&w.memo(function(e){return null}).$$typeof;function lt(e,t){var n;if(Zx&&e.$$typeof===Zx)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,s=e,i=e.displayName||e.name;if(Qx&&e.$$typeof===Qx&&(r=!0,s=e.render,typeof s!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var o=function(l,c){return yL(function(){return s(l,c)},i)};return o.displayName=e.displayName,xL&&Object.defineProperty(o,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(o.contextTypes=e.contextTypes),r&&(o=w.forwardRef(o)),o=w.memo(o),wL(e,o),o}var _L={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function wL(e,t){Object.keys(e).forEach(function(n){_L[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Rf;rL(AS.unstable_batchedUpdates);Rf=Cp.finalizeAllImmediately;const bL="local-app".toLowerCase();function jL(e,t){return e==="mock"||e==="app"||e==="local"?e:"local"}const ek=jL(bL),me=ek!=="mock",st=ek==="app",Jx={"workflow.yml":"流程编排","aitable-workflow.config.yml":"运行配置","coding-agents.config.json":"执行引擎","views.yml":"视图方案",".gitkeep":"目录占位"};function tk(e){return{label:SL(e.toolName,e.toolInput),detail:kL(e.toolName,e.toolInput,e.projectId)}}function SL(e,t){if(!e)return"处理生成进度";const n=e.toLowerCase();if(n==="bash")return NL(Tp(t));if(n.includes("write")||n.includes("edit")){const r=jd(Tp(t));return r?r.name:"更新生成文件"}return n.includes("read")?"读取上下文":n.includes("mkdir")?"创建目录":n.includes("grep")||n.includes("search")?"检索项目内容":"执行生成动作"}function kL(e,t,n){const r=Tp(t);if((e==null?void 0:e.toLowerCase())==="bash"&&r)return EL(r,n);const s=r?jd(r):null;return s?s.purpose:t?Vg(t.replace(/\s+/g," "),64):void 0}function jd(e){var l;const t=e.indexOf("recipes/");if(t>=0){const c=(l=e.slice(t).match(/^[^\s'\"]+/))==null?void 0:l[0];if(c)return{name:c.split("/").pop()??c,purpose:"步骤脚本"}}const n=e.match(/(?:^|[/\\])([^/\\\s'"]+\.(?:yml|yaml|json|ts|tsx|md))$/);if(n!=null&&n[1]){const c=n[1];return{name:c,purpose:Jx[c]??"项目文件"}}const r=e.match(/(?:^|\s)(?:[~./\w-]+\/)?((?:recipes\/)?[^\s'\"]+\.(?:yml|yaml|json|ts|tsx|md))/);if(!(r!=null&&r[1]))return null;const s=r[1].replace(/^.*?(recipes\/)/u,"$1"),i=s.split("/").pop()??s,o=s.startsWith("recipes/")?"步骤脚本":Jx[i]??"项目文件";return{name:i,purpose:o}}function Vg(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function NL(e){const t=e.trim().toLowerCase();return/^mkdir\b/.test(t)?"创建目录":/^(install|touch)\b/.test(t)?"准备生成文件":/^(ls|find|test|cat|pwd)\b/.test(t)?"检查生成结果":/\b(pnpm|npm|tsx|tsc|node|vitest)\b/.test(t)?"校验生成文件":"执行生成命令"}function EL(e,t){const n=e.replace(/\s+/g," ").trim(),r=t?CL(n,t):null;if(r)return r;const s=jd(n);return s?`${s.purpose} · ${s.name}`:`命令 · ${Vg(TL(n),72)}`}function Tp(e){if(!e)return"";const t=e.trim();try{const n=JSON.parse(t);for(const r of["file_path","path","command","cmd"]){const s=n[r];if(typeof s=="string"&&s.trim())return s}}catch{}return t}function CL(e,t){var i;const n=PL(t),r=e.match(new RegExp(`(?:^|[\\s'"])(?:[^\\s'"]*/)?${n}(?:/([^\\s'"]+))?`));if(!r)return null;const s=((i=r[1])==null?void 0:i.replace(/^\/+/,""))??"";return s?`${t}/${s}`:t}function TL(e){return e.replace(/\/Users\/[^/\s]+\/Documents\/Work\/code\/[^\s]+\/?/g,"").replace(/\/private\/var\/folders\/[^\s]+\/?/g,"").replace(/\/var\/folders\/[^\s]+\/?/g,"")}function PL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const AL={configuring:"正在生成项目配置",ready:"配置已完成",failed:"配置生成失败"},RL={clarify_probing:"Agent 正在判读需求,可能会提出澄清问题",clarify_awaiting:"等待确认需求澄清",clarify_failed:"需求澄清准备失败",precheck:"需求已确认,正在准备生成",generating:"正在生成工作流方案",validating:"正在校验流程方案",syncing_schema:"正在把字段与视图计划同步到配置",ready:"工作流设计完成",generate_failed:"工作流设计未通过"},IL={preflight:"正在加载配置与工作流模板",provisioning_table:"正在创建 AI 表格",syncing_schema:"正在创建字段和视图",auth_awaiting:"等待 AI 表格授权",ready:"AI 表格搭建完成",failed:"AI 表格搭建失败"},ML={starting:"正在启动运行服务",listening:"正在监听 AI 表格中的待处理记录",stopped:"运行服务已停止",failed:"运行启动失败",awaiting_machine:"已请求运行,等待执行机器认领",running_on_machine:"运行中"},OL={init:AL,design:RL,setup:IL,run:ML},us={init:"尚未开始配置",design:"尚未开始设计",setup:"尚未开始搭建",adjust:"尚未开始参数调整",test:"尚未开始试运行",run:"尚未开始运行"};function nk(e,t){const n=OL[e][t.phase]??t.phase;if("error"in t&&t.error)return t.error.message;if(e==="design"){const r=t;if(r.phase==="generating")return`第 ${r.round} 轮${r.isFix?"修正":"生成"}进行中`;if(r.phase==="validating")return r.errors.length>0?`第 ${r.round} 轮校验发现 ${r.errors.length} 个问题,准备修正`:`第 ${r.round} 轮校验通过`;if(r.phase==="ready")return`工作流设计完成(${r.rounds} 轮)`}if(e==="run"){const r=t;if(r.phase==="listening")return`${r.workflowName} 正在监听,${r.stepCount} 个步骤,间隔 ${Math.round(r.intervalMs/1e3)} 秒`;if(r.phase==="running_on_machine")return`运行中 · 执行机器 ${r.machineId}`;if(r.phase==="awaiting_machine"&&r.stalledSince)return"无可用执行机器认领本工作流,请检查 daemon 是否在线"}return n}const LL=300,Pp=200,$L=4e3;function e_(e,t=Pp){return e.length>t?`${e.slice(0,t)}…`:e}function t_(e,t=$L){return e.length>t?`${e.slice(0,t)}…`:e}function DL(e,t,n=LL){if(!t.length)return e;const r=[...e,...t];return r.length>n?r.slice(r.length-n):r}function zL(e,t){var n,r,s,i,o,l,c,u;switch(e.type){case"text":{const d=(n=e.content)==null?void 0:n.trim();return d?{kind:"text",text:d,round:t}:null}case"thinking":{const d=(r=e.content)==null?void 0:r.trim();return d?{kind:"thinking",text:d,round:t}:null}case"tool_use":{const d=tk({toolName:e.toolName,toolInput:e.toolInput});return{kind:"tool",text:d.detail?`${d.label} — ${d.detail}`:d.label,toolName:e.toolName,round:t}}case"tool_result":{const d=(s=e.content)==null?void 0:s.trim(),f=((i=e.toolName)==null?void 0:i.trim())||void 0,h=d?`↩ ${e_(d)}`:f?`↩ ${f} 返回结果`:"↩ 工具返回结果",p=d&&d.length>Pp?t_(d):void 0;return p?{kind:"tool_result",text:h,toolName:f,round:t,fullText:p}:{kind:"tool_result",text:h,toolName:f,round:t}}case"permission_request":{const d=((o=e.toolName)==null?void 0:o.trim())||void 0,f=(l=e.content)==null?void 0:l.trim(),h=d?`${d} 待授权`:"待授权请求",p=f?`${h} — ${e_(f)}`:h,g=f&&f.length>Pp?t_(f):void 0;return g?{kind:"permission",text:p,toolName:d,round:t,fullText:g}:{kind:"permission",text:p,toolName:d,round:t}}case"result":{const d=(c=e.content)==null?void 0:c.trim();return d?{kind:"status",text:d,round:t}:null}case"error":return{kind:"status",text:((u=e.content)==null?void 0:u.trim())||"执行出错",round:t};default:return null}}function FL(e){var n,r;if(e.type==="error")return{kind:"status",text:`[setup] 错误: ${((r=(n=e.error)==null?void 0:n.message)==null?void 0:r.trim())||"未知错误"}`};if(e.type!=="stage.changed")return null;const t=e.stageState.state;return t.phase==="ready"?{kind:"status",text:"[setup] 完成",boundary:!0}:{kind:"status",text:`[setup] ${nk("setup",t)}`}}function VL(e){var t,n,r,s,i,o,l,c,u,d,f;switch(e.type){case"run.step.started":{const h=((t=e.stepName)==null?void 0:t.trim())||e.stepId||"步骤";return{kind:"tool",text:`[run] ▶ ${h}`,toolName:h}}case"run.step.succeeded":return{kind:"status",text:`[run] ✓ ${((n=e.stepName)==null?void 0:n.trim())||e.stepId||"步骤"}`};case"run.step.failed":{const h=((r=e.stepName)==null?void 0:r.trim())||e.stepId||"步骤",p=(s=e.error)==null?void 0:s.trim();return{kind:"status",text:p?`[run] ✗ ${h}:${p}`:`[run] ✗ ${h}`}}case"run.record.blocked":{const h=((i=e.stepName)==null?void 0:i.trim())||e.stepId||"步骤",p=(o=e.reason)==null?void 0:o.trim();return{kind:"status",text:p?`[run] ✗ ${h}:${p}`:`[run] ✗ ${h}`}}case"run.record.detected":return{kind:"status",text:`[run] 记录: ${((c=(l=e.record)==null?void 0:l.title)==null?void 0:c.trim())||((u=e.record)==null?void 0:u.id)||"记录"}`};case"stage.changed":return e.stageState.state.phase==="stopped"?{kind:"status",text:"[run] 停止",boundary:!0}:null;case"error":return{kind:"status",text:`[run] 错误: ${((f=(d=e.error)==null?void 0:d.message)==null?void 0:f.trim())||"未知错误"}`};default:return null}}function BL(e){const t=[];let n=!1,r,s=!1;for(const i of e){if(i.boundary){n=!0;continue}const o=i.round!==r;(!s||n||o)&&(t.push({round:i.round,items:[]}),n=!1,r=i.round,s=!0);const l=t[t.length-1].items;if(i.kind==="text"||i.kind==="thinking"){const u=l[l.length-1];if(u&&u.kind===i.kind){u.text+=i.text;continue}l.push({kind:i.kind,text:i.text});continue}const c={kind:i.kind,text:i.text,toolName:i.toolName};i.fullText!==void 0&&(c.fullText=i.fullText),l.push(c)}return t}const rk="";async function Bg(){return(await(await ue("/api/projects",{method:"POST"})).json()).project}async function UL(e,t){const n={};return e&&e.trim()&&(n.title=e.trim()),t&&t.length>0&&(n.files=t),await(await ue("/api/projects",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})).json()}async function HL(e){return await(await ue(`/api/projects/${e}`,{method:"DELETE"})).json()}async function WL(e){return await(await ue(`/api/projects/${e}/export`)).json()}async function KL(e){return await(await ue(`/api/projects/${e}/validate`,{method:"POST"})).json()}async function Ap(e){return(await(await ue(`/api/projects/${e}/workflows`)).json()).workflows}async function GL(e,t){const n={name:t.name};return t.templatePath&&(n.templatePath=t.templatePath),t.files&&t.files.length>0&&(n.files=t.files),await(await ue(`/api/projects/${e}/workflows`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})).json()}async function sk(e,t){return await(await ue(`/api/projects/${e}/workflows/${t}`)).json()}async function qL(e,t){return await(await ue(`/api/projects/${e}/workflows/${t}`,{method:"DELETE"})).json()}async function ik(){await ue("/api/health")}async function YL(){return await(await ue("/api/agents")).json()}async function Ug(){return(await(await ue("/api/projects")).json()).projects}async function XL(e,t){return(await(await ue(`/api/projects/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({title:t})})).json()).project}async function Hg(e){return await(await ue(`/api/projects/${e}/state`)).json()}async function QL(e,t){return await(await ue(`/api/projects/${e}/init`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})).json()}async function ZL(e){return await(await ue(`/api/projects/${e}/design/discovery`,{method:"POST"})).json()}async function JL(e,t){return await(await ue(`/api/projects/${e}/design/discovery/confirm`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({answers:t})})).json()}async function Sd(e,t){const n=t?`?workflowId=${encodeURIComponent(t)}`:"",s=await(await ue(`/api/projects/${e}/workflow${n}`)).json();return h$(s.workflow)}async function Wg(e){return(await(await ue(`/api/projects/${e}/files`)).json()).files}async function e$(e,t){await ak(`/api/projects/${e}/design`,t)}async function t$(e){return await(await ue(`/api/projects/${e}/design/events`)).json()}async function n$(e,t){await ak(`/api/projects/${e}/setup`,t)}async function r$(e,t,n){const r=`/api/projects/${e}/run`,s=await ue(r,{method:"POST",signal:n==null?void 0:n.signal});return l$(s)?{mode:"relay",schedule:(await s.json()).schedule}:(await lk(r,s,t,n),{mode:"local"})}async function s$(e){return await(await ue(`/api/projects/${e}/run/stop`,{method:"POST"})).json()}async function i$(e){return await(await ue(`/api/projects/${e}/run/status`)).json()}async function o$(e,t){return await(await ue(`/api/projects/${e}/run/records`)).json()}async function a$(e,t){const n=new URLSearchParams;t!=null&&t.afterSeq&&n.set("afterSeq",String(t.afterSeq)),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.size>0?`?${n.toString()}`:"";return await(await ue(`/api/projects/${e}/run/events${r}`)).json()}function l$(e){return(e.headers.get("content-type")??"").includes("application/json")}async function c$(e,t,n){return(await(await ue(`/api/projects/${e}/run/records/${t}/human-action`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:n})})).json()).state}async function Ec(e){return await(await ue(`/api/projects/${e}/engine`)).json()}async function ok(e,t){await ue(`/api/projects/${e}/engine`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({machineId:t})})}async function ue(e,t){var r,s;let n;try{n=await fetch(`${rk}${e}`,t)}catch(i){const o=i instanceof Error?i.message:String(i);throw new Error(`无法连接真实后端服务(当前站点):${o}`)}if(!n.ok){const i=await n.text();if(n.status===401){let o;try{o=(r=JSON.parse(i).error)==null?void 0:r.loginUrl}catch{}if(o&&typeof window<"u")return window.location.href=o,new Promise(()=>{});throw new Error("登录已过期,请重新登录")}try{const o=JSON.parse(i);if((s=o.error)!=null&&s.message)throw new Error(o.error.message)}catch(o){if(o instanceof Error&&o.message!==i)throw o}throw new Error(i||`HTTP ${n.status}`)}return n}const u$=5,d$=500,f$=8e3;async function ak(e,t,n){const r=await ue(e,{method:"POST",signal:n==null?void 0:n.signal});await lk(e,r,t,n)}async function lk(e,t,n,r){var l,c;let s=null,i=0,o=t;for(;;){if((l=r==null?void 0:r.signal)!=null&&l.aborted)return;try{if(!o){const h=s?`${e}${e.includes("?")?"&":"?"}cursor=${encodeURIComponent(s)}`:e;o=await ue(h,{method:"POST",signal:r==null?void 0:r.signal})}if(!o.body)return;const u=o.body.getReader(),d=new TextDecoder;let f="";for(;;){const{done:h,value:p}=await u.read();if(h)return;i=0,f+=d.decode(p,{stream:!0});const g=f.split(`
61
+ */var Bi=w;function aL(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lL=typeof Object.is=="function"?Object.is:aL,cL=Bi.useState,uL=Bi.useEffect,dL=Bi.useLayoutEffect,fL=Bi.useDebugValue;function hL(e,t){var n=t(),r=cL({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return dL(function(){s.value=n,s.getSnapshot=t,Tf(s)&&i({inst:s})},[e,n,t]),uL(function(){return Tf(s)&&i({inst:s}),e(function(){Tf(s)&&i({inst:s})})},[e]),fL(n),n}function Tf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!lL(e,n)}catch{return!0}}function pL(e,t){return t()}var mL=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?pL:hL;X1.useSyncExternalStore=Bi.useSyncExternalStore!==void 0?Bi.useSyncExternalStore:mL;Y1.exports=X1;var Q1=Y1.exports;function Gx(e){e.reaction=new xr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function gL(e,t){t===void 0&&(t="observed");var n=or.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(l){return Cp.unregister(r),r.onStoreChange=l,r.reaction||(Gx(r),r.stateVersion=Symbol()),function(){var c;r.onStoreChange=null,(c=r.reaction)===null||c===void 0||c.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var s=n.current;s.reaction||(Gx(s),Cp.register(n,s,s)),or.useDebugValue(s.reaction,nL),Q1.useSyncExternalStore(s.subscribe,s.getSnapshot,s.getSnapshot);var i,o;if(s.reaction.track(function(){try{i=e()}catch(l){o=l}}),o)throw o;return i}var Pf,Af,Z1=typeof Symbol=="function"&&Symbol.for,vL=(Af=(Pf=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Pf===void 0?void 0:Pf.configurable)!==null&&Af!==void 0?Af:!1,qx=Z1?Symbol.for("react.forward_ref"):typeof w.forwardRef=="function"&&w.forwardRef(function(e){return null}).$$typeof,Yx=Z1?Symbol.for("react.memo"):typeof w.memo=="function"&&w.memo(function(e){return null}).$$typeof;function lt(e,t){var n;if(Yx&&e.$$typeof===Yx)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,s=e,i=e.displayName||e.name;if(qx&&e.$$typeof===qx&&(r=!0,s=e.render,typeof s!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var o=function(l,c){return gL(function(){return s(l,c)},i)};return o.displayName=e.displayName,vL&&Object.defineProperty(o,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(o.contextTypes=e.contextTypes),r&&(o=w.forwardRef(o)),o=w.memo(o),xL(e,o),o}var yL={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function xL(e,t){Object.keys(e).forEach(function(n){yL[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Rf;tL(CS.unstable_batchedUpdates);Rf=Cp.finalizeAllImmediately;const _L="local-app".toLowerCase();function wL(e,t){return e==="mock"||e==="app"||e==="local"?e:"local"}const J1=wL(_L),me=J1!=="mock",st=J1==="app",Xx={"workflow.yml":"流程编排","aitable-workflow.config.yml":"运行配置","coding-agents.config.json":"执行引擎","views.yml":"视图方案",".gitkeep":"目录占位"};function ek(e){return{label:bL(e.toolName,e.toolInput),detail:jL(e.toolName,e.toolInput,e.projectId)}}function bL(e,t){if(!e)return"处理生成进度";const n=e.toLowerCase();if(n==="bash")return SL(Tp(t));if(n.includes("write")||n.includes("edit")){const r=jd(Tp(t));return r?r.name:"更新生成文件"}return n.includes("read")?"读取上下文":n.includes("mkdir")?"创建目录":n.includes("grep")||n.includes("search")?"检索项目内容":"执行生成动作"}function jL(e,t,n){const r=Tp(t);if((e==null?void 0:e.toLowerCase())==="bash"&&r)return kL(r,n);const s=r?jd(r):null;return s?s.purpose:t?zg(t.replace(/\s+/g," "),64):void 0}function jd(e){var l;const t=e.indexOf("recipes/");if(t>=0){const c=(l=e.slice(t).match(/^[^\s'\"]+/))==null?void 0:l[0];if(c)return{name:c.split("/").pop()??c,purpose:"步骤脚本"}}const n=e.match(/(?:^|[/\\])([^/\\\s'"]+\.(?:yml|yaml|json|ts|tsx|md))$/);if(n!=null&&n[1]){const c=n[1];return{name:c,purpose:Xx[c]??"项目文件"}}const r=e.match(/(?:^|\s)(?:[~./\w-]+\/)?((?:recipes\/)?[^\s'\"]+\.(?:yml|yaml|json|ts|tsx|md))/);if(!(r!=null&&r[1]))return null;const s=r[1].replace(/^.*?(recipes\/)/u,"$1"),i=s.split("/").pop()??s,o=s.startsWith("recipes/")?"步骤脚本":Xx[i]??"项目文件";return{name:i,purpose:o}}function zg(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function SL(e){const t=e.trim().toLowerCase();return/^mkdir\b/.test(t)?"创建目录":/^(install|touch)\b/.test(t)?"准备生成文件":/^(ls|find|test|cat|pwd)\b/.test(t)?"检查生成结果":/\b(pnpm|npm|tsx|tsc|node|vitest)\b/.test(t)?"校验生成文件":"执行生成命令"}function kL(e,t){const n=e.replace(/\s+/g," ").trim(),r=t?NL(n,t):null;if(r)return r;const s=jd(n);return s?`${s.purpose} · ${s.name}`:`命令 · ${zg(EL(n),72)}`}function Tp(e){if(!e)return"";const t=e.trim();try{const n=JSON.parse(t);for(const r of["file_path","path","command","cmd"]){const s=n[r];if(typeof s=="string"&&s.trim())return s}}catch{}return t}function NL(e,t){var i;const n=CL(t),r=e.match(new RegExp(`(?:^|[\\s'"])(?:[^\\s'"]*/)?${n}(?:/([^\\s'"]+))?`));if(!r)return null;const s=((i=r[1])==null?void 0:i.replace(/^\/+/,""))??"";return s?`${t}/${s}`:t}function EL(e){return e.replace(/\/Users\/[^/\s]+\/Documents\/Work\/code\/[^\s]+\/?/g,"").replace(/\/private\/var\/folders\/[^\s]+\/?/g,"").replace(/\/var\/folders\/[^\s]+\/?/g,"")}function CL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const TL={configuring:"正在生成项目配置",ready:"配置已完成",failed:"配置生成失败"},PL={clarify_probing:"Agent 正在判读需求,可能会提出澄清问题",clarify_awaiting:"等待确认需求澄清",clarify_failed:"需求澄清准备失败",precheck:"需求已确认,正在准备生成",generating:"正在生成工作流方案",validating:"正在校验流程方案",syncing_schema:"正在把字段与视图计划同步到配置",ready:"工作流设计完成",generate_failed:"工作流设计未通过"},AL={preflight:"正在加载配置与工作流模板",provisioning_table:"正在创建 AI 表格",syncing_schema:"正在创建字段和视图",auth_awaiting:"等待 AI 表格授权",ready:"AI 表格搭建完成",failed:"AI 表格搭建失败"},RL={starting:"正在启动运行服务",listening:"正在监听 AI 表格中的待处理记录",stopped:"运行服务已停止",failed:"运行启动失败",awaiting_machine:"已请求运行,等待执行机器认领",running_on_machine:"运行中"},IL={init:TL,design:PL,setup:AL,run:RL},us={init:"尚未开始配置",design:"尚未开始设计",setup:"尚未开始搭建",adjust:"尚未开始参数调整",test:"尚未开始试运行",run:"尚未开始运行"};function tk(e,t){const n=IL[e][t.phase]??t.phase;if("error"in t&&t.error)return t.error.message;if(e==="design"){const r=t;if(r.phase==="generating")return`第 ${r.round} 轮${r.isFix?"修正":"生成"}进行中`;if(r.phase==="validating")return r.errors.length>0?`第 ${r.round} 轮校验发现 ${r.errors.length} 个问题,准备修正`:`第 ${r.round} 轮校验通过`;if(r.phase==="ready")return`工作流设计完成(${r.rounds} 轮)`}if(e==="run"){const r=t;if(r.phase==="listening")return`${r.workflowName} 正在监听,${r.stepCount} 个步骤,间隔 ${Math.round(r.intervalMs/1e3)} 秒`;if(r.phase==="running_on_machine")return`运行中 · 执行机器 ${r.machineId}`;if(r.phase==="awaiting_machine"&&r.stalledSince)return"无可用执行机器认领本工作流,请检查 daemon 是否在线"}return n}const ML=300,Pp=200,OL=4e3;function Qx(e,t=Pp){return e.length>t?`${e.slice(0,t)}…`:e}function Zx(e,t=OL){return e.length>t?`${e.slice(0,t)}…`:e}function LL(e,t,n=ML){if(!t.length)return e;const r=[...e,...t];return r.length>n?r.slice(r.length-n):r}function $L(e,t){var n,r,s,i,o,l,c,u;switch(e.type){case"text":{const d=(n=e.content)==null?void 0:n.trim();return d?{kind:"text",text:d,round:t}:null}case"thinking":{const d=(r=e.content)==null?void 0:r.trim();return d?{kind:"thinking",text:d,round:t}:null}case"tool_use":{const d=ek({toolName:e.toolName,toolInput:e.toolInput});return{kind:"tool",text:d.detail?`${d.label} — ${d.detail}`:d.label,toolName:e.toolName,round:t}}case"tool_result":{const d=(s=e.content)==null?void 0:s.trim(),f=((i=e.toolName)==null?void 0:i.trim())||void 0,h=d?`↩ ${Qx(d)}`:f?`↩ ${f} 返回结果`:"↩ 工具返回结果",p=d&&d.length>Pp?Zx(d):void 0;return p?{kind:"tool_result",text:h,toolName:f,round:t,fullText:p}:{kind:"tool_result",text:h,toolName:f,round:t}}case"permission_request":{const d=((o=e.toolName)==null?void 0:o.trim())||void 0,f=(l=e.content)==null?void 0:l.trim(),h=d?`${d} 待授权`:"待授权请求",p=f?`${h} — ${Qx(f)}`:h,g=f&&f.length>Pp?Zx(f):void 0;return g?{kind:"permission",text:p,toolName:d,round:t,fullText:g}:{kind:"permission",text:p,toolName:d,round:t}}case"result":{const d=(c=e.content)==null?void 0:c.trim();return d?{kind:"status",text:d,round:t}:null}case"error":return{kind:"status",text:((u=e.content)==null?void 0:u.trim())||"执行出错",round:t};default:return null}}function DL(e){var n,r;if(e.type==="error")return{kind:"status",text:`[setup] 错误: ${((r=(n=e.error)==null?void 0:n.message)==null?void 0:r.trim())||"未知错误"}`};if(e.type!=="stage.changed")return null;const t=e.stageState.state;return t.phase==="ready"?{kind:"status",text:"[setup] 完成",boundary:!0}:{kind:"status",text:`[setup] ${tk("setup",t)}`}}function zL(e){var t,n,r,s,i,o,l,c,u,d,f;switch(e.type){case"run.step.started":{const h=((t=e.stepName)==null?void 0:t.trim())||e.stepId||"步骤";return{kind:"tool",text:`[run] ▶ ${h}`,toolName:h}}case"run.step.succeeded":return{kind:"status",text:`[run] ✓ ${((n=e.stepName)==null?void 0:n.trim())||e.stepId||"步骤"}`};case"run.step.failed":{const h=((r=e.stepName)==null?void 0:r.trim())||e.stepId||"步骤",p=(s=e.error)==null?void 0:s.trim();return{kind:"status",text:p?`[run] ✗ ${h}:${p}`:`[run] ✗ ${h}`}}case"run.record.blocked":{const h=((i=e.stepName)==null?void 0:i.trim())||e.stepId||"步骤",p=(o=e.reason)==null?void 0:o.trim();return{kind:"status",text:p?`[run] ✗ ${h}:${p}`:`[run] ✗ ${h}`}}case"run.record.detected":return{kind:"status",text:`[run] 记录: ${((c=(l=e.record)==null?void 0:l.title)==null?void 0:c.trim())||((u=e.record)==null?void 0:u.id)||"记录"}`};case"stage.changed":return e.stageState.state.phase==="stopped"?{kind:"status",text:"[run] 停止",boundary:!0}:null;case"error":return{kind:"status",text:`[run] 错误: ${((f=(d=e.error)==null?void 0:d.message)==null?void 0:f.trim())||"未知错误"}`};default:return null}}function FL(e){const t=[];let n=!1,r,s=!1;for(const i of e){if(i.boundary){n=!0;continue}const o=i.round!==r;(!s||n||o)&&(t.push({round:i.round,items:[]}),n=!1,r=i.round,s=!0);const l=t[t.length-1].items;if(i.kind==="text"||i.kind==="thinking"){const u=l[l.length-1];if(u&&u.kind===i.kind){u.text+=i.text;continue}l.push({kind:i.kind,text:i.text});continue}const c={kind:i.kind,text:i.text,toolName:i.toolName};i.fullText!==void 0&&(c.fullText=i.fullText),l.push(c)}return t}const nk="";async function Fg(){return(await(await ue("/api/projects",{method:"POST"})).json()).project}async function VL(e,t){const n={};return e&&e.trim()&&(n.title=e.trim()),t&&t.length>0&&(n.files=t),await(await ue("/api/projects",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})).json()}async function BL(e){return await(await ue(`/api/projects/${e}`,{method:"DELETE"})).json()}async function UL(e){return await(await ue(`/api/projects/${e}/export`)).json()}async function HL(e){return await(await ue(`/api/projects/${e}/validate`,{method:"POST"})).json()}async function Ap(e){return(await(await ue(`/api/projects/${e}/workflows`)).json()).workflows}async function WL(e,t){const n={name:t.name};return t.templatePath&&(n.templatePath=t.templatePath),t.files&&t.files.length>0&&(n.files=t.files),await(await ue(`/api/projects/${e}/workflows`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})).json()}async function rk(e,t){return await(await ue(`/api/projects/${e}/workflows/${t}`)).json()}async function KL(e,t){return await(await ue(`/api/projects/${e}/workflows/${t}`,{method:"DELETE"})).json()}async function sk(){await ue("/api/health")}async function GL(){return await(await ue("/api/agents")).json()}async function Vg(){return(await(await ue("/api/projects")).json()).projects}async function qL(e,t){return(await(await ue(`/api/projects/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({title:t})})).json()).project}async function Bg(e){return await(await ue(`/api/projects/${e}/state`)).json()}async function YL(e,t){return await(await ue(`/api/projects/${e}/init`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})).json()}async function XL(e){return await(await ue(`/api/projects/${e}/design/discovery`,{method:"POST"})).json()}async function QL(e,t){return await(await ue(`/api/projects/${e}/design/discovery/confirm`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({answers:t})})).json()}async function Sd(e,t){const n=t?`?workflowId=${encodeURIComponent(t)}`:"",s=await(await ue(`/api/projects/${e}/workflow${n}`)).json();return d$(s.workflow)}async function Ug(e){return(await(await ue(`/api/projects/${e}/files`)).json()).files}async function ZL(e,t){await ok(`/api/projects/${e}/design`,t)}async function JL(e){return await(await ue(`/api/projects/${e}/design/events`)).json()}async function e$(e,t){await ok(`/api/projects/${e}/setup`,t)}async function t$(e,t,n){const r=`/api/projects/${e}/run`,s=await ue(r,{method:"POST",signal:n==null?void 0:n.signal});return o$(s)?{mode:"relay",schedule:(await s.json()).schedule}:(await ak(r,s,t,n),{mode:"local"})}async function n$(e){return await(await ue(`/api/projects/${e}/run/stop`,{method:"POST"})).json()}async function r$(e){return await(await ue(`/api/projects/${e}/run/status`)).json()}async function s$(e,t){return await(await ue(`/api/projects/${e}/run/records`)).json()}async function i$(e,t){const n=new URLSearchParams;t!=null&&t.afterSeq&&n.set("afterSeq",String(t.afterSeq)),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.size>0?`?${n.toString()}`:"";return await(await ue(`/api/projects/${e}/run/events${r}`)).json()}function o$(e){return(e.headers.get("content-type")??"").includes("application/json")}async function a$(e,t,n){return(await(await ue(`/api/projects/${e}/run/records/${t}/human-action`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:n})})).json()).state}async function Ec(e){return await(await ue(`/api/projects/${e}/engine`)).json()}async function ik(e,t){await ue(`/api/projects/${e}/engine`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({machineId:t})})}async function ue(e,t){var r,s;let n;try{n=await fetch(`${nk}${e}`,t)}catch(i){const o=i instanceof Error?i.message:String(i);throw new Error(`无法连接真实后端服务(当前站点):${o}`)}if(!n.ok){const i=await n.text();if(n.status===401){let o;try{o=(r=JSON.parse(i).error)==null?void 0:r.loginUrl}catch{}if(o&&typeof window<"u")return window.location.href=o,new Promise(()=>{});throw new Error("登录已过期,请重新登录")}try{const o=JSON.parse(i);if((s=o.error)!=null&&s.message)throw new Error(o.error.message)}catch(o){if(o instanceof Error&&o.message!==i)throw o}throw new Error(i||`HTTP ${n.status}`)}return n}const l$=5,c$=500,u$=8e3;async function ok(e,t,n){const r=await ue(e,{method:"POST",signal:n==null?void 0:n.signal});await ak(e,r,t,n)}async function ak(e,t,n,r){var l,c;let s=null,i=0,o=t;for(;;){if((l=r==null?void 0:r.signal)!=null&&l.aborted)return;try{if(!o){const h=s?`${e}${e.includes("?")?"&":"?"}cursor=${encodeURIComponent(s)}`:e;o=await ue(h,{method:"POST",signal:r==null?void 0:r.signal})}if(!o.body)return;const u=o.body.getReader(),d=new TextDecoder;let f="";for(;;){const{done:h,value:p}=await u.read();if(h)return;i=0,f+=d.decode(p,{stream:!0});const g=f.split(`
62
62
 
63
63
  `);f=g.pop()??"";for(const x of g){const _=x.split(`
64
- `),v=_.find(m=>m.startsWith("id: "));v&&(s=v.slice(4).trim());const y=_.find(m=>m.startsWith("data: "));y&&await n(JSON.parse(y.slice(6)))}}}catch(u){if((c=r==null?void 0:r.signal)!=null&&c.aborted)return;if(o=null,i+=1,i>u$)throw u;const d=Math.min(f$,d$*2**(i-1));await new Promise(f=>setTimeout(f,d))}}}function h$(e){return{steps:e.steps.map(t=>({id:t.id,name:t.name,recipe:t.recipe??"",engine:p$(t.engine),auto:t.auto,requiresAgent:!!t.requires_agent,needsHuman:!!t.needs_human,inputs:Object.values(t.input_mapping??{}),outputs:Object.values(t.output_mapping??{}),status:"idle"})),edges:e.edges.filter(t=>t.from!=="__start__"&&t.to!=="__end__")}}function p$(e){return e==="claude"||e==="codex"||e==="qoder"||e==="qwenwork"||e==="llm_only"?e:"llm_only"}const m$={init:{configuring:!0,ready:!1,failed:!1},design:{clarify_probing:!0,clarify_awaiting:!0,clarify_failed:!1,precheck:!0,generating:!0,validating:!0,syncing_schema:!0,ready:!1,generate_failed:!1},setup:{preflight:!0,provisioning_table:!0,syncing_schema:!0,auth_awaiting:!0,ready:!1,failed:!1},run:{starting:!0,listening:!0,stopped:!1,failed:!1,awaiting_machine:!0,running_on_machine:!0}};function g$(e,t){const r=m$[e][t.phase];if(r===void 0)throw new Error(`phase 未登记推进中/终态:${e}.${t.phase}`);return r}const v$=["precheck","generating","validating","syncing_schema"];function y$(e){return!!e&&v$.includes(e.phase)}function n_(e){return(e==null?void 0:e.phase)==="clarify_failed"||(e==null?void 0:e.phase)==="generate_failed"}function x$(e,t,n){return g$(t,n)?t:e===t?null:e}function _$(e,t){return e===void 0?!1:Array.isArray(e)?e.includes(t):typeof e=="boolean"?String(e)===t:e===t}function ck(e,t){return e.showIf?_$(t[e.showIf.questionId],e.showIf.hasValue):!0}function w$(e,t){return e.questions.filter(n=>ck(n,t))}function b$(e,t){var r;const n=[];for(const s of w$(e,t)){const i=t[s.id];if(s.required&&r_(i)){n.push({questionId:s.id,code:"required",message:`「${s.label}」为必填项`});continue}if(s.maxSelections!==void 0&&Array.isArray(i)&&i.length>s.maxSelections&&n.push({questionId:s.id,code:"max_selections",message:`「${s.label}」最多选 ${s.maxSelections} 项,实际 ${i.length} 项`}),s.allowCustom===!1&&((r=s.options)!=null&&r.length)&&!r_(i)){const o=new Set(s.options.map(u=>u.value)),c=(Array.isArray(i)?i:[String(i)]).filter(u=>!o.has(u));c.length>0&&n.push({questionId:s.id,code:"not_in_options",message:`「${s.label}」只能从给定选项中选择,收到:${c.join("、")}`})}}return n}function r_(e){return e===void 0?!0:typeof e=="string"?e.trim()==="":Array.isArray(e)?e.length===0:!1}const j$=300;function S$(e,t,n={}){var s;const r=k$(n);if(t.type==="run.record.detected")return{records:N$(e.records,{id:t.record.id,title:t.record.title||t.record.id,state:t.record.state,status:t.record.currentStep?"running":"todo",currentStepId:t.record.currentStep,doneStepIds:[],createdAt:r.now(),updatedAt:r.now()}),logs:ds(e.logs,t.record.id,t.record.currentStep??"run","info",`发现待处理记录:${t.record.title||t.record.id}`,r)};if(t.type==="run.step.started"){const i=((s=n.stepLevel)==null?void 0:s.call(n,t.stepId,t))??"ai";return{records:No(e.records,t.itemId,o=>({...o,status:o.status==="done"?o.status:"running",currentStepId:o.status==="done"?o.currentStepId:t.stepId,updatedAt:r.now()})),logs:ds(e.logs,t.itemId,t.stepId,i,`开始执行步骤:${t.stepName}`,r)}}return t.type==="run.step.succeeded"?{records:No(e.records,t.itemId,i=>({...i,doneStepIds:s_(i.doneStepIds,t.stepId),updatedAt:r.now()})),logs:If(ds(e.logs,t.itemId,t.stepId,"ok",`步骤完成:${t.stepName}`,r),t.itemId,t.stepId,"info",t.logs,r)}:t.type==="run.step.failed"?{records:No(e.records,t.itemId,i=>({...i,status:i.status==="done"?i.status:"blocked",currentStepId:i.status==="done"?i.currentStepId:t.stepId,updatedAt:r.now()})),logs:If(ds(e.logs,t.itemId,t.stepId,"error",`步骤失败:${t.stepName} · ${t.error}`,r),t.itemId,t.stepId,"error",t.logs,r)}:t.type==="run.record.blocked"?{records:No(e.records,t.itemId,i=>({...i,status:i.status==="done"?i.status:t.reason.includes("人工")?"review":"blocked",currentStepId:i.status==="done"?i.currentStepId:t.stepId,doneStepIds:s_(i.doneStepIds,t.stepId),updatedAt:r.now()})),logs:If(ds(e.logs,t.itemId,t.stepId,"warn",`${t.stepName}:${t.reason}`,r),t.itemId,t.stepId,"info",t.logs,r)}:t.type==="run.record.completed"?{records:No(e.records,t.itemId,i=>({...i,status:"done",currentStepId:null,updatedAt:r.now()})),logs:ds(e.logs,t.itemId,"run","ok","流程完成",r)}:e}function k$(e){return{now:e.now??Date.now,id:e.id??E$,maxLogs:e.maxLogs??j$}}function N$(e,t){return e.findIndex(r=>r.id===t.id)<0?[...e,t]:e.map(r=>r.id===t.id?{...r,...t,doneStepIds:r.doneStepIds,status:r.status==="done"?r.status:t.status,currentStepId:r.status==="done"?r.currentStepId:t.currentStepId,createdAt:r.createdAt}:r)}function No(e,t,n){return e.map(r=>r.id===t?n(r):r)}function s_(e,t){return e.includes(t)?e:[...e,t]}function ds(e,t,n,r,s,i){return e.some(l=>l.itemId===t&&l.stepId===n&&l.level===r&&l.text===s)?e:[...e,{id:i.id(),ts:i.now(),itemId:t,stepId:n,level:r,text:s}].slice(-i.maxLogs)}function If(e,t,n,r,s,i){return s!=null&&s.length?s.reduce((o,l)=>ds(o,t,n,r,l,i),e):e}function E$(){return`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function C$(e){return{projectId:e,activeStage:null,stages:{},updatedAt:new Date().toISOString()}}function Kg(e,t){const n=e.projectState??C$(e.projectId);return{...n,activeStage:x$(n.activeStage,t.stage,t.stageState.state),stages:{...n.stages,[t.stage]:t.stageState},updatedAt:t.stageState.identity.updatedAt}}function T$(e,t){switch(t.type){case"stage.changed":return{projectState:Kg(e,t)};case"design.agent_event":return{live:{designAgentEvents:e.live.designAgentEvents+1,designLiveText:t.event.type==="tool_use"?`Agent 调用工具:${t.event.toolName??""}`.trim():"Agent 正在输出内容"}};case"design.files":return{files:t.files};case"error":return{live:{designLiveText:`真实设计中断:${t.error.message}`}};default:return{}}}function P$(e,t){switch(t.type){case"stage.changed":return{projectState:Kg(e,t)};default:return{}}}function A$(e,t){if(t.type==="stage.changed")return{projectState:Kg(e,t)};if(t.type==="error")return{live:{logs:uk(e.live.logs,dk("error",t.error.message))}};if(!D$(t))return{};const n=S$(z$(e),t,{stepLevel:r=>{var s,i;return(i=(s=e.steps)==null?void 0:s.find(o=>o.id===r))!=null&&i.requiresAgent?"ai":"info"}});return{live:F$(n)}}function R$(e,t){return{live:{tickets:t.map(n=>({id:n.itemId,title:n.title??n.itemId,customer:n.itemId,category:"真实记录",priority:n.state??"",status:n.status??I$(n),currentStepId:n.currentStepId,doneStepIds:n.doneStepIds,createdAt:Date.parse(n.updatedAt)||Date.now()}))}}}function I$(e){return e.completedAt?"done":e.currentStepId?"running":"todo"}function M$(e,t){const n=`evt_${t.seq}`;return e.live.logs.some(r=>r.id===n)?{}:{live:{logs:[...e.live.logs,{id:n,ts:Date.parse(t.at)||Date.now(),ticketId:t.itemId??"run",stepId:t.stepId??"run",level:L$(t.type),text:$$(t)}]}}}function O$(e,t){return e.live.logs.some(n=>n.ticketId==="run"&&n.text===t)?{}:{live:{logs:uk(e.live.logs,dk("error",t))}}}function L$(e){return e.endsWith("failed")?"error":e.endsWith("blocked")?"warn":e.endsWith("succeeded")||e.endsWith("completed")?"ok":"info"}function $$(e){const t=typeof e.payload.stepName=="string"?e.payload.stepName:e.stepId,n=typeof e.payload.error=="string"?e.payload.error:null,r=typeof e.payload.reason=="string"?e.payload.reason:null;switch(e.type){case"record.observed":return`发现工单 ${e.itemId??""}`.trim();case"step.started":return`开始步骤:${t??""}`.trim();case"step.succeeded":return`步骤完成:${t??""}`.trim();case"step.failed":return`步骤失败:${t??""}${n?` — ${n}`:""}`;case"record.blocked":return`工单受阻${r?`:${r}`:""}`;case"record.completed":return"工单已完成";default:return e.type}}function D$(e){return e.type==="run.record.detected"||e.type==="run.step.started"||e.type==="run.step.succeeded"||e.type==="run.step.failed"||e.type==="run.record.blocked"||e.type==="run.record.completed"}function z$(e){return{records:e.live.tickets.map(t=>({id:t.id,title:t.title,state:t.priority,status:t.status,currentStepId:t.currentStepId,doneStepIds:t.doneStepIds,createdAt:t.createdAt,updatedAt:t.createdAt})),logs:e.live.logs.map(t=>({id:t.id,ts:t.ts,itemId:t.ticketId,stepId:t.stepId,level:t.level,text:t.text}))}}function F$(e){return{tickets:e.records.map(t=>({id:t.id,title:t.title,customer:t.id,category:"真实记录",priority:t.state,status:t.status,currentStepId:t.currentStepId,doneStepIds:t.doneStepIds,createdAt:t.createdAt})),logs:e.logs.map(t=>({id:t.id,ts:t.ts,ticketId:t.itemId,stepId:t.stepId,level:t.level,text:t.text}))}}function uk(e,t){return e.some(r=>r.ticketId===t.ticketId&&r.stepId===t.stepId&&r.level===t.level&&r.text===t.text)?e:[...e,t]}function dk(e,t,n="run",r="run"){return{id:`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`,ts:Date.now(),ticketId:n,stepId:r,level:e,text:t}}function Bl(){return{designAgentEvents:0,designLiveText:"",tickets:[],logs:[]}}const V$={init:["ready"],design:["ready"],setup:["ready"],run:["stopped"]};function Ls(e,t){var n;return!!t&&(((n=V$[e])==null?void 0:n.includes(t))??!1)}const B$=["init","design","setup","adjust","test","run"];function U$(e){return typeof e=="string"&&B$.includes(e)}function i_(){return{init:{message:us.init},design:{message:us.design},setup:{message:us.setup},adjust:{message:us.adjust,local:!0},test:{message:us.test,local:!0},run:{message:us.run}}}const Gg=["init","design","setup","run"];function H$(e,t){if(!e)return{message:us[t]};const n=t,r="error"in e.state?e.state.error:void 0;return{phase:e.state.phase,taskId:e.identity.id,message:nk(n,e.state),retryable:(r==null?void 0:r.retryable)??e.next.kind==="await_user",error:r,next:e.next}}function uo(e){var r;const t=(r=e.projectState)==null?void 0:r.stages;if(!t)return i_();const n=i_();for(const s of Gg)n[s]=H$(t[s],s);return n}function fk(e){return e.files.some(t=>t.path==="workflow.yml"||t.path.endsWith("/workflow.yml"))}function hk(e){return fk(e)&&(!!e.workflow||e.files.some(t=>t.path.endsWith("/workflow.yml")))}function qg(e,t){var n;return((n=e==null?void 0:e.stages[t])==null?void 0:n.state)??null}function W$(e){return qg(e.projectState,"design")}function Yg(e){return qg(e.projectState,"setup")}function K$(e){return qg(e.projectState,"run")}function G$(e,t,n){var s;return n!=="live"?{kind:"open"}:Ls("design",t.design.phase)||fk(e)||(((s=e.workflow)==null?void 0:s.steps.length)??0)>0?{kind:"open"}:{kind:"blocked",reason:"搭建阶段必须使用当前流程生成的 workflow 和 recipes,请先完成设计阶段。",backTo:"design"}}function pk(e,t,n){return t!=="live"||Ls("setup",e.setup.phase)?{kind:"open"}:{kind:"blocked",reason:n,backTo:"setup"}}function q$(e){var n;const t=(n=e.projectState)==null?void 0:n.runSnapshot;return{tickets:(t==null?void 0:t.records.map(r=>({id:r.id,title:r.title,customer:r.id,category:"真实记录",priority:r.state,status:r.status,currentStepId:r.currentStepId,doneStepIds:r.doneStepIds,createdAt:r.createdAt})))??[],logs:(t==null?void 0:t.logs.map(r=>({id:r.id,ts:r.ts,ticketId:r.itemId,stepId:r.stepId,level:r.level,text:r.text})))??[]}}function mk(e){const t=Yg(e);return(t==null?void 0:t.phase)==="ready"?t.tableUrl:null}function Y$(e){const t=Yg(e);return(t==null?void 0:t.phase)!=="ready"?{fields:[],views:[]}:{fields:t.schema.fields,views:t.schema.views}}function X$(e){var r;const t=e.projectState;if(!t)return null;if(t.activeStage&&t.stages[t.activeStage])return t.activeStage;let n=null;for(const s of Gg){const i=(r=t.stages[s])==null?void 0:r.identity;i&&(!n||i.updatedAt.localeCompare(n.updatedAt)>=0)&&(n={stage:s,updatedAt:i.updatedAt})}return(n==null?void 0:n.stage)??null}function gk(e,t="init"){const n=uo(e),r=vk(e);if(r)return r.stage;if(n.setup.phase==="auth_awaiting"||n.setup.phase==="failed")return"setup";const s=X$(e);return s==="design"&&Ls("design",n.design.phase)&&hk(e)?"setup":s??t}function vk(e){var n,r;const t=(n=e.projectState)==null?void 0:n.stages;if(!t)return null;for(const s of["design","setup","run"]){const i=(r=t[s])==null?void 0:r.next;if((i==null?void 0:i.kind)==="attach_stream")return{stage:s,endpoint:i.endpoint}}return null}function Q$(e){var r,s;const t=(r=e.projectState)==null?void 0:r.stages;if(!t)return null;let n=null;for(const i of Gg){const o=(s=t[i])==null?void 0:s.next;(o==null?void 0:o.kind)==="poll"&&(n=n===null?o.intervalMs:Math.min(n,o.intervalMs))}return n}function Z$(e,t){return e.phase==="loading"?{kind:"loading",projectId:e.projectId}:e.phase==="error"?{kind:"load_error",projectId:e.projectId,message:e.error??"项目加载失败"}:t.projectId?{kind:"ready"}:{kind:"no_project"}}function yk(e){return{runtime:uo(e.snapshot).design,state:W$(e.snapshot),unsupported:e.mode!=="live",hasArtifacts:hk(e.snapshot),agentEvents:e.live.designAgentEvents,liveText:e.live.designLiveText}}function xk(e){const t=uo(e.snapshot);return{runtime:t.setup,state:Yg(e.snapshot),gate:G$(e.snapshot,t,e.mode),schema:e.mode==="mock"&&e.mockSetup?{fields:e.mockSetup.fields,views:e.mockSetup.views}:Y$(e.snapshot),tableUrl:e.mode==="mock"&&e.mockSetup?e.mockSetup.tableUrl:mk(e.snapshot)}}function J$(e){const t=uo(e.snapshot);return{runtime:t.test,gate:pk(t,e.mode,"试运行必须基于已搭建完成的 AI 表格,请先完成搭建阶段。")}}function eD(e){const t=uo(e.snapshot);return{runtime:t.run,state:K$(e.snapshot),gate:pk(t,e.mode,"正式运行必须基于已搭建完成的 AI 表格,请先完成搭建阶段。"),tickets:e.live.tickets,logs:e.live.logs}}function ms(){return{projectId:null,projects:[],files:[],projectState:null,workflow:null,workflows:[],currentWorkflowId:null,workflowFiles:[],engineBinding:null,init:null}}D1({enforceActions:"always",computedRequiresReaction:!1});const o_="aitable-workflow:shell-state:v3",tD=["aitable-workflow:shell-state:v2"],Mf={name:"",agentsSelected:[],selectedMachineId:"",tableConnected:!1,tableBaseId:"",tableId:"",llmProvider:"",llmModel:"",roles:[],sop:""};class nD{constructor(){le(this,"theme","light");le(this,"layout",{railCollapsed:!1,chatCollapsed:!1,chatWidth:460});le(this,"projectSource","new");le(this,"agentTraceOpen",!1);le(this,"agentTraceLog",[]);le(this,"initDraft",{...Mf});le(this,"validation",{});le(this,"stepStatus",{});le(this,"mockSetup",{fields:[],views:[],tableUrl:null});le(this,"mode",me?"live":"mock");le(this,"snapshot",ms());le(this,"loading",{phase:"idle",projectId:null});le(this,"live",Bl());V1(this,{theme:ye,layout:ye,projectSource:ye,agentTraceOpen:ye,agentTraceLog:ye.ref,initDraft:ye,validation:ye,stepStatus:ye,mockSetup:ye,snapshot:ye,loading:ye,live:ye,stageRuntime:er,stream:er,recommendedStage:er,steps:er,edges:er,toggleTheme:oe,setRailCollapsed:oe,setChatCollapsed:oe,setChatWidth:oe,setProjectSource:oe,setAgentTraceOpen:oe,toggleAgentTrace:oe,appendAgentTrace:oe,clearAgentTrace:oe,patchInitDraft:oe,setValidation:oe,setStepStatus:oe,addMockField:oe,addMockView:oe,setMockTableUrl:oe,addTicket:oe,updateTicket:oe,appendLog:oe,startNewWorkflow:oe,beginNewProject:oe,setEngineBinding:oe,reset:oe,beginLoad:oe,failLoad:oe,applyLoadedProject:oe,applySnapshotPatch:oe,applyServerFiles:oe,applyServerWorkflow:oe,setCurrentWorkflow:oe,setProjects:oe,setWorkflows:oe,clearProject:oe,patchLive:oe,applyDesignEvent:oe,applySetupEvent:oe,applyRunEvent:oe,applyRunRecords:oe,refreshProjectState:oe,appendRunTimelineEntry:oe,appendRunPollError:oe}),this.hydrateFromStorage(),this.installPersistence()}get stageRuntime(){return uo(this.snapshot)}get stream(){return vk(this.snapshot)}get pollIntervalMs(){return Q$(this.snapshot)}get recommendedStage(){return gk(this.snapshot)}get steps(){var n;return(((n=this.snapshot.workflow)==null?void 0:n.steps)??[]).map(r=>this.stepStatus[r.id]?{...r,status:this.stepStatus[r.id]}:r)}get edges(){var t;return((t=this.snapshot.workflow)==null?void 0:t.edges)??[]}get validationContext(){return{steps:this.steps,init:this.initDraft,stageRuntime:this.stageRuntime}}get tableUrl(){return this.mode==="mock"?this.mockSetup.tableUrl:mk(this.snapshot)}get projectId(){return this.snapshot.projectId}get projects(){return this.snapshot.projects}get projectFiles(){return this.snapshot.files}get workflows(){return this.snapshot.workflows}get currentWorkflowId(){return this.snapshot.currentWorkflowId}get workflowFiles(){return this.snapshot.workflowFiles}toggleTheme(){this.theme=this.theme==="light"?"dark":"light",typeof document<"u"&&document.documentElement.setAttribute("data-theme",this.theme)}setRailCollapsed(t){this.layout={...this.layout,railCollapsed:t}}setChatCollapsed(t){this.layout={...this.layout,chatCollapsed:t}}setChatWidth(t){this.layout={...this.layout,chatWidth:t,chatCollapsed:!1}}setProjectSource(t){this.projectSource=t}setAgentTraceOpen(t){this.agentTraceOpen=t}toggleAgentTrace(){this.agentTraceOpen=!this.agentTraceOpen}appendAgentTrace(t){const n=DL(this.agentTraceLog,Array.isArray(t)?t:[t]);n!==this.agentTraceLog&&(this.agentTraceLog=n)}clearAgentTrace(){this.agentTraceLog.length!==0&&(this.agentTraceLog=[])}patchInitDraft(t){this.initDraft={...this.initDraft,...t}}setValidation(t,n){this.validation={...this.validation,[t]:n}}setStepStatus(t,n){const r={...this.stepStatus};n?r[t]=n:delete r[t],this.stepStatus=r}addMockField(t){this.mockSetup={...this.mockSetup,fields:[...this.mockSetup.fields,t]}}addMockView(t){this.mockSetup={...this.mockSetup,views:[...this.mockSetup.views,t]}}setMockTableUrl(t){this.mockSetup={...this.mockSetup,tableUrl:t}}addTicket(t){this.live={...this.live,tickets:[t,...this.live.tickets]}}updateTicket(t,n){this.live={...this.live,tickets:this.live.tickets.map(r=>r.id===t?{...r,...n}:r)}}appendLog(t){this.live={...this.live,logs:[...this.live.logs,t]}}beginNewProject(t,n){this.startNewWorkflow(),this.projectSource="new",this.snapshot={...ms(),projects:this.snapshot.projects,projectId:t},this.initDraft={...Mf,name:n},this.loading={phase:"ready",projectId:t}}startNewWorkflow(){this.initDraft={...Mf},this.live=Bl(),this.stepStatus={},this.mockSetup={fields:[],views:[],tableUrl:null},this.validation={},this.agentTraceLog=[],this.snapshot={...ms(),projects:this.snapshot.projects,projectId:this.snapshot.projectId}}reset(){this.projectSource="new",this.startNewWorkflow(),this.snapshot={...ms(),projects:this.snapshot.projects},this.loading={phase:"idle",projectId:null}}beginLoad(t){this.loading={phase:"loading",projectId:t}}failLoad(t,n){this.loading={phase:"error",projectId:t,error:n}}applyLoadedProject(t){this.snapshot=t.snapshot,this.live={...Bl(),...t.live},this.stepStatus={},t.snapshot.init&&(this.initDraft=t.snapshot.init),this.loading={phase:"ready",projectId:t.snapshot.projectId}}applySnapshotPatch(t,n){return this.snapshot.projectId!==t?!1:(this.snapshot={...this.snapshot,...n},!0)}applyServerFiles(t,n){return this.applySnapshotPatch(t,{files:n})}applyServerWorkflow(t,n){return this.applySnapshotPatch(t,{workflow:n})}setCurrentWorkflow(t,n){this.snapshot={...this.snapshot,currentWorkflowId:t,workflowFiles:n}}setProjects(t){this.snapshot={...this.snapshot,projects:t}}setWorkflows(t){this.snapshot={...this.snapshot,workflows:t}}setEngineBinding(t,n){this.applySnapshotPatch(t,{engineBinding:n})}clearProject(t){this.snapshot={...ms(),projects:t},this.live=Bl(),this.stepStatus={},this.loading={phase:"idle",projectId:null},this.projectSource="new"}patchLive(t,n){return this.snapshot.projectId!==t?!1:(this.live={...this.live,...n},!0)}applyDesignEvent(t,n){return this.applyReducerPatch(t,r=>T$(r,n))}applySetupEvent(t,n){return this.applyReducerPatch(t,r=>P$(r,n))}applyRunEvent(t,n){return this.applyReducerPatch(t,r=>A$(r,n))}async refreshProjectState(t){if(this.snapshot.projectId!==t)return!1;const n=await Hg(t).catch(()=>null);return!n||this.snapshot.projectId!==t?!1:(this.snapshot={...this.snapshot,projectState:n},!0)}applyRunRecords(t,n){return this.applyReducerPatch(t,r=>R$(r,n))}appendRunTimelineEntry(t,n){return this.applyReducerPatch(t,r=>M$(r,n))}appendRunPollError(t,n){return this.applyReducerPatch(t,r=>O$(r,n))}applyReducerPatch(t,n){if(this.snapshot.projectId!==t)return!1;const r=n({projectId:t,projectState:this.snapshot.projectState,live:this.live,steps:this.steps});return(r.projectState||r.files)&&(this.snapshot={...this.snapshot,...r.projectState?{projectState:r.projectState}:{},...r.files?{files:r.files}:{}}),r.live&&(this.live={...this.live,...r.live}),!0}hydrateFromStorage(){if(!(typeof window>"u"))try{const t=[o_,...tD].map(s=>window.localStorage.getItem(s)).find(s=>s!==null);if(!t)return;const n=JSON.parse(t);if(typeof n!="object"||n===null)return;const r=n;bO(()=>{(r.theme==="dark"||r.theme==="light")&&(this.theme=r.theme),typeof r.layout=="object"&&r.layout!==null&&(this.layout={...this.layout,...r.layout})})}catch{}}installPersistence(){typeof window>"u"||O1(()=>{const t={version:3,theme:this.theme,layout:this.layout};try{window.localStorage.setItem(o_,JSON.stringify(t))}catch{}})}}const B=new nD,rD={sparkle:"M12 2l1.9 5.8L20 9.7l-5.1 3.7L16 20l-4-3.6L8 20l1.1-6.6L4 9.7l6.1-1.9z",check:"M4 12l5 5L20 6","chevron-right":"M9 6l6 6-6 6","chevron-down":"M6 9l6 6 6-6","chevron-left":"M15 6l-6 6 6 6","chevron-up":"M6 15l6-6 6 6",plus:"M12 5v14M5 12h14",play:"M7 5v14l12-7z",pause:"M8 5v14M16 5v14",refresh:"M23 4v6h-6 M1 20v-6h6 M3.51 9a9 9 0 0114.85-3.36L23 10 M1 14l4.64 4.36A9 9 0 0020.49 15",moon:"M21 12.8A9 9 0 1111.2 3a7 7 0 009.8 9.8z",sun:"M12 4V2M12 22v-2M4 12H2M22 12h-2M5.6 5.6L4.2 4.2M19.8 19.8l-1.4-1.4M18.4 5.6l1.4-1.4M4.2 19.8l1.4-1.4M12 8a4 4 0 100 8 4 4 0 000-8z",table:"M3 5h18v14H3zM3 10h18M9 10v9M15 10v9",flow:"M5 5h5v5H5zM14 14h5v5h-5zM10 7h4M12 10v4",robot:"M12 3v3M7 6h10a2 2 0 012 2v9a2 2 0 01-2 2H7a2 2 0 01-2-2V8a2 2 0 012-2zM9 12h.01M15 12h.01",lock:"M6 11V8a6 6 0 0112 0v3M5 11h14v9H5z",bolt:"M13 2L4 14h6l-1 8 9-12h-6z",file:"M6 2h8l4 4v16H6zM14 2v4h4",folder:"M3 6h6l2 2h10v12H3z",link:"M10 13a5 5 0 007 0l2-2a5 5 0 00-7-7l-1 1M14 11a5 5 0 00-7 0l-2 2a5 5 0 007 7l1-1",send:"M22 2L11 13M22 2l-7 20-4-9-9-4z",user:"M12 12a4 4 0 100-8 4 4 0 000 8zM4 21a8 8 0 0116 0",warn:"M12 3l10 18H2zM12 10v5M12 18h.01",close:"M6 6l12 12M18 6L6 18",dot:"M12 12h.01"};function $({name:e,size:t=16,color:n="currentColor",style:r}){const s=e==="play"||e==="pause"||e==="sparkle"||e==="bolt";return a.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:s?n:"none",stroke:s?"none":n,strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",style:r,"aria-hidden":!0,children:a.jsx("path",{d:rD[e]})})}async function sD(){return await(await ue("/api/account/profile")).json()}let Eo={user:null};const Rp=new Set;function Of(){for(const e of Rp)e()}const wu={get(){return Eo},isLoggedIn(){return Eo.user!==null},setUser(e){Eo={user:e},Of()},clear(){Eo={user:null},Of()},async loadProfile(){Eo={user:(await sD()).user},Of()},logout(){this.clear(),typeof window<"u"&&(window.location.href="/")},subscribe(e){return Rp.add(e),()=>{Rp.delete(e)}}},iD={user:null};function _k(){return w.useSyncExternalStore(wu.subscribe,()=>wu.get(),()=>iD)}const oD=[{id:"init",label:"配置"},{id:"design",label:"设计"},{id:"setup",label:"搭建"},{id:"test",label:"试运行"},{id:"run",label:"运行"}],aD=[{id:"adjust",label:"参数调整"}],lD=lt(function({projectId:t}){const n=B.stageRuntime,r=B.projectSource,s=t?oD:aD;return a.jsx("nav",{className:"stepper","aria-label":"阶段进度",children:s.map((i,o)=>{const l=Ls(i.id,n[i.id].phase),c=r==="imported"&&(i.id==="init"||i.id==="design"||i.id==="setup"),u=a.jsx("span",{className:"stepper__num",children:l||c?a.jsx($,{name:"check",size:12}):o+1}),d=l||c?" is-done":"",f=c?"已随包导入":void 0;return a.jsxs(w.Fragment,{children:[o>0&&a.jsx("span",{className:"stepper__sep"}),t?a.jsxs(t1,{to:`/p/${t}/${i.id}`,className:({isActive:h})=>"stepper__item"+(h?" is-active":"")+d,title:f,children:[u,i.label]}):a.jsxs("span",{className:"stepper__item is-active"+d,title:f,children:[u,i.label]})]},i.id)})})});function cD(e){return e?e!=="ready"&&e!=="generate_failed"&&e!=="clarify_failed":!1}const uD=300,dD=80,fD=48;function hD(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=fD}function pD({groups:e,live:t,onClose:n,bodyRef:r,onScroll:s}){return a.jsx("div",{className:"trace-backdrop",onClick:n,children:a.jsxs("aside",{className:"trace-panel",role:"dialog","aria-label":"Agent 执行记录",onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"trace-panel__head",children:[a.jsx("h2",{className:"trace-panel__title",children:"Agent 执行记录"}),a.jsx("button",{type:"button",className:"trace-panel__close",onClick:n,title:"关闭","aria-label":"关闭",children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"trace-panel__body",ref:r,onScroll:s,children:e.length===0?a.jsx("div",{className:"trace-empty",children:"还没有 Agent 执行记录。运行设计后,这里会实时显示 Agent 的思考、正文与工具调用。"}):e.map((i,o)=>{const l=o===e.length-1;return a.jsxs("div",{className:"trace-grp",children:[a.jsx("span",{className:"trace-av","aria-hidden":!0,children:a.jsx($,{name:"robot",size:16})}),a.jsxs("div",{className:"trace-body",children:[a.jsx("div",{className:"trace-head",children:i.round!=null?`第 ${i.round} 轮`:"执行过程"}),i.items.map((c,u)=>{const d=u===i.items.length-1;if(c.kind==="tool")return a.jsxs("div",{className:"trace-tool",children:[a.jsx($,{name:"bolt",size:12}),a.jsx("span",{className:"trace-tool__label",children:c.text})]},u);if(c.kind==="tool_result")return c.fullText?a.jsxs("details",{className:"trace-toolret trace-toolret--expandable",children:[a.jsxs("summary",{className:"trace-toolret__summary",children:[a.jsx($,{name:"dot",size:12}),a.jsx("span",{className:"trace-toolret__label",children:c.text})]}),a.jsx("pre",{className:"trace-toolret__full",children:c.fullText})]},u):a.jsxs("div",{className:"trace-toolret",children:[a.jsx($,{name:"dot",size:12}),a.jsx("span",{className:"trace-toolret__label",children:c.text})]},u);if(c.kind==="permission")return c.fullText?a.jsxs("details",{className:"trace-perm trace-perm--expandable",children:[a.jsxs("summary",{className:"trace-perm__summary",children:[a.jsx($,{name:"lock",size:12}),a.jsx("span",{className:"trace-perm__label",children:c.text})]}),a.jsx("pre",{className:"trace-perm__full",children:c.fullText})]},u):a.jsxs("div",{className:"trace-perm",children:[a.jsx($,{name:"lock",size:12}),a.jsx("span",{className:"trace-perm__label",children:c.text})]},u);if(c.kind==="status")return a.jsxs("div",{className:"trace-status",children:[a.jsx($,{name:"dot",size:12}),a.jsx("span",{children:c.text})]},u);if(c.kind==="thinking"&&c.text.length>uD)return a.jsxs("details",{className:"trace-text trace-text--thinking trace-text--foldable",children:[a.jsx("summary",{className:"trace-text__summary",children:`${c.text.slice(0,dD)}…`}),a.jsx("div",{className:"trace-text__full",children:c.text})]},u);const f=t&&l&&d,h=c.kind==="thinking"?"trace-text trace-text--thinking":"trace-text";return a.jsxs("div",{className:h,children:[c.text,f?a.jsx("span",{className:"trace-cursor"}):null]},u)})]})]},o)})})]})})}const mD=lt(function({onDesign:t=!1}){const n=B.agentTraceOpen,r=B.agentTraceLog,s=w.useMemo(()=>BL(r),[r]),i=t?yk({snapshot:B.snapshot,live:B.live,mode:B.mode}).state:null,o=cD(i==null?void 0:i.phase),l=w.useRef(null),c=w.useRef(!0);w.useEffect(()=>{const d=l.current;!d||!c.current||(d.scrollTop=d.scrollHeight)},[s,n]);function u(){const d=l.current;d&&(c.current=hD(d))}return w.useEffect(()=>{if(!n)return;function d(f){f.key==="Escape"&&B.setAgentTraceOpen(!1)}return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n]),n?a.jsx(pD,{groups:s,live:o,onClose:()=>B.setAgentTraceOpen(!1),bodyRef:l,onScroll:u}):null}),gD={init:"一次性配置",design:"工作流设计",setup:"AI 表格搭建",adjust:"参数调整",test:"试运行",run:"运行监控"};function Xg({stage:e}){return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:gD[e]}),a.jsx("div",{className:"work-head__sub",children:"正在读取项目状态…"})]})}),a.jsxs("div",{className:"work-body stage-skeleton",children:[a.jsx("div",{className:"stage-skeleton__bar stage-skeleton__bar--wide"}),a.jsx("div",{className:"stage-skeleton__bar"}),a.jsx("div",{className:"stage-skeleton__bar stage-skeleton__bar--narrow"}),a.jsx("div",{className:"stage-skeleton__card"})]})]})})}function a_({message:e,onRetry:t,title:n="项目加载失败",subtitle:r="服务端状态未取到"}){return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:n}),a.jsx("div",{className:"work-head__sub",children:r})]})}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:[e,a.jsx("div",{style:{marginTop:16},children:a.jsxs("button",{type:"button",className:"primary",onClick:t,children:[a.jsx($,{name:"play",size:14,color:"#fff"}),"重试"]})})]})})]})})}let Ui=null;const Qg="aitable-workflow-dev-token";function vD(e){try{localStorage.setItem(Qg,e)}catch{}}function yD(){try{return localStorage.getItem(Qg)}catch{return null}}function xD(e){if(Ui=e,e)vD(e);else try{localStorage.removeItem(Qg)}catch{}}function wk(){return Ui!==null}function bk(){const t=new URLSearchParams(window.location.search).get("token");if(t){xD(t);const n=new URL(window.location.href);n.searchParams.delete("token"),window.history.replaceState({},"",n.toString())}else if(!Ui){const n=yD();n&&(Ui=n)}return wk()}async function Ee(e,t){if(!Ui)throw new Error("Dev token not set");const n=await fetch(e,{...t,headers:{...t==null?void 0:t.headers,Authorization:`Bearer ${Ui}`}});if(!n.ok){const r=await n.text();try{const s=JSON.parse(r),i=s.error??s.message;if(i)throw new Error(i)}catch(s){if(s instanceof Error&&s.message!==r)throw s}throw new Error(r||`HTTP ${n.status}`)}return n}async function Ip(e){return await(await Ee("/dev/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:e})})).json()}async function jk(){await Ee("/dev/setup/complete",{method:"POST"})}async function l_(){return await(await Ee("/dev/setup/progress")).json()}async function _D(e,t){return await(await Ee("/dev/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,files:t})})).json()}async function wD(e,t){return await(await Ee("/dev/kb/ingest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,source:t})})).json()}async function Sk(){return await(await Ee("/dev/config/enriched")).json()}async function bD(e){return await(await Ee(`/dev/file/read?path=${encodeURIComponent(e)}`)).json()}async function jD(e,t){return await(await Ee("/dev/file/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:t})})).json()}async function c_(){return await(await Ee("/dev/setup/artifacts")).json()}async function kk(){return await(await Ee("/dev/console/state")).json()}async function Mp(){return await(await Ee("/dev/console/mode")).json()}async function SD(){return await(await Ee("/dev/console/promote",{method:"POST"})).json()}async function u_(){return await(await Ee("/dev/console/dws-auth")).json()}async function kD(){return await(await Ee("/dev/console/dws-auth/login",{method:"POST"})).json()}async function ND(){return await(await Ee("/dev/console/dws-auth/login")).json()}async function ED(){return await(await Ee("/dev/console/admin-groups")).json()}async function CD(e){return await(await Ee(`/dev/console/groups/${encodeURIComponent(e.conversationId)}/add-enterprise-bot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,groupType:e.groupType})})).json()}async function Nk(e){return await(await Ee(`/dev/console/groups/${encodeURIComponent(e.conversationId)}/custom-bot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,groupType:e.groupType,name:e.name,webhook:e.webhook,secret:e.secret})})).json()}async function Ek(){return await(await Ee("/dev/console/group-config-table")).json()}async function TD(){return await(await Ee("/dev/console/group-config-table/flush-staging",{method:"POST"})).json()}async function d_(e,t){return await(await Ee(`/dev/console/group-config-table/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function PD(e,t){return await(await Ee("/dev/kb/official",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,enabled:t})})).json()}async function AD(){return await(await Ee("/dev/run/status")).json()}const RD={start:"/dev/run/start",stop:"/dev/run/stop"};async function ID(e){return await(await Ee(RD[e],{method:"POST"})).json()}async function MD(e){return await(await Ee("/dev/workflow/trigger-once",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflowId:e})})).json()}function OD(){const e=_k(),[t,n]=w.useState(!1),r=w.useRef(null);return w.useEffect(()=>{if(!t)return;function s(i){r.current&&!r.current.contains(i.target)&&n(!1)}return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[t]),!st||!e.user?null:a.jsxs("div",{className:"user-menu",ref:r,children:[a.jsxs("button",{type:"button",className:"user-menu__trigger",onClick:()=>n(s=>!s),title:"用户菜单",children:[a.jsx($,{name:"user",size:15}),a.jsx("span",{className:"user-menu__name",children:e.user.username}),a.jsx($,{name:"chevron-down",size:12})]}),t&&a.jsxs("div",{className:"user-menu__dropdown",children:[a.jsxs(Ue,{className:"user-menu__item",to:"/account",onClick:()=>n(!1),children:[a.jsx($,{name:"user",size:14}),"用户中心"]}),a.jsxs(Ue,{className:"user-menu__item",to:"/engines",onClick:()=>n(!1),children:[a.jsx($,{name:"bolt",size:14}),"执行引擎"]}),a.jsx("div",{className:"user-menu__divider"}),a.jsxs("button",{type:"button",className:"user-menu__item user-menu__item--danger",onClick:()=>{wu.logout(),n(!1)},children:[a.jsx($,{name:"close",size:14}),"退出登录"]})]})]})}const LD=lt(function(){const[t]=w.useState(()=>bk()),[n,r]=w.useState(st&&!t),s=B.theme;w.useEffect(()=>{if(!st||t){r(!1);return}let u=!1;return wu.loadProfile().then(()=>{u||r(!1)}).catch(()=>{u||r(!1)}),()=>{u=!0}},[t]);const i=wc({path:"/p/:projectId",end:!1}),o=wc("/setup"),l=!!i||!!o,c=wc("/p/:projectId/design");return n?a.jsx(Xg,{stage:"init"}):a.jsxs("div",{className:"app-root",children:[a.jsxs("header",{className:"chrome",children:[a.jsxs(Ue,{className:"chrome__brand",to:"/",title:"返回首页",children:[a.jsx("span",{className:"chrome__brand-mark",children:a.jsx($,{name:"sparkle",size:15,color:"#fff"})}),"aitable-workflow"]}),l&&a.jsx(lD,{projectId:i==null?void 0:i.params.projectId}),a.jsx("div",{className:"chrome__spacer"}),a.jsx("button",{type:"button",className:"chrome__theme",onClick:()=>B.toggleTheme(),title:s==="light"?"切换到暗色":"切换到亮色","aria-label":"切换主题",children:a.jsx($,{name:s==="light"?"moon":"sun",size:17})}),a.jsx(OD,{})]}),a.jsx(JS,{}),a.jsx(mD,{onDesign:!!c})]})});async function Ck(e,t){const n=await Ap(e);if(n.length===0)return{workflows:[],currentWorkflowId:null,workflowFiles:[]};const r=t&&n.some(i=>i.id===t)?t:n[0].id;let s=[];try{s=(await sk(e,r)).files}catch{}return{workflows:n,currentWorkflowId:r,workflowFiles:s}}function $D(e){var u;const t=(u=e.find(d=>d.path==="aitable-workflow.config.yml"))==null?void 0:u.content;if(!t)return null;const n=Zn(t,"name")??"",r=Zn(t,"base_id"),s=Zn(t,"table_id")??"",i=Zn(t,"provider"),o=Zn(t,"model"),l=Zn(t,"engine"),c=zD(t,"scene")??"";return!r&&!i&&!o?null:{name:n,agentsSelected:l==="qoder"||l==="codex"?[l]:["claude"],selectedMachineId:"",tableConnected:!!r,tableBaseId:r??"",tableId:s,llmProvider:i??"",llmModel:o??"",roles:DD(e),sop:c}}function DD(e){return e.filter(t=>t.path.startsWith("roles/")&&t.path.endsWith(".role.yml")&&t.content).map(t=>{const n=Zn(t.content,"id")??"",r=Zn(t.content,"name")??"",s=Zn(t.content,"persona")??"";return{id:n,name:r,persona:s,skills:[],knowledge:[]}}).filter(t=>t.id&&t.name)}function Zn(e,t){const n=new RegExp(`^\\s*${t}:\\s*(?:"([^"]*)"|'([^']*)'|([^#\\n]*))`,"m"),r=e.match(n),s=(r==null?void 0:r[1])??(r==null?void 0:r[2])??(r==null?void 0:r[3]),i=s==null?void 0:s.trim();return i||null}function zD(e,t){const n=new RegExp(`^${t}:\\s*\\|\\n([\\s\\S]*?)(?=\\n\\S|$)`,"m"),r=e.match(n);return r!=null&&r[1]&&r[1].split(`
64
+ `),v=_.find(m=>m.startsWith("id: "));v&&(s=v.slice(4).trim());const y=_.find(m=>m.startsWith("data: "));y&&await n(JSON.parse(y.slice(6)))}}}catch(u){if((c=r==null?void 0:r.signal)!=null&&c.aborted)return;if(o=null,i+=1,i>l$)throw u;const d=Math.min(u$,c$*2**(i-1));await new Promise(f=>setTimeout(f,d))}}}function d$(e){return{steps:e.steps.map(t=>({id:t.id,name:t.name,recipe:t.recipe??"",engine:f$(t.engine),auto:t.auto,requiresAgent:!!t.requires_agent,needsHuman:!!t.needs_human,inputs:Object.values(t.input_mapping??{}),outputs:Object.values(t.output_mapping??{}),status:"idle"})),edges:e.edges.filter(t=>t.from!=="__start__"&&t.to!=="__end__")}}function f$(e){return e==="claude"||e==="codex"||e==="qoder"||e==="qwenwork"||e==="llm_only"?e:"llm_only"}const h$={init:{configuring:!0,ready:!1,failed:!1},design:{clarify_probing:!0,clarify_awaiting:!0,clarify_failed:!1,precheck:!0,generating:!0,validating:!0,syncing_schema:!0,ready:!1,generate_failed:!1},setup:{preflight:!0,provisioning_table:!0,syncing_schema:!0,auth_awaiting:!0,ready:!1,failed:!1},run:{starting:!0,listening:!0,stopped:!1,failed:!1,awaiting_machine:!0,running_on_machine:!0}};function p$(e,t){const r=h$[e][t.phase];if(r===void 0)throw new Error(`phase 未登记推进中/终态:${e}.${t.phase}`);return r}const m$=["precheck","generating","validating","syncing_schema"];function g$(e){return!!e&&m$.includes(e.phase)}function Jx(e){return(e==null?void 0:e.phase)==="clarify_failed"||(e==null?void 0:e.phase)==="generate_failed"}function v$(e,t,n){return p$(t,n)?t:e===t?null:e}function y$(e,t){return e===void 0?!1:Array.isArray(e)?e.includes(t):typeof e=="boolean"?String(e)===t:e===t}function lk(e,t){return e.showIf?y$(t[e.showIf.questionId],e.showIf.hasValue):!0}function x$(e,t){return e.questions.filter(n=>lk(n,t))}function _$(e,t){var r;const n=[];for(const s of x$(e,t)){const i=t[s.id];if(s.required&&e_(i)){n.push({questionId:s.id,code:"required",message:`「${s.label}」为必填项`});continue}if(s.maxSelections!==void 0&&Array.isArray(i)&&i.length>s.maxSelections&&n.push({questionId:s.id,code:"max_selections",message:`「${s.label}」最多选 ${s.maxSelections} 项,实际 ${i.length} 项`}),s.allowCustom===!1&&((r=s.options)!=null&&r.length)&&!e_(i)){const o=new Set(s.options.map(u=>u.value)),c=(Array.isArray(i)?i:[String(i)]).filter(u=>!o.has(u));c.length>0&&n.push({questionId:s.id,code:"not_in_options",message:`「${s.label}」只能从给定选项中选择,收到:${c.join("、")}`})}}return n}function e_(e){return e===void 0?!0:typeof e=="string"?e.trim()==="":Array.isArray(e)?e.length===0:!1}const w$=300;function b$(e,t,n={}){var s;const r=j$(n);if(t.type==="run.record.detected")return{records:S$(e.records,{id:t.record.id,title:t.record.title||t.record.id,state:t.record.state,status:t.record.currentStep?"running":"todo",currentStepId:t.record.currentStep,doneStepIds:[],createdAt:r.now(),updatedAt:r.now()}),logs:ds(e.logs,t.record.id,t.record.currentStep??"run","info",`发现待处理记录:${t.record.title||t.record.id}`,r)};if(t.type==="run.step.started"){const i=((s=n.stepLevel)==null?void 0:s.call(n,t.stepId,t))??"ai";return{records:No(e.records,t.itemId,o=>({...o,status:o.status==="done"?o.status:"running",currentStepId:o.status==="done"?o.currentStepId:t.stepId,updatedAt:r.now()})),logs:ds(e.logs,t.itemId,t.stepId,i,`开始执行步骤:${t.stepName}`,r)}}return t.type==="run.step.succeeded"?{records:No(e.records,t.itemId,i=>({...i,doneStepIds:t_(i.doneStepIds,t.stepId),updatedAt:r.now()})),logs:If(ds(e.logs,t.itemId,t.stepId,"ok",`步骤完成:${t.stepName}`,r),t.itemId,t.stepId,"info",t.logs,r)}:t.type==="run.step.failed"?{records:No(e.records,t.itemId,i=>({...i,status:i.status==="done"?i.status:"blocked",currentStepId:i.status==="done"?i.currentStepId:t.stepId,updatedAt:r.now()})),logs:If(ds(e.logs,t.itemId,t.stepId,"error",`步骤失败:${t.stepName} · ${t.error}`,r),t.itemId,t.stepId,"error",t.logs,r)}:t.type==="run.record.blocked"?{records:No(e.records,t.itemId,i=>({...i,status:i.status==="done"?i.status:t.reason.includes("人工")?"review":"blocked",currentStepId:i.status==="done"?i.currentStepId:t.stepId,doneStepIds:t_(i.doneStepIds,t.stepId),updatedAt:r.now()})),logs:If(ds(e.logs,t.itemId,t.stepId,"warn",`${t.stepName}:${t.reason}`,r),t.itemId,t.stepId,"info",t.logs,r)}:t.type==="run.record.completed"?{records:No(e.records,t.itemId,i=>({...i,status:"done",currentStepId:null,updatedAt:r.now()})),logs:ds(e.logs,t.itemId,"run","ok","流程完成",r)}:e}function j$(e){return{now:e.now??Date.now,id:e.id??k$,maxLogs:e.maxLogs??w$}}function S$(e,t){return e.findIndex(r=>r.id===t.id)<0?[...e,t]:e.map(r=>r.id===t.id?{...r,...t,doneStepIds:r.doneStepIds,status:r.status==="done"?r.status:t.status,currentStepId:r.status==="done"?r.currentStepId:t.currentStepId,createdAt:r.createdAt}:r)}function No(e,t,n){return e.map(r=>r.id===t?n(r):r)}function t_(e,t){return e.includes(t)?e:[...e,t]}function ds(e,t,n,r,s,i){return e.some(l=>l.itemId===t&&l.stepId===n&&l.level===r&&l.text===s)?e:[...e,{id:i.id(),ts:i.now(),itemId:t,stepId:n,level:r,text:s}].slice(-i.maxLogs)}function If(e,t,n,r,s,i){return s!=null&&s.length?s.reduce((o,l)=>ds(o,t,n,r,l,i),e):e}function k$(){return`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function N$(e){return{projectId:e,activeStage:null,stages:{},updatedAt:new Date().toISOString()}}function Hg(e,t){const n=e.projectState??N$(e.projectId);return{...n,activeStage:v$(n.activeStage,t.stage,t.stageState.state),stages:{...n.stages,[t.stage]:t.stageState},updatedAt:t.stageState.identity.updatedAt}}function E$(e,t){switch(t.type){case"stage.changed":return{projectState:Hg(e,t)};case"design.agent_event":return{live:{designAgentEvents:e.live.designAgentEvents+1,designLiveText:t.event.type==="tool_use"?`Agent 调用工具:${t.event.toolName??""}`.trim():"Agent 正在输出内容"}};case"design.files":return{files:t.files};case"error":return{live:{designLiveText:`真实设计中断:${t.error.message}`}};default:return{}}}function C$(e,t){switch(t.type){case"stage.changed":return{projectState:Hg(e,t)};default:return{}}}function T$(e,t){if(t.type==="stage.changed")return{projectState:Hg(e,t)};if(t.type==="error")return{live:{logs:ck(e.live.logs,uk("error",t.error.message))}};if(!L$(t))return{};const n=b$($$(e),t,{stepLevel:r=>{var s,i;return(i=(s=e.steps)==null?void 0:s.find(o=>o.id===r))!=null&&i.requiresAgent?"ai":"info"}});return{live:D$(n)}}function P$(e,t){return{live:{tickets:t.map(n=>({id:n.itemId,title:n.title??n.itemId,customer:n.itemId,category:"真实记录",priority:n.state??"",status:n.status??A$(n),currentStepId:n.currentStepId,doneStepIds:n.doneStepIds,createdAt:Date.parse(n.updatedAt)||Date.now()}))}}}function A$(e){return e.completedAt?"done":e.currentStepId?"running":"todo"}function R$(e,t){const n=`evt_${t.seq}`;return e.live.logs.some(r=>r.id===n)?{}:{live:{logs:[...e.live.logs,{id:n,ts:Date.parse(t.at)||Date.now(),ticketId:t.itemId??"run",stepId:t.stepId??"run",level:M$(t.type),text:O$(t)}]}}}function I$(e,t){return e.live.logs.some(n=>n.ticketId==="run"&&n.text===t)?{}:{live:{logs:ck(e.live.logs,uk("error",t))}}}function M$(e){return e.endsWith("failed")?"error":e.endsWith("blocked")?"warn":e.endsWith("succeeded")||e.endsWith("completed")?"ok":"info"}function O$(e){const t=typeof e.payload.stepName=="string"?e.payload.stepName:e.stepId,n=typeof e.payload.error=="string"?e.payload.error:null,r=typeof e.payload.reason=="string"?e.payload.reason:null;switch(e.type){case"record.observed":return`发现工单 ${e.itemId??""}`.trim();case"step.started":return`开始步骤:${t??""}`.trim();case"step.succeeded":return`步骤完成:${t??""}`.trim();case"step.failed":return`步骤失败:${t??""}${n?` — ${n}`:""}`;case"record.blocked":return`工单受阻${r?`:${r}`:""}`;case"record.completed":return"工单已完成";default:return e.type}}function L$(e){return e.type==="run.record.detected"||e.type==="run.step.started"||e.type==="run.step.succeeded"||e.type==="run.step.failed"||e.type==="run.record.blocked"||e.type==="run.record.completed"}function $$(e){return{records:e.live.tickets.map(t=>({id:t.id,title:t.title,state:t.priority,status:t.status,currentStepId:t.currentStepId,doneStepIds:t.doneStepIds,createdAt:t.createdAt,updatedAt:t.createdAt})),logs:e.live.logs.map(t=>({id:t.id,ts:t.ts,itemId:t.ticketId,stepId:t.stepId,level:t.level,text:t.text}))}}function D$(e){return{tickets:e.records.map(t=>({id:t.id,title:t.title,customer:t.id,category:"真实记录",priority:t.state,status:t.status,currentStepId:t.currentStepId,doneStepIds:t.doneStepIds,createdAt:t.createdAt})),logs:e.logs.map(t=>({id:t.id,ts:t.ts,ticketId:t.itemId,stepId:t.stepId,level:t.level,text:t.text}))}}function ck(e,t){return e.some(r=>r.ticketId===t.ticketId&&r.stepId===t.stepId&&r.level===t.level&&r.text===t.text)?e:[...e,t]}function uk(e,t,n="run",r="run"){return{id:`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`,ts:Date.now(),ticketId:n,stepId:r,level:e,text:t}}function Bl(){return{designAgentEvents:0,designLiveText:"",tickets:[],logs:[]}}const z$={init:["ready"],design:["ready"],setup:["ready"],run:["stopped"]};function Ls(e,t){var n;return!!t&&(((n=z$[e])==null?void 0:n.includes(t))??!1)}const F$=["init","design","setup","adjust","test","run"];function V$(e){return typeof e=="string"&&F$.includes(e)}function n_(){return{init:{message:us.init},design:{message:us.design},setup:{message:us.setup},adjust:{message:us.adjust,local:!0},test:{message:us.test,local:!0},run:{message:us.run}}}const Wg=["init","design","setup","run"];function B$(e,t){if(!e)return{message:us[t]};const n=t,r="error"in e.state?e.state.error:void 0;return{phase:e.state.phase,taskId:e.identity.id,message:tk(n,e.state),retryable:(r==null?void 0:r.retryable)??e.next.kind==="await_user",error:r,next:e.next}}function uo(e){var r;const t=(r=e.projectState)==null?void 0:r.stages;if(!t)return n_();const n=n_();for(const s of Wg)n[s]=B$(t[s],s);return n}function dk(e){return e.files.some(t=>t.path==="workflow.yml"||t.path.endsWith("/workflow.yml"))}function fk(e){return dk(e)&&(!!e.workflow||e.files.some(t=>t.path.endsWith("/workflow.yml")))}function Kg(e,t){var n;return((n=e==null?void 0:e.stages[t])==null?void 0:n.state)??null}function U$(e){return Kg(e.projectState,"design")}function Gg(e){return Kg(e.projectState,"setup")}function H$(e){return Kg(e.projectState,"run")}function W$(e,t,n){var s;return n!=="live"?{kind:"open"}:Ls("design",t.design.phase)||dk(e)||(((s=e.workflow)==null?void 0:s.steps.length)??0)>0?{kind:"open"}:{kind:"blocked",reason:"搭建阶段必须使用当前流程生成的 workflow 和 recipes,请先完成设计阶段。",backTo:"design"}}function hk(e,t,n){return t!=="live"||Ls("setup",e.setup.phase)?{kind:"open"}:{kind:"blocked",reason:n,backTo:"setup"}}function K$(e){var n;const t=(n=e.projectState)==null?void 0:n.runSnapshot;return{tickets:(t==null?void 0:t.records.map(r=>({id:r.id,title:r.title,customer:r.id,category:"真实记录",priority:r.state,status:r.status,currentStepId:r.currentStepId,doneStepIds:r.doneStepIds,createdAt:r.createdAt})))??[],logs:(t==null?void 0:t.logs.map(r=>({id:r.id,ts:r.ts,ticketId:r.itemId,stepId:r.stepId,level:r.level,text:r.text})))??[]}}function pk(e){const t=Gg(e);return(t==null?void 0:t.phase)==="ready"?t.tableUrl:null}function G$(e){const t=Gg(e);return(t==null?void 0:t.phase)!=="ready"?{fields:[],views:[]}:{fields:t.schema.fields,views:t.schema.views}}function q$(e){var r;const t=e.projectState;if(!t)return null;if(t.activeStage&&t.stages[t.activeStage])return t.activeStage;let n=null;for(const s of Wg){const i=(r=t.stages[s])==null?void 0:r.identity;i&&(!n||i.updatedAt.localeCompare(n.updatedAt)>=0)&&(n={stage:s,updatedAt:i.updatedAt})}return(n==null?void 0:n.stage)??null}function mk(e,t="init"){const n=uo(e),r=gk(e);if(r)return r.stage;if(n.setup.phase==="auth_awaiting"||n.setup.phase==="failed")return"setup";const s=q$(e);return s==="design"&&Ls("design",n.design.phase)&&fk(e)?"setup":s??t}function gk(e){var n,r;const t=(n=e.projectState)==null?void 0:n.stages;if(!t)return null;for(const s of["design","setup","run"]){const i=(r=t[s])==null?void 0:r.next;if((i==null?void 0:i.kind)==="attach_stream")return{stage:s,endpoint:i.endpoint}}return null}function Y$(e){var r,s;const t=(r=e.projectState)==null?void 0:r.stages;if(!t)return null;let n=null;for(const i of Wg){const o=(s=t[i])==null?void 0:s.next;(o==null?void 0:o.kind)==="poll"&&(n=n===null?o.intervalMs:Math.min(n,o.intervalMs))}return n}function X$(e,t){return e.phase==="loading"?{kind:"loading",projectId:e.projectId}:e.phase==="error"?{kind:"load_error",projectId:e.projectId,message:e.error??"项目加载失败"}:t.projectId?{kind:"ready"}:{kind:"no_project"}}function vk(e){return{runtime:uo(e.snapshot).design,state:U$(e.snapshot),unsupported:e.mode!=="live",hasArtifacts:fk(e.snapshot),agentEvents:e.live.designAgentEvents,liveText:e.live.designLiveText}}function yk(e){const t=uo(e.snapshot);return{runtime:t.setup,state:Gg(e.snapshot),gate:W$(e.snapshot,t,e.mode),schema:e.mode==="mock"&&e.mockSetup?{fields:e.mockSetup.fields,views:e.mockSetup.views}:G$(e.snapshot),tableUrl:e.mode==="mock"&&e.mockSetup?e.mockSetup.tableUrl:pk(e.snapshot)}}function Q$(e){const t=uo(e.snapshot);return{runtime:t.test,gate:hk(t,e.mode,"试运行必须基于已搭建完成的 AI 表格,请先完成搭建阶段。")}}function Z$(e){const t=uo(e.snapshot);return{runtime:t.run,state:H$(e.snapshot),gate:hk(t,e.mode,"正式运行必须基于已搭建完成的 AI 表格,请先完成搭建阶段。"),tickets:e.live.tickets,logs:e.live.logs}}function ms(){return{projectId:null,projects:[],files:[],projectState:null,workflow:null,workflows:[],currentWorkflowId:null,workflowFiles:[],engineBinding:null,init:null}}$1({enforceActions:"always",computedRequiresReaction:!1});const r_="aitable-workflow:shell-state:v3",J$=["aitable-workflow:shell-state:v2"],Mf={name:"",agentsSelected:[],selectedMachineId:"",tableConnected:!1,tableBaseId:"",tableId:"",llmProvider:"",llmModel:"",roles:[],sop:""};class eD{constructor(){le(this,"theme","light");le(this,"layout",{railCollapsed:!1,chatCollapsed:!1,chatWidth:460});le(this,"projectSource","new");le(this,"agentTraceOpen",!1);le(this,"agentTraceLog",[]);le(this,"initDraft",{...Mf});le(this,"validation",{});le(this,"stepStatus",{});le(this,"mockSetup",{fields:[],views:[],tableUrl:null});le(this,"mode",me?"live":"mock");le(this,"snapshot",ms());le(this,"loading",{phase:"idle",projectId:null});le(this,"live",Bl());F1(this,{theme:ye,layout:ye,projectSource:ye,agentTraceOpen:ye,agentTraceLog:ye.ref,initDraft:ye,validation:ye,stepStatus:ye,mockSetup:ye,snapshot:ye,loading:ye,live:ye,stageRuntime:er,stream:er,recommendedStage:er,steps:er,edges:er,toggleTheme:oe,setRailCollapsed:oe,setChatCollapsed:oe,setChatWidth:oe,setProjectSource:oe,setAgentTraceOpen:oe,toggleAgentTrace:oe,appendAgentTrace:oe,clearAgentTrace:oe,patchInitDraft:oe,setValidation:oe,setStepStatus:oe,addMockField:oe,addMockView:oe,setMockTableUrl:oe,addTicket:oe,updateTicket:oe,appendLog:oe,startNewWorkflow:oe,beginNewProject:oe,setEngineBinding:oe,reset:oe,beginLoad:oe,failLoad:oe,applyLoadedProject:oe,applySnapshotPatch:oe,applyServerFiles:oe,applyServerWorkflow:oe,setCurrentWorkflow:oe,setProjects:oe,setWorkflows:oe,clearProject:oe,patchLive:oe,applyDesignEvent:oe,applySetupEvent:oe,applyRunEvent:oe,applyRunRecords:oe,refreshProjectState:oe,appendRunTimelineEntry:oe,appendRunPollError:oe}),this.hydrateFromStorage(),this.installPersistence()}get stageRuntime(){return uo(this.snapshot)}get stream(){return gk(this.snapshot)}get pollIntervalMs(){return Y$(this.snapshot)}get recommendedStage(){return mk(this.snapshot)}get steps(){var n;return(((n=this.snapshot.workflow)==null?void 0:n.steps)??[]).map(r=>this.stepStatus[r.id]?{...r,status:this.stepStatus[r.id]}:r)}get edges(){var t;return((t=this.snapshot.workflow)==null?void 0:t.edges)??[]}get validationContext(){return{steps:this.steps,init:this.initDraft,stageRuntime:this.stageRuntime}}get tableUrl(){return this.mode==="mock"?this.mockSetup.tableUrl:pk(this.snapshot)}get projectId(){return this.snapshot.projectId}get projects(){return this.snapshot.projects}get projectFiles(){return this.snapshot.files}get workflows(){return this.snapshot.workflows}get currentWorkflowId(){return this.snapshot.currentWorkflowId}get workflowFiles(){return this.snapshot.workflowFiles}toggleTheme(){this.theme=this.theme==="light"?"dark":"light",typeof document<"u"&&document.documentElement.setAttribute("data-theme",this.theme)}setRailCollapsed(t){this.layout={...this.layout,railCollapsed:t}}setChatCollapsed(t){this.layout={...this.layout,chatCollapsed:t}}setChatWidth(t){this.layout={...this.layout,chatWidth:t,chatCollapsed:!1}}setProjectSource(t){this.projectSource=t}setAgentTraceOpen(t){this.agentTraceOpen=t}toggleAgentTrace(){this.agentTraceOpen=!this.agentTraceOpen}appendAgentTrace(t){const n=LL(this.agentTraceLog,Array.isArray(t)?t:[t]);n!==this.agentTraceLog&&(this.agentTraceLog=n)}clearAgentTrace(){this.agentTraceLog.length!==0&&(this.agentTraceLog=[])}patchInitDraft(t){this.initDraft={...this.initDraft,...t}}setValidation(t,n){this.validation={...this.validation,[t]:n}}setStepStatus(t,n){const r={...this.stepStatus};n?r[t]=n:delete r[t],this.stepStatus=r}addMockField(t){this.mockSetup={...this.mockSetup,fields:[...this.mockSetup.fields,t]}}addMockView(t){this.mockSetup={...this.mockSetup,views:[...this.mockSetup.views,t]}}setMockTableUrl(t){this.mockSetup={...this.mockSetup,tableUrl:t}}addTicket(t){this.live={...this.live,tickets:[t,...this.live.tickets]}}updateTicket(t,n){this.live={...this.live,tickets:this.live.tickets.map(r=>r.id===t?{...r,...n}:r)}}appendLog(t){this.live={...this.live,logs:[...this.live.logs,t]}}beginNewProject(t,n){this.startNewWorkflow(),this.projectSource="new",this.snapshot={...ms(),projects:this.snapshot.projects,projectId:t},this.initDraft={...Mf,name:n},this.loading={phase:"ready",projectId:t}}startNewWorkflow(){this.initDraft={...Mf},this.live=Bl(),this.stepStatus={},this.mockSetup={fields:[],views:[],tableUrl:null},this.validation={},this.agentTraceLog=[],this.snapshot={...ms(),projects:this.snapshot.projects,projectId:this.snapshot.projectId}}reset(){this.projectSource="new",this.startNewWorkflow(),this.snapshot={...ms(),projects:this.snapshot.projects},this.loading={phase:"idle",projectId:null}}beginLoad(t){this.loading={phase:"loading",projectId:t}}failLoad(t,n){this.loading={phase:"error",projectId:t,error:n}}applyLoadedProject(t){this.snapshot=t.snapshot,this.live={...Bl(),...t.live},this.stepStatus={},t.snapshot.init&&(this.initDraft=t.snapshot.init),this.loading={phase:"ready",projectId:t.snapshot.projectId}}applySnapshotPatch(t,n){return this.snapshot.projectId!==t?!1:(this.snapshot={...this.snapshot,...n},!0)}applyServerFiles(t,n){return this.applySnapshotPatch(t,{files:n})}applyServerWorkflow(t,n){return this.applySnapshotPatch(t,{workflow:n})}setCurrentWorkflow(t,n){this.snapshot={...this.snapshot,currentWorkflowId:t,workflowFiles:n}}setProjects(t){this.snapshot={...this.snapshot,projects:t}}setWorkflows(t){this.snapshot={...this.snapshot,workflows:t}}setEngineBinding(t,n){this.applySnapshotPatch(t,{engineBinding:n})}clearProject(t){this.snapshot={...ms(),projects:t},this.live=Bl(),this.stepStatus={},this.loading={phase:"idle",projectId:null},this.projectSource="new"}patchLive(t,n){return this.snapshot.projectId!==t?!1:(this.live={...this.live,...n},!0)}applyDesignEvent(t,n){return this.applyReducerPatch(t,r=>E$(r,n))}applySetupEvent(t,n){return this.applyReducerPatch(t,r=>C$(r,n))}applyRunEvent(t,n){return this.applyReducerPatch(t,r=>T$(r,n))}async refreshProjectState(t){if(this.snapshot.projectId!==t)return!1;const n=await Bg(t).catch(()=>null);return!n||this.snapshot.projectId!==t?!1:(this.snapshot={...this.snapshot,projectState:n},!0)}applyRunRecords(t,n){return this.applyReducerPatch(t,r=>P$(r,n))}appendRunTimelineEntry(t,n){return this.applyReducerPatch(t,r=>R$(r,n))}appendRunPollError(t,n){return this.applyReducerPatch(t,r=>I$(r,n))}applyReducerPatch(t,n){if(this.snapshot.projectId!==t)return!1;const r=n({projectId:t,projectState:this.snapshot.projectState,live:this.live,steps:this.steps});return(r.projectState||r.files)&&(this.snapshot={...this.snapshot,...r.projectState?{projectState:r.projectState}:{},...r.files?{files:r.files}:{}}),r.live&&(this.live={...this.live,...r.live}),!0}hydrateFromStorage(){if(!(typeof window>"u"))try{const t=[r_,...J$].map(s=>window.localStorage.getItem(s)).find(s=>s!==null);if(!t)return;const n=JSON.parse(t);if(typeof n!="object"||n===null)return;const r=n;_O(()=>{(r.theme==="dark"||r.theme==="light")&&(this.theme=r.theme),typeof r.layout=="object"&&r.layout!==null&&(this.layout={...this.layout,...r.layout})})}catch{}}installPersistence(){typeof window>"u"||M1(()=>{const t={version:3,theme:this.theme,layout:this.layout};try{window.localStorage.setItem(r_,JSON.stringify(t))}catch{}})}}const B=new eD,tD={sparkle:"M12 2l1.9 5.8L20 9.7l-5.1 3.7L16 20l-4-3.6L8 20l1.1-6.6L4 9.7l6.1-1.9z",check:"M4 12l5 5L20 6","chevron-right":"M9 6l6 6-6 6","chevron-down":"M6 9l6 6 6-6","chevron-left":"M15 6l-6 6 6 6","chevron-up":"M6 15l6-6 6 6",plus:"M12 5v14M5 12h14",play:"M7 5v14l12-7z",pause:"M8 5v14M16 5v14",refresh:"M23 4v6h-6 M1 20v-6h6 M3.51 9a9 9 0 0114.85-3.36L23 10 M1 14l4.64 4.36A9 9 0 0020.49 15",moon:"M21 12.8A9 9 0 1111.2 3a7 7 0 009.8 9.8z",sun:"M12 4V2M12 22v-2M4 12H2M22 12h-2M5.6 5.6L4.2 4.2M19.8 19.8l-1.4-1.4M18.4 5.6l1.4-1.4M4.2 19.8l1.4-1.4M12 8a4 4 0 100 8 4 4 0 000-8z",table:"M3 5h18v14H3zM3 10h18M9 10v9M15 10v9",flow:"M5 5h5v5H5zM14 14h5v5h-5zM10 7h4M12 10v4",robot:"M12 3v3M7 6h10a2 2 0 012 2v9a2 2 0 01-2 2H7a2 2 0 01-2-2V8a2 2 0 012-2zM9 12h.01M15 12h.01",lock:"M6 11V8a6 6 0 0112 0v3M5 11h14v9H5z",bolt:"M13 2L4 14h6l-1 8 9-12h-6z",file:"M6 2h8l4 4v16H6zM14 2v4h4",folder:"M3 6h6l2 2h10v12H3z",link:"M10 13a5 5 0 007 0l2-2a5 5 0 00-7-7l-1 1M14 11a5 5 0 00-7 0l-2 2a5 5 0 007 7l1-1",send:"M22 2L11 13M22 2l-7 20-4-9-9-4z",user:"M12 12a4 4 0 100-8 4 4 0 000 8zM4 21a8 8 0 0116 0",warn:"M12 3l10 18H2zM12 10v5M12 18h.01",close:"M6 6l12 12M18 6L6 18",dot:"M12 12h.01"};function $({name:e,size:t=16,color:n="currentColor",style:r}){const s=e==="play"||e==="pause"||e==="sparkle"||e==="bolt";return a.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:s?n:"none",stroke:s?"none":n,strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",style:r,"aria-hidden":!0,children:a.jsx("path",{d:tD[e]})})}async function nD(){return await(await ue("/api/account/profile")).json()}let Eo={user:null};const Rp=new Set;function Of(){for(const e of Rp)e()}const wu={get(){return Eo},isLoggedIn(){return Eo.user!==null},setUser(e){Eo={user:e},Of()},clear(){Eo={user:null},Of()},async loadProfile(){Eo={user:(await nD()).user},Of()},logout(){this.clear(),typeof window<"u"&&(window.location.href="/")},subscribe(e){return Rp.add(e),()=>{Rp.delete(e)}}},rD={user:null};function xk(){return w.useSyncExternalStore(wu.subscribe,()=>wu.get(),()=>rD)}const sD=[{id:"init",label:"配置"},{id:"design",label:"设计"},{id:"setup",label:"搭建"},{id:"test",label:"试运行"},{id:"run",label:"运行"}],iD=[{id:"adjust",label:"参数调整"}],oD=lt(function({projectId:t}){const n=B.stageRuntime,r=B.projectSource,s=t?sD:iD;return a.jsx("nav",{className:"stepper","aria-label":"阶段进度",children:s.map((i,o)=>{const l=Ls(i.id,n[i.id].phase),c=r==="imported"&&(i.id==="init"||i.id==="design"||i.id==="setup"),u=a.jsx("span",{className:"stepper__num",children:l||c?a.jsx($,{name:"check",size:12}):o+1}),d=l||c?" is-done":"",f=c?"已随包导入":void 0;return a.jsxs(w.Fragment,{children:[o>0&&a.jsx("span",{className:"stepper__sep"}),t?a.jsxs(JS,{to:`/p/${t}/${i.id}`,className:({isActive:h})=>"stepper__item"+(h?" is-active":"")+d,title:f,children:[u,i.label]}):a.jsxs("span",{className:"stepper__item is-active"+d,title:f,children:[u,i.label]})]},i.id)})})});function aD(e){return e?e!=="ready"&&e!=="generate_failed"&&e!=="clarify_failed":!1}const lD=300,cD=80,uD=48;function dD(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=uD}function fD({groups:e,live:t,onClose:n,bodyRef:r,onScroll:s}){return a.jsx("div",{className:"trace-backdrop",onClick:n,children:a.jsxs("aside",{className:"trace-panel",role:"dialog","aria-label":"Agent 执行记录",onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"trace-panel__head",children:[a.jsx("h2",{className:"trace-panel__title",children:"Agent 执行记录"}),a.jsx("button",{type:"button",className:"trace-panel__close",onClick:n,title:"关闭","aria-label":"关闭",children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"trace-panel__body",ref:r,onScroll:s,children:e.length===0?a.jsx("div",{className:"trace-empty",children:"还没有 Agent 执行记录。运行设计后,这里会实时显示 Agent 的思考、正文与工具调用。"}):e.map((i,o)=>{const l=o===e.length-1;return a.jsxs("div",{className:"trace-grp",children:[a.jsx("span",{className:"trace-av","aria-hidden":!0,children:a.jsx($,{name:"robot",size:16})}),a.jsxs("div",{className:"trace-body",children:[a.jsx("div",{className:"trace-head",children:i.round!=null?`第 ${i.round} 轮`:"执行过程"}),i.items.map((c,u)=>{const d=u===i.items.length-1;if(c.kind==="tool")return a.jsxs("div",{className:"trace-tool",children:[a.jsx($,{name:"bolt",size:12}),a.jsx("span",{className:"trace-tool__label",children:c.text})]},u);if(c.kind==="tool_result")return c.fullText?a.jsxs("details",{className:"trace-toolret trace-toolret--expandable",children:[a.jsxs("summary",{className:"trace-toolret__summary",children:[a.jsx($,{name:"dot",size:12}),a.jsx("span",{className:"trace-toolret__label",children:c.text})]}),a.jsx("pre",{className:"trace-toolret__full",children:c.fullText})]},u):a.jsxs("div",{className:"trace-toolret",children:[a.jsx($,{name:"dot",size:12}),a.jsx("span",{className:"trace-toolret__label",children:c.text})]},u);if(c.kind==="permission")return c.fullText?a.jsxs("details",{className:"trace-perm trace-perm--expandable",children:[a.jsxs("summary",{className:"trace-perm__summary",children:[a.jsx($,{name:"lock",size:12}),a.jsx("span",{className:"trace-perm__label",children:c.text})]}),a.jsx("pre",{className:"trace-perm__full",children:c.fullText})]},u):a.jsxs("div",{className:"trace-perm",children:[a.jsx($,{name:"lock",size:12}),a.jsx("span",{className:"trace-perm__label",children:c.text})]},u);if(c.kind==="status")return a.jsxs("div",{className:"trace-status",children:[a.jsx($,{name:"dot",size:12}),a.jsx("span",{children:c.text})]},u);if(c.kind==="thinking"&&c.text.length>lD)return a.jsxs("details",{className:"trace-text trace-text--thinking trace-text--foldable",children:[a.jsx("summary",{className:"trace-text__summary",children:`${c.text.slice(0,cD)}…`}),a.jsx("div",{className:"trace-text__full",children:c.text})]},u);const f=t&&l&&d,h=c.kind==="thinking"?"trace-text trace-text--thinking":"trace-text";return a.jsxs("div",{className:h,children:[c.text,f?a.jsx("span",{className:"trace-cursor"}):null]},u)})]})]},o)})})]})})}const hD=lt(function({onDesign:t=!1}){const n=B.agentTraceOpen,r=B.agentTraceLog,s=w.useMemo(()=>FL(r),[r]),i=t?vk({snapshot:B.snapshot,live:B.live,mode:B.mode}).state:null,o=aD(i==null?void 0:i.phase),l=w.useRef(null),c=w.useRef(!0);w.useEffect(()=>{const d=l.current;!d||!c.current||(d.scrollTop=d.scrollHeight)},[s,n]);function u(){const d=l.current;d&&(c.current=dD(d))}return w.useEffect(()=>{if(!n)return;function d(f){f.key==="Escape"&&B.setAgentTraceOpen(!1)}return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n]),n?a.jsx(fD,{groups:s,live:o,onClose:()=>B.setAgentTraceOpen(!1),bodyRef:l,onScroll:u}):null}),pD={init:"一次性配置",design:"工作流设计",setup:"AI 表格搭建",adjust:"参数调整",test:"试运行",run:"运行监控"};function _k({stage:e}){return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:pD[e]}),a.jsx("div",{className:"work-head__sub",children:"正在读取项目状态…"})]})}),a.jsxs("div",{className:"work-body stage-skeleton",children:[a.jsx("div",{className:"stage-skeleton__bar stage-skeleton__bar--wide"}),a.jsx("div",{className:"stage-skeleton__bar"}),a.jsx("div",{className:"stage-skeleton__bar stage-skeleton__bar--narrow"}),a.jsx("div",{className:"stage-skeleton__card"})]})]})})}function s_({message:e,onRetry:t,title:n="项目加载失败",subtitle:r="服务端状态未取到"}){return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:n}),a.jsx("div",{className:"work-head__sub",children:r})]})}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:[e,a.jsx("div",{style:{marginTop:16},children:a.jsxs("button",{type:"button",className:"primary",onClick:t,children:[a.jsx($,{name:"play",size:14,color:"#fff"}),"重试"]})})]})})]})})}let Ui=null;const qg="aitable-workflow-dev-token";function mD(e){try{localStorage.setItem(qg,e)}catch{}}function gD(){try{return localStorage.getItem(qg)}catch{return null}}function vD(e){if(Ui=e,e)mD(e);else try{localStorage.removeItem(qg)}catch{}}function yD(){return Ui!==null}function wk(){const t=new URLSearchParams(window.location.search).get("token");if(t){vD(t);const n=new URL(window.location.href);n.searchParams.delete("token"),window.history.replaceState({},"",n.toString())}else if(!Ui){const n=gD();n&&(Ui=n)}return yD()}async function Ee(e,t){if(!Ui)throw new Error("Dev token not set");const n=await fetch(e,{...t,headers:{...t==null?void 0:t.headers,Authorization:`Bearer ${Ui}`}});if(!n.ok){const r=await n.text();try{const s=JSON.parse(r),i=s.error??s.message;if(i)throw new Error(i)}catch(s){if(s instanceof Error&&s.message!==r)throw s}throw new Error(r||`HTTP ${n.status}`)}return n}async function Ip(e){return await(await Ee("/dev/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:e})})).json()}async function bk(){await Ee("/dev/setup/complete",{method:"POST"})}async function i_(){return await(await Ee("/dev/setup/progress")).json()}async function xD(e,t){return await(await Ee("/dev/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,files:t})})).json()}async function _D(e,t){return await(await Ee("/dev/kb/ingest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,source:t})})).json()}async function jk(){return await(await Ee("/dev/config/enriched")).json()}async function wD(e){return await(await Ee(`/dev/file/read?path=${encodeURIComponent(e)}`)).json()}async function bD(e,t){return await(await Ee("/dev/file/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:t})})).json()}async function o_(){return await(await Ee("/dev/setup/artifacts")).json()}async function jD(){return await(await Ee("/dev/console/state")).json()}async function Mp(){return await(await Ee("/dev/console/mode")).json()}async function SD(){return await(await Ee("/dev/console/promote",{method:"POST"})).json()}async function a_(){return await(await Ee("/dev/console/dws-auth")).json()}async function kD(){return await(await Ee("/dev/console/dws-auth/login",{method:"POST"})).json()}async function ND(){return await(await Ee("/dev/console/dws-auth/login")).json()}async function ED(){return await(await Ee("/dev/console/admin-groups")).json()}async function CD(e){return await(await Ee(`/dev/console/groups/${encodeURIComponent(e.conversationId)}/add-enterprise-bot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,groupType:e.groupType})})).json()}async function Sk(e){return await(await Ee(`/dev/console/groups/${encodeURIComponent(e.conversationId)}/custom-bot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,groupType:e.groupType,name:e.name,webhook:e.webhook,secret:e.secret})})).json()}async function kk(){return await(await Ee("/dev/console/group-config-table")).json()}async function TD(){return await(await Ee("/dev/console/group-config-table/flush-staging",{method:"POST"})).json()}async function l_(e,t){return await(await Ee(`/dev/console/group-config-table/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function PD(e,t){return await(await Ee("/dev/kb/official",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,enabled:t})})).json()}async function AD(){return await(await Ee("/dev/run/status")).json()}const RD={start:"/dev/run/start",stop:"/dev/run/stop"};async function ID(e){return await(await Ee(RD[e],{method:"POST"})).json()}async function MD(e){return await(await Ee("/dev/workflow/trigger-once",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflowId:e})})).json()}function OD(){const e=xk(),[t,n]=w.useState(!1),r=w.useRef(null);return w.useEffect(()=>{if(!t)return;function s(i){r.current&&!r.current.contains(i.target)&&n(!1)}return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[t]),!st||!e.user?null:a.jsxs("div",{className:"user-menu",ref:r,children:[a.jsxs("button",{type:"button",className:"user-menu__trigger",onClick:()=>n(s=>!s),title:"用户菜单",children:[a.jsx($,{name:"user",size:15}),a.jsx("span",{className:"user-menu__name",children:e.user.username}),a.jsx($,{name:"chevron-down",size:12})]}),t&&a.jsxs("div",{className:"user-menu__dropdown",children:[a.jsxs(Ue,{className:"user-menu__item",to:"/account",onClick:()=>n(!1),children:[a.jsx($,{name:"user",size:14}),"用户中心"]}),a.jsxs(Ue,{className:"user-menu__item",to:"/engines",onClick:()=>n(!1),children:[a.jsx($,{name:"bolt",size:14}),"执行引擎"]}),a.jsx("div",{className:"user-menu__divider"}),a.jsxs("button",{type:"button",className:"user-menu__item user-menu__item--danger",onClick:()=>{wu.logout(),n(!1)},children:[a.jsx($,{name:"close",size:14}),"退出登录"]})]})]})}const LD=lt(function(){const[t]=w.useState(()=>wk()),[n,r]=w.useState(st&&!t),s=B.theme;w.useEffect(()=>{if(!st||t){r(!1);return}let u=!1;return wu.loadProfile().then(()=>{u||r(!1)}).catch(()=>{u||r(!1)}),()=>{u=!0}},[t]);const i=wc({path:"/p/:projectId",end:!1}),o=wc("/setup"),l=!!i||!!o,c=wc("/p/:projectId/design");return n?a.jsx(_k,{stage:"init"}):a.jsxs("div",{className:"app-root",children:[a.jsxs("header",{className:"chrome",children:[a.jsxs(Ue,{className:"chrome__brand",to:"/",title:"返回首页",children:[a.jsx("span",{className:"chrome__brand-mark",children:a.jsx($,{name:"sparkle",size:15,color:"#fff"})}),"aitable-workflow"]}),l&&a.jsx(oD,{projectId:i==null?void 0:i.params.projectId}),a.jsx("div",{className:"chrome__spacer"}),a.jsx("button",{type:"button",className:"chrome__theme",onClick:()=>B.toggleTheme(),title:s==="light"?"切换到暗色":"切换到亮色","aria-label":"切换主题",children:a.jsx($,{name:s==="light"?"moon":"sun",size:17})}),a.jsx(OD,{})]}),a.jsx(QS,{}),a.jsx(hD,{onDesign:!!c})]})});async function Nk(e,t){const n=await Ap(e);if(n.length===0)return{workflows:[],currentWorkflowId:null,workflowFiles:[]};const r=t&&n.some(i=>i.id===t)?t:n[0].id;let s=[];try{s=(await rk(e,r)).files}catch{}return{workflows:n,currentWorkflowId:r,workflowFiles:s}}function $D(e){var u;const t=(u=e.find(d=>d.path==="aitable-workflow.config.yml"))==null?void 0:u.content;if(!t)return null;const n=Zn(t,"name")??"",r=Zn(t,"base_id"),s=Zn(t,"table_id")??"",i=Zn(t,"provider"),o=Zn(t,"model"),l=Zn(t,"engine"),c=zD(t,"scene")??"";return!r&&!i&&!o?null:{name:n,agentsSelected:l==="qoder"||l==="codex"?[l]:["claude"],selectedMachineId:"",tableConnected:!!r,tableBaseId:r??"",tableId:s,llmProvider:i??"",llmModel:o??"",roles:DD(e),sop:c}}function DD(e){return e.filter(t=>t.path.startsWith("roles/")&&t.path.endsWith(".role.yml")&&t.content).map(t=>{const n=Zn(t.content,"id")??"",r=Zn(t.content,"name")??"",s=Zn(t.content,"persona")??"";return{id:n,name:r,persona:s,skills:[],knowledge:[]}}).filter(t=>t.id&&t.name)}function Zn(e,t){const n=new RegExp(`^\\s*${t}:\\s*(?:"([^"]*)"|'([^']*)'|([^#\\n]*))`,"m"),r=e.match(n),s=(r==null?void 0:r[1])??(r==null?void 0:r[2])??(r==null?void 0:r[3]),i=s==null?void 0:s.trim();return i||null}function zD(e,t){const n=new RegExp(`^${t}:\\s*\\|\\n([\\s\\S]*?)(?=\\n\\S|$)`,"m"),r=e.match(n);return r!=null&&r[1]&&r[1].split(`
65
65
  `).map(i=>i.replace(/^ /,"")).join(`
66
- `).trim()||null}async function bu(e){if(!me)return;const t=Lf.get(e);if(t)return t;const n=FD(e).finally(()=>{Lf.delete(e)});return Lf.set(e,n),n}const Lf=new Map;async function FD(e){B.beginLoad(e);try{await ik();const t=await Ug();if(!t.some(r=>r.id===e)){B.clearProject(t);return}const n=await VD(e,t);B.applyLoadedProject({snapshot:n,live:q$(n)})}catch(t){B.failLoad(e,t instanceof Error?t.message:String(t))}}async function Hi(e){if(!me)return null;const t=await Hg(e).catch(()=>null);return t&&B.applySnapshotPatch(e,{projectState:t})?t:null}async function VD(e,t){const n=await Wg(e),r=await Hg(e).catch(()=>null),s=await Ck(e,null).catch(()=>({workflows:[],currentWorkflowId:null,workflowFiles:[]})),i=n.some(c=>c.path==="workflow.yml"||c.path.endsWith("/workflow.yml"))?await Sd(e,s.currentWorkflowId).catch(()=>null):null,o=st?await Ec(e).catch(()=>null):null,l=$D(n);return l&&(o!=null&&o.machineId)&&(l.selectedMachineId=o.machineId),{...ms(),projectId:e,projects:t,files:n,projectState:r,workflow:i,workflows:s.workflows,currentWorkflowId:s.currentWorkflowId,workflowFiles:s.workflowFiles,engineBinding:o,init:l}}function BD(){var t;const[e]=Ag();return e.get("w")??((t=B.workflows[0])==null?void 0:t.id)??null}function UD(){const e=B.projectId,t=B.pollIntervalMs;w.useEffect(()=>{if(B.mode!=="live"||!e||t===null)return;let n=!1,r;const s=async()=>{await Hi(e).catch(()=>{}),n||(r=setTimeout(()=>void s(),t))};return r=setTimeout(()=>void s(),t),()=>{n=!0,r!==void 0&&clearTimeout(r)}},[e,t])}function Tk({onConfirm:e,onCancel:t}){const[n,r]=w.useState("未命名项目");return a.jsx("div",{className:"modal-overlay",onClick:t,children:a.jsxs("div",{className:"import-panel",style:{maxWidth:400},onClick:s=>s.stopPropagation(),children:[a.jsxs("div",{className:"import-panel__head",children:[a.jsx("span",{className:"import-panel__title",children:"新建项目"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:t,children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"import-panel__body",children:a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"项目名称"}),a.jsx("input",{className:"import-confirm__input",value:n,onChange:s=>r(s.target.value),placeholder:"输入项目名称",autoFocus:!0,onKeyDown:s=>{s.key==="Enter"&&n.trim()&&e(n.trim())}})]})}),a.jsxs("div",{className:"import-panel__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:t,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!n.trim(),onClick:()=>e(n.trim()),children:"创建项目"})]})]})})}var f_={},HD=function(e,t,n,r,s){var i=new Worker(f_[t]||(f_[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(o){var l=o.data,c=l.$e$;if(c){var u=new Error(c[0]);u.code=c[1],u.stack=c[2],s(u,null)}else s(null,l)},i.postMessage(n,r),i},Pe=Uint8Array,dt=Uint16Array,al=Int32Array,fo=new Pe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ho=new Pe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Pa=new Pe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pk=function(e,t){for(var n=new dt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new al(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return{b:n,r:s}},Ak=Pk(fo,2),Zg=Ak.b,ju=Ak.r;Zg[28]=258,ju[258]=28;var Rk=Pk(ho,0),Ik=Rk.b,Op=Rk.r,Aa=new dt(32768);for(var je=0;je<32768;++je){var Nr=(je&43690)>>1|(je&21845)<<1;Nr=(Nr&52428)>>2|(Nr&13107)<<2,Nr=(Nr&61680)>>4|(Nr&3855)<<4,Aa[je]=((Nr&65280)>>8|(Nr&255)<<8)>>1}var Jt=function(e,t,n){for(var r=e.length,s=0,i=new dt(t);s<r;++s)e[s]&&++i[e[s]-1];var o=new dt(t);for(s=1;s<t;++s)o[s]=o[s-1]+i[s-1]<<1;var l;if(n){l=new dt(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],d=t-e[s],f=o[e[s]-1]++<<d,h=f|(1<<d)-1;f<=h;++f)l[Aa[f]>>c]=u}else for(l=new dt(r),s=0;s<r;++s)e[s]&&(l[s]=Aa[o[e[s]-1]++]>>15-e[s]);return l},_r=new Pe(288);for(var je=0;je<144;++je)_r[je]=8;for(var je=144;je<256;++je)_r[je]=9;for(var je=256;je<280;++je)_r[je]=7;for(var je=280;je<288;++je)_r[je]=8;var Wi=new Pe(32);for(var je=0;je<32;++je)Wi[je]=5;var Mk=Jt(_r,9,0),Ok=Jt(_r,9,1),Lk=Jt(Wi,5,0),$k=Jt(Wi,5,1),Cc=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Bt=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Tc=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},ll=function(e){return(e+7)/8|0},Ys=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Pe(e.subarray(t,n))},Dk=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Fe=function(e,t,n){var r=new Error(t||Dk[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Fe),!n)throw r;return r},zk=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new Pe(0);var o=!n,l=o||t.i!=2,c=t.i;o&&(n=new Pe(s*3));var u=function(te){var Z=n.length;if(te>Z){var ee=new Pe(Math.max(Z*2,te));ee.set(n),n=ee}},d=t.f||0,f=t.p||0,h=t.b||0,p=t.l,g=t.d,x=t.m,_=t.n,v=s*8;do{if(!p){d=Bt(e,f,1);var y=Bt(e,f+1,3);if(f+=3,y)if(y==1)p=Ok,g=$k,x=9,_=5;else if(y==2){var k=Bt(e,f,31)+257,S=Bt(e,f+10,15)+4,N=k+Bt(e,f+5,31)+1;f+=14;for(var R=new Pe(N),O=new Pe(19),D=0;D<S;++D)O[Pa[D]]=Bt(e,f+D*3,7);f+=S*3;for(var M=Cc(O),z=(1<<M)-1,T=Jt(O,M,1),D=0;D<N;){var E=T[Bt(e,f,z)];f+=E&15;var m=E>>4;if(m<16)R[D++]=m;else{var A=0,P=0;for(m==16?(P=3+Bt(e,f,3),f+=2,A=R[D-1]):m==17?(P=3+Bt(e,f,7),f+=3):m==18&&(P=11+Bt(e,f,127),f+=7);P--;)R[D++]=A}}var I=R.subarray(0,k),C=R.subarray(k);x=Cc(I),_=Cc(C),p=Jt(I,x,1),g=Jt(C,_,1)}else Fe(1);else{var m=ll(f)+4,b=e[m-4]|e[m-3]<<8,j=m+b;if(j>s){c&&Fe(0);break}l&&u(h+b),n.set(e.subarray(m,j),h),t.b=h+=b,t.p=f=j*8,t.f=d;continue}if(f>v){c&&Fe(0);break}}l&&u(h+131072);for(var L=(1<<x)-1,F=(1<<_)-1,V=f;;V=f){var A=p[Tc(e,f)&L],H=A>>4;if(f+=A&15,f>v){c&&Fe(0);break}if(A||Fe(2),H<256)n[h++]=H;else if(H==256){V=f,p=null;break}else{var U=H-254;if(H>264){var D=H-257,W=fo[D];U=Bt(e,f,(1<<W)-1)+Zg[D],f+=W}var G=g[Tc(e,f)&F],Y=G>>4;G||Fe(3),f+=G&15;var C=Ik[Y];if(Y>3){var W=ho[Y];C+=Tc(e,f)&(1<<W)-1,f+=W}if(f>v){c&&Fe(0);break}l&&u(h+131072);var K=h+U;if(h<C){var X=i-C,re=Math.min(C,K);for(X+h<0&&Fe(3);h<re;++h)n[h]=r[X+h]}for(;h<K;++h)n[h]=n[h-C]}}t.l=p,t.p=V,t.b=h,t.f=d,p&&(d=1,t.m=x,t.d=g,t.n=_)}while(!d);return h!=n.length&&o?Ys(n,0,h):n.subarray(0,h)},Tn=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},ei=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Pc=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var s=n.length,i=n.slice();if(!s)return{t:ev,l:0};if(s==1){var o=new Pe(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(j,k){return j.f-k.f}),n.push({s:-1,f:25001});var l=n[0],c=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};d!=s-1;)l=n[n[u].f<n[f].f?u++:f++],c=n[u!=d&&n[u].f<n[f].f?u++:f++],n[d++]={s:-1,f:l.f+c.f,l,r:c};for(var h=i[0].s,r=1;r<s;++r)i[r].s>h&&(h=i[r].s);var p=new dt(h+1),g=Su(n[d-1],p,0);if(g>t){var r=0,x=0,_=g-t,v=1<<_;for(i.sort(function(k,S){return p[S.s]-p[k.s]||k.f-S.f});r<s;++r){var y=i[r].s;if(p[y]>t)x+=v-(1<<g-p[y]),p[y]=t;else break}for(x>>=_;x>0;){var m=i[r].s;p[m]<t?x-=1<<t-p[m]++-1:++r}for(;r>=0&&x;--r){var b=i[r].s;p[b]==t&&(--p[b],++x)}g=t}return{t:new Pe(p),l:g}},Su=function(e,t,n){return e.s==-1?Math.max(Su(e.l,t,n+1),Su(e.r,t,n+1)):t[e.s]=n},Lp=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new dt(++t),r=0,s=e[0],i=1,o=function(c){n[r++]=c},l=1;l<=t;++l)if(e[l]==s&&l!=t)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=e[l]}return{c:n.subarray(0,r),n:t}},ti=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Jg=function(e,t,n){var r=n.length,s=ll(t+2);e[s]=r&255,e[s+1]=r>>8,e[s+2]=e[s]^255,e[s+3]=e[s+1]^255;for(var i=0;i<r;++i)e[s+i+4]=n[i];return(s+4+r)*8},$p=function(e,t,n,r,s,i,o,l,c,u,d){Tn(t,d++,n),++s[256];for(var f=Pc(s,15),h=f.t,p=f.l,g=Pc(i,15),x=g.t,_=g.l,v=Lp(h),y=v.c,m=v.n,b=Lp(x),j=b.c,k=b.n,S=new dt(19),N=0;N<y.length;++N)++S[y[N]&31];for(var N=0;N<j.length;++N)++S[j[N]&31];for(var R=Pc(S,7),O=R.t,D=R.l,M=19;M>4&&!O[Pa[M-1]];--M);var z=u+5<<3,T=ti(s,_r)+ti(i,Wi)+o,E=ti(s,h)+ti(i,x)+o+14+3*M+ti(S,O)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&z<=T&&z<=E)return Jg(t,d,e.subarray(c,c+u));var A,P,I,C;if(Tn(t,d,1+(E<T)),d+=2,E<T){A=Jt(h,p,0),P=h,I=Jt(x,_,0),C=x;var L=Jt(O,D,0);Tn(t,d,m-257),Tn(t,d+5,k-1),Tn(t,d+10,M-4),d+=14;for(var N=0;N<M;++N)Tn(t,d+3*N,O[Pa[N]]);d+=3*M;for(var F=[y,j],V=0;V<2;++V)for(var H=F[V],N=0;N<H.length;++N){var U=H[N]&31;Tn(t,d,L[U]),d+=O[U],U>15&&(Tn(t,d,H[N]>>5&127),d+=H[N]>>12)}}else A=Mk,P=_r,I=Lk,C=Wi;for(var N=0;N<l;++N){var W=r[N];if(W>255){var U=W>>18&31;ei(t,d,A[U+257]),d+=P[U+257],U>7&&(Tn(t,d,W>>23&31),d+=fo[U]);var G=W&31;ei(t,d,I[G]),d+=C[G],G>3&&(ei(t,d,W>>5&8191),d+=ho[G])}else ei(t,d,A[W]),d+=P[W]}return ei(t,d,A[256]),d+P[256]},Fk=new al([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ev=new Pe(0),Vk=function(e,t,n,r,s,i){var o=i.z||e.length,l=new Pe(r+o+5*(1+Math.ceil(o/7e3))+s),c=l.subarray(r,l.length-s),u=i.l,d=(i.r||0)&7;if(t){d&&(c[0]=i.r>>3);for(var f=Fk[t-1],h=f>>13,p=f&8191,g=(1<<n)-1,x=i.p||new dt(32768),_=i.h||new dt(g+1),v=Math.ceil(n/3),y=2*v,m=function(se){return(e[se]^e[se+1]<<v^e[se+2]<<y)&g},b=new al(25e3),j=new dt(288),k=new dt(32),S=0,N=0,R=i.i||0,O=0,D=i.w||0,M=0;R+2<o;++R){var z=m(R),T=R&32767,E=_[z];if(x[T]=E,_[z]=T,D<=R){var A=o-R;if((S>7e3||O>24576)&&(A>423||!u)){d=$p(e,c,0,b,j,k,N,O,M,R-M,d),O=S=N=0,M=R;for(var P=0;P<286;++P)j[P]=0;for(var P=0;P<30;++P)k[P]=0}var I=2,C=0,L=p,F=T-E&32767;if(A>2&&z==m(R-F))for(var V=Math.min(h,A)-1,H=Math.min(32767,R),U=Math.min(258,A);F<=H&&--L&&T!=E;){if(e[R+I]==e[R+I-F]){for(var W=0;W<U&&e[R+W]==e[R+W-F];++W);if(W>I){if(I=W,C=F,W>V)break;for(var G=Math.min(F,W-2),Y=0,P=0;P<G;++P){var K=R-F+P&32767,X=x[K],re=K-X&32767;re>Y&&(Y=re,E=K)}}}T=E,E=x[T],F+=T-E&32767}if(C){b[O++]=268435456|ju[I]<<18|Op[C];var te=ju[I]&31,Z=Op[C]&31;N+=fo[te]+ho[Z],++j[257+te],++k[Z],D=R+I,++S}else b[O++]=e[R],++j[e[R]]}}for(R=Math.max(R,D);R<o;++R)b[O++]=e[R],++j[e[R]];d=$p(e,c,u,b,j,k,N,O,M,R-M,d),u||(i.r=d&7|c[d/8|0]<<3,d-=7,i.h=_,i.p=x,i.i=R,i.w=D)}else{for(var R=i.w||0;R<o+u;R+=65535){var ee=R+65535;ee>=o&&(c[d/8|0]=u,ee=o),d=Jg(c,d+1,e.subarray(R,ee))}i.i=o}return Ys(l,0,r+ll(d)+s)},WD=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e}(),KD=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=WD[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},Bk=function(e,t,n,r,s){if(!s&&(s={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new Pe(i.length+e.length);o.set(i),o.set(e,i.length),e=o,s.w=i.length}return Vk(e,t.level==null?6:t.level,t.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,s)},tv=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},h_=function(e,t,n){for(var r=e(),s=e.toString(),i=s.slice(s.indexOf("[")+1,s.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<r.length;++o){var l=r[o],c=i[o];if(typeof l=="function"){t+=";"+c+"=";var u=l.toString();if(l.prototype)if(u.indexOf("[native code]")!=-1){var d=u.indexOf(" ",8)+1;t+=u.slice(d,u.indexOf("(",d))}else{t+=u;for(var f in l.prototype)t+=";"+c+".prototype."+f+"="+l.prototype[f].toString()}else t+=u}else n[c]=l}return t},Ul=[],GD=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},qD=function(e,t,n,r){if(!Ul[n]){for(var s="",i={},o=e.length-1,l=0;l<o;++l)s=h_(e[l],s,i);Ul[n]={c:h_(e[o],s,i),e:i}}var c=tv({},Ul[n].e);return HD(Ul[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,c,GD(c),r)},YD=function(){return[Pe,dt,al,fo,ho,Pa,Zg,Ik,Ok,$k,Aa,Dk,Jt,Cc,Bt,Tc,ll,Ys,Fe,zk,rv,kd,Uk]},XD=function(){return[Pe,dt,al,fo,ho,Pa,ju,Op,Mk,_r,Lk,Wi,Aa,Fk,ev,Jt,Tn,ei,Pc,Su,Lp,ti,Jg,$p,ll,Ys,Vk,Bk,nv,kd]},kd=function(e){return postMessage(e,[e.buffer])},Uk=function(e){return e&&{out:e.size&&new Pe(e.size),dictionary:e.dictionary}},Hk=function(e,t,n,r,s,i){var o=qD(n,r,s,function(l,c){o.terminate(),i(l,c)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Mn=function(e,t){return e[t]|e[t+1]<<8},Ht=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},$f=function(e,t){return Ht(e,t)+Ht(e,t+4)*4294967296},Xe=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function QD(e,t,n){return n||(n=t,t={}),typeof n!="function"&&Fe(7),Hk(e,t,[XD],function(r){return kd(nv(r.data[0],r.data[1]))},0,n)}function nv(e,t){return Bk(e,t||{},0,0)}function ZD(e,t,n){return n||(n=t,t={}),typeof n!="function"&&Fe(7),Hk(e,t,[YD],function(r){return kd(rv(r.data[0],Uk(r.data[1])))},1,n)}function rv(e,t){return zk(e,{i:2},t&&t.out,t&&t.dictionary)}var Wk=function(e,t,n,r){for(var s in e){var i=e[s],o=t+s,l=r;Array.isArray(i)&&(l=tv(r,i[1]),i=i[0]),ArrayBuffer.isView(i)?n[o]=[i,l]:(n[o+="/"]=[new Pe(0),l],Wk(i,o,n,r))}},p_=typeof TextEncoder<"u"&&new TextEncoder,Dp=typeof TextDecoder<"u"&&new TextDecoder,JD=0;try{Dp.decode(ev,{stream:!0}),JD=1}catch{}var e3=function(e){for(var t="",n=0;;){var r=e[n++],s=(r>127)+(r>223)+(r>239);if(n+s>e.length)return{s:t,r:Ys(e,n-1)};s?s==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):s&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function zp(e,t){var n;if(p_)return p_.encode(e);for(var r=e.length,s=new Pe(e.length+(e.length>>1)),i=0,o=function(u){s[i++]=u},n=0;n<r;++n){if(i+5>s.length){var l=new Pe(i+8+(r-n<<1));l.set(s),s=l}var c=e.charCodeAt(n);c<128||t?o(c):c<2048?(o(192|c>>6),o(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|e.charCodeAt(++n)&1023,o(240|c>>18),o(128|c>>12&63),o(128|c>>6&63),o(128|c&63)):(o(224|c>>12),o(128|c>>6&63),o(128|c&63))}return Ys(s,0,i)}function Kk(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else{if(Dp)return Dp.decode(e);var s=e3(e),i=s.s,n=s.r;return n.length&&Fe(8),i}}var t3=function(e,t){return t+30+Mn(e,t+26)+Mn(e,t+28)},n3=function(e,t,n){var r=Mn(e,t+28),s=Mn(e,t+30),i=Kk(e.subarray(t+46,t+46+r),!(Mn(e,t+8)&2048)),o=t+46+r,l=r3(e,o,s,n,Ht(e,t+20),Ht(e,t+24),Ht(e,t+42)),c=l[0],u=l[1],d=l[2];return[Mn(e,t+10),c,u,i,o+s+Mn(e,t+32),d]},r3=function(e,t,n,r,s,i,o){var l=s==4294967295,c=i==4294967295,u=o==4294967295,d=t+n,f=l+c+u;if(r&&f){for(;t+4<d;t+=4+Mn(e,t+2))if(Mn(e,t)==1)return[l?$f(e,t+4+8*c):s,c?$f(e,t+4):i,u?$f(e,t+4+8*(c+l)):o,1];r<2&&Fe(13)}return[s,i,o,0]},Fp=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Fe(9),t+=r+4}return t},m_=function(e,t,n,r,s,i,o,l){var c=r.length,u=n.extra,d=l&&l.length,f=Fp(u);Xe(e,t,o!=null?33639248:67324752),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(i<0&&8),e[t++]=s&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var h=new Date(n.mtime==null?Date.now():n.mtime),p=h.getFullYear()-1980;if((p<0||p>119)&&Fe(10),Xe(e,t,p<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,i!=-1&&(Xe(e,t,n.crc),Xe(e,t+4,i<0?-i-2:i),Xe(e,t+8,n.size)),Xe(e,t+12,c),Xe(e,t+14,f),t+=16,o!=null&&(Xe(e,t,d),Xe(e,t+6,n.attrs),Xe(e,t+10,o),t+=14),e.set(r,t),t+=c,f)for(var g in u){var x=u[g],_=x.length;Xe(e,t,+g),Xe(e,t+2,_),e.set(x,t+4),t+=4+_}return d&&(e.set(l,t),t+=d),t},s3=function(e,t,n,r,s){Xe(e,t,101010256),Xe(e,t+8,n),Xe(e,t+10,n),Xe(e,t+12,r),Xe(e,t+16,s)};function i3(e,t,n){n||(n=t,t={}),typeof n!="function"&&Fe(7);var r={};Wk(e,"",r,t);var s=Object.keys(r),i=s.length,o=0,l=0,c=i,u=new Array(i),d=[],f=function(){for(var _=0;_<d.length;++_)d[_]()},h=function(_,v){ku(function(){n(_,v)})};ku(function(){h=n});var p=function(){var _=new Pe(l+22),v=o,y=l-o;l=0;for(var m=0;m<c;++m){var b=u[m];try{var j=b.c.length;m_(_,l,b,b.f,b.u,j);var k=30+b.f.length+Fp(b.extra),S=l+k;_.set(b.c,S),m_(_,o,b,b.f,b.u,j,l,b.m),o+=16+k+(b.m?b.m.length:0),l=S+j}catch(N){return h(N,null)}}s3(_,o,u.length,y,v),h(null,_)};i||p();for(var g=function(_){var v=s[_],y=r[v],m=y[0],b=y[1],j=KD(),k=m.length;j.p(m);var S=zp(v),N=S.length,R=b.comment,O=R&&zp(R),D=O&&O.length,M=Fp(b.extra),z=b.level==0?0:8,T=function(E,A){if(E)f(),h(E,null);else{var P=A.length;u[_]=tv(b,{size:k,crc:j.d(),c:A,f:S,m:O,u:N!=v.length||O&&R.length!=D,compression:z}),o+=30+N+M+P,l+=76+2*(N+M)+(D||0)+P,--i||p()}};if(N>65535&&T(Fe(11,0,1),null),!z)T(null,m);else if(k<16e4)try{T(null,nv(m,b))}catch(E){T(E,null)}else d.push(QD(m,b,T))},x=0;x<c;++x)g(x);return f}var ku=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function o3(e,t,n){n||(n=t,t={}),typeof n!="function"&&Fe(7);var r=[],s=function(){for(var _=0;_<r.length;++_)r[_]()},i={},o=function(_,v){ku(function(){n(_,v)})};ku(function(){o=n});for(var l=e.length-22;Ht(e,l)!=101010256;--l)if(!l||e.length-l>65558)return o(Fe(13,0,1),null),s;var c=Mn(e,l+8);if(c){var u=c,d=Ht(e,l+16),f=Ht(e,l-20)==117853008;if(f){var h=Ht(e,l-12);f=Ht(e,h)==101075792,f&&(u=c=Ht(e,h+32),d=Ht(e,h+48))}for(var p=t&&t.filter,g=function(_){var v=n3(e,d,f),y=v[0],m=v[1],b=v[2],j=v[3],k=v[4],S=v[5],N=t3(e,S);d=k;var R=function(D,M){D?(s(),o(D,null)):(M&&(i[j]=M),--c||o(null,i))};if(!p||p({name:j,size:m,originalSize:b,compression:y}))if(!y)R(null,Ys(e,N,N+m));else if(y==8){var O=e.subarray(N,N+m);if(b<524288||m>.8*b)try{R(null,rv(O,{out:new Pe(b)}))}catch(D){R(D,null)}else r.push(ZD(O,{size:b},R))}else R(Fe(14,"unknown compression type "+y,1),null);else R(null,null)},x=0;x<u;++x)g(x)}else o(null,{});return s}const Vp="project-manifest.json",a3=".aitable-workflow.zip",l3=/\.(json|ya?ml|ts|js|md|txt)$/i,c3=new Set(["runtime","traces","node_modules"]),Gk=/(^|\/)\.(_|DS_Store)/;async function u3(e){const{project:t,files:n,checksums:r,exportedAt:s}=e,i={};for(const l of n)Yk(l.path)||Gk.test(l.path)||(i[l.path]=l.content);const o={version:1,title:t.title??"",scene:g3(n),checksums:r,exportedAt:s,projectId:t.id};return i[Vp]=JSON.stringify(o,null,2),d3(i)}function d3(e){const t={};for(const[n,r]of Object.entries(e))t[n]=zp(r);return new Promise((n,r)=>{i3(t,{level:6},(s,i)=>{s?r(s):n(new Blob([i.slice()],{type:"application/zip"}))})})}async function qk(e){let t;e instanceof Uint8Array?t=e:e instanceof ArrayBuffer?t=new Uint8Array(e):t=new Uint8Array(await e.arrayBuffer());const n=await new Promise((s,i)=>{o3(t,(o,l)=>o?i(o):s(l))}),r={};for(const[s,i]of Object.entries(n))s.endsWith("/")||(r[s]=Kk(i));return r}function f3(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.rel="noopener",document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)}async function h3(e){const t=await qk(e);let n;const r=t[Vp];if(r!==void 0)try{n=JSON.parse(r)}catch{n=void 0}const s=[];for(const[o,l]of Object.entries(t)){if(o===Vp)continue;const c=o.replace(/^\/+/,"");!c||Gk.test(c)||Yk(c)||!l3.test(c)||s.push({path:c,content:l})}s.sort((o,l)=>o.path.localeCompare(l.path));const i=await m3(n,s);return{title:(n==null?void 0:n.title)??"",files:s,manifest:n,checksumWarnings:i}}async function p3(e){try{const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}catch{return null}}async function m3(e,t){if(!(e!=null&&e.checksums)||e.checksums.length===0)return[];const n=[],r=new Map(t.map(s=>[s.path,s.content]));for(const s of e.checksums){const i=r.get(s.path);if(i===void 0){n.push(`manifest 记录的文件缺失:${s.path}`);continue}const o=await p3(i);o&&o!==s.sha256&&n.push(`checksum 不一致:${s.path}`)}return n}function g3(e){const t=e.find(r=>r.path==="aitable-workflow.config.yml"||r.path.endsWith(".config.yml"));if(!t)return;const n=/^[ \t]*scene[ \t]*:[ \t]*(.+)$/m.exec(t.content);if(n)return n[1].trim().replace(/^['"]/,"").replace(/['"]$/,"").replace(/\s+#.*$/,"")||void 0}function Yk(e){const t=e.split("/")[0]??"";return c3.has(t)}function v3(e){return e.trim().replace(/[^\w一-龥.\- ]+/g,"_").replace(/_{2,}/g,"_")||"project"}function y3(e){return`${v3(e)}${a3}`}function Ra(e,t){const n=e.filter(r=>r.id!==t.id);return[t,...n].sort((r,s)=>s.updatedAt.localeCompare(r.updatedAt))}function Bp(e,t){var n;return(n=e.title)!=null&&n.trim()?e.title.trim():`工作流 #${t+1} · ${e.id.slice(-6)}`}const x3=lt(function(){const t=B.workflows,n=B.currentWorkflowId,r=B.workflowFiles,s=B.projectId,[,i]=Ag(),[o,l]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState(!1),[h,p]=w.useState(null),g=y=>{if(!y)return null;const m=t.find(b=>b.id===y);return(m==null?void 0:m.fileCount)!=null?m.fileCount:y!==n?null:r.length};function x(y){!s||y===n||i(m=>{const b=new URLSearchParams(m);return b.set("w",y),b})}async function _(){if(s)try{const y=await Ap(s);B.setWorkflows(y)}catch{}}async function v(){if(!(!c||!s)){f(!0),p(null);try{await qL(s,c);const y=await Ap(s),m=c===n;if(B.setWorkflows(y),m){const b=y[0];i(j=>{const k=new URLSearchParams(j);return b?k.set("w",b.id):k.delete("w"),k}),b||B.setCurrentWorkflow(null,[])}u(null)}catch(y){const m=y instanceof Error?y.message:String(y);p(/运行中|project_busy|活跃|无法删除/i.test(m)?"项目运行中,无法删除工作流":m)}finally{f(!1)}}}return t.length===0?a.jsxs("div",{className:"rail__workflow-empty",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--workflow rail__workflow-new",onClick:()=>l(!0),children:[a.jsx($,{name:"plus",size:14,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建工作流"})]}),h&&a.jsx("div",{className:"rail__workflow-error",children:h}),o&&a.jsx(g_,{onCancel:()=>l(!1),onCreated:async()=>{l(!1),await _()}})]}):a.jsxs("div",{className:"rail__workflow-list",children:[t.map(y=>{const m=y.id===n,b=g(y.id);return a.jsxs("div",{className:"rail__workflow-card-wrap",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--workflow"+(m?" is-active":""),onClick:()=>x(y.id),disabled:d,title:`${y.name}${y.domain?" · "+y.domain:""}${y.tableId?" · "+y.tableId:""}`,children:[a.jsx($,{name:"flow",size:14,style:{flex:"0 0 auto"}}),a.jsxs("span",{className:"rail__item-copy",children:[a.jsx("span",{className:"rail__item-title",children:y.name}),a.jsx("span",{className:"rail__item-sub",children:[y.domain,y.tableId].filter(Boolean).join(" · ")||y.id})]}),b!==null&&a.jsx("span",{className:"rail__badge",children:b})]}),a.jsx("button",{type:"button",className:"rail__item-delete",title:"删除工作流","aria-label":"删除工作流",disabled:d,onClick:()=>{u(y.id),p(null)},children:a.jsx($,{name:"close",size:12})})]},y.id)}),a.jsxs("button",{type:"button",className:"rail__item rail__workflow-add",onClick:()=>l(!0),children:[a.jsx($,{name:"plus",size:14,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建工作流"})]}),h&&a.jsx("div",{className:"rail__workflow-error",children:h}),o&&a.jsx(g_,{onCancel:()=>l(!1),onCreated:async()=>{l(!1),await _()}}),c&&a.jsx("div",{className:"modal-overlay",onClick:()=>!d&&u(null),children:a.jsxs("div",{className:"modal-card",onClick:y=>y.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"删除工作流?"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>u(null),disabled:d,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsx("p",{className:"cfg-muted",children:"删除后该工作流的 workflow.yml / recipes / views 将一并移除,且不可恢复。"}),h&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),h]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>u(null),disabled:d,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:d,onClick:()=>void v(),children:d?"删除中...":"确认删除"})]})]})})]})});function g_({onCancel:e,onCreated:t}){const n=B.projectId,[r,s]=w.useState(""),[i,o]=w.useState(""),[l,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(null),p=w.useRef(null);async function g(_){if(!_||_.length===0)return[];const v=Array.from(_),y=[];for(const m of v){const b=m.webkitRelativePath||m.name,j=await m.text();y.push({path:Xk(b),content:j})}return y}function x(){if(!n)return;const _=r.trim();if(!_){h("工作流名称不能为空");return}d(!0),h(null),(async()=>{var v;try{const y=[];if(i.trim()&&y.push({path:"workflow.yml",content:i}),l.trim()){const b=_3(l);y.push(...b)}if((v=p.current)!=null&&v.files){const b=await g(p.current.files);y.push(...b)}const m=await GL(n,{name:_,files:y.length>0?y:void 0});await t(m.workflow)}catch(y){h(y instanceof Error?y.message:String(y))}finally{d(!1)}})()}return a.jsx("div",{className:"modal-overlay",onClick:()=>!u&&e(),children:a.jsxs("div",{className:"modal-card",onClick:_=>_.stopPropagation(),style:{maxWidth:560},children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"新建工作流"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:e,disabled:u,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsxs("label",{className:"cfg-label",children:["工作流名称",a.jsx("input",{className:"cfg-input",value:r,placeholder:"例如:合同审批流程",onChange:_=>s(_.target.value),disabled:u})]}),a.jsxs("label",{className:"cfg-label",style:{marginTop:12},children:["workflow.yml(可选,留空则后端用默认模板)",a.jsx("textarea",{className:"cfg-textarea",rows:8,value:i,placeholder:`workflow:
66
+ `).trim()||null}async function bu(e){if(!me)return;const t=Lf.get(e);if(t)return t;const n=FD(e).finally(()=>{Lf.delete(e)});return Lf.set(e,n),n}const Lf=new Map;async function FD(e){B.beginLoad(e);try{await sk();const t=await Vg();if(!t.some(r=>r.id===e)){B.clearProject(t);return}const n=await VD(e,t);B.applyLoadedProject({snapshot:n,live:K$(n)})}catch(t){B.failLoad(e,t instanceof Error?t.message:String(t))}}async function Hi(e){if(!me)return null;const t=await Bg(e).catch(()=>null);return t&&B.applySnapshotPatch(e,{projectState:t})?t:null}async function VD(e,t){const n=await Ug(e),r=await Bg(e).catch(()=>null),s=await Nk(e,null).catch(()=>({workflows:[],currentWorkflowId:null,workflowFiles:[]})),i=n.some(c=>c.path==="workflow.yml"||c.path.endsWith("/workflow.yml"))?await Sd(e,s.currentWorkflowId).catch(()=>null):null,o=st?await Ec(e).catch(()=>null):null,l=$D(n);return l&&(o!=null&&o.machineId)&&(l.selectedMachineId=o.machineId),{...ms(),projectId:e,projects:t,files:n,projectState:r,workflow:i,workflows:s.workflows,currentWorkflowId:s.currentWorkflowId,workflowFiles:s.workflowFiles,engineBinding:o,init:l}}function BD(){var t;const[e]=t1();return e.get("w")??((t=B.workflows[0])==null?void 0:t.id)??null}function UD(){const e=B.projectId,t=B.pollIntervalMs;w.useEffect(()=>{if(B.mode!=="live"||!e||t===null)return;let n=!1,r;const s=async()=>{await Hi(e).catch(()=>{}),n||(r=setTimeout(()=>void s(),t))};return r=setTimeout(()=>void s(),t),()=>{n=!0,r!==void 0&&clearTimeout(r)}},[e,t])}function Ek({onConfirm:e,onCancel:t}){const[n,r]=w.useState("未命名项目");return a.jsx("div",{className:"modal-overlay",onClick:t,children:a.jsxs("div",{className:"import-panel",style:{maxWidth:400},onClick:s=>s.stopPropagation(),children:[a.jsxs("div",{className:"import-panel__head",children:[a.jsx("span",{className:"import-panel__title",children:"新建项目"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:t,children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"import-panel__body",children:a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"项目名称"}),a.jsx("input",{className:"import-confirm__input",value:n,onChange:s=>r(s.target.value),placeholder:"输入项目名称",autoFocus:!0,onKeyDown:s=>{s.key==="Enter"&&n.trim()&&e(n.trim())}})]})}),a.jsxs("div",{className:"import-panel__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:t,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!n.trim(),onClick:()=>e(n.trim()),children:"创建项目"})]})]})})}var c_={},HD=function(e,t,n,r,s){var i=new Worker(c_[t]||(c_[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(o){var l=o.data,c=l.$e$;if(c){var u=new Error(c[0]);u.code=c[1],u.stack=c[2],s(u,null)}else s(null,l)},i.postMessage(n,r),i},Pe=Uint8Array,dt=Uint16Array,al=Int32Array,fo=new Pe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ho=new Pe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Pa=new Pe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ck=function(e,t){for(var n=new dt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new al(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return{b:n,r:s}},Tk=Ck(fo,2),Yg=Tk.b,ju=Tk.r;Yg[28]=258,ju[258]=28;var Pk=Ck(ho,0),Ak=Pk.b,Op=Pk.r,Aa=new dt(32768);for(var je=0;je<32768;++je){var Nr=(je&43690)>>1|(je&21845)<<1;Nr=(Nr&52428)>>2|(Nr&13107)<<2,Nr=(Nr&61680)>>4|(Nr&3855)<<4,Aa[je]=((Nr&65280)>>8|(Nr&255)<<8)>>1}var Jt=function(e,t,n){for(var r=e.length,s=0,i=new dt(t);s<r;++s)e[s]&&++i[e[s]-1];var o=new dt(t);for(s=1;s<t;++s)o[s]=o[s-1]+i[s-1]<<1;var l;if(n){l=new dt(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],d=t-e[s],f=o[e[s]-1]++<<d,h=f|(1<<d)-1;f<=h;++f)l[Aa[f]>>c]=u}else for(l=new dt(r),s=0;s<r;++s)e[s]&&(l[s]=Aa[o[e[s]-1]++]>>15-e[s]);return l},_r=new Pe(288);for(var je=0;je<144;++je)_r[je]=8;for(var je=144;je<256;++je)_r[je]=9;for(var je=256;je<280;++je)_r[je]=7;for(var je=280;je<288;++je)_r[je]=8;var Wi=new Pe(32);for(var je=0;je<32;++je)Wi[je]=5;var Rk=Jt(_r,9,0),Ik=Jt(_r,9,1),Mk=Jt(Wi,5,0),Ok=Jt(Wi,5,1),Cc=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Bt=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Tc=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},ll=function(e){return(e+7)/8|0},Ys=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Pe(e.subarray(t,n))},Lk=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Fe=function(e,t,n){var r=new Error(t||Lk[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Fe),!n)throw r;return r},$k=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new Pe(0);var o=!n,l=o||t.i!=2,c=t.i;o&&(n=new Pe(s*3));var u=function(te){var Z=n.length;if(te>Z){var ee=new Pe(Math.max(Z*2,te));ee.set(n),n=ee}},d=t.f||0,f=t.p||0,h=t.b||0,p=t.l,g=t.d,x=t.m,_=t.n,v=s*8;do{if(!p){d=Bt(e,f,1);var y=Bt(e,f+1,3);if(f+=3,y)if(y==1)p=Ik,g=Ok,x=9,_=5;else if(y==2){var k=Bt(e,f,31)+257,S=Bt(e,f+10,15)+4,N=k+Bt(e,f+5,31)+1;f+=14;for(var R=new Pe(N),O=new Pe(19),D=0;D<S;++D)O[Pa[D]]=Bt(e,f+D*3,7);f+=S*3;for(var M=Cc(O),z=(1<<M)-1,T=Jt(O,M,1),D=0;D<N;){var E=T[Bt(e,f,z)];f+=E&15;var m=E>>4;if(m<16)R[D++]=m;else{var A=0,P=0;for(m==16?(P=3+Bt(e,f,3),f+=2,A=R[D-1]):m==17?(P=3+Bt(e,f,7),f+=3):m==18&&(P=11+Bt(e,f,127),f+=7);P--;)R[D++]=A}}var I=R.subarray(0,k),C=R.subarray(k);x=Cc(I),_=Cc(C),p=Jt(I,x,1),g=Jt(C,_,1)}else Fe(1);else{var m=ll(f)+4,b=e[m-4]|e[m-3]<<8,j=m+b;if(j>s){c&&Fe(0);break}l&&u(h+b),n.set(e.subarray(m,j),h),t.b=h+=b,t.p=f=j*8,t.f=d;continue}if(f>v){c&&Fe(0);break}}l&&u(h+131072);for(var L=(1<<x)-1,F=(1<<_)-1,V=f;;V=f){var A=p[Tc(e,f)&L],H=A>>4;if(f+=A&15,f>v){c&&Fe(0);break}if(A||Fe(2),H<256)n[h++]=H;else if(H==256){V=f,p=null;break}else{var U=H-254;if(H>264){var D=H-257,W=fo[D];U=Bt(e,f,(1<<W)-1)+Yg[D],f+=W}var G=g[Tc(e,f)&F],Y=G>>4;G||Fe(3),f+=G&15;var C=Ak[Y];if(Y>3){var W=ho[Y];C+=Tc(e,f)&(1<<W)-1,f+=W}if(f>v){c&&Fe(0);break}l&&u(h+131072);var K=h+U;if(h<C){var X=i-C,re=Math.min(C,K);for(X+h<0&&Fe(3);h<re;++h)n[h]=r[X+h]}for(;h<K;++h)n[h]=n[h-C]}}t.l=p,t.p=V,t.b=h,t.f=d,p&&(d=1,t.m=x,t.d=g,t.n=_)}while(!d);return h!=n.length&&o?Ys(n,0,h):n.subarray(0,h)},Tn=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},ei=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Pc=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var s=n.length,i=n.slice();if(!s)return{t:Qg,l:0};if(s==1){var o=new Pe(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(j,k){return j.f-k.f}),n.push({s:-1,f:25001});var l=n[0],c=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};d!=s-1;)l=n[n[u].f<n[f].f?u++:f++],c=n[u!=d&&n[u].f<n[f].f?u++:f++],n[d++]={s:-1,f:l.f+c.f,l,r:c};for(var h=i[0].s,r=1;r<s;++r)i[r].s>h&&(h=i[r].s);var p=new dt(h+1),g=Su(n[d-1],p,0);if(g>t){var r=0,x=0,_=g-t,v=1<<_;for(i.sort(function(k,S){return p[S.s]-p[k.s]||k.f-S.f});r<s;++r){var y=i[r].s;if(p[y]>t)x+=v-(1<<g-p[y]),p[y]=t;else break}for(x>>=_;x>0;){var m=i[r].s;p[m]<t?x-=1<<t-p[m]++-1:++r}for(;r>=0&&x;--r){var b=i[r].s;p[b]==t&&(--p[b],++x)}g=t}return{t:new Pe(p),l:g}},Su=function(e,t,n){return e.s==-1?Math.max(Su(e.l,t,n+1),Su(e.r,t,n+1)):t[e.s]=n},Lp=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new dt(++t),r=0,s=e[0],i=1,o=function(c){n[r++]=c},l=1;l<=t;++l)if(e[l]==s&&l!=t)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=e[l]}return{c:n.subarray(0,r),n:t}},ti=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Xg=function(e,t,n){var r=n.length,s=ll(t+2);e[s]=r&255,e[s+1]=r>>8,e[s+2]=e[s]^255,e[s+3]=e[s+1]^255;for(var i=0;i<r;++i)e[s+i+4]=n[i];return(s+4+r)*8},$p=function(e,t,n,r,s,i,o,l,c,u,d){Tn(t,d++,n),++s[256];for(var f=Pc(s,15),h=f.t,p=f.l,g=Pc(i,15),x=g.t,_=g.l,v=Lp(h),y=v.c,m=v.n,b=Lp(x),j=b.c,k=b.n,S=new dt(19),N=0;N<y.length;++N)++S[y[N]&31];for(var N=0;N<j.length;++N)++S[j[N]&31];for(var R=Pc(S,7),O=R.t,D=R.l,M=19;M>4&&!O[Pa[M-1]];--M);var z=u+5<<3,T=ti(s,_r)+ti(i,Wi)+o,E=ti(s,h)+ti(i,x)+o+14+3*M+ti(S,O)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&z<=T&&z<=E)return Xg(t,d,e.subarray(c,c+u));var A,P,I,C;if(Tn(t,d,1+(E<T)),d+=2,E<T){A=Jt(h,p,0),P=h,I=Jt(x,_,0),C=x;var L=Jt(O,D,0);Tn(t,d,m-257),Tn(t,d+5,k-1),Tn(t,d+10,M-4),d+=14;for(var N=0;N<M;++N)Tn(t,d+3*N,O[Pa[N]]);d+=3*M;for(var F=[y,j],V=0;V<2;++V)for(var H=F[V],N=0;N<H.length;++N){var U=H[N]&31;Tn(t,d,L[U]),d+=O[U],U>15&&(Tn(t,d,H[N]>>5&127),d+=H[N]>>12)}}else A=Rk,P=_r,I=Mk,C=Wi;for(var N=0;N<l;++N){var W=r[N];if(W>255){var U=W>>18&31;ei(t,d,A[U+257]),d+=P[U+257],U>7&&(Tn(t,d,W>>23&31),d+=fo[U]);var G=W&31;ei(t,d,I[G]),d+=C[G],G>3&&(ei(t,d,W>>5&8191),d+=ho[G])}else ei(t,d,A[W]),d+=P[W]}return ei(t,d,A[256]),d+P[256]},Dk=new al([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qg=new Pe(0),zk=function(e,t,n,r,s,i){var o=i.z||e.length,l=new Pe(r+o+5*(1+Math.ceil(o/7e3))+s),c=l.subarray(r,l.length-s),u=i.l,d=(i.r||0)&7;if(t){d&&(c[0]=i.r>>3);for(var f=Dk[t-1],h=f>>13,p=f&8191,g=(1<<n)-1,x=i.p||new dt(32768),_=i.h||new dt(g+1),v=Math.ceil(n/3),y=2*v,m=function(se){return(e[se]^e[se+1]<<v^e[se+2]<<y)&g},b=new al(25e3),j=new dt(288),k=new dt(32),S=0,N=0,R=i.i||0,O=0,D=i.w||0,M=0;R+2<o;++R){var z=m(R),T=R&32767,E=_[z];if(x[T]=E,_[z]=T,D<=R){var A=o-R;if((S>7e3||O>24576)&&(A>423||!u)){d=$p(e,c,0,b,j,k,N,O,M,R-M,d),O=S=N=0,M=R;for(var P=0;P<286;++P)j[P]=0;for(var P=0;P<30;++P)k[P]=0}var I=2,C=0,L=p,F=T-E&32767;if(A>2&&z==m(R-F))for(var V=Math.min(h,A)-1,H=Math.min(32767,R),U=Math.min(258,A);F<=H&&--L&&T!=E;){if(e[R+I]==e[R+I-F]){for(var W=0;W<U&&e[R+W]==e[R+W-F];++W);if(W>I){if(I=W,C=F,W>V)break;for(var G=Math.min(F,W-2),Y=0,P=0;P<G;++P){var K=R-F+P&32767,X=x[K],re=K-X&32767;re>Y&&(Y=re,E=K)}}}T=E,E=x[T],F+=T-E&32767}if(C){b[O++]=268435456|ju[I]<<18|Op[C];var te=ju[I]&31,Z=Op[C]&31;N+=fo[te]+ho[Z],++j[257+te],++k[Z],D=R+I,++S}else b[O++]=e[R],++j[e[R]]}}for(R=Math.max(R,D);R<o;++R)b[O++]=e[R],++j[e[R]];d=$p(e,c,u,b,j,k,N,O,M,R-M,d),u||(i.r=d&7|c[d/8|0]<<3,d-=7,i.h=_,i.p=x,i.i=R,i.w=D)}else{for(var R=i.w||0;R<o+u;R+=65535){var ee=R+65535;ee>=o&&(c[d/8|0]=u,ee=o),d=Xg(c,d+1,e.subarray(R,ee))}i.i=o}return Ys(l,0,r+ll(d)+s)},WD=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e}(),KD=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=WD[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},Fk=function(e,t,n,r,s){if(!s&&(s={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new Pe(i.length+e.length);o.set(i),o.set(e,i.length),e=o,s.w=i.length}return zk(e,t.level==null?6:t.level,t.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,s)},Zg=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},u_=function(e,t,n){for(var r=e(),s=e.toString(),i=s.slice(s.indexOf("[")+1,s.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<r.length;++o){var l=r[o],c=i[o];if(typeof l=="function"){t+=";"+c+"=";var u=l.toString();if(l.prototype)if(u.indexOf("[native code]")!=-1){var d=u.indexOf(" ",8)+1;t+=u.slice(d,u.indexOf("(",d))}else{t+=u;for(var f in l.prototype)t+=";"+c+".prototype."+f+"="+l.prototype[f].toString()}else t+=u}else n[c]=l}return t},Ul=[],GD=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},qD=function(e,t,n,r){if(!Ul[n]){for(var s="",i={},o=e.length-1,l=0;l<o;++l)s=u_(e[l],s,i);Ul[n]={c:u_(e[o],s,i),e:i}}var c=Zg({},Ul[n].e);return HD(Ul[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,c,GD(c),r)},YD=function(){return[Pe,dt,al,fo,ho,Pa,Yg,Ak,Ik,Ok,Aa,Lk,Jt,Cc,Bt,Tc,ll,Ys,Fe,$k,ev,kd,Vk]},XD=function(){return[Pe,dt,al,fo,ho,Pa,ju,Op,Rk,_r,Mk,Wi,Aa,Dk,Qg,Jt,Tn,ei,Pc,Su,Lp,ti,Xg,$p,ll,Ys,zk,Fk,Jg,kd]},kd=function(e){return postMessage(e,[e.buffer])},Vk=function(e){return e&&{out:e.size&&new Pe(e.size),dictionary:e.dictionary}},Bk=function(e,t,n,r,s,i){var o=qD(n,r,s,function(l,c){o.terminate(),i(l,c)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Mn=function(e,t){return e[t]|e[t+1]<<8},Ht=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},$f=function(e,t){return Ht(e,t)+Ht(e,t+4)*4294967296},Xe=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function QD(e,t,n){return n||(n=t,t={}),typeof n!="function"&&Fe(7),Bk(e,t,[XD],function(r){return kd(Jg(r.data[0],r.data[1]))},0,n)}function Jg(e,t){return Fk(e,t||{},0,0)}function ZD(e,t,n){return n||(n=t,t={}),typeof n!="function"&&Fe(7),Bk(e,t,[YD],function(r){return kd(ev(r.data[0],Vk(r.data[1])))},1,n)}function ev(e,t){return $k(e,{i:2},t&&t.out,t&&t.dictionary)}var Uk=function(e,t,n,r){for(var s in e){var i=e[s],o=t+s,l=r;Array.isArray(i)&&(l=Zg(r,i[1]),i=i[0]),ArrayBuffer.isView(i)?n[o]=[i,l]:(n[o+="/"]=[new Pe(0),l],Uk(i,o,n,r))}},d_=typeof TextEncoder<"u"&&new TextEncoder,Dp=typeof TextDecoder<"u"&&new TextDecoder,JD=0;try{Dp.decode(Qg,{stream:!0}),JD=1}catch{}var e3=function(e){for(var t="",n=0;;){var r=e[n++],s=(r>127)+(r>223)+(r>239);if(n+s>e.length)return{s:t,r:Ys(e,n-1)};s?s==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):s&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function zp(e,t){var n;if(d_)return d_.encode(e);for(var r=e.length,s=new Pe(e.length+(e.length>>1)),i=0,o=function(u){s[i++]=u},n=0;n<r;++n){if(i+5>s.length){var l=new Pe(i+8+(r-n<<1));l.set(s),s=l}var c=e.charCodeAt(n);c<128||t?o(c):c<2048?(o(192|c>>6),o(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|e.charCodeAt(++n)&1023,o(240|c>>18),o(128|c>>12&63),o(128|c>>6&63),o(128|c&63)):(o(224|c>>12),o(128|c>>6&63),o(128|c&63))}return Ys(s,0,i)}function Hk(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else{if(Dp)return Dp.decode(e);var s=e3(e),i=s.s,n=s.r;return n.length&&Fe(8),i}}var t3=function(e,t){return t+30+Mn(e,t+26)+Mn(e,t+28)},n3=function(e,t,n){var r=Mn(e,t+28),s=Mn(e,t+30),i=Hk(e.subarray(t+46,t+46+r),!(Mn(e,t+8)&2048)),o=t+46+r,l=r3(e,o,s,n,Ht(e,t+20),Ht(e,t+24),Ht(e,t+42)),c=l[0],u=l[1],d=l[2];return[Mn(e,t+10),c,u,i,o+s+Mn(e,t+32),d]},r3=function(e,t,n,r,s,i,o){var l=s==4294967295,c=i==4294967295,u=o==4294967295,d=t+n,f=l+c+u;if(r&&f){for(;t+4<d;t+=4+Mn(e,t+2))if(Mn(e,t)==1)return[l?$f(e,t+4+8*c):s,c?$f(e,t+4):i,u?$f(e,t+4+8*(c+l)):o,1];r<2&&Fe(13)}return[s,i,o,0]},Fp=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Fe(9),t+=r+4}return t},f_=function(e,t,n,r,s,i,o,l){var c=r.length,u=n.extra,d=l&&l.length,f=Fp(u);Xe(e,t,o!=null?33639248:67324752),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(i<0&&8),e[t++]=s&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var h=new Date(n.mtime==null?Date.now():n.mtime),p=h.getFullYear()-1980;if((p<0||p>119)&&Fe(10),Xe(e,t,p<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,i!=-1&&(Xe(e,t,n.crc),Xe(e,t+4,i<0?-i-2:i),Xe(e,t+8,n.size)),Xe(e,t+12,c),Xe(e,t+14,f),t+=16,o!=null&&(Xe(e,t,d),Xe(e,t+6,n.attrs),Xe(e,t+10,o),t+=14),e.set(r,t),t+=c,f)for(var g in u){var x=u[g],_=x.length;Xe(e,t,+g),Xe(e,t+2,_),e.set(x,t+4),t+=4+_}return d&&(e.set(l,t),t+=d),t},s3=function(e,t,n,r,s){Xe(e,t,101010256),Xe(e,t+8,n),Xe(e,t+10,n),Xe(e,t+12,r),Xe(e,t+16,s)};function i3(e,t,n){n||(n=t,t={}),typeof n!="function"&&Fe(7);var r={};Uk(e,"",r,t);var s=Object.keys(r),i=s.length,o=0,l=0,c=i,u=new Array(i),d=[],f=function(){for(var _=0;_<d.length;++_)d[_]()},h=function(_,v){ku(function(){n(_,v)})};ku(function(){h=n});var p=function(){var _=new Pe(l+22),v=o,y=l-o;l=0;for(var m=0;m<c;++m){var b=u[m];try{var j=b.c.length;f_(_,l,b,b.f,b.u,j);var k=30+b.f.length+Fp(b.extra),S=l+k;_.set(b.c,S),f_(_,o,b,b.f,b.u,j,l,b.m),o+=16+k+(b.m?b.m.length:0),l=S+j}catch(N){return h(N,null)}}s3(_,o,u.length,y,v),h(null,_)};i||p();for(var g=function(_){var v=s[_],y=r[v],m=y[0],b=y[1],j=KD(),k=m.length;j.p(m);var S=zp(v),N=S.length,R=b.comment,O=R&&zp(R),D=O&&O.length,M=Fp(b.extra),z=b.level==0?0:8,T=function(E,A){if(E)f(),h(E,null);else{var P=A.length;u[_]=Zg(b,{size:k,crc:j.d(),c:A,f:S,m:O,u:N!=v.length||O&&R.length!=D,compression:z}),o+=30+N+M+P,l+=76+2*(N+M)+(D||0)+P,--i||p()}};if(N>65535&&T(Fe(11,0,1),null),!z)T(null,m);else if(k<16e4)try{T(null,Jg(m,b))}catch(E){T(E,null)}else d.push(QD(m,b,T))},x=0;x<c;++x)g(x);return f}var ku=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function o3(e,t,n){n||(n=t,t={}),typeof n!="function"&&Fe(7);var r=[],s=function(){for(var _=0;_<r.length;++_)r[_]()},i={},o=function(_,v){ku(function(){n(_,v)})};ku(function(){o=n});for(var l=e.length-22;Ht(e,l)!=101010256;--l)if(!l||e.length-l>65558)return o(Fe(13,0,1),null),s;var c=Mn(e,l+8);if(c){var u=c,d=Ht(e,l+16),f=Ht(e,l-20)==117853008;if(f){var h=Ht(e,l-12);f=Ht(e,h)==101075792,f&&(u=c=Ht(e,h+32),d=Ht(e,h+48))}for(var p=t&&t.filter,g=function(_){var v=n3(e,d,f),y=v[0],m=v[1],b=v[2],j=v[3],k=v[4],S=v[5],N=t3(e,S);d=k;var R=function(D,M){D?(s(),o(D,null)):(M&&(i[j]=M),--c||o(null,i))};if(!p||p({name:j,size:m,originalSize:b,compression:y}))if(!y)R(null,Ys(e,N,N+m));else if(y==8){var O=e.subarray(N,N+m);if(b<524288||m>.8*b)try{R(null,ev(O,{out:new Pe(b)}))}catch(D){R(D,null)}else r.push(ZD(O,{size:b},R))}else R(Fe(14,"unknown compression type "+y,1),null);else R(null,null)},x=0;x<u;++x)g(x)}else o(null,{});return s}const Vp="project-manifest.json",a3=".aitable-workflow.zip",l3=/\.(json|ya?ml|ts|js|md|txt)$/i,c3=new Set(["runtime","traces","node_modules"]),Wk=/(^|\/)\.(_|DS_Store)/;async function u3(e){const{project:t,files:n,checksums:r,exportedAt:s}=e,i={};for(const l of n)Gk(l.path)||Wk.test(l.path)||(i[l.path]=l.content);const o={version:1,title:t.title??"",scene:g3(n),checksums:r,exportedAt:s,projectId:t.id};return i[Vp]=JSON.stringify(o,null,2),d3(i)}function d3(e){const t={};for(const[n,r]of Object.entries(e))t[n]=zp(r);return new Promise((n,r)=>{i3(t,{level:6},(s,i)=>{s?r(s):n(new Blob([i.slice()],{type:"application/zip"}))})})}async function Kk(e){let t;e instanceof Uint8Array?t=e:e instanceof ArrayBuffer?t=new Uint8Array(e):t=new Uint8Array(await e.arrayBuffer());const n=await new Promise((s,i)=>{o3(t,(o,l)=>o?i(o):s(l))}),r={};for(const[s,i]of Object.entries(n))s.endsWith("/")||(r[s]=Hk(i));return r}function f3(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.rel="noopener",document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)}async function h3(e){const t=await Kk(e);let n;const r=t[Vp];if(r!==void 0)try{n=JSON.parse(r)}catch{n=void 0}const s=[];for(const[o,l]of Object.entries(t)){if(o===Vp)continue;const c=o.replace(/^\/+/,"");!c||Wk.test(c)||Gk(c)||!l3.test(c)||s.push({path:c,content:l})}s.sort((o,l)=>o.path.localeCompare(l.path));const i=await m3(n,s);return{title:(n==null?void 0:n.title)??"",files:s,manifest:n,checksumWarnings:i}}async function p3(e){try{const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}catch{return null}}async function m3(e,t){if(!(e!=null&&e.checksums)||e.checksums.length===0)return[];const n=[],r=new Map(t.map(s=>[s.path,s.content]));for(const s of e.checksums){const i=r.get(s.path);if(i===void 0){n.push(`manifest 记录的文件缺失:${s.path}`);continue}const o=await p3(i);o&&o!==s.sha256&&n.push(`checksum 不一致:${s.path}`)}return n}function g3(e){const t=e.find(r=>r.path==="aitable-workflow.config.yml"||r.path.endsWith(".config.yml"));if(!t)return;const n=/^[ \t]*scene[ \t]*:[ \t]*(.+)$/m.exec(t.content);if(n)return n[1].trim().replace(/^['"]/,"").replace(/['"]$/,"").replace(/\s+#.*$/,"")||void 0}function Gk(e){const t=e.split("/")[0]??"";return c3.has(t)}function v3(e){return e.trim().replace(/[^\w一-龥.\- ]+/g,"_").replace(/_{2,}/g,"_")||"project"}function y3(e){return`${v3(e)}${a3}`}function Ra(e,t){const n=e.filter(r=>r.id!==t.id);return[t,...n].sort((r,s)=>s.updatedAt.localeCompare(r.updatedAt))}function Bp(e,t){var n;return(n=e.title)!=null&&n.trim()?e.title.trim():`工作流 #${t+1} · ${e.id.slice(-6)}`}const x3=lt(function(){const t=B.workflows,n=B.currentWorkflowId,r=B.workflowFiles,s=B.projectId,[,i]=t1(),[o,l]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState(!1),[h,p]=w.useState(null),g=y=>{if(!y)return null;const m=t.find(b=>b.id===y);return(m==null?void 0:m.fileCount)!=null?m.fileCount:y!==n?null:r.length};function x(y){!s||y===n||i(m=>{const b=new URLSearchParams(m);return b.set("w",y),b})}async function _(){if(s)try{const y=await Ap(s);B.setWorkflows(y)}catch{}}async function v(){if(!(!c||!s)){f(!0),p(null);try{await KL(s,c);const y=await Ap(s),m=c===n;if(B.setWorkflows(y),m){const b=y[0];i(j=>{const k=new URLSearchParams(j);return b?k.set("w",b.id):k.delete("w"),k}),b||B.setCurrentWorkflow(null,[])}u(null)}catch(y){const m=y instanceof Error?y.message:String(y);p(/运行中|project_busy|活跃|无法删除/i.test(m)?"项目运行中,无法删除工作流":m)}finally{f(!1)}}}return t.length===0?a.jsxs("div",{className:"rail__workflow-empty",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--workflow rail__workflow-new",onClick:()=>l(!0),children:[a.jsx($,{name:"plus",size:14,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建工作流"})]}),h&&a.jsx("div",{className:"rail__workflow-error",children:h}),o&&a.jsx(h_,{onCancel:()=>l(!1),onCreated:async()=>{l(!1),await _()}})]}):a.jsxs("div",{className:"rail__workflow-list",children:[t.map(y=>{const m=y.id===n,b=g(y.id);return a.jsxs("div",{className:"rail__workflow-card-wrap",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--workflow"+(m?" is-active":""),onClick:()=>x(y.id),disabled:d,title:`${y.name}${y.domain?" · "+y.domain:""}${y.tableId?" · "+y.tableId:""}`,children:[a.jsx($,{name:"flow",size:14,style:{flex:"0 0 auto"}}),a.jsxs("span",{className:"rail__item-copy",children:[a.jsx("span",{className:"rail__item-title",children:y.name}),a.jsx("span",{className:"rail__item-sub",children:[y.domain,y.tableId].filter(Boolean).join(" · ")||y.id})]}),b!==null&&a.jsx("span",{className:"rail__badge",children:b})]}),a.jsx("button",{type:"button",className:"rail__item-delete",title:"删除工作流","aria-label":"删除工作流",disabled:d,onClick:()=>{u(y.id),p(null)},children:a.jsx($,{name:"close",size:12})})]},y.id)}),a.jsxs("button",{type:"button",className:"rail__item rail__workflow-add",onClick:()=>l(!0),children:[a.jsx($,{name:"plus",size:14,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建工作流"})]}),h&&a.jsx("div",{className:"rail__workflow-error",children:h}),o&&a.jsx(h_,{onCancel:()=>l(!1),onCreated:async()=>{l(!1),await _()}}),c&&a.jsx("div",{className:"modal-overlay",onClick:()=>!d&&u(null),children:a.jsxs("div",{className:"modal-card",onClick:y=>y.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"删除工作流?"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>u(null),disabled:d,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsx("p",{className:"cfg-muted",children:"删除后该工作流的 workflow.yml / recipes / views 将一并移除,且不可恢复。"}),h&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),h]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>u(null),disabled:d,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:d,onClick:()=>void v(),children:d?"删除中...":"确认删除"})]})]})})]})});function h_({onCancel:e,onCreated:t}){const n=B.projectId,[r,s]=w.useState(""),[i,o]=w.useState(""),[l,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(null),p=w.useRef(null);async function g(_){if(!_||_.length===0)return[];const v=Array.from(_),y=[];for(const m of v){const b=m.webkitRelativePath||m.name,j=await m.text();y.push({path:qk(b),content:j})}return y}function x(){if(!n)return;const _=r.trim();if(!_){h("工作流名称不能为空");return}d(!0),h(null),(async()=>{var v;try{const y=[];if(i.trim()&&y.push({path:"workflow.yml",content:i}),l.trim()){const b=_3(l);y.push(...b)}if((v=p.current)!=null&&v.files){const b=await g(p.current.files);y.push(...b)}const m=await WL(n,{name:_,files:y.length>0?y:void 0});await t(m.workflow)}catch(y){h(y instanceof Error?y.message:String(y))}finally{d(!1)}})()}return a.jsx("div",{className:"modal-overlay",onClick:()=>!u&&e(),children:a.jsxs("div",{className:"modal-card",onClick:_=>_.stopPropagation(),style:{maxWidth:560},children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"新建工作流"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:e,disabled:u,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsxs("label",{className:"cfg-label",children:["工作流名称",a.jsx("input",{className:"cfg-input",value:r,placeholder:"例如:合同审批流程",onChange:_=>s(_.target.value),disabled:u})]}),a.jsxs("label",{className:"cfg-label",style:{marginTop:12},children:["workflow.yml(可选,留空则后端用默认模板)",a.jsx("textarea",{className:"cfg-textarea",rows:8,value:i,placeholder:`workflow:
67
67
  name: ...`,onChange:_=>o(_.target.value),disabled:u})]}),a.jsxs("label",{className:"cfg-label",style:{marginTop:12},children:["recipes 脚本(可选,按 --- 文件名 --- 分段)",a.jsx("textarea",{className:"cfg-textarea",rows:5,value:l,placeholder:`--- recipes/fetch.recipe.ts ---
68
- export default ...`,onChange:_=>c(_.target.value),disabled:u})]}),a.jsxs("label",{className:"cfg-label",style:{marginTop:12},children:["上传工作流文件(可选,支持选目录)",a.jsx("input",{ref:p,type:"file",multiple:!0,webkitdirectory:"",directory:"",disabled:u})]}),f&&a.jsxs("div",{className:"import-env-warn",style:{marginTop:12},children:[a.jsx($,{name:"warn",size:13}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:e,disabled:u,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:u,onClick:()=>x(),children:u?"创建中...":"创建"})]})]})})}function _3(e){var i,o;const t=e.trim();if(!t)return[];const n=[],r=t.split(/^---\s+(.+?)\s+---\s*$/m);if(r.length<=1)return[{path:"recipes/_inline.recipe.ts",content:t}];let s=0;for(r[0].trim()&&n.push({path:"recipes/_inline.recipe.ts",content:r[0].trim()}),s=1;s<r.length;s+=2){const l=(i=r[s])==null?void 0:i.trim(),c=((o=r[s+1])==null?void 0:o.trim())??"";l&&n.push({path:Xk(l),content:c})}return n}function Xk(e){let t=e.replace(/^\.\//,"");const n=/^workflows\/[^/]+\//;return n.test(t)&&(t=t.replace(n,"")),t}const w3=lt(function(){const t=Sr(),{projectId:n}=YS(),r=B.projectId,s=B.projects,i=B.steps.length,l=wc("/p/:projectId/setup")?xk({snapshot:B.snapshot,mode:B.mode,mockSetup:B.mockSetup}).schema:null,c=(l==null?void 0:l.fields.length)??0,u=(l==null?void 0:l.views.length)??0,d=i>0,[f,h]=w.useState(!1),[p,g]=w.useState(null),[x,_]=w.useState(!1),[v,y]=w.useState(null),[m,b]=w.useState(null),[j,k]=w.useState(null),S=[`${i} 步工作流`,c>0?`${c} 字段`:null,u>0?`${u} 视图`:null].filter(Boolean).join(" · "),N=r?[{id:r,title:B.initDraft.name||(B.projectSource==="imported"?"导入项目":"新建项目"),dir:"",createdAt:"",updatedAt:""}]:[],R=me?s:N;function O(E){t(`/p/${E}`)}async function D(E){if(!me){B.beginNewProject(`mock-${Date.now()}`,E);return}const A=await Bg();B.beginNewProject(A.id,E),B.setProjects(Ra(s,A))}async function M(){if(!me||!r)return;const E=s.find(I=>I.id===r),A=window.prompt("项目名称",(E==null?void 0:E.title)??"");if(!(A!=null&&A.trim()))return;const P=await XL(r,A.trim());B.setProjects(Ra(s,P))}async function z(){if(p){_(!0),y(null);try{await HL(p);const E=await Ug().catch(()=>s.filter(A=>A.id!==p));p===r?(B.clearProject(E),t("/")):B.setProjects(E),g(null)}catch(E){const A=E instanceof Error?E.message:String(E);y(/运行中|project_busy|活跃|无法删除/i.test(A)?"项目运行中,无法删除":A)}finally{_(!1)}}}async function T(E){if(me){b(E),k(null);try{const A=await WL(E),P=await u3(A),I=y3(A.project.title??E);f3(P,I)}catch(A){k(A instanceof Error?A.message:String(A))}finally{b(null)}}}return a.jsxs("aside",{className:"rail",children:[a.jsxs("div",{className:"rail__head",children:[a.jsx("div",{className:"rail__title",children:"我的项目"}),a.jsx("button",{type:"button",className:"rail__collapse",onClick:()=>B.setRailCollapsed(!0),title:"收起项目列表","aria-label":"收起项目列表",children:a.jsx($,{name:"chevron-left",size:14})})]}),a.jsx("div",{className:"rail__list",children:R.map((E,A)=>{const P=me?E.id===n:!0;return a.jsxs("div",{className:"rail__project",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--project"+(P?" is-active":""),onClick:()=>O(E.id),onDoubleClick:()=>void M(),title:me?`${Bp(E,A)} · ${E.id}`:void 0,children:[a.jsx($,{name:"file",size:15,style:{flex:"0 0 auto"}}),a.jsxs("span",{className:"rail__item-copy",children:[a.jsx("span",{className:"rail__item-title",children:Bp(E,A)}),me&&a.jsx("span",{className:"rail__item-sub",children:E.id})]})]}),me&&a.jsx("button",{type:"button",className:"rail__item-delete",style:{right:30},title:m===E.id?"导出中...":"导出项目包","aria-label":"导出项目包",disabled:m===E.id,onClick:()=>void T(E.id),children:a.jsx("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M12 3v12M7 10l5 5 5-5M5 21h14"})})}),me&&a.jsx("button",{type:"button",className:"rail__item-delete",title:"删除项目","aria-label":"删除项目",onClick:()=>{g(E.id),y(null)},children:a.jsx($,{name:"close",size:12})}),P&&a.jsx(x3,{})]},E.id)})}),p&&a.jsx("div",{className:"modal-overlay",onClick:()=>!x&&g(null),children:a.jsxs("div",{className:"modal-card",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"删除项目?"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>g(null),disabled:x,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsx("p",{className:"cfg-muted",children:"删除后项目配置与工作流文件将一并移除,且不可恢复。"}),v&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),v]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>g(null),disabled:x,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:x,onClick:()=>void z(),children:x?"删除中...":"确认删除"})]})]})}),a.jsxs("button",{type:"button",className:"rail__item rail__new",onClick:()=>h(!0),children:[a.jsx($,{name:"plus",size:17,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建项目"})]}),f&&a.jsx(Tk,{onConfirm:E=>{D(E),h(!1)},onCancel:()=>h(!1)}),a.jsx("div",{className:"rail__spacer"}),me&&a.jsxs("button",{type:"button",className:"rail__item rail__machines",onClick:()=>B.toggleAgentTrace(),title:"查看 Agent 执行记录",children:[a.jsx($,{name:"bolt",size:17,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"执行记录"})]}),a.jsxs("div",{className:"rail__foot",children:[d?S:"尚未创建工作流",a.jsx("br",{}),"aitable-workflow 原型"]}),j&&a.jsx("div",{className:"modal-overlay",onClick:()=>k(null),children:a.jsxs("div",{className:"modal-card",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"导出失败"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>k(null),children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"modal-card__body",children:a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),j]})}),a.jsx("div",{className:"modal-card__foot",children:a.jsx("button",{type:"button",className:"primary modal-card__btn",onClick:()=>k(null),children:"知道了"})})]})})]})});function b3(){return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:"项目不存在"}),a.jsx("div",{className:"work-head__sub",children:"这个地址指向的项目已被删除,或从未存在"})]})}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:["可以从左侧列表选一个项目,或回到首页新建。",a.jsx("div",{style:{marginTop:16},children:a.jsx(Ue,{className:"primary",to:"/",children:"回到首页"})})]})})]})})}const j3=lt(function(){const{projectId:t}=YS(),{pathname:n}=Dt();w.useEffect(()=>{t&&bu(t)},[t]),UD();const r=BD(),[s,i]=w.useState(null),[o,l]=w.useState(0);w.useEffect(()=>{if(!t||!r||r===B.currentWorkflowId)return;let h=!1;return(async()=>{try{const[p,g]=await Promise.all([sk(t,r),Sd(t,r).catch(()=>null)]);if(h)return;B.setCurrentWorkflow(r,p.files),g&&B.applyServerWorkflow(t,g),i(null)}catch{if(h)return;i(r)}})(),()=>{h=!0}},[t,r,o]);const c=Z$(B.loading,B.snapshot),u=B.layout.railCollapsed,d=n.split("/").filter(Boolean).pop(),f=U$(d)?d:"init";return a.jsxs("div",{className:"body"+(u?" body--rail-collapsed":""),children:[u?a.jsx("button",{type:"button",className:"rail-peek",onClick:()=>B.setRailCollapsed(!1),title:"展开工作流列表","aria-label":"展开工作流列表",children:a.jsx($,{name:"chevron-right",size:14})}):a.jsx(w3,{}),c.kind==="loading"?a.jsx(Xg,{stage:f}):c.kind==="load_error"?a.jsx(a_,{message:c.message,onRetry:()=>void bu(t)}):c.kind==="no_project"?a.jsx(b3,{}):s&&s===r?a.jsx(a_,{title:"工作流切换失败",subtitle:`?w=${s} 的内容没取到`,message:"没能读取该工作流的详情,画布未切换。请重试,或改用左侧列表选择其他工作流。",onRetry:()=>l(h=>h+1)}):a.jsx(JS,{},t)]})}),S3=lt(function(){const t=gk(B.snapshot);return a.jsx(Eg,{to:t,replace:!0})}),sv=w.createContext({});function iv(e){const t=w.useRef(null);return t.current===null&&(t.current=e()),t.current}const Nd=w.createContext(null),ov=w.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class k3 extends w.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function N3({children:e,isPresent:t}){const n=w.useId(),r=w.useRef(null),s=w.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=w.useContext(ov);return w.useInsertionEffect(()=>{const{width:o,height:l,top:c,left:u}=s.current;if(t||!r.current||!o||!l)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(`
68
+ export default ...`,onChange:_=>c(_.target.value),disabled:u})]}),a.jsxs("label",{className:"cfg-label",style:{marginTop:12},children:["上传工作流文件(可选,支持选目录)",a.jsx("input",{ref:p,type:"file",multiple:!0,webkitdirectory:"",directory:"",disabled:u})]}),f&&a.jsxs("div",{className:"import-env-warn",style:{marginTop:12},children:[a.jsx($,{name:"warn",size:13}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:e,disabled:u,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:u,onClick:()=>x(),children:u?"创建中...":"创建"})]})]})})}function _3(e){var i,o;const t=e.trim();if(!t)return[];const n=[],r=t.split(/^---\s+(.+?)\s+---\s*$/m);if(r.length<=1)return[{path:"recipes/_inline.recipe.ts",content:t}];let s=0;for(r[0].trim()&&n.push({path:"recipes/_inline.recipe.ts",content:r[0].trim()}),s=1;s<r.length;s+=2){const l=(i=r[s])==null?void 0:i.trim(),c=((o=r[s+1])==null?void 0:o.trim())??"";l&&n.push({path:qk(l),content:c})}return n}function qk(e){let t=e.replace(/^\.\//,"");const n=/^workflows\/[^/]+\//;return n.test(t)&&(t=t.replace(n,"")),t}const w3=lt(function(){const t=Sr(),{projectId:n}=KS(),r=B.projectId,s=B.projects,i=B.steps.length,l=wc("/p/:projectId/setup")?yk({snapshot:B.snapshot,mode:B.mode,mockSetup:B.mockSetup}).schema:null,c=(l==null?void 0:l.fields.length)??0,u=(l==null?void 0:l.views.length)??0,d=i>0,[f,h]=w.useState(!1),[p,g]=w.useState(null),[x,_]=w.useState(!1),[v,y]=w.useState(null),[m,b]=w.useState(null),[j,k]=w.useState(null),S=[`${i} 步工作流`,c>0?`${c} 字段`:null,u>0?`${u} 视图`:null].filter(Boolean).join(" · "),N=r?[{id:r,title:B.initDraft.name||(B.projectSource==="imported"?"导入项目":"新建项目"),dir:"",createdAt:"",updatedAt:""}]:[],R=me?s:N;function O(E){t(`/p/${E}`)}async function D(E){if(!me){B.beginNewProject(`mock-${Date.now()}`,E);return}const A=await Fg();B.beginNewProject(A.id,E),B.setProjects(Ra(s,A))}async function M(){if(!me||!r)return;const E=s.find(I=>I.id===r),A=window.prompt("项目名称",(E==null?void 0:E.title)??"");if(!(A!=null&&A.trim()))return;const P=await qL(r,A.trim());B.setProjects(Ra(s,P))}async function z(){if(p){_(!0),y(null);try{await BL(p);const E=await Vg().catch(()=>s.filter(A=>A.id!==p));p===r?(B.clearProject(E),t("/")):B.setProjects(E),g(null)}catch(E){const A=E instanceof Error?E.message:String(E);y(/运行中|project_busy|活跃|无法删除/i.test(A)?"项目运行中,无法删除":A)}finally{_(!1)}}}async function T(E){if(me){b(E),k(null);try{const A=await UL(E),P=await u3(A),I=y3(A.project.title??E);f3(P,I)}catch(A){k(A instanceof Error?A.message:String(A))}finally{b(null)}}}return a.jsxs("aside",{className:"rail",children:[a.jsxs("div",{className:"rail__head",children:[a.jsx("div",{className:"rail__title",children:"我的项目"}),a.jsx("button",{type:"button",className:"rail__collapse",onClick:()=>B.setRailCollapsed(!0),title:"收起项目列表","aria-label":"收起项目列表",children:a.jsx($,{name:"chevron-left",size:14})})]}),a.jsx("div",{className:"rail__list",children:R.map((E,A)=>{const P=me?E.id===n:!0;return a.jsxs("div",{className:"rail__project",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--project"+(P?" is-active":""),onClick:()=>O(E.id),onDoubleClick:()=>void M(),title:me?`${Bp(E,A)} · ${E.id}`:void 0,children:[a.jsx($,{name:"file",size:15,style:{flex:"0 0 auto"}}),a.jsxs("span",{className:"rail__item-copy",children:[a.jsx("span",{className:"rail__item-title",children:Bp(E,A)}),me&&a.jsx("span",{className:"rail__item-sub",children:E.id})]})]}),me&&a.jsx("button",{type:"button",className:"rail__item-delete",style:{right:30},title:m===E.id?"导出中...":"导出项目包","aria-label":"导出项目包",disabled:m===E.id,onClick:()=>void T(E.id),children:a.jsx("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M12 3v12M7 10l5 5 5-5M5 21h14"})})}),me&&a.jsx("button",{type:"button",className:"rail__item-delete",title:"删除项目","aria-label":"删除项目",onClick:()=>{g(E.id),y(null)},children:a.jsx($,{name:"close",size:12})}),P&&a.jsx(x3,{})]},E.id)})}),p&&a.jsx("div",{className:"modal-overlay",onClick:()=>!x&&g(null),children:a.jsxs("div",{className:"modal-card",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"删除项目?"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>g(null),disabled:x,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsx("p",{className:"cfg-muted",children:"删除后项目配置与工作流文件将一并移除,且不可恢复。"}),v&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),v]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>g(null),disabled:x,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:x,onClick:()=>void z(),children:x?"删除中...":"确认删除"})]})]})}),a.jsxs("button",{type:"button",className:"rail__item rail__new",onClick:()=>h(!0),children:[a.jsx($,{name:"plus",size:17,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建项目"})]}),f&&a.jsx(Ek,{onConfirm:E=>{D(E),h(!1)},onCancel:()=>h(!1)}),a.jsx("div",{className:"rail__spacer"}),me&&a.jsxs("button",{type:"button",className:"rail__item rail__machines",onClick:()=>B.toggleAgentTrace(),title:"查看 Agent 执行记录",children:[a.jsx($,{name:"bolt",size:17,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"执行记录"})]}),a.jsxs("div",{className:"rail__foot",children:[d?S:"尚未创建工作流",a.jsx("br",{}),"aitable-workflow 原型"]}),j&&a.jsx("div",{className:"modal-overlay",onClick:()=>k(null),children:a.jsxs("div",{className:"modal-card",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__title",children:"导出失败"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>k(null),children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"modal-card__body",children:a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),j]})}),a.jsx("div",{className:"modal-card__foot",children:a.jsx("button",{type:"button",className:"primary modal-card__btn",onClick:()=>k(null),children:"知道了"})})]})})]})});function b3(){return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:"项目不存在"}),a.jsx("div",{className:"work-head__sub",children:"这个地址指向的项目已被删除,或从未存在"})]})}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:["可以从左侧列表选一个项目,或回到首页新建。",a.jsx("div",{style:{marginTop:16},children:a.jsx(Ue,{className:"primary",to:"/",children:"回到首页"})})]})})]})})}const j3=lt(function(){const{projectId:t}=KS(),{pathname:n}=Dt();w.useEffect(()=>{t&&bu(t)},[t]),UD();const r=BD(),[s,i]=w.useState(null),[o,l]=w.useState(0);w.useEffect(()=>{if(!t||!r||r===B.currentWorkflowId)return;let h=!1;return(async()=>{try{const[p,g]=await Promise.all([rk(t,r),Sd(t,r).catch(()=>null)]);if(h)return;B.setCurrentWorkflow(r,p.files),g&&B.applyServerWorkflow(t,g),i(null)}catch{if(h)return;i(r)}})(),()=>{h=!0}},[t,r,o]);const c=X$(B.loading,B.snapshot),u=B.layout.railCollapsed,d=n.split("/").filter(Boolean).pop(),f=V$(d)?d:"init";return a.jsxs("div",{className:"body"+(u?" body--rail-collapsed":""),children:[u?a.jsx("button",{type:"button",className:"rail-peek",onClick:()=>B.setRailCollapsed(!1),title:"展开工作流列表","aria-label":"展开工作流列表",children:a.jsx($,{name:"chevron-right",size:14})}):a.jsx(w3,{}),c.kind==="loading"?a.jsx(_k,{stage:f}):c.kind==="load_error"?a.jsx(s_,{message:c.message,onRetry:()=>void bu(t)}):c.kind==="no_project"?a.jsx(b3,{}):s&&s===r?a.jsx(s_,{title:"工作流切换失败",subtitle:`?w=${s} 的内容没取到`,message:"没能读取该工作流的详情,画布未切换。请重试,或改用左侧列表选择其他工作流。",onRetry:()=>l(h=>h+1)}):a.jsx(QS,{},t)]})}),S3=lt(function(){const t=mk(B.snapshot);return a.jsx(XS,{to:t,replace:!0})}),tv=w.createContext({});function nv(e){const t=w.useRef(null);return t.current===null&&(t.current=e()),t.current}const Nd=w.createContext(null),rv=w.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class k3 extends w.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function N3({children:e,isPresent:t}){const n=w.useId(),r=w.useRef(null),s=w.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=w.useContext(rv);return w.useInsertionEffect(()=>{const{width:o,height:l,top:c,left:u}=s.current;if(t||!r.current||!o||!l)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(`
69
69
  [data-motion-pop-id="${n}"] {
70
70
  position: absolute !important;
71
71
  width: ${o}px !important;
@@ -73,9 +73,9 @@ export default ...`,onChange:_=>c(_.target.value),disabled:u})]}),a.jsxs("label"
73
73
  top: ${c}px !important;
74
74
  left: ${u}px !important;
75
75
  }
76
- `),()=>{document.head.removeChild(d)}},[t]),a.jsx(k3,{isPresent:t,childRef:r,sizeRef:s,children:w.cloneElement(e,{ref:r})})}const E3=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const l=iv(C3),c=w.useId(),u=w.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;r&&r()},[l,r]),d=w.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),i?[Math.random(),u]:[n,u]);return w.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),w.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),o==="popLayout"&&(e=a.jsx(N3,{isPresent:n,children:e})),a.jsx(Nd.Provider,{value:d,children:e})};function C3(){return new Map}function Qk(e=!0){const t=w.useContext(Nd);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=w.useId();w.useEffect(()=>{e&&s(i)},[e]);const o=w.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const Hl=e=>e.key||"";function v_(e){const t=[];return w.Children.forEach(e,n=>{w.isValidElement(n)&&t.push(n)}),t}const av=typeof window<"u",Zk=av?w.useLayoutEffect:w.useEffect,ea=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1})=>{const[l,c]=Qk(o),u=w.useMemo(()=>v_(e),[e]),d=o&&!l?[]:u.map(Hl),f=w.useRef(!0),h=w.useRef(u),p=iv(()=>new Map),[g,x]=w.useState(u),[_,v]=w.useState(u);Zk(()=>{f.current=!1,h.current=u;for(let b=0;b<_.length;b++){const j=Hl(_[b]);d.includes(j)?p.delete(j):p.get(j)!==!0&&p.set(j,!1)}},[_,d.length,d.join("-")]);const y=[];if(u!==g){let b=[...u];for(let j=0;j<_.length;j++){const k=_[j],S=Hl(k);d.includes(S)||(b.splice(j,0,k),y.push(k))}i==="wait"&&y.length&&(b=y),v(v_(b)),x(u);return}const{forceRender:m}=w.useContext(sv);return a.jsx(a.Fragment,{children:_.map(b=>{const j=Hl(b),k=o&&!l?!1:u===_||d.includes(j),S=()=>{if(p.has(j))p.set(j,!0);else return;let N=!0;p.forEach(R=>{R||(N=!1)}),N&&(m==null||m(),v(h.current),o&&(c==null||c()),r&&r())};return a.jsx(E3,{isPresent:k,initial:!f.current||n?void 0:!1,custom:k?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:k?void 0:S,children:b},j)})})},At=e=>e;let Jk=At;const T3={useManualTiming:!1};function P3(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(u){i.has(u)&&(c.schedule(u),e()),u(o)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(l),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const Wl=["read","resolveKeyframes","update","preRender","render","postRender"],A3=40;function eN(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=Wl.reduce((v,y)=>(v[y]=P3(i),v),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=o,p=()=>{const v=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(v-s.timestamp,A3),1),s.timestamp=v,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},g=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:Wl.reduce((v,y)=>{const m=o[y];return v[y]=(b,j=!1,k=!1)=>(n||g(),m.schedule(b,j,k)),v},{}),cancel:v=>{for(let y=0;y<Wl.length;y++)o[Wl[y]].cancel(v)},state:s,steps:o}}const{schedule:Ne,cancel:Xr,state:Qe,steps:Df}=eN(typeof requestAnimationFrame<"u"?requestAnimationFrame:At,!0),tN=w.createContext({strict:!1}),y_={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ki={};for(const e in y_)Ki[e]={isEnabled:t=>y_[e].some(n=>!!t[n])};function R3(e){for(const t in e)Ki[t]={...Ki[t],...e[t]}}const I3=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Nu(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||I3.has(e)}let nN=e=>!Nu(e);function M3(e){e&&(nN=t=>t.startsWith("on")?!Nu(t):e(t))}try{M3(require("@emotion/is-prop-valid").default)}catch{}function O3(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(nN(s)||n===!0&&Nu(s)||!t&&!Nu(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function L3(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const Ed=w.createContext({});function Ia(e){return typeof e=="string"||Array.isArray(e)}function Cd(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const lv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cv=["initial",...lv];function Td(e){return Cd(e.animate)||cv.some(t=>Ia(e[t]))}function rN(e){return!!(Td(e)||e.variants)}function $3(e,t){if(Td(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Ia(n)?n:void 0,animate:Ia(r)?r:void 0}}return e.inherit!==!1?t:{}}function D3(e){const{initial:t,animate:n}=$3(e,w.useContext(Ed));return w.useMemo(()=>({initial:t,animate:n}),[x_(t),x_(n)])}function x_(e){return Array.isArray(e)?e.join(" "):e}const z3=Symbol.for("motionComponentSymbol");function gi(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function F3(e,t,n){return w.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):gi(n)&&(n.current=r))},[t])}const uv=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),V3="framerAppearId",sN="data-"+uv(V3),{schedule:dv}=eN(queueMicrotask,!1),iN=w.createContext({});function B3(e,t,n,r,s){var i,o;const{visualElement:l}=w.useContext(Ed),c=w.useContext(tN),u=w.useContext(Nd),d=w.useContext(ov).reducedMotion,f=w.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=w.useContext(iN);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&U3(f.current,n,s,p);const g=w.useRef(!1);w.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const x=n[sN],_=w.useRef(!!x&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,x))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,x)));return Zk(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),dv.render(h.render),_.current&&h.animationState&&h.animationState.animateChanges())}),w.useEffect(()=>{h&&(!_.current&&h.animationState&&h.animationState.animateChanges(),_.current&&(queueMicrotask(()=>{var v;(v=window.MotionHandoffMarkAsComplete)===null||v===void 0||v.call(window,x)}),_.current=!1))}),h}function U3(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:oN(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&gi(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function oN(e){if(e)return e.options.allowProjection!==!1?e.projection:oN(e.parent)}function H3({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,o;e&&R3(e);function l(u,d){let f;const h={...w.useContext(ov),...u,layoutId:W3(u)},{isStatic:p}=h,g=D3(u),x=r(u,p);if(!p&&av){K3();const _=G3(h);f=_.MeasureLayout,g.visualElement=B3(s,x,h,t,_.ProjectionNode)}return a.jsxs(Ed.Provider,{value:g,children:[f&&g.visualElement?a.jsx(f,{visualElement:g.visualElement,...h}):null,n(s,u,F3(x,g.visualElement,d),x,p,g.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const c=w.forwardRef(l);return c[z3]=s,c}function W3({layoutId:e}){const t=w.useContext(sv).id;return t&&e!==void 0?t+"-"+e:e}function K3(e,t){w.useContext(tN).strict}function G3(e){const{drag:t,layout:n}=Ki;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const q3=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function fv(e){return typeof e!="string"||e.includes("-")?!1:!!(q3.indexOf(e)>-1||/[A-Z]/u.test(e))}function __(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function hv(e,t,n,r){if(typeof t=="function"){const[s,i]=__(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=__(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const Up=e=>Array.isArray(e),Y3=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),X3=e=>Up(e)?e[e.length-1]||0:e,ot=e=>!!(e&&e.getVelocity);function Ac(e){const t=ot(e)?e.get():e;return Y3(t)?t.toValue():t}function Q3({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const o={latestValues:Z3(r,s,i,e),renderState:t()};return n&&(o.onMount=l=>n({props:r,current:l,...o}),o.onUpdate=l=>n(l)),o}const aN=e=>(t,n)=>{const r=w.useContext(Ed),s=w.useContext(Nd),i=()=>Q3(e,t,r,s);return n?i():iv(i)};function Z3(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=Ac(i[h]);let{initial:o,animate:l}=e;const c=Td(e),u=rN(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const f=d?l:o;if(f&&typeof f!="boolean"&&!Cd(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p<h.length;p++){const g=hv(e,h[p]);if(g){const{transitionEnd:x,transition:_,...v}=g;for(const y in v){let m=v[y];if(Array.isArray(m)){const b=d?m.length-1:0;m=m[b]}m!==null&&(s[y]=m)}for(const y in x)s[y]=x[y]}}}return s}const po=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xs=new Set(po),lN=e=>t=>typeof t=="string"&&t.startsWith(e),cN=lN("--"),J3=lN("var(--"),pv=e=>J3(e)?ez.test(e.split("/*")[0].trim()):!1,ez=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,uN=(e,t)=>t&&typeof e=="number"?t.transform(e):e,wr=(e,t,n)=>n>t?t:n<e?e:n,mo={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ma={...mo,transform:e=>wr(0,1,e)},Kl={...mo,default:1},cl=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Tr=cl("deg"),Vn=cl("%"),ie=cl("px"),tz=cl("vh"),nz=cl("vw"),w_={...Vn,parse:e=>Vn.parse(e)/100,transform:e=>Vn.transform(e*100)},rz={borderWidth:ie,borderTopWidth:ie,borderRightWidth:ie,borderBottomWidth:ie,borderLeftWidth:ie,borderRadius:ie,radius:ie,borderTopLeftRadius:ie,borderTopRightRadius:ie,borderBottomRightRadius:ie,borderBottomLeftRadius:ie,width:ie,maxWidth:ie,height:ie,maxHeight:ie,top:ie,right:ie,bottom:ie,left:ie,padding:ie,paddingTop:ie,paddingRight:ie,paddingBottom:ie,paddingLeft:ie,margin:ie,marginTop:ie,marginRight:ie,marginBottom:ie,marginLeft:ie,backgroundPositionX:ie,backgroundPositionY:ie},sz={rotate:Tr,rotateX:Tr,rotateY:Tr,rotateZ:Tr,scale:Kl,scaleX:Kl,scaleY:Kl,scaleZ:Kl,skew:Tr,skewX:Tr,skewY:Tr,distance:ie,translateX:ie,translateY:ie,translateZ:ie,x:ie,y:ie,z:ie,perspective:ie,transformPerspective:ie,opacity:Ma,originX:w_,originY:w_,originZ:ie},b_={...mo,transform:Math.round},mv={...rz,...sz,zIndex:b_,size:ie,fillOpacity:Ma,strokeOpacity:Ma,numOctaves:b_},iz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},oz=po.length;function az(e,t,n){let r="",s=!0;for(let i=0;i<oz;i++){const o=po[i],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=uN(l,mv[o]);if(!c){s=!1;const d=iz[o]||o;r+=`${d}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function gv(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let o=!1,l=!1;for(const c in t){const u=t[c];if(Xs.has(c)){o=!0;continue}else if(cN(c)){s[c]=u;continue}else{const d=uN(u,mv[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(t.transform||(o||n?r.transform=az(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${c} ${u} ${d}`}}const lz={offset:"stroke-dashoffset",array:"stroke-dasharray"},cz={offset:"strokeDashoffset",array:"strokeDasharray"};function uz(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?lz:cz;e[i.offset]=ie.transform(-r);const o=ie.transform(t),l=ie.transform(n);e[i.array]=`${o} ${l}`}function j_(e,t,n){return typeof e=="string"?e:ie.transform(t+n*e)}function dz(e,t,n){const r=j_(t,e.x,e.width),s=j_(n,e.y,e.height);return`${r} ${s}`}function vv(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...u},d,f){if(gv(e,u,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:g}=e;h.transform&&(g&&(p.transform=h.transform),delete h.transform),g&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=dz(g,s!==void 0?s:.5,i!==void 0?i:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),o!==void 0&&uz(h,o,l,c,!1)}const yv=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),dN=()=>({...yv(),attrs:{}}),xv=e=>typeof e=="string"&&e.toLowerCase()==="svg";function fN(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const hN=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function pN(e,t,n,r){fN(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(hN.has(s)?s:uv(s),t.attrs[s])}const Eu={};function fz(e){Object.assign(Eu,e)}function mN(e,{layout:t,layoutId:n}){return Xs.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Eu[e]||e==="opacity")}function _v(e,t,n){var r;const{style:s}=e,i={};for(const o in s)(ot(s[o])||t.style&&ot(t.style[o])||mN(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function gN(e,t,n){const r=_v(e,t,n);for(const s in e)if(ot(e[s])||ot(t[s])){const i=po.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function hz(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const S_=["x","y","width","height","cx","cy","r"],pz={useVisualState:aN({scrapeMotionValuesFromProps:gN,createRenderState:dN,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const l in s)if(Xs.has(l)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let l=0;l<S_.length;l++){const c=S_[l];e[c]!==t[c]&&(o=!0)}o&&Ne.read(()=>{hz(n,r),Ne.render(()=>{vv(r,s,xv(n.tagName),e.transformTemplate),pN(n,r)})})}})},mz={useVisualState:aN({scrapeMotionValuesFromProps:_v,createRenderState:yv})};function vN(e,t,n){for(const r in t)!ot(t[r])&&!mN(r,n)&&(e[r]=t[r])}function gz({transformTemplate:e},t){return w.useMemo(()=>{const n=yv();return gv(n,t,e),Object.assign({},n.vars,n.style)},[t])}function vz(e,t){const n=e.style||{},r={};return vN(r,n,e),Object.assign(r,gz(e,t)),r}function yz(e,t){const n={},r=vz(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function xz(e,t,n,r){const s=w.useMemo(()=>{const i=dN();return vv(i,t,xv(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};vN(i,e.style,e),s.style={...i,...s.style}}return s}function _z(e=!1){return(n,r,s,{latestValues:i},o)=>{const c=(fv(n)?xz:yz)(r,i,o,n),u=O3(r,typeof n=="string",e),d=n!==w.Fragment?{...u,...c,ref:s}:{},{children:f}=r,h=w.useMemo(()=>ot(f)?f.get():f,[f]);return w.createElement(n,{...d,children:h})}}function wz(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...fv(r)?pz:mz,preloadedFeatures:e,useRender:_z(s),createVisualElement:t,Component:r};return H3(o)}}function yN(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Pd(e,t,n){const r=e.getProps();return hv(r,t,n!==void 0?n:r.custom,e)}function wv(e,t){return e?e[t]||e.default||e:void 0}const xN=new Set(["width","height","top","left","right","bottom",...po]);let Rc;function bz(){Rc=void 0}const Bn={now:()=>(Rc===void 0&&Bn.set(Qe.isProcessing||T3.useManualTiming?Qe.timestamp:performance.now()),Rc),set:e=>{Rc=e,queueMicrotask(bz)}};function bv(e,t){e.indexOf(t)===-1&&e.push(t)}function jv(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Sv{constructor(){this.subscriptions=[]}add(t){return bv(this.subscriptions,t),()=>jv(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function _N(e,t){return t?e*(1e3/t):0}const k_=30,jz=e=>!isNaN(parseFloat(e));class Sz{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Bn.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Bn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=jz(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Sv);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ne.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Bn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>k_)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,k_);return _N(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Oa(e,t){return new Sz(e,t)}function kz(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Oa(n))}function Nz(e,t){const n=Pd(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=X3(i[o]);kz(e,o,l)}}function Ez(e){return!!(ot(e)&&e.add)}function Hp(e,t){const n=e.getValue("willChange");if(Ez(n))return n.add(t)}function wN(e){return e.props[sN]}function kv(e){let t;return()=>(t===void 0&&(t=e()),t)}const Cz=kv(()=>window.ScrollTimeline!==void 0);class Tz{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t,n){const r=this.animations.map(s=>{if(Cz()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n<this.animations.length;n++)t=Math.max(t,this.animations[n].duration);return t}runAll(t){this.animations.forEach(n=>n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Pz extends Tz{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const ur=e=>e*1e3,dr=e=>e/1e3;function Nv(e){return typeof e=="function"}function N_(e,t){e.timeline=t,e.onfinish=null}const Ev=e=>Array.isArray(e)&&typeof e[0]=="number",Az={linearEasing:void 0};function Rz(e,t){const n=kv(e);return()=>{var r;return(r=Az[t])!==null&&r!==void 0?r:n()}}const Cu=Rz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Gi=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},bN=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=e(Gi(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function jN(e){return!!(typeof e=="function"&&Cu()||!e||typeof e=="string"&&(e in Wp||Cu())||Ev(e)||Array.isArray(e)&&e.every(jN))}const Lo=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Wp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Lo([0,.65,.55,1]),circOut:Lo([.55,0,1,.45]),backIn:Lo([.31,.01,.66,-.59]),backOut:Lo([.33,1.53,.69,.99])};function SN(e,t){if(e)return typeof e=="function"&&Cu()?bN(e,t):Ev(e)?Lo(e):Array.isArray(e)?e.map(n=>SN(n,t)||Wp.easeOut):Wp[e]}const kN=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Iz=1e-7,Mz=12;function Oz(e,t,n,r,s){let i,o,l=0;do o=t+(n-t)/2,i=kN(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>Iz&&++l<Mz);return o}function ul(e,t,n,r){if(e===t&&n===r)return At;const s=i=>Oz(i,0,1,e,n);return i=>i===0||i===1?i:kN(s(i),t,r)}const NN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,EN=e=>t=>1-e(1-t),CN=ul(.33,1.53,.69,.99),Cv=EN(CN),TN=NN(Cv),PN=e=>(e*=2)<1?.5*Cv(e):.5*(2-Math.pow(2,-10*(e-1))),Tv=e=>1-Math.sin(Math.acos(e)),AN=EN(Tv),RN=NN(Tv),IN=e=>/^0[^.\s]+$/u.test(e);function Lz(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||IN(e):!0}const ta=e=>Math.round(e*1e5)/1e5,Pv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function $z(e){return e==null}const Dz=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Av=(e,t)=>n=>!!(typeof n=="string"&&Dz.test(n)&&n.startsWith(e)||t&&!$z(n)&&Object.prototype.hasOwnProperty.call(n,t)),MN=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(Pv);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},zz=e=>wr(0,255,e),zf={...mo,transform:e=>Math.round(zz(e))},xs={test:Av("rgb","red"),parse:MN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+zf.transform(e)+", "+zf.transform(t)+", "+zf.transform(n)+", "+ta(Ma.transform(r))+")"};function Fz(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Kp={test:Av("#"),parse:Fz,transform:xs.transform},vi={test:Av("hsl","hue"),parse:MN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Vn.transform(ta(t))+", "+Vn.transform(ta(n))+", "+ta(Ma.transform(r))+")"},rt={test:e=>xs.test(e)||Kp.test(e)||vi.test(e),parse:e=>xs.test(e)?xs.parse(e):vi.test(e)?vi.parse(e):Kp.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?xs.transform(e):vi.transform(e)},Vz=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Bz(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Pv))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(Vz))===null||n===void 0?void 0:n.length)||0)>0}const ON="number",LN="color",Uz="var",Hz="var(",E_="${}",Wz=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function La(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=t.replace(Wz,c=>(rt.test(c)?(r.color.push(i),s.push(LN),n.push(rt.parse(c))):c.startsWith(Hz)?(r.var.push(i),s.push(Uz),n.push(c)):(r.number.push(i),s.push(ON),n.push(parseFloat(c))),++i,E_)).split(E_);return{values:n,split:l,indexes:r,types:s}}function $N(e){return La(e).values}function DN(e){const{split:t,types:n}=La(e),r=t.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=t[o],s[o]!==void 0){const l=n[o];l===ON?i+=ta(s[o]):l===LN?i+=rt.transform(s[o]):i+=s[o]}return i}}const Kz=e=>typeof e=="number"?0:e;function Gz(e){const t=$N(e);return DN(e)(t.map(Kz))}const Qr={test:Bz,parse:$N,createTransformer:DN,getAnimatableNone:Gz},qz=new Set(["brightness","contrast","saturate","opacity"]);function Yz(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Pv)||[];if(!r)return e;const s=n.replace(r,"");let i=qz.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const Xz=/\b([a-z-]*)\(.*?\)/gu,Gp={...Qr,getAnimatableNone:e=>{const t=e.match(Xz);return t?t.map(Yz).join(" "):e}},Qz={...mv,color:rt,backgroundColor:rt,outlineColor:rt,fill:rt,stroke:rt,borderColor:rt,borderTopColor:rt,borderRightColor:rt,borderBottomColor:rt,borderLeftColor:rt,filter:Gp,WebkitFilter:Gp},Rv=e=>Qz[e];function zN(e,t){let n=Rv(e);return n!==Gp&&(n=Qr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Zz=new Set(["auto","none","0"]);function Jz(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!Zz.has(i)&&La(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=zN(n,s)}const C_=e=>e===mo||e===ie,T_=(e,t)=>parseFloat(e.split(", ")[t]),P_=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return T_(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?T_(i[1],e):0}},eF=new Set(["x","y","z"]),tF=po.filter(e=>!eF.has(e));function nF(e){const t=[];return tF.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const qi={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:P_(4,13),y:P_(5,14)};qi.translateX=qi.x;qi.translateY=qi.y;const Ss=new Set;let qp=!1,Yp=!1;function FN(){if(Yp){const e=Array.from(Ss).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=nF(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))===null||l===void 0||l.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Yp=!1,qp=!1,Ss.forEach(e=>e.complete()),Ss.clear()}function VN(){Ss.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Yp=!0)})}function rF(){VN(),FN()}class Iv{constructor(t,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ss.add(this),qp||(qp=!0,Ne.read(VN),Ne.resolveKeyframes(FN))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i<t.length;i++)if(t[i]===null)if(i===0){const o=s==null?void 0:s.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const c=r.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),s&&o===void 0&&s.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ss.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ss.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const BN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),sF=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iF(e){const t=sF.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function UN(e,t,n=1){const[r,s]=iF(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return BN(o)?parseFloat(o):o}return pv(s)?UN(s,t,n+1):s}const HN=e=>t=>t.test(e),oF={test:e=>e==="auto",parse:e=>e},WN=[mo,ie,Vn,Tr,nz,tz,oF],A_=e=>WN.find(HN(e));class KN extends Iv{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let u=t[c];if(typeof u=="string"&&(u=u.trim(),pv(u))){const d=UN(u,n.current);d!==void 0&&(t[c]=d),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!xN.has(r)||t.length!==2)return;const[s,i]=t,o=A_(s),l=A_(i);if(o!==l)if(C_(o)&&C_(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)Lz(t[s])&&r.push(s);r.length&&Jz(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=qi[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var t;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,l=s[o];s[o]=qi[r](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([c,u])=>{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const R_=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Qr.test(e)||e==="0")&&!e.startsWith("url("));function aF(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function lF(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=R_(s,t),l=R_(i,t);return!o||!l?!1:aF(e)||(n==="spring"||Nv(n))&&r}const cF=e=>e!==null;function Ad(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(cF),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const uF=40;class GN{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Bn.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>uF?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&rF(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Bn.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!lF(t,r,s,i))if(o)this.options.duration=0;else{c&&c(Ad(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Xp=2e4;function qN(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Xp;)t+=n,r=e.next(t);return t>=Xp?1/0:t}const Re=(e,t,n)=>e+(t-e)*n;function Ff(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function dF({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=Ff(c,l,e+1/3),i=Ff(c,l,e),o=Ff(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Tu(e,t){return n=>n>0?t:e}const Vf=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},fF=[Kp,xs,vi],hF=e=>fF.find(t=>t.test(e));function I_(e){const t=hF(e);if(!t)return!1;let n=t.parse(e);return t===vi&&(n=dF(n)),n}const M_=(e,t)=>{const n=I_(e),r=I_(t);if(!n||!r)return Tu(e,t);const s={...n};return i=>(s.red=Vf(n.red,r.red,i),s.green=Vf(n.green,r.green,i),s.blue=Vf(n.blue,r.blue,i),s.alpha=Re(n.alpha,r.alpha,i),xs.transform(s))},pF=(e,t)=>n=>t(e(n)),dl=(...e)=>e.reduce(pF),Qp=new Set(["none","hidden"]);function mF(e,t){return Qp.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function gF(e,t){return n=>Re(e,t,n)}function Mv(e){return typeof e=="number"?gF:typeof e=="string"?pv(e)?Tu:rt.test(e)?M_:xF:Array.isArray(e)?YN:typeof e=="object"?rt.test(e)?M_:vF:Tu}function YN(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>Mv(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function vF(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Mv(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function yF(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],l=e.indexes[o][s[o]],c=(n=e.values[l])!==null&&n!==void 0?n:0;r[i]=c,s[o]++}return r}const xF=(e,t)=>{const n=Qr.createTransformer(t),r=La(e),s=La(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Qp.has(e)&&!s.values.length||Qp.has(t)&&!r.values.length?mF(e,t):dl(YN(yF(r,s),s.values),n):Tu(e,t)};function XN(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Re(e,t,n):Mv(e)(e,t)}const _F=5;function QN(e,t,n){const r=Math.max(t-_F,0);return _N(n-e(r),t-r)}const $e={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Bf=.001;function wF({duration:e=$e.duration,bounce:t=$e.bounce,velocity:n=$e.velocity,mass:r=$e.mass}){let s,i,o=1-t;o=wr($e.minDamping,$e.maxDamping,o),e=wr($e.minDuration,$e.maxDuration,dr(e)),o<1?(s=u=>{const d=u*o,f=d*e,h=d-n,p=Zp(u,o),g=Math.exp(-f);return Bf-h/p*g},i=u=>{const f=u*o*e,h=f*n+n,p=Math.pow(o,2)*Math.pow(u,2)*e,g=Math.exp(-f),x=Zp(Math.pow(u,2),o);return(-s(u)+Bf>0?-1:1)*((h-p)*g)/x}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Bf+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=jF(s,i,l);if(e=ur(e),isNaN(c))return{stiffness:$e.stiffness,damping:$e.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const bF=12;function jF(e,t,n){let r=n;for(let s=1;s<bF;s++)r=r-e(r)/t(r);return r}function Zp(e,t){return e*Math.sqrt(1-t*t)}const SF=["duration","bounce"],kF=["stiffness","damping","mass"];function O_(e,t){return t.some(n=>e[n]!==void 0)}function NF(e){let t={velocity:$e.velocity,stiffness:$e.stiffness,damping:$e.damping,mass:$e.mass,isResolvedFromDuration:!1,...e};if(!O_(e,kF)&&O_(e,SF))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*wr(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:$e.mass,stiffness:s,damping:i}}else{const n=wF(e);t={...t,...n,mass:$e.mass},t.isResolvedFromDuration=!0}return t}function ZN(e=$e.visualDuration,t=$e.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=NF({...n,velocity:-dr(n.velocity||0)}),g=h||0,x=u/(2*Math.sqrt(c*d)),_=o-i,v=dr(Math.sqrt(c/d)),y=Math.abs(_)<5;r||(r=y?$e.restSpeed.granular:$e.restSpeed.default),s||(s=y?$e.restDelta.granular:$e.restDelta.default);let m;if(x<1){const j=Zp(v,x);m=k=>{const S=Math.exp(-x*v*k);return o-S*((g+x*v*_)/j*Math.sin(j*k)+_*Math.cos(j*k))}}else if(x===1)m=j=>o-Math.exp(-v*j)*(_+(g+v*_)*j);else{const j=v*Math.sqrt(x*x-1);m=k=>{const S=Math.exp(-x*v*k),N=Math.min(j*k,300);return o-S*((g+x*v*_)*Math.sinh(N)+j*_*Math.cosh(N))/j}}const b={calculatedDuration:p&&f||null,next:j=>{const k=m(j);if(p)l.done=j>=f;else{let S=0;x<1&&(S=j===0?ur(g):QN(m,j,k));const N=Math.abs(S)<=r,R=Math.abs(o-k)<=s;l.done=N&&R}return l.value=l.done?o:k,l},toString:()=>{const j=Math.min(qN(b),Xp),k=bN(S=>b.next(j*S).value,j,30);return j+"ms "+k}};return b}function L_({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=N=>l!==void 0&&N<l||c!==void 0&&N>c,g=N=>l===void 0?c:c===void 0||Math.abs(l-N)<Math.abs(c-N)?l:c;let x=n*t;const _=f+x,v=o===void 0?_:o(_);v!==_&&(x=v-f);const y=N=>-x*Math.exp(-N/r),m=N=>v+y(N),b=N=>{const R=y(N),O=m(N);h.done=Math.abs(R)<=u,h.value=h.done?v:O};let j,k;const S=N=>{p(h.value)&&(j=N,k=ZN({keyframes:[h.value,g(h.value)],velocity:QN(m,N,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return S(0),{calculatedDuration:null,next:N=>{let R=!1;return!k&&j===void 0&&(R=!0,b(N),S(N)),j!==void 0&&N>=j?k.next(N-j):(!R&&b(N),h)}}}const EF=ul(.42,0,1,1),CF=ul(0,0,.58,1),JN=ul(.42,0,.58,1),TF=e=>Array.isArray(e)&&typeof e[0]!="number",PF={linear:At,easeIn:EF,easeInOut:JN,easeOut:CF,circIn:Tv,circInOut:RN,circOut:AN,backIn:Cv,backInOut:TN,backOut:CN,anticipate:PN},$_=e=>{if(Ev(e)){Jk(e.length===4);const[t,n,r,s]=e;return ul(t,n,r,s)}else if(typeof e=="string")return PF[e];return e};function AF(e,t,n){const r=[],s=n||XN,i=e.length-1;for(let o=0;o<i;o++){let l=s(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||At:t;l=dl(c,l)}r.push(l)}return r}function RF(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(Jk(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=AF(t,r,s),c=l.length,u=d=>{if(o&&d<e[0])return t[0];let f=0;if(c>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const h=Gi(e[f],e[f+1],d);return l[f](h)};return n?d=>u(wr(e[0],e[i-1],d)):u}function IF(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Gi(0,t,r);e.push(Re(n,1,s))}}function MF(e){const t=[0];return IF(t,e.length-1),t}function OF(e,t){return e.map(n=>n*t)}function LF(e,t){return e.map(()=>t||JN).splice(0,e.length-1)}function Pu({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=TF(r)?r.map($_):$_(r),i={done:!1,value:t[0]},o=OF(n&&n.length===t.length?n:MF(t),e),l=RF(o,t,{ease:Array.isArray(s)?s:LF(t,s)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const $F=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Ne.update(t,!0),stop:()=>Xr(t),now:()=>Qe.isProcessing?Qe.timestamp:Bn.now()}},DF={decay:L_,inertia:L_,tween:Pu,keyframes:Pu,spring:ZN},zF=e=>e/100;class Ov extends GN{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||Iv,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new o(i,l,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,l=Nv(n)?n:DF[n]||Pu;let c,u;l!==Pu&&typeof t[0]!="number"&&(c=dl(zF,XN(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});i==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=qN(d));const{calculatedDuration:f}=d,h=f+s,p=h*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:N}=this.options;return{done:!0,value:N[N.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:g,repeatDelay:x,onUpdate:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?v<0:v>d;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let m=this.currentTime,b=i;if(p){const N=Math.min(this.currentTime,d)/f;let R=Math.floor(N),O=N%1;!O&&N>=1&&(O=1),O===1&&R--,R=Math.min(R,p+1),!!(R%2)&&(g==="reverse"?(O=1-O,x&&(O-=x/f)):g==="mirror"&&(b=o)),m=wr(0,1,O)*f}const j=y?{done:!1,value:c[0]}:b.next(m);l&&(j.value=l(j.value));let{done:k}=j;!y&&u!==null&&(k=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return S&&s!==void 0&&(j.value=Ad(c,this.options,s)),_&&_(j.value),S&&this.finish(),j}get duration(){const{resolved:t}=this;return t?dr(t.calculatedDuration):0}get time(){return dr(this.currentTime)}set time(t){t=ur(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=dr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=$F,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const FF=new Set(["opacity","clipPath","filter","transform"]);function VF(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=SN(l,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const BF=kv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Au=10,UF=2e4;function HF(e){return Nv(e.type)||e.type==="spring"||!jN(e.ease)}function WF(e,t){const n=new Ov({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&i<UF;)r=n.sample(i),s.push(r.value),i+=Au;return{times:void 0,keyframes:s,duration:i-Au,ease:"linear"}}const eE={anticipate:PN,backInOut:TN,circInOut:RN};function KF(e){return e in eE}class D_ extends GN{constructor(t){super(t);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new KN(i,(o,l)=>this.onKeyframesResolved(o,l),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&Cu()&&KF(i)&&(i=eE[i]),HF(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:g,...x}=this.options,_=WF(t,x);t=_.keyframes,t.length===1&&(t[1]=t[0]),r=_.duration,s=_.times,i=_.ease,o="keyframes"}const d=VF(l.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(N_(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(Ad(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:o,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return dr(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return dr(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=ur(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return At;const{animation:r}=n;N_(r,t)}return At}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,g=new Ov({...p,keyframes:r,duration:s,type:i,ease:o,times:l,isGenerator:!0}),x=ur(this.time);u.setWithVelocity(g.sample(x-Au).value,g.sample(x).value,Au)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return BF()&&r&&FF.has(r)&&!c&&!u&&!s&&i!=="mirror"&&o!==0&&l!=="inertia"}}const GF={type:"spring",stiffness:500,damping:25,restSpeed:10},qF=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),YF={type:"keyframes",duration:.8},XF={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},QF=(e,{keyframes:t})=>t.length>2?YF:Xs.has(e)?e.startsWith("scale")?qF(t[1]):GF:XF;function ZF({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Lv=(e,t,n,r={},s,i)=>o=>{const l=wv(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-ur(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:s};ZF(l)||(d={...d,...QF(e,d)}),d.duration&&(d.duration=ur(d.duration)),d.repeatDelay&&(d.repeatDelay=ur(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=Ad(d.keyframes,l);if(h!==void 0)return Ne.update(()=>{d.onUpdate(h),d.onComplete()}),new Pz([])}return!i&&D_.supports(d)?new D_(d):new Ov(d)};function JF({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function tE(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=e.getDefaultTransition(),transitionEnd:l,...c}=t;r&&(o=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in c){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),p=c[f];if(p===void 0||d&&JF(d,f))continue;const g={delay:n,...wv(o||{},f)};let x=!1;if(window.MotionHandoffAnimation){const v=wN(e);if(v){const y=window.MotionHandoffAnimation(v,f,Ne);y!==null&&(g.startTime=y,x=!0)}}Hp(e,f),h.start(Lv(f,h,p,e.shouldReduceMotion&&xN.has(f)?{type:!1}:g,e,x));const _=h.animation;_&&u.push(_)}return l&&Promise.all(u).then(()=>{Ne.update(()=>{l&&Nz(e,l)})}),u}function Jp(e,t,n={}){var r;const s=Pd(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(tE(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return e4(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[o,l]:[l,o];return u().then(()=>d())}else return Promise.all([o(),l(n.delay)])}function e4(e,t,n=0,r=0,s=1,i){const o=[],l=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(e.variantChildren).sort(t4).forEach((u,d)=>{u.notify("AnimationStart",t),o.push(Jp(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function t4(e,t){return e.sortNodePosition(t)}function n4(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>Jp(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=Jp(e,t,n);else{const s=typeof t=="function"?Pd(e,t,n.custom):t;r=Promise.all(tE(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const r4=cv.length;function nE(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?nE(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<r4;n++){const r=cv[n],s=e.props[r];(Ia(s)||s===!1)&&(t[r]=s)}return t}const s4=[...lv].reverse(),i4=lv.length;function o4(e){return t=>Promise.all(t.map(({animation:n,options:r})=>n4(e,n,r)))}function a4(e){let t=o4(e),n=z_(),r=!0;const s=c=>(u,d)=>{var f;const h=Pd(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:g,...x}=h;u={...u,...x,...g}}return u};function i(c){t=c(e)}function o(c){const{props:u}=e,d=nE(e.parent)||{},f=[],h=new Set;let p={},g=1/0;for(let _=0;_<i4;_++){const v=s4[_],y=n[v],m=u[v]!==void 0?u[v]:d[v],b=Ia(m),j=v===c?y.isActive:null;j===!1&&(g=_);let k=m===d[v]&&m!==u[v]&&b;if(k&&r&&e.manuallyAnimateOnMount&&(k=!1),y.protectedKeys={...p},!y.isActive&&j===null||!m&&!y.prevProp||Cd(m)||typeof m=="boolean")continue;const S=l4(y.prevProp,m);let N=S||v===c&&y.isActive&&!k&&b||_>g&&b,R=!1;const O=Array.isArray(m)?m:[m];let D=O.reduce(s(v),{});j===!1&&(D={});const{prevResolvedValues:M={}}=y,z={...M,...D},T=P=>{N=!0,h.has(P)&&(R=!0,h.delete(P)),y.needsAnimating[P]=!0;const I=e.getValue(P);I&&(I.liveStyle=!1)};for(const P in z){const I=D[P],C=M[P];if(p.hasOwnProperty(P))continue;let L=!1;Up(I)&&Up(C)?L=!yN(I,C):L=I!==C,L?I!=null?T(P):h.add(P):I!==void 0&&h.has(P)?T(P):y.protectedKeys[P]=!0}y.prevProp=m,y.prevResolvedValues=D,y.isActive&&(p={...p,...D}),r&&e.blockInitialAnimation&&(N=!1),N&&(!(k&&S)||R)&&f.push(...O.map(P=>({animation:P,options:{type:v}})))}if(h.size){const _={};h.forEach(v=>{const y=e.getBaseTarget(v),m=e.getValue(v);m&&(m.liveStyle=!0),_[v]=y??null}),f.push({animation:_})}let x=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,x?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=o(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=z_(),r=!0}}}function l4(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!yN(t,e):!1}function os(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function z_(){return{animate:os(!0),whileInView:os(),whileHover:os(),whileTap:os(),whileDrag:os(),whileFocus:os(),exit:os()}}class ns{constructor(t){this.isMounted=!1,this.node=t}update(){}}class c4 extends ns{constructor(t){super(t),t.animationState||(t.animationState=a4(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Cd(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let u4=0;class d4 extends ns{constructor(){super(...arguments),this.id=u4++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const f4={animation:{Feature:c4},exit:{Feature:d4}},an={x:!1,y:!1};function rE(){return an.x||an.y}function h4(e){return e==="x"||e==="y"?an[e]?null:(an[e]=!0,()=>{an[e]=!1}):an.x||an.y?null:(an.x=an.y=!0,()=>{an.x=an.y=!1})}const $v=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function $a(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function fl(e){return{point:{x:e.pageX,y:e.pageY}}}const p4=e=>t=>$v(t)&&e(t,fl(t));function na(e,t,n,r){return $a(e,t,p4(n),r)}const F_=(e,t)=>Math.abs(e-t);function m4(e,t){const n=F_(e.x,t.x),r=F_(e.y,t.y);return Math.sqrt(n**2+r**2)}class sE{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Hf(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=m4(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:g}=f,{timestamp:x}=Qe;this.history.push({...g,timestamp:x});const{onStart:_,onMove:v}=this.handlers;h||(_&&_(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Uf(h,this.transformPagePoint),Ne.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:g,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Hf(f.type==="pointercancel"?this.lastMoveEventInfo:Uf(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,_),g&&g(f,_)},!$v(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=fl(t),l=Uf(o,this.transformPagePoint),{point:c}=l,{timestamp:u}=Qe;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Hf(l,this.history)),this.removeListeners=dl(na(this.contextWindow,"pointermove",this.handlePointerMove),na(this.contextWindow,"pointerup",this.handlePointerUp),na(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Xr(this.updatePoint)}}function Uf(e,t){return t?{point:t(e.point)}:e}function V_(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hf({point:e},t){return{point:e,delta:V_(e,iE(t)),offset:V_(e,g4(t)),velocity:v4(t,.1)}}function g4(e){return e[0]}function iE(e){return e[e.length-1]}function v4(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=iE(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>ur(t)));)n--;if(!r)return{x:0,y:0};const i=dr(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const oE=1e-4,y4=1-oE,x4=1+oE,aE=.01,_4=0-aE,w4=0+aE;function It(e){return e.max-e.min}function b4(e,t,n){return Math.abs(e-t)<=n}function B_(e,t,n,r=.5){e.origin=r,e.originPoint=Re(t.min,t.max,e.origin),e.scale=It(n)/It(t),e.translate=Re(n.min,n.max,e.origin)-e.originPoint,(e.scale>=y4&&e.scale<=x4||isNaN(e.scale))&&(e.scale=1),(e.translate>=_4&&e.translate<=w4||isNaN(e.translate))&&(e.translate=0)}function ra(e,t,n,r){B_(e.x,t.x,n.x,r?r.originX:void 0),B_(e.y,t.y,n.y,r?r.originY:void 0)}function U_(e,t,n){e.min=n.min+t.min,e.max=e.min+It(t)}function j4(e,t,n){U_(e.x,t.x,n.x),U_(e.y,t.y,n.y)}function H_(e,t,n){e.min=t.min-n.min,e.max=e.min+It(t)}function sa(e,t,n){H_(e.x,t.x,n.x),H_(e.y,t.y,n.y)}function S4(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Re(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Re(n,e,r.max):Math.min(e,n)),e}function W_(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function k4(e,{top:t,left:n,bottom:r,right:s}){return{x:W_(e.x,n,s),y:W_(e.y,t,r)}}function K_(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function N4(e,t){return{x:K_(e.x,t.x),y:K_(e.y,t.y)}}function E4(e,t){let n=.5;const r=It(e),s=It(t);return s>r?n=Gi(t.min,t.max-r,e.min):r>s&&(n=Gi(e.min,e.max-s,t.min)),wr(0,1,n)}function C4(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const em=.35;function T4(e=em){return e===!1?e=0:e===!0&&(e=em),{x:G_(e,"left","right"),y:G_(e,"top","bottom")}}function G_(e,t,n){return{min:q_(e,t),max:q_(e,n)}}function q_(e,t){return typeof e=="number"?e:e[t]||0}const Y_=()=>({translate:0,scale:1,origin:0,originPoint:0}),yi=()=>({x:Y_(),y:Y_()}),X_=()=>({min:0,max:0}),ze=()=>({x:X_(),y:X_()});function Ut(e){return[e("x"),e("y")]}function lE({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function P4({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function A4(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Wf(e){return e===void 0||e===1}function tm({scale:e,scaleX:t,scaleY:n}){return!Wf(e)||!Wf(t)||!Wf(n)}function fs(e){return tm(e)||cE(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function cE(e){return Q_(e.x)||Q_(e.y)}function Q_(e){return e&&e!=="0%"}function Ru(e,t,n){const r=e-n,s=t*r;return n+s}function Z_(e,t,n,r,s){return s!==void 0&&(e=Ru(e,s,r)),Ru(e,n,r)+t}function nm(e,t=0,n=1,r,s){e.min=Z_(e.min,t,n,r,s),e.max=Z_(e.max,t,n,r,s)}function uE(e,{x:t,y:n}){nm(e.x,t.translate,t.scale,t.originPoint),nm(e.y,n.translate,n.scale,n.originPoint)}const J_=.999999999999,e0=1.0000000000001;function R4(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&_i(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,uE(e,o)),r&&fs(i.latestValues)&&_i(e,i.latestValues))}t.x<e0&&t.x>J_&&(t.x=1),t.y<e0&&t.y>J_&&(t.y=1)}function xi(e,t){e.min=e.min+t,e.max=e.max+t}function t0(e,t,n,r,s=.5){const i=Re(e.min,e.max,s);nm(e,t,n,i,r)}function _i(e,t){t0(e.x,t.x,t.scaleX,t.scale,t.originX),t0(e.y,t.y,t.scaleY,t.scale,t.originY)}function dE(e,t){return lE(A4(e.getBoundingClientRect(),t))}function I4(e,t,n){const r=dE(e,n),{scroll:s}=t;return s&&(xi(r.x,s.offset.x),xi(r.y,s.offset.y)),r}const fE=({current:e})=>e?e.ownerDocument.defaultView:null,M4=new WeakMap;class O4{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ze(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(fl(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:g}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=h4(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ut(_=>{let v=this.getAxisMotionValue(_).get()||0;if(Vn.test(v)){const{projection:y}=this.visualElement;if(y&&y.layout){const m=y.layout.layoutBox[_];m&&(v=It(m)*(parseFloat(v)/100))}}this.originPoint[_]=v}),g&&Ne.postRender(()=>g(d,f)),Hp(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},o=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:g,onDrag:x}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:_}=f;if(p&&this.currentDirection===null){this.currentDirection=L4(_),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,_),this.updateAxis("y",f.point,_),this.visualElement.render(),x&&x(d,f)},l=(d,f)=>this.stop(d,f),c=()=>Ut(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new sE(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:fE(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&Ne.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Gl(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=S4(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&gi(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=k4(s.layoutBox,n):this.constraints=!1,this.elastic=T4(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Ut(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=C4(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!gi(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=I4(r,s.root,this.visualElement.getTransformPagePoint());let o=N4(s.layout.layoutBox,i);if(n){const l=n(P4(o));this.hasMutatedConstraints=!!l,l&&(o=lE(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Ut(d=>{if(!Gl(d,n,this.currentDirection))return;let f=c&&c[d]||{};o&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Hp(this.visualElement,t),r.start(Lv(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ut(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ut(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ut(n=>{const{drag:r}=this.getProps();if(!Gl(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];i.set(t[n]-Re(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!gi(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ut(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=E4({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ut(o=>{if(!Gl(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Re(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;M4.set(this.visualElement,this);const t=this.visualElement.current,n=na(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();gi(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Ne.read(r);const o=$a(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ut(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=em,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function Gl(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function L4(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class $4 extends ns{constructor(t){super(t),this.removeGroupControls=At,this.removeListeners=At,this.controls=new O4(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||At}unmount(){this.removeGroupControls(),this.removeListeners()}}const n0=e=>(t,n)=>{e&&Ne.postRender(()=>e(t,n))};class D4 extends ns{constructor(){super(...arguments),this.removePointerDownListener=At}onPointerDown(t){this.session=new sE(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:fE(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:n0(t),onStart:n0(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&Ne.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=na(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Ic={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function r0(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Co={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ie.test(e))e=parseFloat(e);else return e;const n=r0(e,t.target.x),r=r0(e,t.target.y);return`${n}% ${r}%`}},z4={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Qr.parse(e);if(s.length>5)return r;const i=Qr.createTransformer(e),o=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+o]/=l,s[1+o]/=c;const u=Re(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class F4 extends w.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;fz(V4),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Ic.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||Ne.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),dv.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function hE(e){const[t,n]=Qk(),r=w.useContext(sv);return a.jsx(F4,{...e,layoutGroup:r,switchLayoutGroup:w.useContext(iN),isPresent:t,safeToRemove:n})}const V4={borderRadius:{...Co,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Co,borderTopRightRadius:Co,borderBottomLeftRadius:Co,borderBottomRightRadius:Co,boxShadow:z4};function B4(e,t,n){const r=ot(e)?e:Oa(e);return r.start(Lv("",r,t,n)),r.animation}function U4(e){return e instanceof SVGElement&&e.tagName!=="svg"}const H4=(e,t)=>e.depth-t.depth;class W4{constructor(){this.children=[],this.isDirty=!1}add(t){bv(this.children,t),this.isDirty=!0}remove(t){jv(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(H4),this.isDirty=!1,this.children.forEach(t)}}function K4(e,t){const n=Bn.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Xr(r),e(i-t))};return Ne.read(r,!0),()=>Xr(r)}const pE=["TopLeft","TopRight","BottomLeft","BottomRight"],G4=pE.length,s0=e=>typeof e=="string"?parseFloat(e):e,i0=e=>typeof e=="number"||ie.test(e);function q4(e,t,n,r,s,i){s?(e.opacity=Re(0,n.opacity!==void 0?n.opacity:1,Y4(r)),e.opacityExit=Re(t.opacity!==void 0?t.opacity:1,0,X4(r))):i&&(e.opacity=Re(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<G4;o++){const l=`border${pE[o]}Radius`;let c=o0(t,l),u=o0(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||i0(c)===i0(u)?(e[l]=Math.max(Re(s0(c),s0(u),r),0),(Vn.test(u)||Vn.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=Re(t.rotate||0,n.rotate||0,r))}function o0(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const Y4=mE(0,.5,AN),X4=mE(.5,.95,At);function mE(e,t,n){return r=>r<e?0:r>t?1:n(Gi(e,t,r))}function a0(e,t){e.min=t.min,e.max=t.max}function Vt(e,t){a0(e.x,t.x),a0(e.y,t.y)}function l0(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function c0(e,t,n,r,s){return e-=t,e=Ru(e,1/n,r),s!==void 0&&(e=Ru(e,1/s,r)),e}function Q4(e,t=0,n=1,r=.5,s,i=e,o=e){if(Vn.test(t)&&(t=parseFloat(t),t=Re(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Re(i.min,i.max,r);e===i&&(l-=t),e.min=c0(e.min,t,n,l,s),e.max=c0(e.max,t,n,l,s)}function u0(e,t,[n,r,s],i,o){Q4(e,t[n],t[r],t[s],t.scale,i,o)}const Z4=["x","scaleX","originX"],J4=["y","scaleY","originY"];function d0(e,t,n,r){u0(e.x,t,Z4,n?n.x:void 0,r?r.x:void 0),u0(e.y,t,J4,n?n.y:void 0,r?r.y:void 0)}function f0(e){return e.translate===0&&e.scale===1}function gE(e){return f0(e.x)&&f0(e.y)}function h0(e,t){return e.min===t.min&&e.max===t.max}function eV(e,t){return h0(e.x,t.x)&&h0(e.y,t.y)}function p0(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function vE(e,t){return p0(e.x,t.x)&&p0(e.y,t.y)}function m0(e){return It(e.x)/It(e.y)}function g0(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class tV{constructor(){this.members=[]}add(t){bv(this.members,t),t.scheduleRender()}remove(t){if(jv(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function nV(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:g}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),g&&(r+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const hs={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},$o=typeof window<"u"&&window.MotionDebug!==void 0,Kf=["","X","Y","Z"],rV={visibility:"hidden"},v0=1e3;let sV=0;function Gf(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function yE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=wN(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ne,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&yE(r)}function xE({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=t==null?void 0:t()){this.id=sV++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,$o&&(hs.totalNodes=hs.resolvedTargetDeltas=hs.recalculatedProjection=0),this.nodes.forEach(aV),this.nodes.forEach(fV),this.nodes.forEach(hV),this.nodes.forEach(lV),$o&&window.MotionDebug.record(hs)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new W4)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Sv),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=U4(o),this.instance=o;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(u||c)&&(this.isLayoutDirty=!0),e){let f;const h=()=>this.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=K4(h,250),Ic.hasAnimatedSinceResize&&(Ic.hasAnimatedSinceResize=!1,this.nodes.forEach(x0))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||d.getDefaultTransition()||yV,{onLayoutAnimationStart:_,onLayoutAnimationComplete:v}=d.getProps(),y=!this.targetLayout||!vE(this.targetLayout,g)||p,m=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||m||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,m);const b={...wv(x,"layout"),onPlay:_,onComplete:v};(d.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else h||x0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Xr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pV),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&yE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(y0);return}this.isUpdating||this.nodes.forEach(uV),this.isUpdating=!1,this.nodes.forEach(dV),this.nodes.forEach(iV),this.nodes.forEach(oV),this.clearAllSnapshots();const l=Bn.now();Qe.delta=wr(0,1e3/60,l-Qe.timestamp),Qe.timestamp=l,Qe.isProcessing=!0,Df.update.process(Qe),Df.preRender.process(Qe),Df.render.process(Qe),Qe.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,dv.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(cV),this.sharedNodes.forEach(mV)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ne.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ne.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ze(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!gE(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&(l||fs(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),xV(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return ze();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(_V))){const{scroll:d}=this.root;d&&(xi(c.x,d.offset.x),xi(c.y,d.offset.y))}return c}removeElementScroll(o){var l;const c=ze();if(Vt(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:h}=d;d!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&Vt(c,o),xi(c.x,f.offset.x),xi(c.y,f.offset.y))}return c}applyTransform(o,l=!1){const c=ze();Vt(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&_i(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),fs(d.latestValues)&&_i(c,d.latestValues)}return fs(this.latestValues)&&_i(c,this.latestValues),c}removeTransform(o){const l=ze();Vt(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!fs(u.latestValues))continue;tm(u.latestValues)&&u.updateSnapshot();const d=ze(),f=u.measurePageBox();Vt(d,f),d0(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return fs(this.latestValues)&&d0(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Qe.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:h}=this.options;if(!(!this.layout||!(f||h))){if(this.resolvedRelativeTargetAt=Qe.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ze(),this.relativeTargetOrigin=ze(),sa(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Vt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=ze(),this.targetWithTransforms=ze()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),j4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Vt(this.target,this.layout.layoutBox),uE(this.target,this.targetDelta)):Vt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ze(),this.relativeTargetOrigin=ze(),sa(this.relativeTargetOrigin,this.target,p.target),Vt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}$o&&hs.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||tm(this.parent.latestValues)||cE(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===Qe.timestamp&&(u=!1),u)return;const{layout:d,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||f))return;Vt(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,p=this.treeScale.y;R4(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=ze());const{target:g}=l;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(l0(this.prevProjectionDelta.x,this.projectionDelta.x),l0(this.prevProjectionDelta.y,this.projectionDelta.y)),ra(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==p||!g0(this.projectionDelta.x,this.prevProjectionDelta.x)||!g0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g)),$o&&hs.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=yi(),this.projectionDelta=yi(),this.projectionDeltaWithTransform=yi()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=yi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const h=ze(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,x=p!==g,_=this.getStack(),v=!_||_.members.length<=1,y=!!(x&&!v&&this.options.crossfade===!0&&!this.path.some(vV));this.animationProgress=0;let m;this.mixTargetDelta=b=>{const j=b/1e3;_0(f.x,o.x,j),_0(f.y,o.y,j),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sa(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),gV(this.relativeTarget,this.relativeTargetOrigin,h,j),m&&eV(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=ze()),Vt(m,this.relativeTarget)),x&&(this.animationValues=d,q4(d,u,this.latestValues,j,y,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Xr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ne.update(()=>{Ic.hasAnimatedSinceResize=!0,this.currentAnimation=B4(0,v0,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(v0),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&_E(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ze();const f=It(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=It(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}Vt(l,c),_i(l,d),ra(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new tV),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&Gf("z",o,u,this.animationValues);for(let d=0;d<Kf.length;d++)Gf(`rotate${Kf[d]}`,o,u,this.animationValues),Gf(`skew${Kf[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return rV;const u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=Ac(o==null?void 0:o.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const x={};return this.options.layoutId&&(x.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,x.pointerEvents=Ac(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!fs(this.latestValues)&&(x.transform=d?d({},""):"none",this.hasProjected=!1),x}const h=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=nV(this.projectionDeltaWithTransform,this.treeScale,h),d&&(u.transform=d(h,u.transform));const{x:p,y:g}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${g.origin*100}% 0`,f.animationValues?u.opacity=f===this?(c=(l=h.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:u.opacity=f===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const x in Eu){if(h[x]===void 0)continue;const{correct:_,applyTo:v}=Eu[x],y=u.transform==="none"?h[x]:_(h[x],f);if(v){const m=v.length;for(let b=0;b<m;b++)u[v[b]]=y}else u[x]=y}return this.options.layoutId&&(u.pointerEvents=f===this?Ac(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(y0),this.root.sharedNodes.clear()}}}function iV(e){e.updateLayout()}function oV(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=n.source!==e.layout.source;i==="size"?Ut(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=It(h);h.min=r[f].min,h.max=h.min+p}):_E(i,n.layoutBox,r)&&Ut(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=It(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=yi();ra(l,r,n.layoutBox);const c=yi();o?ra(c,e.applyTransform(s,!0),n.measuredBox):ra(c,r,n.layoutBox);const u=!gE(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const g=ze();sa(g,n.layoutBox,h.layoutBox);const x=ze();sa(x,r,p.layoutBox),vE(g,x)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function aV(e){$o&&hs.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function lV(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function cV(e){e.clearSnapshot()}function y0(e){e.clearMeasurements()}function uV(e){e.isLayoutDirty=!1}function dV(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function x0(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function fV(e){e.resolveTargetDelta()}function hV(e){e.calcProjection()}function pV(e){e.resetSkewAndRotation()}function mV(e){e.removeLeadSnapshot()}function _0(e,t,n){e.translate=Re(t.translate,0,n),e.scale=Re(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function w0(e,t,n,r){e.min=Re(t.min,n.min,r),e.max=Re(t.max,n.max,r)}function gV(e,t,n,r){w0(e.x,t.x,n.x,r),w0(e.y,t.y,n.y,r)}function vV(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const yV={duration:.45,ease:[.4,0,.1,1]},b0=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),j0=b0("applewebkit/")&&!b0("chrome/")?Math.round:At;function S0(e){e.min=j0(e.min),e.max=j0(e.max)}function xV(e){S0(e.x),S0(e.y)}function _E(e,t,n){return e==="position"||e==="preserve-aspect"&&!b4(m0(t),m0(n),.2)}function _V(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const wV=xE({attachResizeListener:(e,t)=>$a(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),qf={current:void 0},wE=xE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!qf.current){const e=new wV({});e.mount(window),e.setOptions({layoutScroll:!0}),qf.current=e}return qf.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),bV={pan:{Feature:D4},drag:{Feature:$4,ProjectionNode:wE,MeasureLayout:hE}};function jV(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function bE(e,t){const n=jV(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function k0(e){return t=>{t.pointerType==="touch"||rE()||e(t)}}function SV(e,t,n={}){const[r,s,i]=bE(e,n),o=k0(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=k0(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}function N0(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Ne.postRender(()=>i(t,fl(t)))}class kV extends ns{mount(){const{current:t}=this.node;t&&(this.unmount=SV(t,n=>(N0(this.node,n,"Start"),r=>N0(this.node,r,"End"))))}unmount(){}}class NV extends ns{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=dl($a(this.node.current,"focus",()=>this.onFocus()),$a(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const jE=(e,t)=>t?e===t?!0:jE(e,t.parentElement):!1,EV=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function CV(e){return EV.has(e.tagName)||e.tabIndex!==-1}const Do=new WeakSet;function E0(e){return t=>{t.key==="Enter"&&e(t)}}function Yf(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const TV=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=E0(()=>{if(Do.has(n))return;Yf(n,"down");const s=E0(()=>{Yf(n,"up")}),i=()=>Yf(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function C0(e){return $v(e)&&!rE()}function PV(e,t,n={}){const[r,s,i]=bE(e,n),o=l=>{const c=l.currentTarget;if(!C0(l)||Do.has(c))return;Do.add(c);const u=t(l),d=(p,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!C0(p)||!Do.has(c))&&(Do.delete(c),typeof u=="function"&&u(p,{success:g}))},f=p=>{d(p,n.useGlobalTarget||jE(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(l=>{!CV(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),l.addEventListener("focus",u=>TV(u,s),s)}),i}function T0(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Ne.postRender(()=>i(t,fl(t)))}class AV extends ns{mount(){const{current:t}=this.node;t&&(this.unmount=PV(t,n=>(T0(this.node,n,"Start"),(r,{success:s})=>T0(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const rm=new WeakMap,Xf=new WeakMap,RV=e=>{const t=rm.get(e.target);t&&t(e)},IV=e=>{e.forEach(RV)};function MV({root:e,...t}){const n=e||document;Xf.has(n)||Xf.set(n,{});const r=Xf.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(IV,{root:e,...t})),r[s]}function OV(e,t,n){const r=MV(t);return rm.set(e,n),r.observe(e),()=>{rm.delete(e),r.unobserve(e)}}const LV={some:0,all:1};class $V extends ns{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:LV[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return OV(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(DV(t,n))&&this.startObserver()}unmount(){}}function DV({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const zV={inView:{Feature:$V},tap:{Feature:AV},focus:{Feature:NV},hover:{Feature:kV}},FV={layout:{ProjectionNode:wE,MeasureLayout:hE}},sm={current:null},SE={current:!1};function VV(){if(SE.current=!0,!!av)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>sm.current=e.matches;e.addListener(t),t()}else sm.current=!1}const BV=[...WN,rt,Qr],UV=e=>BV.find(HN(e)),P0=new WeakMap;function HV(e,t,n){for(const r in t){const s=t[r],i=n[r];if(ot(s))e.addValue(r,s);else if(ot(i))e.addValue(r,Oa(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,Oa(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const A0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class WV{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Iv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Bn.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,Ne.render(this.render,!1,!0))};const{latestValues:c,renderState:u,onUpdate:d}=o;this.onUpdate=d,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=Td(n),this.isVariantNode=rN(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:f,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in h){const g=h[p];c[p]!==void 0&&ot(g)&&g.set(c[p],!1)}}mount(t){this.current=t,P0.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),SE.current||VV(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:sm.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){P0.delete(this.current),this.projection&&this.projection.unmount(),Xr(this.notifyUpdate),Xr(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Xs.has(t),s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Ne.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ki){const n=Ki[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ze()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<A0.length;r++){const s=A0[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=t[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=HV(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Oa(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(BN(s)||IN(s))?s=parseFloat(s):!UV(s)&&Qr.test(n)&&(s=zN(t,n)),this.setBaseTarget(t,ot(s)?s.get():s)),ot(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=hv(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!ot(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Sv),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class kE extends WV{constructor(){super(...arguments),this.KeyframeResolver=KN}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ot(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function KV(e){return window.getComputedStyle(e)}class GV extends kE{constructor(){super(...arguments),this.type="html",this.renderInstance=fN}readValueFromInstance(t,n){if(Xs.has(n)){const r=Rv(n);return r&&r.default||0}else{const r=KV(t),s=(cN(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return dE(t,n)}build(t,n,r){gv(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return _v(t,n,r)}}class qV extends kE{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ze}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Xs.has(n)){const r=Rv(n);return r&&r.default||0}return n=hN.has(n)?n:uv(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return gN(t,n,r)}build(t,n,r){vv(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){pN(t,n,r,s)}mount(t){this.isSVGTag=xv(t.tagName),super.mount(t)}}const YV=(e,t)=>fv(e)?new qV(t):new GV(t,{allowProjection:e!==w.Fragment}),XV=wz({...f4,...zV,...bV,...FV},YV),Ze=L3(XV),Dv={type:"spring",stiffness:500,damping:30,mass:.8};({...Dv});const QV={hidden:{opacity:0,scale:.95},visible:{opacity:1,scale:1,transition:Dv},exit:{opacity:0,scale:.97,transition:{duration:.15}}},Ct={hidden:{opacity:0,y:8},visible:{opacity:1,y:0},exit:{opacity:0,y:-4,transition:{duration:.1}}},NE={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.06,delayChildren:.02}}},ZV={hidden:{opacity:0,scale:.9},visible:{opacity:1,scale:1,transition:{...Dv,stiffness:420,damping:26}}},R0=[{id:"hr-onboarding",name:"HR 入职协同",steps:[{id:"classify",name:"信息校验",recipe:"validate-onboarding",engine:"llm_only",auto:!0,inputs:["员工姓名","身份证号","入职日期"],outputs:["校验结论","异常项"]},{id:"investigate",name:"权限准备",recipe:"prepare-access",engine:"qoder",auto:!0,inputs:["员工姓名","部门","岗位","校验结论"],outputs:["权限清单"]},{id:"draft_reply",name:"入职指引草拟",recipe:"draft-onboarding-guide",engine:"llm_only",auto:!0,inputs:["员工姓名","部门","岗位","权限清单"],outputs:["入职指引"]},{id:"quality_check",name:"法务与 HR 复核",recipe:"hr-legal-review",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["入职指引","异常项"],outputs:["复核结论"]},{id:"send_reply",name:"发送入职通知",recipe:"send-onboarding-notice",engine:"llm_only",auto:!0,inputs:["员工姓名","入职指引","复核结论"],outputs:["发送状态"]}],edges:[{from:"classify",to:"investigate"},{from:"investigate",to:"draft_reply"},{from:"draft_reply",to:"quality_check"},{from:"quality_check",to:"send_reply"}]},{id:"customer-service",name:"客服工单处理",steps:[{id:"classify",name:"工单分类",recipe:"classify-ticket",engine:"llm_only",auto:!0,inputs:["标题","描述"],outputs:["类型","紧急度"]},{id:"investigate",name:"问题排查",recipe:"investigate",engine:"qoder",auto:!0,inputs:["标题","类型"],outputs:["解决方案"]},{id:"draft_reply",name:"草拟回复",recipe:"draft-reply",engine:"llm_only",auto:!0,inputs:["客户","解决方案"],outputs:["回复内容"]},{id:"quality_check",name:"质量审核",recipe:"quality-check",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["回复内容"],outputs:["审核结论"]},{id:"send_reply",name:"发送回复",recipe:"send-reply",engine:"llm_only",auto:!0,inputs:["客户","回复内容"],outputs:["发送状态"]}],edges:[{from:"classify",to:"investigate"},{from:"investigate",to:"draft_reply"},{from:"draft_reply",to:"quality_check"},{from:"quality_check",to:"send_reply"}]},{id:"message-triage",name:"消息分诊",steps:[{id:"investigate",name:"深度调查",recipe:"investigate",engine:"qoder",auto:!0,inputs:["消息内容","发送人"],outputs:["调查结论"]},{id:"reply",name:"群内回复",recipe:"reply-to-group",engine:"llm_only",auto:!0,inputs:["调查结论","对话ID"],outputs:["回复状态"]}],edges:[{from:"investigate",to:"reply"}]},{id:"daily-digest",name:"每日摘要",steps:[{id:"collect",name:"收集当日数据",recipe:"collect-daily",engine:"llm_only",auto:!0,inputs:["日期"],outputs:["统计数据"]},{id:"generate",name:"生成摘要",recipe:"generate-digest",engine:"llm_only",auto:!0,inputs:["统计数据"],outputs:["摘要内容"]},{id:"send",name:"发送到群",recipe:"send-to-group",engine:"llm_only",auto:!0,inputs:["摘要内容"],outputs:["发送状态"]}],edges:[{from:"collect",to:"generate"},{from:"generate",to:"send"}]},{id:"kb-im",name:"知识库问答",steps:[{id:"check_relevance",name:"判断问题相关性",recipe:"check-relevance",engine:"llm_only",auto:!0,inputs:["消息内容"],outputs:["是否相关"]},{id:"generate_answer",name:"生成回答",recipe:"generate-answer",engine:"qoder",auto:!0,inputs:["消息内容","知识库文章"],outputs:["回答内容"]},{id:"reply_to_group",name:"回复群消息",recipe:"reply-to-group",engine:"llm_only",auto:!0,inputs:["回答内容","群ID"],outputs:["发送状态"]}],edges:[{from:"check_relevance",to:"generate_answer"},{from:"generate_answer",to:"reply_to_group"}]},{id:"discovery-demo",name:"需求发现演示",steps:[{id:"classify",name:"工单分类",recipe:"classify",engine:"llm_only",auto:!0,inputs:["消息内容"],outputs:["问题类型","紧急程度"]},{id:"enrich",name:"信息补全",recipe:"enrich",engine:"qoder",auto:!0,inputs:["消息内容","订单号"],outputs:["客户记录","历史工单"]},{id:"draft",name:"回复草拟",recipe:"draft-reply",engine:"llm_only",auto:!0,inputs:["客户记录","历史工单"],outputs:["回复内容"]},{id:"review",name:"质检审核",recipe:"quality-check",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["回复内容"],outputs:["审核结果"]},{id:"send",name:"发送回复",recipe:"send-reply",engine:"llm_only",auto:!0,inputs:["回复内容"],outputs:["发送状态"]}],edges:[{from:"classify",to:"enrich"},{from:"enrich",to:"draft"},{from:"draft",to:"review"},{from:"review",to:"send"}]},{id:"plugin-i18n-upgrade",name:"插件国际化升级",steps:[{id:"prepare_workspace",name:"准备工作空间",recipe:"prepare-workspace",engine:"qoder",auto:!0,inputs:["插件名称","仓库地址"],outputs:["目标分支"]},{id:"upgrade_i18n",name:"国际化升级",recipe:"upgrade-i18n",engine:"qoder",auto:!0,inputs:["插件名称","目标分支"],outputs:["升级日志"]},{id:"submit_review",name:"提交代码评审",recipe:"submit-review",engine:"qoder",auto:!0,inputs:["目标分支"],outputs:["MR链接"]}],edges:[{from:"prepare_workspace",to:"upgrade_i18n"},{from:"upgrade_i18n",to:"submit_review"}]}];function EE(){return R0}function Qf(e){return EE().find(n=>n.id===e)??null}const I0=/\.(json|ya?ml|ts|js|md|txt)$/i,JV=new Set(["runtime","traces","node_modules"]),M0=/(^|\/)\.(_|DS_Store)/;function O0(e){const t=e.split("/")[0]??"";return JV.has(t)}async function e5(e){const t=Array.from(e),n=[];for(const s of t)if(s.name.toLowerCase().endsWith(".zip")){const o=await qk(s),l=n5(Object.keys(o));for(const[c,u]of Object.entries(o)){const d=l(c).replace(/^\/+/,"");!d||M0.test(d)||O0(d)||!I0.test(d)||n.push({path:d,content:u})}}else{const o=t5(s);if(!o||M0.test(o)||O0(o)||!I0.test(o))continue;const l=await s.text();n.push({path:o,content:l})}const r=new Map;for(const s of n)r.set(s.path,s);return Array.from(r.values()).sort((s,i)=>s.path.localeCompare(i.path))}function t5(e){var n;const t=(n=e.webkitRelativePath)==null?void 0:n.trim();return t&&t.includes("/")?CE(t):e.name}function n5(e){if(e.length===0)return s=>s;const t=e.map(s=>s.split("/")).filter(s=>s.length>1).map(s=>s[0]);if(t.length===0)return s=>s;const n=t[0];return t.every(s=>s===n)?s=>CE(s):s=>s}function CE(e){const t=e.split("/");return t.length>1?t.slice(1).join("/"):e}function r5(e,t){return{identity:{id:"imported_init",projectId:e,stage:"init",attempt:1,startedAt:t,updatedAt:t,completedAt:t},state:{phase:"ready",warnings:[],roleFiles:[]},next:{kind:"idle"}}}function s5(e){const t=[],n=[];for(const o of e)t.push({path:o.path,status:"ok"});if(!e.some(o=>o.path==="aitable-workflow.config.yml"||o.path.endsWith(".config.yml")))t.push({path:"aitable-workflow.config.yml",status:"warning",detail:"缺失主配置文件,导入后可在「配置」阶段补齐"});else{const o=e.find(c=>c.path==="aitable-workflow.config.yml"||c.path.endsWith(".config.yml"));o&&!/^[ \t]*scene[ \t]*:[ \t]*\S/m.test(o.content)&&!/^[ \t]*scene[ \t]*:[ \t]*\|/m.test(o.content)&&t.push({path:"scene",status:"warning",detail:"config 缺少 scene 字段(业务场景描述)"})}return e.some(o=>o.path.startsWith("roles/")&&o.path.endsWith(".role.yml"))||t.push({path:"roles/",status:"warning",detail:"未检测到角色定义,可后续添加"}),e.some(o=>o.path==="workflow.yml"||o.path.endsWith("/workflow.yml"))||t.push({path:"workflow.yml",status:"warning",detail:"未包含工作流,导入后可在「设计」阶段生成"}),{items:t,envMissing:n}}function i5({onClose:e}){const t=Sr(),n=EE(),r=w.useRef(null),[s,i]=w.useState("upload"),[o,l]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState(null),[h,p]=w.useState([]),[g,x]=w.useState([]),[_,v]=w.useState([]),[y,m]=w.useState(null),[b,j]=w.useState(!1),[k,S]=w.useState(!1),[N,R]=w.useState(null),[O,D]=w.useState("");async function M(C){var L,F,V,H,U;u(!0),f(null);try{const W=Array.from(C),G=W.length>=1&&W.every(se=>/\.aitable-workflow\.zip$|\.zip$/i.test(se.name))?await z(W).catch(()=>null):null,Y=(G==null?void 0:G.files)??await e5(C);if(Y.length===0){f("未解析到可导入的文件(仅支持 .json/.yml/.yaml/.ts/.js/.md/.txt,且不能位于 runtime/traces/node_modules)"),l(!1),p([]),x([]),v([]);return}const{items:K,envMissing:X}=s5(Y);for(const se of(G==null?void 0:G.checksumWarnings)??[])K.push({path:se,status:"warning",detail:"checksum 校验"});p(Y),x(K),v(X),l(!0);const re=(L=G==null?void 0:G.title)==null?void 0:L.trim(),te=(F=Y.find(se=>se.path==="aitable-workflow.config.yml"||se.path.endsWith(".config.yml")))==null?void 0:F.content,Z=te?((V=/^name:\s*(?:"([^"]*)"|'([^']*)'|([^#\n]*))/m.exec(te))==null?void 0:V[1])??((H=/^name:\s*(?:"([^"]*)"|'([^']*)'|([^#\n]*))/m.exec(te))==null?void 0:H[3]):null,ee=re||(Z!=null&&Z.trim()?Z.trim():"")||((U=W.find(se=>/\.zip$/i.test(se.name)))==null?void 0:U.name.replace(/\.aitable-workflow\.zip$|\.zip$/i,""))||"导入项目";D(ee)}catch(W){f(W instanceof Error?W.message:String(W)),l(!1)}finally{u(!1)}}async function z(C){const L=[];let F;const V=[];let H=!1;const U=new Map;for(const W of C)try{const G=await h3(W);if(!G.manifest)continue;H=!0,!F&&G.title&&(F=G.title);for(const Y of G.checksumWarnings)V.push(Y);for(const Y of G.files)U.set(Y.path,Y)}catch{}if(!H)return null;for(const W of U.values())L.push(W);return L.sort((W,G)=>W.path.localeCompare(G.path)),{files:L,title:F,checksumWarnings:V}}function T(C){!C.target.files||C.target.files.length===0||(M(C.target.files),C.target.value="")}function E(C){m(C);const L=Qf(C);D((L==null?void 0:L.name)??C),p([]),f(null),x([{path:`examples/${C}/config.yml`,status:"ok"},{path:`examples/${C}/workflow.yml`,status:"ok"},{path:`examples/${C}/recipes/`,status:"ok"},{path:`examples/${C}/roles/`,status:"ok"}]),v([]),l(!0)}function A(){if(!O){const C=y?Qf(y):null;D((C==null?void 0:C.name)??"导入项目")}j(!0)}async function P(){if(S(!0),R(null),me)try{const{project:H}=await UL(O,h);B.setProjectSource("imported"),await bu(H.id),t(`/p/${H.id}/init`),e();return}catch(H){R(H instanceof Error?H.message:String(H)),S(!1);return}const C=`mock-imported-${Date.now()}`,L=y?Qf(y):null,F=((L==null?void 0:L.steps.length)??0)>0,V=new Date().toISOString();B.setProjectSource("imported"),B.applyLoadedProject({snapshot:{...ms(),projectId:C,projects:Ra(B.projects,{id:C,title:O,dir:"",createdAt:V,updatedAt:V}),files:h,workflow:L?{steps:L.steps,edges:L.edges}:null,projectState:{projectId:C,activeStage:null,stages:{init:r5(C,V)},updatedAt:V},init:{name:O,agentsSelected:[],selectedMachineId:"",tableConnected:!1,tableBaseId:"",tableId:"",llmProvider:"",llmModel:"",roles:[],sop:""}}}),t(`/p/${C}/${F?"setup":"design"}`),e()}const I=o&&(s==="upload"||y);return a.jsx("div",{className:"modal-overlay",onClick:e,children:a.jsxs("div",{className:"import-panel",onClick:C=>C.stopPropagation(),children:[a.jsxs("div",{className:"import-panel__head",children:[a.jsx("span",{className:"import-panel__title",children:"导入已有项目"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:e,children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"import-panel__body",children:b?a.jsxs("div",{className:"import-confirm",children:[a.jsx("div",{className:"import-confirm__icon",children:a.jsx($,{name:"file",size:22})}),a.jsx("h4",{className:"import-confirm__title",children:"确认导入到我的项目?"}),a.jsxs("p",{className:"import-confirm__desc",children:["将在你的账号下新建项目,并导入已解析的工作流配置。",y&&a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("span",{className:"cfg-muted",children:"导入后需在「搭建」阶段配置 AI 表格。"})]})]}),a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"项目名称"}),a.jsx("input",{className:"import-confirm__input",value:O,onChange:C=>D(C.target.value),placeholder:"输入项目名称"})]}),N&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),N]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"import-panel__sources",children:[a.jsxs("label",{className:`import-source${s==="upload"?" is-selected":""}`,children:[a.jsx("input",{type:"radio",name:"source",checked:s==="upload",onChange:()=>{i("upload"),l(!1),m(null),f(null),p([]),x([])}}),"上传项目包"]}),a.jsxs("label",{className:`import-source${s==="template"?" is-selected":""}`,children:[a.jsx("input",{type:"radio",name:"source",checked:s==="template",onChange:()=>{i("template"),l(!1),f(null),p([])}}),"从模板库选择"]})]}),s==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:r,type:"file",multiple:!0,accept:".zip,.json,.yml,.yaml,.ts,.js,.md,.txt",style:{display:"none"},onChange:T}),a.jsxs("button",{type:"button",className:"import-drop",disabled:c,onClick:()=>{var C;return(C=r.current)==null?void 0:C.click()},children:[a.jsx($,{name:"plus",size:20}),a.jsx("span",{children:c?"解析中...":o?"重新选择文件 (.zip / 多选 / 目录)":"拖拽或点击上传 (.zip / 多选)"})]}),d&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),d]})]}),s==="template"&&a.jsx("div",{className:"import-templates",children:n.map(C=>a.jsxs("button",{type:"button",className:`import-template${y===C.id?" is-selected":""}`,onClick:()=>E(C.id),children:[a.jsx("span",{className:"import-template__icon",children:a.jsx($,{name:"flow",size:14})}),a.jsx("span",{className:"import-template__name",children:C.name}),a.jsxs("span",{className:"cfg-muted",children:["examples/",C.id]})]},C.id))}),o&&a.jsxs("div",{className:"import-preview",children:[a.jsxs("div",{className:"import-preview__title",children:["解析结果预览(",h.length||g.length," 项):"]}),a.jsx("ul",{className:"import-preview__list",children:g.map(C=>a.jsxs("li",{className:`import-preview__item import-preview__item--${C.status}`,children:[a.jsx("span",{className:"import-preview__icon",children:C.status==="ok"?"✓":C.status==="warning"?"⚠":"✗"}),a.jsx("span",{className:"import-preview__path",children:C.path}),C.detail&&a.jsx("span",{className:"import-preview__detail",children:C.detail})]},C.path))}),_.length>0&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),"需要补齐 ",_.length," 个环境变量"]})]})]})}),a.jsx("div",{className:"import-panel__foot",children:b?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>j(!1),children:"返回"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!O.trim()||k,onClick:()=>void P(),children:k?"导入中...":"确认导入"})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:e,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!I,onClick:A,children:"下一步 →"})]})})]})})}function Rd({children:e}){return a.jsx("div",{className:"body body--norail",children:e})}const o5=[{icon:"robot",label:"配置",stage:"init",desc:"发现并接入 Agent、角色、SOP"},{icon:"flow",label:"设计",stage:"design",desc:"问答对齐后可视化编排工作流"},{icon:"table",label:"搭建",stage:"setup",desc:"自动创建字段与视图"},{icon:"sparkle",label:"试运行",stage:"test",desc:"用一条真实记录验证流程"}],a5=lt(function(){const[t,n]=w.useState(!1),[r,s]=w.useState(!1),i=Sr(),o=B.projects,[l,c]=w.useState(!1),[u,d]=w.useState(0);w.useEffect(()=>{if(!me)return;let g=!1;return Ug().then(x=>{g||(B.setProjects(x),c(!1))}).catch(()=>{g||c(!0)}),()=>{g=!0}},[u]);const[f,h]=w.useState(null);async function p(g){if(!me){const x=`mock-${Date.now()}`;B.beginNewProject(x,g),i(`/p/${x}/init`);return}h(null);try{const x=await Bg();B.beginNewProject(x.id,g),B.setProjects(Ra(B.projects,x)),i(`/p/${x.id}/init`)}catch(x){h(x instanceof Error?x.message:String(x))}}return a.jsx(Rd,{children:a.jsxs("div",{className:"home-hero",children:[a.jsx(Ze.span,{className:"home-hero__mark",variants:QV,initial:"hidden",animate:"visible",children:a.jsx($,{name:"sparkle",size:28,color:"#fff"})}),a.jsx("h1",{className:"home-hero__title",children:"用对话搭建你的 AI 表格工作流"}),a.jsxs("p",{className:"home-hero__desc",children:["从配置、设计、搭建到试运行,全程对话式引导。",a.jsx("br",{}),"以 HR、法务等专业岗位协作为例,四步落地一条可运行的业务流程。"]}),a.jsxs("div",{className:"home-hero__ctas",children:[a.jsxs("button",{type:"button",className:"primary home-hero__cta",onClick:()=>s(!0),children:[a.jsx($,{name:"play",size:16,color:"#fff"}),"新建项目"]}),a.jsxs("button",{type:"button",className:"home-hero__cta home-hero__cta--ghost",onClick:()=>n(!0),children:[a.jsx($,{name:"plus",size:16}),"导入已有项目"]})]}),f&&a.jsxs("div",{className:"home-hero__error",children:["新建项目失败:",f]}),a.jsxs("div",{className:"home-projects",children:[a.jsx("div",{className:"home-projects__title",children:"我的项目"}),l&&o.length===0?a.jsxs("div",{className:"home-projects__empty",children:["项目列表没取到。",a.jsx("button",{type:"button",className:"home-projects__retry",onClick:()=>d(g=>g+1),children:"重试"})]}):o.length===0?a.jsx("div",{className:"home-projects__empty",children:"还没有项目,从上面新建一个开始。"}):a.jsx("ul",{className:"home-projects__list",children:o.map((g,x)=>a.jsx("li",{children:a.jsxs(Ue,{className:"home-projects__item",to:`/p/${g.id}`,children:[a.jsx($,{name:"file",size:15}),a.jsx("span",{className:"home-projects__name",children:Bp(g,x)}),a.jsx("span",{className:"home-projects__id",children:g.id})]})},g.id))})]}),a.jsx(Ze.div,{className:"home-beats",variants:NE,initial:"hidden",animate:"visible",children:o5.map((g,x)=>a.jsxs(Ze.div,{className:"home-beat",variants:Ct,children:[a.jsx("span",{className:"home-beat__idx",children:x+1}),a.jsx("span",{className:"home-beat__icon",children:a.jsx($,{name:g.icon,size:18})}),a.jsx("span",{className:"home-beat__label",children:g.label}),a.jsx("span",{className:"home-beat__desc",children:g.desc})]},g.stage))}),t&&a.jsx(i5,{onClose:()=>n(!1)}),r&&a.jsx(Tk,{onConfirm:g=>{p(g),s(!1)},onCancel:()=>s(!1)})]})})});function l5({summary:e,allPassed:t,saving:n,onComplete:r}){return a.jsxs("div",{className:`cfg-summary${t?" cfg-summary--ok":""}`,children:[a.jsxs("div",{className:"cfg-summary__stats",children:[a.jsxs("span",{className:"cfg-summary__stat",children:[a.jsx($,{name:"check",size:14,color:"var(--green)"}),e.passedModules,"/",e.totalModules," 模块通过"]}),e.errors>0&&a.jsxs("span",{className:"cfg-summary__stat cfg-summary__stat--error",children:[e.errors," 错误"]}),e.warnings>0&&a.jsxs("span",{className:"cfg-summary__stat cfg-summary__stat--warn",children:[e.warnings," 警告"]})]}),a.jsx("button",{type:"button",className:"primary cfg-summary__btn",disabled:!t||n,onClick:r,children:n?"完成中…":t?"保存配置,继续搭建 →":"请先修复所有错误"})]})}const c5=".md,.txt,.text,.rst,.csv,.json,.yaml,.yml,.xml,.html,.htm,.docx,.pdf,.xlsx",u5=new Set([".docx",".pdf",".xlsx"]);let d5=0;function f5(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n)}function h5(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function p5({roleId:e,onIngestUrl:t,onUploadFiles:n}){const[r,s]=w.useState([]),[i,o]=w.useState([]),[l,c]=w.useState(!1),u=w.useRef(null),d=w.useRef(null),f=w.useRef(null),h=w.useCallback(()=>{s(b=>[...b,{id:++d5,type:"file",url:"",files:[]}])},[]),p=w.useCallback(b=>{s(j=>j.filter(k=>k.id!==b))},[]),g=w.useCallback((b,j)=>{s(k=>k.map(S=>S.id===b?{...S,type:j,url:"",files:[]}:S))},[]),x=w.useCallback((b,j)=>{s(k=>k.map(S=>S.id===b?{...S,url:j}:S))},[]),_=w.useCallback((b,j)=>{var k,S;f.current=b,j==="folder"?(k=d.current)==null||k.click():(S=u.current)==null||S.click()},[]),v=w.useCallback(b=>{const j=f.current;if(j===null)return;const k=Array.from(b.target.files??[]);k.length>0&&s(S=>S.map(N=>N.id===j?{...N,files:k}:N)),b.target.value=""},[]),y=w.useCallback(async()=>{if(l)return;c(!0);const b=[];for(const j of r)if(j.type==="url"){if(!j.url.trim())continue;try{const k=await t(e,j.url.trim());b.push({ok:k.ok,message:k.message??(k.ok?"导入成功":"导入失败")})}catch(k){b.push({ok:!1,message:k instanceof Error?k.message:"导入失败"})}}else{if(j.files.length===0)continue;try{const k=[];for(const N of j.files){const R=h5(N.name),O=N.webkitRelativePath||N.name;if(u5.has(R)){const D=await N.arrayBuffer();k.push({name:N.name,relativePath:O,content:f5(D),encoding:"base64"})}else{const D=await N.text();k.push({name:N.name,relativePath:O,content:D,encoding:"utf8"})}}const S=await n(e,k);b.push({ok:S.ok,message:S.message??(S.ok?`导入成功 (${j.files.length} 个文件)`:"导入失败")})}catch(k){b.push({ok:!1,message:k instanceof Error?k.message:"文件上传失败"})}}o(j=>[...j,...b]),s([]),c(!1)},[l,r,e,t,n]),m=r.some(b=>b.type==="url"&&b.url.trim()||b.type==="file"&&b.files.length>0);return a.jsxs("div",{className:"kb-panel",children:[a.jsx("input",{ref:u,type:"file",multiple:!0,accept:c5,style:{display:"none"},onChange:v}),a.jsx("input",{ref:d,type:"file",webkitdirectory:"",directory:"",multiple:!0,style:{display:"none"},onChange:v}),i.length>0&&a.jsx("div",{className:"kb-panel__results",children:i.map((b,j)=>a.jsxs("div",{className:`kb-panel__result ${b.ok?"is-ok":"is-error"}`,children:[a.jsx($,{name:b.ok?"check":"warn",size:12,color:b.ok?"var(--green)":"var(--red)"}),a.jsx("span",{children:b.message})]},j))}),r.length>0&&a.jsx("div",{className:"kb-panel__rows",children:r.map(b=>a.jsxs("div",{className:"kb-panel__row",children:[a.jsxs("select",{className:"kb-panel__type-select",value:b.type,onChange:j=>g(b.id,j.target.value),disabled:l,children:[a.jsx("option",{value:"file",children:"本地文件"}),a.jsx("option",{value:"url",children:"在线文档链接"})]}),b.type==="file"?a.jsxs("div",{className:"kb-panel__file-area",children:[b.files.length>0?a.jsxs("span",{className:"kb-panel__file-info",title:b.files.map(j=>j.name).join(`
77
- `),children:["已选 ",b.files.length," 个文件"]}):a.jsx("span",{className:"kb-panel__file-placeholder",children:"未选择文件"}),a.jsx("button",{type:"button",className:"kb-panel__file-btn",onClick:()=>_(b.id,"file"),disabled:l,children:"选择文件"}),a.jsx("button",{type:"button",className:"kb-panel__file-btn",onClick:()=>_(b.id,"folder"),disabled:l,children:"选择文件夹"})]}):a.jsx("input",{type:"text",className:"qf-input kb-panel__url-input",value:b.url,placeholder:"输入在线文档链接",onChange:j=>x(b.id,j.target.value),disabled:l}),a.jsx("button",{type:"button",className:"kb-panel__row-remove",onClick:()=>p(b.id),disabled:l,title:"删除此行",children:a.jsx($,{name:"close",size:12})})]},b.id))}),a.jsxs("div",{className:"kb-panel__actions",children:[a.jsx("button",{type:"button",className:"cfg-item__edit-btn cfg-item__kb-btn",onClick:h,disabled:l,children:r.length>0||i.length>0?"继续添加知识库":"添加知识库"}),r.length>0&&a.jsx("button",{type:"button",className:"primary kb-panel__import-btn",onClick:()=>void y(),disabled:l||!m,children:l?"导入中…":"导入"})]})]})}function m5({fileRef:e}){const[t,n]=w.useState(!1),[r,s]=w.useState(null),[i,o]=w.useState(""),[l,c]=w.useState(!1),[u,d]=w.useState(!1),[f,h]=w.useState(!1),[p,g]=w.useState(null),[x,_]=w.useState(!1);async function v(){if(t){n(!1);return}if(n(!0),r===null){d(!0),g(null);try{const b=await bD(e.path);s(b.content),o(b.content)}catch(b){g(b instanceof Error?b.message:String(b))}finally{d(!1)}}}async function y(){h(!0),g(null);try{await jD(e.path,i),s(i),c(!1),_(!0),setTimeout(()=>_(!1),2400)}catch(b){g(b instanceof Error?b.message:String(b))}finally{h(!1)}}const m=(e.summary??[]).map(b=>b.count!==void 0?`${b.key} ${b.count}`:b.key).join(" · ");return a.jsxs("div",{className:"file-ref",children:[a.jsxs("button",{type:"button",className:"file-ref__toggle",onClick:()=>void v(),children:[a.jsx("span",{className:`file-ref__chevron${t?" is-open":""}`,children:a.jsx($,{name:"chevron-right",size:11})}),a.jsx($,{name:"file",size:12,color:"var(--text-muted)"}),a.jsx("code",{className:"file-ref__path",children:e.path}),e.exists?m&&a.jsx("span",{className:"file-ref__summary",children:m}):a.jsx("span",{className:"file-ref__missing",children:"文件不存在,展开可创建"})]}),e.exists&&a.jsxs("div",{className:"file-ref__locked-hint",children:[a.jsx($,{name:"lock",size:11,color:"var(--text-muted)"}),a.jsx("span",{children:"该配置指向上方文件,路径不可改;展开文件编辑其内容"})]}),t&&a.jsxs("div",{className:"file-ref__body",children:[u&&a.jsx("div",{className:"file-ref__hint",children:"读取中…"}),p&&a.jsxs("div",{className:"file-ref__error",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),a.jsx("span",{children:p})]}),!u&&r!==null&&!l&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"file-ref__pre",children:r||"(空文件)"}),a.jsxs("div",{className:"file-ref__actions",children:[a.jsx("button",{type:"button",className:"file-ref__btn",onClick:()=>{o(r),c(!0),g(null)},children:"编辑内容"}),x&&a.jsxs("span",{className:"file-ref__saved",children:[a.jsx($,{name:"check",size:12,color:"var(--green)"})," 已保存"]})]})]}),!u&&l&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{className:"qf-textarea file-ref__editor",value:i,spellCheck:!1,onChange:b=>o(b.target.value),autoFocus:!0}),a.jsxs("div",{className:"file-ref__actions",children:[a.jsx("button",{type:"button",className:"primary file-ref__btn",onClick:()=>void y(),disabled:f,children:f?"保存中…":`保存${e.format==="json"?" JSON":" YAML"}`}),a.jsx("button",{type:"button",className:"file-ref__btn",onClick:()=>{o(r??""),c(!1),g(null)},disabled:f,children:"取消"}),a.jsxs("span",{className:"file-ref__hint file-ref__hint--inline",children:["保存前会校验",e.format==="json"?" JSON":" YAML","语法,语法错误不会写入"]})]})]})]})]})}const g5=/secret|token|password|api_key/i;let TE=1;function v5(e,t){if(!e.trim())return[];try{const n=JSON.parse(e);return!n||typeof n!="object"||Array.isArray(n)?[]:Object.entries(n).map(([r,s])=>{const i={},o=[...t.valueFields];for(const l of Object.keys(s??{}))o.includes(l)||o.push(l);for(const l of o){const c=(s??{})[l];i[l]=c==null?"":String(c)}return{id:TE++,name:r,fields:i}})}catch{return[]}}function L0(e){const t={};for(const n of e.valueFields)t[n]="";return{id:TE++,name:"",fields:t}}function y5({spec:e,initialValue:t,saving:n,onSave:r,onCancel:s}){const[i,o]=w.useState(()=>{const p=v5(t,e);return p.length>0?p:[L0(e)]}),l=e.keyLabel??"名称",c=w.useMemo(()=>{const p=i.map(g=>g.name.trim());return p.some(g=>!g)?`每一项都需要填写「${l}」`:new Set(p).size!==p.length?`「${l}」不能重复`:null},[i,l]);function u(p,g){o(x=>x.map(_=>_.id===p?{..._,...g}:_))}function d(p,g,x){o(_=>_.map(v=>v.id===p?{...v,fields:{...v.fields,[g]:x}}:v))}function f(p){o(g=>g.filter(x=>x.id!==p))}async function h(){if(c)return;const p={};for(const g of i)p[g.name.trim()]=g.fields;await r(JSON.stringify(p))}return a.jsxs("div",{className:"env-map",children:[a.jsxs("p",{className:"env-map__hint",children:["按项填写,每项包含 ",e.valueFields.map(p=>a.jsx("code",{children:p},p)),",保存后自动写回配置。"]}),i.map((p,g)=>a.jsxs("div",{className:"env-map__entry",children:[a.jsxs("div",{className:"env-map__entry-head",children:[a.jsxs("span",{className:"env-map__entry-index",children:["#",g+1]}),a.jsx("input",{type:"text",className:"qf-input env-map__key-input",placeholder:l,value:p.name,onChange:x=>u(p.id,{name:x.target.value}),autoFocus:!p.name}),a.jsx("button",{type:"button",className:"env-map__remove-btn",title:"删除此项",onClick:()=>f(p.id),disabled:n,children:a.jsx($,{name:"close",size:13})})]}),a.jsx("div",{className:"env-map__fields",children:Object.keys(p.fields).map(x=>a.jsxs("label",{className:"env-map__field",children:[a.jsx("span",{className:"env-map__field-name",children:x}),a.jsx("input",{type:g5.test(x)?"password":"text",className:"qf-input env-map__field-input",placeholder:`输入 ${x}`,value:p.fields[x]??"",onChange:_=>d(p.id,x,_.target.value)})]},x))})]},p.id)),a.jsxs("button",{type:"button",className:"env-map__add-btn",onClick:()=>o(p=>[...p,L0(e)]),disabled:n,children:[a.jsx($,{name:"plus",size:13}),"添加一项"]}),c&&i.length>0&&a.jsx("div",{className:"env-map__error",children:c}),a.jsxs("div",{className:"cfg-item__edit-actions",children:[a.jsx("button",{type:"button",className:"primary cfg-item__save-btn",onClick:()=>void h(),disabled:n||!!c||i.length===0,children:n?"保存中…":"保存"}),a.jsx("button",{type:"button",className:"cfg-item__cancel-btn",onClick:s,disabled:n,children:"取消"})]})]})}const $0={ok:{icon:"check",color:"var(--green)"},error:{icon:"warn",color:"var(--red)"},warn:{icon:"warn",color:"var(--amber)"},suggestion:{icon:"dot",color:"var(--blue)"}},D0=".knowledge_scope.kb_collections";function x5(e){if(!e.endsWith(D0))return null;const t=e.slice(0,-D0.length),n=t.lastIndexOf(".");return n>=0?t.slice(n+1):t}function fn({item:e,onSave:t,onKbIngest:n,onKbUpload:r,suggestedDefault:s}){var k,S,N,R,O,D,M,z,T,E,A,P;const[i,o]=w.useState(!1),[l,c]=w.useState(zo(e)),[u,d]=w.useState(!1),f=((k=e.surface)==null?void 0:k.label)??e.key,h=((S=e.surface)==null?void 0:S.description)??e.message,p=e.writeTarget&&((N=e.surface)==null?void 0:N.editable)!==!1,g=e.sensitive,x=$0[e.status]??$0.suggestion,_=x5(e.key),y=_!==null&&n&&r,m=(R=e.surface)==null?void 0:R.envJsonSpec;async function b(I){if(!(!e.writeTarget||!I.trim())){d(!0);try{await t(e.writeTarget,I),o(!1)}finally{d(!1)}}}async function j(){await b(l)}return a.jsxs("div",{className:`cfg-item cfg-item--${e.status}`,children:[a.jsxs("div",{className:"cfg-item__head",children:[a.jsx("span",{className:"cfg-item__status",children:a.jsx($,{name:x.icon,size:14,color:x.color})}),a.jsx("span",{className:"cfg-item__label",children:f}),g&&a.jsx("span",{className:"cfg-item__badge cfg-item__badge--sensitive",children:"敏感"}),((O=e.surface)==null?void 0:O.required)&&a.jsx("span",{className:"cfg-item__badge cfg-item__badge--required",children:"必填"})]}),h&&!i&&a.jsx("div",{className:"cfg-item__desc",children:h}),!i&&a.jsxs("div",{className:"cfg-item__value-row",children:[a.jsx("span",{className:`cfg-item__value${((D=e.surface)==null?void 0:D.valueType)==="text"?" cfg-item__value--multiline":""}`,children:m?_5(e,m.keyLabel):g&&e.value?"***":e.value!==void 0&&String(e.value)!==""?String(e.value):"—"}),p&&a.jsx("button",{type:"button",className:"cfg-item__edit-btn",onClick:()=>{c(g?"":zo(e)||s||""),o(!0)},children:"编辑"})]}),!i&&p&&s&&!zo(e)&&a.jsxs("div",{className:"cfg-item__suggest",children:["默认沿用已配置的 Base ID:",a.jsx("code",{children:s}),"(点“编辑”已自动预填,直接保存即可)"]}),!i&&((M=e.surface)==null?void 0:M.fileRef)&&a.jsx(m5,{fileRef:e.surface.fileRef}),i&&m&&a.jsx("div",{className:"cfg-item__edit",children:a.jsx(y5,{spec:m,initialValue:g?"":zo(e),saving:u,onSave:b,onCancel:()=>o(!1)})}),i&&!m&&a.jsxs("div",{className:"cfg-item__edit",children:[((z=e.surface)==null?void 0:z.valueType)==="string[]"||((T=e.surface)==null?void 0:T.valueType)==="text"?a.jsx("textarea",{className:"qf-textarea cfg-item__input",rows:((E=e.surface)==null?void 0:E.valueType)==="text"?10:3,value:l,placeholder:((A=e.surface)==null?void 0:A.valueType)==="text"?`输入 ${f}`:"每行一个值,或用逗号分隔",onChange:I=>c(I.target.value),autoFocus:!0}):a.jsx("input",{type:g?"password":"text",className:"qf-input cfg-item__input",value:l,placeholder:((P=e.surface)==null?void 0:P.description)??`输入 ${f}`,onChange:I=>c(I.target.value),onKeyDown:I=>{I.key==="Enter"&&j()},autoFocus:!0}),a.jsxs("div",{className:"cfg-item__edit-actions",children:[a.jsx("button",{type:"button",className:"primary cfg-item__save-btn",onClick:()=>void j(),disabled:u||!l.trim(),children:u?"保存中…":"保存"}),a.jsx("button",{type:"button",className:"cfg-item__cancel-btn",onClick:()=>o(!1),disabled:u,children:"取消"})]})]}),y&&!p&&a.jsx(p5,{roleId:_,onIngestUrl:n,onUploadFiles:r})]})}function zo(e){return e.value===void 0||e.value===null?"":Array.isArray(e.value)?e.value.join(", "):String(e.value)}function _5(e,t){const n=zo(e);if(!n.trim())return"—";try{const r=JSON.parse(n),s=Object.keys(r);return s.length===0?"—":`已配 ${s.length} 项(${t??"名称"}: ${s.join(", ")})`}catch{return n}}function Iu({items:e}){const[t,n]=w.useState(!1);if(e.length===0)return null;const r=e.map(i=>`[${i.status}] ${i.key}: ${i.message}`).join(`
78
- `);async function s(){try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),2e3)}catch{}}return a.jsxs("section",{className:"process-errors",children:[a.jsxs("div",{className:"process-errors__head",children:[a.jsx($,{name:"warn",size:14,color:"var(--red)"}),a.jsx("span",{children:"过程错误"}),a.jsx("button",{type:"button",className:"process-errors__copy",onClick:()=>void s(),children:t?"已复制":"复制"})]}),e.map((i,o)=>a.jsxs("div",{className:`process-errors__item process-errors__item--${i.status}`,children:[a.jsx("span",{className:"process-errors__icon",children:a.jsx($,{name:"warn",size:13,color:i.status==="error"?"var(--red)":"var(--amber)"})}),a.jsxs("div",{className:"process-errors__body",children:[i.key&&a.jsx("code",{className:"process-errors__key",children:i.key}),a.jsx("span",{className:"process-errors__msg",children:i.message})]})]},i.key??`pe-${o}`))]})}const w5=new Set(["workflow","agent.engine"]);function b5({config:e,engines:t,projectEnvRefs:n,onSave:r,onBatchSave:s}){const i=e.modules.find(m=>m.id==="project"),o=e.modules.find(m=>m.id==="coding_agent"),l=e.modules.find(m=>m.id==="env"),c=o==null?void 0:o.items.find(m=>m.key==="coding_agent.engine"),u=o==null?void 0:o.items.find(m=>m.key==="coding_agent.config.enabled"),d=c==null?void 0:c.value,[f,h]=w.useState(!1),p=w.useRef(!1),g=w.useCallback(async m=>{if(!(!(c!=null&&c.writeTarget)||!m)){h(!0);try{const b=[{writeTarget:c.writeTarget,value:m}];(u==null?void 0:u.status)==="error"&&u.writeTarget&&b.push({writeTarget:u.writeTarget,value:"true"}),await s(b)}finally{h(!1)}}},[c,u,s]);w.useEffect(()=>{p.current||(c==null?void 0:c.status)==="error"&&d&&t.available.some(m=>m.engine===d)&&c.writeTarget&&(p.current=!0,g(d))},[c,d,t.available,g]);const x=((i==null?void 0:i.items)??[]).filter(m=>!w5.has(m.key)&&(m.status!=="ok"||m.writeTarget)),_=((l==null?void 0:l.items)??[]).filter(m=>m.writeTarget&&(!n||n.includes(m.key))),v=((o==null?void 0:o.items)??[]).filter(m=>m.key!=="coding_agent.engine"&&m.writeTarget&&m.status==="error"),y=[...(i==null?void 0:i.items)??[],...(o==null?void 0:o.items)??[],...e.modules.filter(m=>m.id==="profile").flatMap(m=>m.items).filter(m=>!m.key.startsWith("kb_compile.")),...(l==null?void 0:l.items)??[]].filter(m=>!m.writeTarget&&(m.status==="error"||m.status==="warn"));return a.jsxs("div",{className:"adjust__tab-inner",children:[a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx($,{name:"robot",size:15}),"编码引擎"]}),a.jsxs("div",{className:"adjust__engine-row",children:[a.jsxs("select",{className:"qf-select adjust__engine-select",value:d??"",onChange:m=>void g(m.target.value),disabled:f,children:[a.jsx("option",{value:"",children:"请选择…"}),t.available.map(m=>a.jsxs("option",{value:m.engine,children:[m.engine," (",m.cmd,m.version?` v${m.version}`:"",")"]},m.engine)),!t.available.some(m=>m.engine==="llm_only")&&a.jsx("option",{value:"llm_only",children:"llm_only (无需本地 CLI)"})]}),(c==null?void 0:c.status)==="error"&&a.jsxs("span",{className:"adjust__engine-warn",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),c.message]}),(c==null?void 0:c.status)==="ok"&&a.jsx("span",{className:"adjust__engine-ok",children:a.jsx($,{name:"check",size:13,color:"var(--green)"})}),f&&a.jsx("span",{className:"adjust__engine-saving",children:"保存中…"})]}),t.recommended&&d!==t.recommended&&a.jsxs("p",{className:"adjust__hint-text",children:["推荐:",t.recommended]})]}),v.length>0&&a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx($,{name:"robot",size:15}),"引擎配置"]}),v.map(m=>a.jsx(fn,{item:m,onSave:r},m.key))]}),(x.length>0||_.length>0)&&a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx($,{name:"folder",size:15}),"项目参数"]}),x.map(m=>a.jsx(fn,{item:m,onSave:r},m.key)),_.map(m=>a.jsx(fn,{item:m,onSave:r},m.key))]}),x.length===0&&_.length===0&&v.length===0&&(c==null?void 0:c.status)==="ok"&&a.jsxs("div",{className:"adjust__empty",children:[a.jsx($,{name:"check",size:20,color:"var(--green)"}),a.jsx("span",{children:"项目参数已完整"})]}),a.jsx(Iu,{items:y})]})}const im=new Set(["roles.enabled","roles_dir","roles"]);function j5(e){const t=new Map;for(const n of e){if(im.has(n.key))continue;const r=n.key.match(/^role\.([^.]+)/);if(!r)continue;const s=r[1];t.has(s)||t.set(s,[]),t.get(s).push(n)}return Array.from(t.entries()).map(([n,r])=>({roleId:n,items:r}))}function S5({config:e,onSave:t,onKbIngest:n,onKbUpload:r}){const s=e.modules.find(d=>d.id==="roles");if(!s)return a.jsx("div",{className:"adjust__empty",children:"角色系统未启用"});const o=s.items.filter(d=>im.has(d.key)).find(d=>d.status==="error");if(o){const d=((s==null?void 0:s.items)??[]).filter(f=>!f.writeTarget&&f.status!=="ok"&&f!==o);return a.jsxs("div",{className:"adjust__tab-inner",children:[a.jsxs("div",{className:"adjust__error",children:[a.jsx($,{name:"warn",size:16,color:"var(--red)"}),a.jsx("span",{children:o.message})]}),a.jsx(Iu,{items:d})]})}const l=j5(s.items),c=new Map;for(const d of e.modules.filter(f=>f.id==="profile"))for(const f of d.items){const h=f.key.match(/^kb_compile\.([^.]+)\./);if(!h)continue;const p=h[1];c.has(p)||c.set(p,[]),c.get(p).push(f)}for(const d of c.values())d.sort((f,h)=>(f.status==="error"?0:1)-(h.status==="error"?0:1));if(l.length===0)return a.jsx("div",{className:"adjust__tab-inner",children:a.jsxs("div",{className:"adjust__empty",children:[a.jsx($,{name:"user",size:20,color:"var(--text-muted)"}),a.jsx("span",{children:"暂无角色配置"})]})});const u=((s==null?void 0:s.items)??[]).filter(d=>im.has(d.key)&&!d.writeTarget&&d.status!=="ok");return a.jsxs("div",{className:"adjust__tab-inner",children:[l.map(d=>a.jsx(k5,{role:d,kbItems:c.get(d.roleId)??[],onSave:t,onKbIngest:n,onKbUpload:r},d.roleId)),a.jsx(Iu,{items:u})]})}function k5({role:e,kbItems:t,onSave:n,onKbIngest:r,onKbUpload:s}){const i=e.items.find(c=>c.key===`role.${e.roleId}`),o=(i==null?void 0:i.status)==="ok"&&!t.some(c=>c.status==="error"),l=e.items.filter(c=>c.key!==`role.${e.roleId}`);return a.jsxs("div",{className:`role-card${o?" is-ok":""}`,children:[a.jsxs("div",{className:"role-card__head",children:[a.jsx($,{name:"user",size:15}),a.jsx("span",{className:"role-card__name",children:e.roleId}),a.jsx("span",{className:`role-card__status${o?" is-ok":""}`,children:o?a.jsxs(a.Fragment,{children:[a.jsx($,{name:"check",size:12})," 通过"]}):"需配置"})]}),(l.length>0||t.length>0)&&a.jsxs("div",{className:"role-card__body",children:[l.map(c=>a.jsx(fn,{item:c,onSave:n,onKbIngest:r,onKbUpload:s},c.key)),t.length>0&&a.jsxs("div",{className:"role-card__kb",children:[a.jsx("div",{className:"role-card__kb-title",children:"知识库编译配置"}),t.map(c=>a.jsx(fn,{item:c,onSave:n},c.key))]})]})]})}function He(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=He(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var N5={value:()=>{}};function Id(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Mc(n)}function Mc(e){this._=e}function E5(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Mc.prototype=Id.prototype={constructor:Mc,on:function(e,t){var n=this._,r=E5(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=C5(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(s=(e=r[i]).type)n[s]=z0(n[s],e.name,t);else if(t==null)for(s in n)n[s]=z0(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Mc(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function C5(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function z0(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=N5,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var om="http://www.w3.org/1999/xhtml";const F0={svg:"http://www.w3.org/2000/svg",xhtml:om,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Md(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),F0.hasOwnProperty(t)?{space:F0[t],local:e}:e}function T5(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===om&&t.documentElement.namespaceURI===om?t.createElement(e):t.createElementNS(n,e)}}function P5(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function PE(e){var t=Md(e);return(t.local?P5:T5)(t)}function A5(){}function zv(e){return e==null?A5:function(){return this.querySelector(e)}}function R5(e){typeof e!="function"&&(e=zv(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=new Array(o),c,u,d=0;d<o;++d)(c=i[d])&&(u=e.call(c,c.__data__,d,i))&&("__data__"in c&&(u.__data__=c.__data__),l[d]=u);return new Mt(r,this._parents)}function I5(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function M5(){return[]}function AE(e){return e==null?M5:function(){return this.querySelectorAll(e)}}function O5(e){return function(){return I5(e.apply(this,arguments))}}function L5(e){typeof e=="function"?e=O5(e):e=AE(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var o=t[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&(r.push(e.call(c,c.__data__,u,o)),s.push(c));return new Mt(r,s)}function RE(e){return function(){return this.matches(e)}}function IE(e){return function(t){return t.matches(e)}}var $5=Array.prototype.find;function D5(e){return function(){return $5.call(this.children,e)}}function z5(){return this.firstElementChild}function F5(e){return this.select(e==null?z5:D5(typeof e=="function"?e:IE(e)))}var V5=Array.prototype.filter;function B5(){return Array.from(this.children)}function U5(e){return function(){return V5.call(this.children,e)}}function H5(e){return this.selectAll(e==null?B5:U5(typeof e=="function"?e:IE(e)))}function W5(e){typeof e!="function"&&(e=RE(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new Mt(r,this._parents)}function ME(e){return new Array(e.length)}function K5(){return new Mt(this._enter||this._groups.map(ME),this._parents)}function Mu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Mu.prototype={constructor:Mu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function G5(e){return function(){return e}}function q5(e,t,n,r,s,i){for(var o=0,l,c=t.length,u=i.length;o<u;++o)(l=t[o])?(l.__data__=i[o],r[o]=l):n[o]=new Mu(e,i[o]);for(;o<c;++o)(l=t[o])&&(s[o]=l)}function Y5(e,t,n,r,s,i,o){var l,c,u=new Map,d=t.length,f=i.length,h=new Array(d),p;for(l=0;l<d;++l)(c=t[l])&&(h[l]=p=o.call(c,c.__data__,l,t)+"",u.has(p)?s[l]=c:u.set(p,c));for(l=0;l<f;++l)p=o.call(e,i[l],l,i)+"",(c=u.get(p))?(r[l]=c,c.__data__=i[l],u.delete(p)):n[l]=new Mu(e,i[l]);for(l=0;l<d;++l)(c=t[l])&&u.get(h[l])===c&&(s[l]=c)}function X5(e){return e.__data__}function Q5(e,t){if(!arguments.length)return Array.from(this,X5);var n=t?Y5:q5,r=this._parents,s=this._groups;typeof e!="function"&&(e=G5(e));for(var i=s.length,o=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var d=r[u],f=s[u],h=f.length,p=Z5(e.call(d,d&&d.__data__,u,r)),g=p.length,x=l[u]=new Array(g),_=o[u]=new Array(g),v=c[u]=new Array(h);n(d,f,x,_,v,p,t);for(var y=0,m=0,b,j;y<g;++y)if(b=x[y]){for(y>=m&&(m=y+1);!(j=_[m])&&++m<g;);b._next=j||null}}return o=new Mt(o,r),o._enter=l,o._exit=c,o}function Z5(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function J5(){return new Mt(this._exit||this._groups.map(ME),this._parents)}function eB(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function tB(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,o=Math.min(s,i),l=new Array(s),c=0;c<o;++c)for(var u=n[c],d=r[c],f=u.length,h=l[c]=new Array(f),p,g=0;g<f;++g)(p=u[g]||d[g])&&(h[g]=p);for(;c<s;++c)l[c]=n[c];return new Mt(l,this._parents)}function nB(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function rB(e){e||(e=sB);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],l=o.length,c=s[i]=new Array(l),u,d=0;d<l;++d)(u=o[d])&&(c[d]=u);c.sort(t)}return new Mt(s,this._parents).order()}function sB(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function iB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function oB(){return Array.from(this)}function aB(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function lB(){let e=0;for(const t of this)++e;return e}function cB(){return!this.node()}function uB(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,o=s.length,l;i<o;++i)(l=s[i])&&e.call(l,l.__data__,i,s);return this}function dB(e){return function(){this.removeAttribute(e)}}function fB(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hB(e,t){return function(){this.setAttribute(e,t)}}function pB(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function mB(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function gB(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function vB(e,t){var n=Md(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?fB:dB:typeof t=="function"?n.local?gB:mB:n.local?pB:hB)(n,t))}function OE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yB(e){return function(){this.style.removeProperty(e)}}function xB(e,t,n){return function(){this.style.setProperty(e,t,n)}}function _B(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function wB(e,t,n){return arguments.length>1?this.each((t==null?yB:typeof t=="function"?_B:xB)(e,t,n??"")):Yi(this.node(),e)}function Yi(e,t){return e.style.getPropertyValue(t)||OE(e).getComputedStyle(e,null).getPropertyValue(t)}function bB(e){return function(){delete this[e]}}function jB(e,t){return function(){this[e]=t}}function SB(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function kB(e,t){return arguments.length>1?this.each((t==null?bB:typeof t=="function"?SB:jB)(e,t)):this.node()[e]}function LE(e){return e.trim().split(/^|\s+/)}function Fv(e){return e.classList||new $E(e)}function $E(e){this._node=e,this._names=LE(e.getAttribute("class")||"")}$E.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function DE(e,t){for(var n=Fv(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function zE(e,t){for(var n=Fv(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function NB(e){return function(){DE(this,e)}}function EB(e){return function(){zE(this,e)}}function CB(e,t){return function(){(t.apply(this,arguments)?DE:zE)(this,e)}}function TB(e,t){var n=LE(e+"");if(arguments.length<2){for(var r=Fv(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?CB:t?NB:EB)(n,t))}function PB(){this.textContent=""}function AB(e){return function(){this.textContent=e}}function RB(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function IB(e){return arguments.length?this.each(e==null?PB:(typeof e=="function"?RB:AB)(e)):this.node().textContent}function MB(){this.innerHTML=""}function OB(e){return function(){this.innerHTML=e}}function LB(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function $B(e){return arguments.length?this.each(e==null?MB:(typeof e=="function"?LB:OB)(e)):this.node().innerHTML}function DB(){this.nextSibling&&this.parentNode.appendChild(this)}function zB(){return this.each(DB)}function FB(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function VB(){return this.each(FB)}function BB(e){var t=typeof e=="function"?e:PE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function UB(){return null}function HB(e,t){var n=typeof e=="function"?e:PE(e),r=t==null?UB:typeof t=="function"?t:zv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function WB(){var e=this.parentNode;e&&e.removeChild(this)}function KB(){return this.each(WB)}function GB(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qB(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function YB(e){return this.select(e?qB:GB)}function XB(e){return arguments.length?this.property("__data__",e):this.node().__data__}function QB(e){return function(t){e.call(this,t,this.__data__)}}function ZB(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function JB(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function e6(e,t,n){return function(){var r=this.__on,s,i=QB(t);if(r){for(var o=0,l=r.length;o<l;++o)if((s=r[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function t6(e,t,n){var r=ZB(e+""),s,i=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,d;c<u;++c)for(s=0,d=l[c];s<i;++s)if((o=r[s]).type===d.type&&o.name===d.name)return d.value}return}for(l=t?e6:JB,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function FE(e,t,n){var r=OE(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function n6(e,t){return function(){return FE(this,e,t)}}function r6(e,t){return function(){return FE(this,e,t.apply(this,arguments))}}function s6(e,t){return this.each((typeof t=="function"?r6:n6)(e,t))}function*i6(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var VE=[null];function Mt(e,t){this._groups=e,this._parents=t}function hl(){return new Mt([[document.documentElement]],VE)}function o6(){return this}Mt.prototype=hl.prototype={constructor:Mt,select:R5,selectAll:L5,selectChild:F5,selectChildren:H5,filter:W5,data:Q5,enter:K5,exit:J5,join:eB,merge:tB,selection:o6,order:nB,sort:rB,call:iB,nodes:oB,node:aB,size:lB,empty:cB,each:uB,attr:vB,style:wB,property:kB,classed:TB,text:IB,html:$B,raise:zB,lower:VB,append:BB,insert:HB,remove:KB,clone:YB,datum:XB,on:t6,dispatch:s6,[Symbol.iterator]:i6};function Nt(e){return typeof e=="string"?new Mt([[document.querySelector(e)]],[document.documentElement]):new Mt([[e]],VE)}function a6(e){let t;for(;t=e.sourceEvent;)e=t;return e}function un(e,t){if(e=a6(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const l6={passive:!1},Da={capture:!0,passive:!1};function Zf(e){e.stopImmediatePropagation()}function Pi(e){e.preventDefault(),e.stopImmediatePropagation()}function BE(e){var t=e.document.documentElement,n=Nt(e).on("dragstart.drag",Pi,Da);"onselectstart"in t?n.on("selectstart.drag",Pi,Da):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function UE(e,t){var n=e.document.documentElement,r=Nt(e).on("dragstart.drag",null);t&&(r.on("click.drag",Pi,Da),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const ql=e=>()=>e;function am(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:o,y:l,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}am.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function c6(e){return!e.ctrlKey&&!e.button}function u6(){return this.parentNode}function d6(e,t){return t??{x:e.x,y:e.y}}function f6(){return navigator.maxTouchPoints||"ontouchstart"in this}function HE(){var e=c6,t=u6,n=d6,r=f6,s={},i=Id("start","drag","end"),o=0,l,c,u,d,f=0;function h(b){b.on("mousedown.drag",p).filter(r).on("touchstart.drag",_).on("touchmove.drag",v,l6).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(b,j){if(!(d||!e.call(this,b,j))){var k=m(this,t.call(this,b,j),b,j,"mouse");k&&(Nt(b.view).on("mousemove.drag",g,Da).on("mouseup.drag",x,Da),BE(b.view),Zf(b),u=!1,l=b.clientX,c=b.clientY,k("start",b))}}function g(b){if(Pi(b),!u){var j=b.clientX-l,k=b.clientY-c;u=j*j+k*k>f}s.mouse("drag",b)}function x(b){Nt(b.view).on("mousemove.drag mouseup.drag",null),UE(b.view,u),Pi(b),s.mouse("end",b)}function _(b,j){if(e.call(this,b,j)){var k=b.changedTouches,S=t.call(this,b,j),N=k.length,R,O;for(R=0;R<N;++R)(O=m(this,S,b,j,k[R].identifier,k[R]))&&(Zf(b),O("start",b,k[R]))}}function v(b){var j=b.changedTouches,k=j.length,S,N;for(S=0;S<k;++S)(N=s[j[S].identifier])&&(Pi(b),N("drag",b,j[S]))}function y(b){var j=b.changedTouches,k=j.length,S,N;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),S=0;S<k;++S)(N=s[j[S].identifier])&&(Zf(b),N("end",b,j[S]))}function m(b,j,k,S,N,R){var O=i.copy(),D=un(R||k,j),M,z,T;if((T=n.call(b,new am("beforestart",{sourceEvent:k,target:h,identifier:N,active:o,x:D[0],y:D[1],dx:0,dy:0,dispatch:O}),S))!=null)return M=T.x-D[0]||0,z=T.y-D[1]||0,function E(A,P,I){var C=D,L;switch(A){case"start":s[N]=E,L=o++;break;case"end":delete s[N],--o;case"drag":D=un(I||P,j),L=o;break}O.call(A,b,new am(A,{sourceEvent:P,subject:T,target:h,identifier:N,active:L,x:D[0]+M,y:D[1]+z,dx:D[0]-C[0],dy:D[1]-C[1],dispatch:O}),S)}}return h.filter=function(b){return arguments.length?(e=typeof b=="function"?b:ql(!!b),h):e},h.container=function(b){return arguments.length?(t=typeof b=="function"?b:ql(b),h):t},h.subject=function(b){return arguments.length?(n=typeof b=="function"?b:ql(b),h):n},h.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:ql(!!b),h):r},h.on=function(){var b=i.on.apply(i,arguments);return b===i?h:b},h.clickDistance=function(b){return arguments.length?(f=(b=+b)*b,h):Math.sqrt(f)},h}function Vv(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function WE(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function pl(){}var za=.7,Ou=1/za,Ai="\\s*([+-]?\\d+)\\s*",Fa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Un="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",h6=/^#([0-9a-f]{3,8})$/,p6=new RegExp(`^rgb\\(${Ai},${Ai},${Ai}\\)$`),m6=new RegExp(`^rgb\\(${Un},${Un},${Un}\\)$`),g6=new RegExp(`^rgba\\(${Ai},${Ai},${Ai},${Fa}\\)$`),v6=new RegExp(`^rgba\\(${Un},${Un},${Un},${Fa}\\)$`),y6=new RegExp(`^hsl\\(${Fa},${Un},${Un}\\)$`),x6=new RegExp(`^hsla\\(${Fa},${Un},${Un},${Fa}\\)$`),V0={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};Vv(pl,$s,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:B0,formatHex:B0,formatHex8:_6,formatHsl:w6,formatRgb:U0,toString:U0});function B0(){return this.rgb().formatHex()}function _6(){return this.rgb().formatHex8()}function w6(){return KE(this).formatHsl()}function U0(){return this.rgb().formatRgb()}function $s(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=h6.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?H0(t):n===3?new vt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Yl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Yl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=p6.exec(e))?new vt(t[1],t[2],t[3],1):(t=m6.exec(e))?new vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=g6.exec(e))?Yl(t[1],t[2],t[3],t[4]):(t=v6.exec(e))?Yl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=y6.exec(e))?G0(t[1],t[2]/100,t[3]/100,1):(t=x6.exec(e))?G0(t[1],t[2]/100,t[3]/100,t[4]):V0.hasOwnProperty(e)?H0(V0[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function H0(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function Yl(e,t,n,r){return r<=0&&(e=t=n=NaN),new vt(e,t,n,r)}function b6(e){return e instanceof pl||(e=$s(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function lm(e,t,n,r){return arguments.length===1?b6(e):new vt(e,t,n,r??1)}function vt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Vv(vt,lm,WE(pl,{brighter(e){return e=e==null?Ou:Math.pow(Ou,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?za:Math.pow(za,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(ks(this.r),ks(this.g),ks(this.b),Lu(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:W0,formatHex:W0,formatHex8:j6,formatRgb:K0,toString:K0}));function W0(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}`}function j6(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}${_s((isNaN(this.opacity)?1:this.opacity)*255)}`}function K0(){const e=Lu(this.opacity);return`${e===1?"rgb(":"rgba("}${ks(this.r)}, ${ks(this.g)}, ${ks(this.b)}${e===1?")":`, ${e})`}`}function Lu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ks(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _s(e){return e=ks(e),(e<16?"0":"")+e.toString(16)}function G0(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new hn(e,t,n,r)}function KE(e){if(e instanceof hn)return new hn(e.h,e.s,e.l,e.opacity);if(e instanceof pl||(e=$s(e)),!e)return new hn;if(e instanceof hn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new hn(o,l,c,e.opacity)}function S6(e,t,n,r){return arguments.length===1?KE(e):new hn(e,t,n,r??1)}function hn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Vv(hn,S6,WE(pl,{brighter(e){return e=e==null?Ou:Math.pow(Ou,e),new hn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?za:Math.pow(za,e),new hn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new vt(Jf(e>=240?e-240:e+120,s,r),Jf(e,s,r),Jf(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new hn(q0(this.h),Xl(this.s),Xl(this.l),Lu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Lu(this.opacity);return`${e===1?"hsl(":"hsla("}${q0(this.h)}, ${Xl(this.s)*100}%, ${Xl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function q0(e){return e=(e||0)%360,e<0?e+360:e}function Xl(e){return Math.max(0,Math.min(1,e||0))}function Jf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Bv=e=>()=>e;function k6(e,t){return function(n){return e+n*t}}function N6(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function E6(e){return(e=+e)==1?GE:function(t,n){return n-t?N6(t,n,e):Bv(isNaN(t)?n:t)}}function GE(e,t){var n=t-e;return n?k6(e,n):Bv(isNaN(e)?t:e)}const $u=function e(t){var n=E6(t);function r(s,i){var o=n((s=lm(s)).r,(i=lm(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=GE(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function C6(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function T6(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function P6(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=ia(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(l){for(o=0;o<r;++o)i[o]=s[o](l);return i}}function A6(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function An(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function R6(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=ia(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var cm=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,eh=new RegExp(cm.source,"g");function I6(e){return function(){return e}}function M6(e){return function(t){return e(t)+""}}function qE(e,t){var n=cm.lastIndex=eh.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=cm.exec(e))&&(s=eh.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:An(r,s)})),n=eh.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?M6(c[0].x):I6(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function ia(e,t){var n=typeof t,r;return t==null||n==="boolean"?Bv(t):(n==="number"?An:n==="string"?(r=$s(t))?(t=r,$u):qE:t instanceof $s?$u:t instanceof Date?A6:T6(t)?C6:Array.isArray(t)?P6:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?R6:An)(e,t)}var Y0=180/Math.PI,um={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function YE(e,t,n,r,s,i){var o,l,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*Y0,skewX:Math.atan(c)*Y0,scaleX:o,scaleY:l}}var Ql;function O6(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?um:YE(t.a,t.b,t.c,t.d,t.e,t.f)}function L6(e){return e==null||(Ql||(Ql=document.createElementNS("http://www.w3.org/2000/svg","g")),Ql.setAttribute("transform",e),!(e=Ql.transform.baseVal.consolidate()))?um:(e=e.matrix,YE(e.a,e.b,e.c,e.d,e.e,e.f))}function XE(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,d,f,h,p,g){if(u!==f||d!==h){var x=p.push("translate(",null,t,null,n);g.push({i:x-4,x:An(u,f)},{i:x-2,x:An(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function o(u,d,f,h){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,r)-2,x:An(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function l(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,r)-2,x:An(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,h,p,g){if(u!==f||d!==h){var x=p.push(s(p)+"scale(",null,",",null,")");g.push({i:x-4,x:An(u,f)},{i:x-2,x:An(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,f,h),o(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var g=-1,x=h.length,_;++g<x;)f[(_=h[g]).i]=_.x(p);return f.join("")}}}var $6=XE(O6,"px, ","px)","deg)"),D6=XE(L6,", ",")",")"),z6=1e-12;function X0(e){return((e=Math.exp(e))+1/e)/2}function F6(e){return((e=Math.exp(e))-1/e)/2}function V6(e){return((e=Math.exp(2*e))-1)/(e+1)}const Oc=function e(t,n,r){function s(i,o){var l=i[0],c=i[1],u=i[2],d=o[0],f=o[1],h=o[2],p=d-l,g=f-c,x=p*p+g*g,_,v;if(x<z6)v=Math.log(h/u)/t,_=function(S){return[l+S*p,c+S*g,u*Math.exp(t*S*v)]};else{var y=Math.sqrt(x),m=(h*h-u*u+r*x)/(2*u*n*y),b=(h*h-u*u-r*x)/(2*h*n*y),j=Math.log(Math.sqrt(m*m+1)-m),k=Math.log(Math.sqrt(b*b+1)-b);v=(k-j)/t,_=function(S){var N=S*v,R=X0(j),O=u/(n*y)*(R*V6(t*N+j)-F6(j));return[l+O*p,c+O*g,u*R/X0(t*N+j)]}}return _.duration=v*1e3*t/Math.SQRT2,_}return s.rho=function(i){var o=Math.max(.001,+i),l=o*o,c=l*l;return e(o,l,c)},s}(Math.SQRT2,2,4);var Xi=0,Fo=0,To=0,QE=1e3,Du,Vo,zu=0,Ds=0,Od=0,Va=typeof performance=="object"&&performance.now?performance:Date,ZE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Uv(){return Ds||(ZE(B6),Ds=Va.now()+Od)}function B6(){Ds=0}function Fu(){this._call=this._time=this._next=null}Fu.prototype=JE.prototype={constructor:Fu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Uv():+n)+(t==null?0:+t),!this._next&&Vo!==this&&(Vo?Vo._next=this:Du=this,Vo=this),this._call=e,this._time=n,dm()},stop:function(){this._call&&(this._call=null,this._time=1/0,dm())}};function JE(e,t,n){var r=new Fu;return r.restart(e,t,n),r}function U6(){Uv(),++Xi;for(var e=Du,t;e;)(t=Ds-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Xi}function Q0(){Ds=(zu=Va.now())+Od,Xi=Fo=0;try{U6()}finally{Xi=0,W6(),Ds=0}}function H6(){var e=Va.now(),t=e-zu;t>QE&&(Od-=t,zu=e)}function W6(){for(var e,t=Du,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Du=n);Vo=e,dm(r)}function dm(e){if(!Xi){Fo&&(Fo=clearTimeout(Fo));var t=e-Ds;t>24?(e<1/0&&(Fo=setTimeout(Q0,e-Va.now()-Od)),To&&(To=clearInterval(To))):(To||(zu=Va.now(),To=setInterval(H6,QE)),Xi=1,ZE(Q0))}}function Z0(e,t,n){var r=new Fu;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var K6=Id("start","end","cancel","interrupt"),G6=[],eC=0,J0=1,fm=2,Lc=3,ew=4,hm=5,$c=6;function Ld(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;q6(e,n,{name:t,index:r,group:s,on:K6,tween:G6,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:eC})}function Hv(e,t){var n=kn(e,t);if(n.state>eC)throw new Error("too late; already scheduled");return n}function Hn(e,t){var n=kn(e,t);if(n.state>Lc)throw new Error("too late; already running");return n}function kn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function q6(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=JE(i,0,n.time);function i(u){n.state=J0,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var d,f,h,p;if(n.state!==J0)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===Lc)return Z0(o);p.state===ew?(p.state=$c,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+d<t&&(p.state=$c,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[d])}if(Z0(function(){n.state===Lc&&(n.state=ew,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=fm,n.on.call("start",e,e.__data__,n.index,n.group),n.state===fm){for(n.state=Lc,s=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(s[++f]=p);s.length=f+1}}function l(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=hm,1),f=-1,h=s.length;++f<h;)s[f].call(e,d);n.state===hm&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=$c,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Dc(e,t){var n=e.__transition,r,s,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}s=r.state>fm&&r.state<hm,r.state=$c,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function Y6(e){return this.each(function(){Dc(this,e)})}function X6(e,t){var n,r;return function(){var s=Hn(this,e),i=s.tween;if(i!==n){r=n=i;for(var o=0,l=r.length;o<l;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function Q6(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Hn(this,e),o=i.tween;if(o!==r){s=(r=o).slice();for(var l={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=l;break}c===u&&s.push(l)}i.tween=s}}function Z6(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=kn(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===e)return o.value;return null}return this.each((t==null?X6:Q6)(n,e,t))}function Wv(e,t,n){var r=e._id;return e.each(function(){var s=Hn(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return kn(s,r).value[t]}}function tC(e,t){var n;return(typeof t=="number"?An:t instanceof $s?$u:(n=$s(t))?(t=n,$u):qE)(e,t)}function J6(e){return function(){this.removeAttribute(e)}}function e8(e){return function(){this.removeAttributeNS(e.space,e.local)}}function t8(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttribute(e);return o===s?null:o===r?i:i=t(r=o,n)}}function n8(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===r?i:i=t(r=o,n)}}function r8(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function s8(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function i8(e,t){var n=Md(e),r=n==="transform"?D6:tC;return this.attrTween(e,typeof t=="function"?(n.local?s8:r8)(n,r,Wv(this,"attr."+e,t)):t==null?(n.local?e8:J6)(n):(n.local?n8:t8)(n,r,t))}function o8(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function a8(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function l8(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&a8(e,i)),n}return s._value=t,s}function c8(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&o8(e,i)),n}return s._value=t,s}function u8(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Md(e);return this.tween(n,(r.local?l8:c8)(r,t))}function d8(e,t){return function(){Hv(this,e).delay=+t.apply(this,arguments)}}function f8(e,t){return t=+t,function(){Hv(this,e).delay=t}}function h8(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?d8:f8)(t,e)):kn(this.node(),t).delay}function p8(e,t){return function(){Hn(this,e).duration=+t.apply(this,arguments)}}function m8(e,t){return t=+t,function(){Hn(this,e).duration=t}}function g8(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?p8:m8)(t,e)):kn(this.node(),t).duration}function v8(e,t){if(typeof t!="function")throw new Error;return function(){Hn(this,e).ease=t}}function y8(e){var t=this._id;return arguments.length?this.each(v8(t,e)):kn(this.node(),t).ease}function x8(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Hn(this,e).ease=n}}function _8(e){if(typeof e!="function")throw new Error;return this.each(x8(this._id,e))}function w8(e){typeof e!="function"&&(e=RE(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new br(r,this._parents,this._name,this._id)}function b8(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),o=new Array(r),l=0;l<i;++l)for(var c=t[l],u=n[l],d=c.length,f=o[l]=new Array(d),h,p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;l<r;++l)o[l]=t[l];return new br(o,this._parents,this._name,this._id)}function j8(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function S8(e,t,n){var r,s,i=j8(t)?Hv:Hn;return function(){var o=i(this,e),l=o.on;l!==r&&(s=(r=l).copy()).on(t,n),o.on=s}}function k8(e,t){var n=this._id;return arguments.length<2?kn(this.node(),n).on.on(e):this.each(S8(n,e,t))}function N8(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function E8(){return this.on("end.remove",N8(this._id))}function C8(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zv(e));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var l=r[o],c=l.length,u=i[o]=new Array(c),d,f,h=0;h<c;++h)(d=l[h])&&(f=e.call(d,d.__data__,h,l))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f,Ld(u[h],t,n,h,u,kn(d,n)));return new br(i,this._parents,t,n)}function T8(e){var t=this._name,n=this._id;typeof e!="function"&&(e=AE(e));for(var r=this._groups,s=r.length,i=[],o=[],l=0;l<s;++l)for(var c=r[l],u=c.length,d,f=0;f<u;++f)if(d=c[f]){for(var h=e.call(d,d.__data__,f,c),p,g=kn(d,n),x=0,_=h.length;x<_;++x)(p=h[x])&&Ld(p,t,n,x,h,g);i.push(h),o.push(d)}return new br(i,o,t,n)}var P8=hl.prototype.constructor;function A8(){return new P8(this._groups,this._parents)}function R8(e,t){var n,r,s;return function(){var i=Yi(this,e),o=(this.style.removeProperty(e),Yi(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function nC(e){return function(){this.style.removeProperty(e)}}function I8(e,t,n){var r,s=n+"",i;return function(){var o=Yi(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function M8(e,t,n){var r,s,i;return function(){var o=Yi(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Yi(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l))}}function O8(e,t){var n,r,s,i="style."+t,o="end."+i,l;return function(){var c=Hn(this,e),u=c.on,d=c.value[i]==null?l||(l=nC(t)):void 0;(u!==n||s!==d)&&(r=(n=u).copy()).on(o,s=d),c.on=r}}function L8(e,t,n){var r=(e+="")=="transform"?$6:tC;return t==null?this.styleTween(e,R8(e,r)).on("end.style."+e,nC(e)):typeof t=="function"?this.styleTween(e,M8(e,r,Wv(this,"style."+e,t))).each(O8(this._id,e)):this.styleTween(e,I8(e,r,t),n).on("end.style."+e,null)}function $8(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function D8(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&$8(e,o,n)),r}return i._value=t,i}function z8(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,D8(e,t,n??""))}function F8(e){return function(){this.textContent=e}}function V8(e){return function(){var t=e(this);this.textContent=t??""}}function B8(e){return this.tween("text",typeof e=="function"?V8(Wv(this,"text",e)):F8(e==null?"":e+""))}function U8(e){return function(t){this.textContent=e.call(this,t)}}function H8(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&U8(s)),t}return r._value=e,r}function W8(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,H8(e))}function K8(){for(var e=this._name,t=this._id,n=rC(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)if(c=o[u]){var d=kn(c,t);Ld(c,e,n,u,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new br(r,this._parents,e,n)}function G8(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var l={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var u=Hn(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var q8=0;function br(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function rC(){return++q8}var Yn=hl.prototype;br.prototype={constructor:br,select:C8,selectAll:T8,selectChild:Yn.selectChild,selectChildren:Yn.selectChildren,filter:w8,merge:b8,selection:A8,transition:K8,call:Yn.call,nodes:Yn.nodes,node:Yn.node,size:Yn.size,empty:Yn.empty,each:Yn.each,on:k8,attr:i8,attrTween:u8,style:L8,styleTween:z8,text:B8,textTween:W8,remove:E8,tween:Z6,delay:h8,duration:g8,ease:y8,easeVarying:_8,end:G8,[Symbol.iterator]:Yn[Symbol.iterator]};function Y8(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var X8={time:null,delay:0,duration:250,ease:Y8};function Q8(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Z8(e){var t,n;e instanceof br?(t=e._id,e=e._name):(t=rC(),(n=X8).time=Uv(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&Ld(c,e,t,u,o,n||Q8(c,t));return new br(r,this._parents,e,t)}hl.prototype.interrupt=Y6;hl.prototype.transition=Z8;const Zl=e=>()=>e;function J8(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function sr(e,t,n){this.k=e,this.x=t,this.y=n}sr.prototype={constructor:sr,scale:function(e){return e===1?this:new sr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new sr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $d=new sr(1,0,0);sC.prototype=sr.prototype;function sC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $d;return e.__zoom}function th(e){e.stopImmediatePropagation()}function Po(e){e.preventDefault(),e.stopImmediatePropagation()}function eU(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function tU(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function tw(){return this.__zoom||$d}function nU(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function rU(){return navigator.maxTouchPoints||"ontouchstart"in this}function sU(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function iC(){var e=eU,t=tU,n=sU,r=nU,s=rU,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Oc,u=Id("start","zoom","end"),d,f,h,p=500,g=150,x=0,_=10;function v(T){T.property("__zoom",tw).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",O).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(T,E,A,P){var I=T.selection?T.selection():T;I.property("__zoom",tw),T!==I?j(T,E,A,P):I.interrupt().each(function(){k(this,arguments).event(P).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},v.scaleBy=function(T,E,A,P){v.scaleTo(T,function(){var I=this.__zoom.k,C=typeof E=="function"?E.apply(this,arguments):E;return I*C},A,P)},v.scaleTo=function(T,E,A,P){v.transform(T,function(){var I=t.apply(this,arguments),C=this.__zoom,L=A==null?b(I):typeof A=="function"?A.apply(this,arguments):A,F=C.invert(L),V=typeof E=="function"?E.apply(this,arguments):E;return n(m(y(C,V),L,F),I,o)},A,P)},v.translateBy=function(T,E,A,P){v.transform(T,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),o)},null,P)},v.translateTo=function(T,E,A,P,I){v.transform(T,function(){var C=t.apply(this,arguments),L=this.__zoom,F=P==null?b(C):typeof P=="function"?P.apply(this,arguments):P;return n($d.translate(F[0],F[1]).scale(L.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof A=="function"?-A.apply(this,arguments):-A),C,o)},P,I)};function y(T,E){return E=Math.max(i[0],Math.min(i[1],E)),E===T.k?T:new sr(E,T.x,T.y)}function m(T,E,A){var P=E[0]-A[0]*T.k,I=E[1]-A[1]*T.k;return P===T.x&&I===T.y?T:new sr(T.k,P,I)}function b(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function j(T,E,A,P){T.on("start.zoom",function(){k(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(P).end()}).tween("zoom",function(){var I=this,C=arguments,L=k(I,C).event(P),F=t.apply(I,C),V=A==null?b(F):typeof A=="function"?A.apply(I,C):A,H=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),U=I.__zoom,W=typeof E=="function"?E.apply(I,C):E,G=c(U.invert(V).concat(H/U.k),W.invert(V).concat(H/W.k));return function(Y){if(Y===1)Y=W;else{var K=G(Y),X=H/K[2];Y=new sr(X,V[0]-K[0]*X,V[1]-K[1]*X)}L.zoom(null,Y)}})}function k(T,E,A){return!A&&T.__zooming||new S(T,E)}function S(T,E){this.that=T,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,E),this.taps=0}S.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,E){return this.mouse&&T!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var E=Nt(this.that).datum();u.call(T,this.that,new J8(T,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:u}),E)}};function N(T,...E){if(!e.apply(this,arguments))return;var A=k(this,E).event(T),P=this.__zoom,I=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,r.apply(this,arguments)))),C=un(T);if(A.wheel)(A.mouse[0][0]!==C[0]||A.mouse[0][1]!==C[1])&&(A.mouse[1]=P.invert(A.mouse[0]=C)),clearTimeout(A.wheel);else{if(P.k===I)return;A.mouse=[C,P.invert(C)],Dc(this),A.start()}Po(T),A.wheel=setTimeout(L,g),A.zoom("mouse",n(m(y(P,I),A.mouse[0],A.mouse[1]),A.extent,o));function L(){A.wheel=null,A.end()}}function R(T,...E){if(h||!e.apply(this,arguments))return;var A=T.currentTarget,P=k(this,E,!0).event(T),I=Nt(T.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",H,!0),C=un(T,A),L=T.clientX,F=T.clientY;BE(T.view),th(T),P.mouse=[C,this.__zoom.invert(C)],Dc(this),P.start();function V(U){if(Po(U),!P.moved){var W=U.clientX-L,G=U.clientY-F;P.moved=W*W+G*G>x}P.event(U).zoom("mouse",n(m(P.that.__zoom,P.mouse[0]=un(U,A),P.mouse[1]),P.extent,o))}function H(U){I.on("mousemove.zoom mouseup.zoom",null),UE(U.view,P.moved),Po(U),P.event(U).end()}}function O(T,...E){if(e.apply(this,arguments)){var A=this.__zoom,P=un(T.changedTouches?T.changedTouches[0]:T,this),I=A.invert(P),C=A.k*(T.shiftKey?.5:2),L=n(m(y(A,C),P,I),t.apply(this,E),o);Po(T),l>0?Nt(this).transition().duration(l).call(j,L,P,T):Nt(this).call(v.transform,L,P,T)}}function D(T,...E){if(e.apply(this,arguments)){var A=T.touches,P=A.length,I=k(this,E,T.changedTouches.length===P).event(T),C,L,F,V;for(th(T),L=0;L<P;++L)F=A[L],V=un(F,this),V=[V,this.__zoom.invert(V),F.identifier],I.touch0?!I.touch1&&I.touch0[2]!==V[2]&&(I.touch1=V,I.taps=0):(I.touch0=V,C=!0,I.taps=1+!!d);d&&(d=clearTimeout(d)),C&&(I.taps<2&&(f=V[0],d=setTimeout(function(){d=null},p)),Dc(this),I.start())}}function M(T,...E){if(this.__zooming){var A=k(this,E).event(T),P=T.changedTouches,I=P.length,C,L,F,V;for(Po(T),C=0;C<I;++C)L=P[C],F=un(L,this),A.touch0&&A.touch0[2]===L.identifier?A.touch0[0]=F:A.touch1&&A.touch1[2]===L.identifier&&(A.touch1[0]=F);if(L=A.that.__zoom,A.touch1){var H=A.touch0[0],U=A.touch0[1],W=A.touch1[0],G=A.touch1[1],Y=(Y=W[0]-H[0])*Y+(Y=W[1]-H[1])*Y,K=(K=G[0]-U[0])*K+(K=G[1]-U[1])*K;L=y(L,Math.sqrt(Y/K)),F=[(H[0]+W[0])/2,(H[1]+W[1])/2],V=[(U[0]+G[0])/2,(U[1]+G[1])/2]}else if(A.touch0)F=A.touch0[0],V=A.touch0[1];else return;A.zoom("touch",n(m(L,F,V),A.extent,o))}}function z(T,...E){if(this.__zooming){var A=k(this,E).event(T),P=T.changedTouches,I=P.length,C,L;for(th(T),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),C=0;C<I;++C)L=P[C],A.touch0&&A.touch0[2]===L.identifier?delete A.touch0:A.touch1&&A.touch1[2]===L.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(L=un(L,this),Math.hypot(f[0]-L[0],f[1]-L[1])<_)){var F=Nt(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return v.wheelDelta=function(T){return arguments.length?(r=typeof T=="function"?T:Zl(+T),v):r},v.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Zl(!!T),v):e},v.touchable=function(T){return arguments.length?(s=typeof T=="function"?T:Zl(!!T),v):s},v.extent=function(T){return arguments.length?(t=typeof T=="function"?T:Zl([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),v):t},v.scaleExtent=function(T){return arguments.length?(i[0]=+T[0],i[1]=+T[1],v):[i[0],i[1]]},v.translateExtent=function(T){return arguments.length?(o[0][0]=+T[0][0],o[1][0]=+T[1][0],o[0][1]=+T[0][1],o[1][1]=+T[1][1],v):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},v.constrain=function(T){return arguments.length?(n=T,v):n},v.duration=function(T){return arguments.length?(l=+T,v):l},v.interpolate=function(T){return arguments.length?(c=T,v):c},v.on=function(){var T=u.on.apply(u,arguments);return T===u?v:T},v.clickDistance=function(T){return arguments.length?(x=(T=+T)*T,v):Math.sqrt(x)},v.tapDistance=function(T){return arguments.length?(_=+T,v):_},v}const jn={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Ba=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],oC=["Enter"," ","Escape"],aC={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Qi;(function(e){e.Strict="strict",e.Loose="loose"})(Qi||(Qi={}));var Ns;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ns||(Ns={}));var Ua;(function(e){e.Partial="partial",e.Full="full"})(Ua||(Ua={}));const lC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Mr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Mr||(Mr={}));var Vu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Vu||(Vu={}));var ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ne||(ne={}));const nw={[ne.Left]:ne.Right,[ne.Right]:ne.Left,[ne.Top]:ne.Bottom,[ne.Bottom]:ne.Top};function cC(e){return e===null?null:e?"valid":"invalid"}const uC=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,iU=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Kv=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ml=(e,t=[0,0])=>{const{width:n,height:r}=Wn(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},oU=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let o=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(o=i?t.nodeLookup.get(s):Kv(s)?s:t.nodeLookup.get(s.id));const l=o?Bu(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Dd(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zd(n)},gl=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Dd(n,Bu(s)),r=!0)}),r?zd(n):{x:0,y:0,width:0,height:0}},Gv=(e,t,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const l=(t.x-n)/s,c=(t.y-r)/s,u=t.width/s,d=t.height/s,f=[];for(const h of e.values()){const{measured:p,selectable:g=!0,hidden:x=!1}=h;if(o&&!g||x)continue;const _=p.width??h.width??h.initialWidth??0,v=p.height??h.height??h.initialHeight??0,{x:y,y:m}=h.internals.positionAbsolute,b=pC(l,c,u,d,y,m,_,v),j=_*v,k=i&&b>0;(!h.internals.handleBounds||k||b>=j||h.dragging)&&f.push(h)}return f},aU=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function lU(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{let i;if(t!=null&&t.includeHiddenNodes){const{width:o,height:l}=Wn(s);i=o>0&&l>0}else i=!!(s.measured.width&&s.measured.height&&!s.hidden);i&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function cU({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return!0;const l=lU(e,o),c=gl(l),u=Yv(c,t,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(u,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),!0}function dC({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=o.origin??r;let f=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!l)i==null||i("005",jn.error005());else{const p=l.measured.width,g=l.measured.height;p&&g&&(f=[[c,u],[c+p,u+g]])}else l&&Fs(o.extent)&&(f=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const h=Fs(f)?zs(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",jn.error015())),{position:{x:h.x-c+(o.measured.width??0)*d[0],y:h.y-u+(o.measured.height??0)*d[1]},positionAbsolute:h}}async function uU({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(h=>h.id)),o=[];for(const h of n){if(h.deletable===!1)continue;const p=i.has(h.id),g=!p&&h.parentId&&o.find(x=>x.id===h.parentId);(p||g)&&o.push(h)}const l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=aU(o,c);for(const h of c)l.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:o};const f=await s({nodes:o,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:o}:{edges:[],nodes:[]}:f}const Zi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),zs=(e={x:0,y:0},t,n)=>({x:Zi(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Zi(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function fC(e,t,n){const{width:r,height:s}=Wn(n),{x:i,y:o}=n.internals.positionAbsolute;return zs(e,[[i,o],[i+r,o+s]],t)}const rw=(e,t,n)=>e<t?Zi(Math.abs(e-t),1,t)/t:e>n?-Zi(Math.abs(e-n),1,t)/t:0,qv=(e,t,n=15,r=40)=>{const s=rw(e.x,r,t.width-r)*n,i=rw(e.y,r,t.height-r)*n;return[s,i]},Dd=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),pm=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),zd=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ha=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Kv(e)?e.internals.positionAbsolute:ml(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Bu=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Kv(e)?e.internals.positionAbsolute:ml(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},hC=(e,t)=>zd(Dd(pm(e),pm(t))),pC=(e,t,n,r,s,i,o,l)=>{const c=Math.max(0,Math.min(e+n,s+o)-Math.max(e,s)),u=Math.max(0,Math.min(t+r,i+l)-Math.max(t,i));return Math.ceil(c*u)},Uu=(e,t)=>pC(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),sw=e=>pn(e.width)&&pn(e.height)&&pn(e.x)&&pn(e.y),pn=e=>!isNaN(e)&&isFinite(e),mC=(e,t)=>(n,r)=>{},vl=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yl=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?vl(l,o):l},Ji=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Js(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function dU(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Js(e,n),s=Js(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Js(e.top??e.y??0,n),s=Js(e.bottom??e.y??0,n),i=Js(e.left??e.x??0,t),o=Js(e.right??e.x??0,t);return{top:r,right:o,bottom:s,left:i,x:i+o,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function fU(e,t,n,r,s,i){const{x:o,y:l}=Ji(e,[t,n,r]),{x:c,y:u}=Ji({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,f=i-u;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const Yv=(e,t,n,r,s,i)=>{const o=dU(i,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(l,c),d=Zi(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,g=n/2-h*d,x=fU(e,p,g,d,t,n),_={left:Math.min(x.left-o.left,0),top:Math.min(x.top-o.top,0),right:Math.min(x.right-o.right,0),bottom:Math.min(x.bottom-o.bottom,0)};return{x:p-_.left+_.right,y:g-_.top+_.bottom,zoom:d}},Wa=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Fs(e){return e!=null&&e!=="parent"}function Wn(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function gC(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function vC(e,t={width:0,height:0},n,r,s){const i={...e},o=r.get(n);if(o){const l=o.origin||s;i.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function iw(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function hU(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function pU(e){return{...aC,...e||{}}}function oa(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=mn(e),l=yl({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?vl(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Xv=e=>({width:e.offsetWidth,height:e.offsetHeight}),yC=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},mU=["INPUT","SELECT","TEXTAREA"];function xC(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:mU.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const _C=e=>"clientX"in e,mn=(e,t)=>{var i,o;const n=_C(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},ow=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...Xv(o)}})};function wC({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:l}){const c=e*.125+s*.375+o*.375+n*.125,u=t*.125+i*.375+l*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function Jl(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function aw({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case ne.Left:return[t-Jl(t-r,i),n];case ne.Right:return[t+Jl(r-t,i),n];case ne.Top:return[t,n-Jl(n-s,i)];case ne.Bottom:return[t,n+Jl(s-n,i)]}}function bC({sourceX:e,sourceY:t,sourcePosition:n=ne.Bottom,targetX:r,targetY:s,targetPosition:i=ne.Top,curvature:o=.25}){const[l,c]=aw({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[u,d]=aw({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[f,h,p,g]=wC({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${r},${s}`,f,h,p,g]}function jC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,o=Math.abs(r-t)/2,l=r<t?r+o:r-o;return[i,l,s,o]}function gU({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const o=s&&n?r+1e3:r,l=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return o+l}function vU({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Dd(Bu(e),Bu(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return Uu(o,zd(i))>0}const yU=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,xU=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),_U=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",jn.error006()),t;const r=n.getEdgeId||yU;let s;return uC(e)?s={...e}:s={...e,id:r(e)},xU(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function SC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,l]=jC({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,l]}const lw={[ne.Left]:{x:-1,y:0},[ne.Right]:{x:1,y:0},[ne.Top]:{x:0,y:-1},[ne.Bottom]:{x:0,y:1}},wU=({source:e,sourcePosition:t=ne.Bottom,target:n})=>t===ne.Left||t===ne.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},cw=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function bU({source:e,sourcePosition:t=ne.Bottom,target:n,targetPosition:r=ne.Top,center:s,offset:i,stepPosition:o}){const l=lw[t],c=lw[r],u={x:e.x+l.x*i,y:e.y+l.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=wU({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let g=[],x,_;const v={x:0,y:0},y={x:0,y:0},[,,m,b]=jC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(x=s.x??u.x+(d.x-u.x)*o,_=s.y??(u.y+d.y)/2):(x=s.x??(u.x+d.x)/2,_=s.y??u.y+(d.y-u.y)*o);const N=[{x,y:u.y},{x,y:d.y}],R=[{x:u.x,y:_},{x:d.x,y:_}];l[h]===p?g=h==="x"?N:R:g=h==="x"?R:N}else{const N=[{x:u.x,y:d.y}],R=[{x:d.x,y:u.y}];if(h==="x"?g=l.x===p?R:N:g=l.y===p?N:R,t===r){const T=Math.abs(e[h]-n[h]);if(T<=i){const E=Math.min(i-1,i-T);l[h]===p?v[h]=(u[h]>e[h]?-1:1)*E:y[h]=(d[h]>n[h]?-1:1)*E}}if(t!==r){const T=h==="x"?"y":"x",E=l[h]===c[T],A=u[T]>d[T],P=u[T]<d[T];(l[h]===1&&(!E&&A||E&&P)||l[h]!==1&&(!E&&P||E&&A))&&(g=h==="x"?N:R)}const O={x:u.x+v.x,y:u.y+v.y},D={x:d.x+y.x,y:d.y+y.y},M=Math.max(Math.abs(O.x-g[0].x),Math.abs(D.x-g[0].x)),z=Math.max(Math.abs(O.y-g[0].y),Math.abs(D.y-g[0].y));M>=z?(x=(O.x+D.x)/2,_=g[0].y):(x=g[0].x,_=(O.y+D.y)/2)}const j={x:u.x+v.x,y:u.y+v.y},k={x:d.x+y.x,y:d.y+y.y};return[[e,...j.x!==g[0].x||j.y!==g[0].y?[j]:[],...g,...k.x!==g[g.length-1].x||k.y!==g[g.length-1].y?[k]:[],n],x,_,m,b]}function jU(e,t,n,r){const s=Math.min(cw(e,t)/2,cw(t,n)/2,r),{x:i,y:o}=t;if(e.x===i&&i===n.x||e.y===o&&o===n.y)return`L${i} ${o}`;if(e.y===o){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+s*u},${o}Q ${i},${o} ${i},${o+s*d}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*l},${o}`}function mm({sourceX:e,sourceY:t,sourcePosition:n=ne.Bottom,targetX:r,targetY:s,targetPosition:i=ne.Top,borderRadius:o=5,centerX:l,centerY:c,offset:u=20,stepPosition:d=.5}){const[f,h,p,g,x]=bU({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:d});let _=`M${f[0].x} ${f[0].y}`;for(let v=1;v<f.length-1;v++)_+=jU(f[v-1],f[v],f[v+1],o);return _+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[_,h,p,g,x]}function uw(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function SU(e){var f;const{sourceNode:t,targetNode:n}=e;if(!uw(t)||!uw(n))return null;const r=t.internals.handleBounds||dw(t.handles),s=n.internals.handleBounds||dw(n.handles),i=fw((r==null?void 0:r.source)??[],e.sourceHandle),o=fw(e.connectionMode===Qi.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!o)return(f=e.onError)==null||f.call(e,"008",jn.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||ne.Bottom,c=(o==null?void 0:o.position)||ne.Top,u=Vs(t,i,l),d=Vs(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}function dw(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Vs(e,t,n=ne.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=t??Wn(e);if(r)return{x:s+o/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case ne.Top:return{x:s+o/2,y:i};case ne.Right:return{x:s+o,y:i+l/2};case ne.Bottom:return{x:s+o/2,y:i+l};case ne.Left:return{x:s,y:i+l/2}}}function fw(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function gm(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function kU(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((o,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=gm(c,t);i.has(u)||(o.push({id:u,color:c.color||n,...c}),i.add(u))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const kC=1e3,NU=10,Qv={nodeOrigin:[0,0],nodeExtent:Ba,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},EU={...Qv,checkEquality:!0};function Zv(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function CU(e,t,n){const r=Zv(Qv,n);for(const s of e.values())if(s.parentId)ey(s,e,t,r);else{const i=ml(s,r.nodeOrigin),o=Fs(s.extent)?s.extent:r.nodeExtent,l=zs(i,o,Wn(s));s.internals.positionAbsolute=l}}function TU(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function Jv(e){return e==="manual"}function vm(e,t,n,r={}){var d,f;const s=Zv(EU,r),i={i:0},o=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Jv(s.zIndexMode)?kC:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=o.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const g=ml(h,s.nodeOrigin),x=Fs(h.extent)?h.extent:s.nodeExtent,_=zs(g,x,Wn(h));p={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:_,handleBounds:TU(h,p),z:NC(h,l,s.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&ey(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function PU(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function ey(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=Zv(Qv,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}PU(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*NU),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!Jv(c)?kC:0,{x:h,y:p,z:g}=AU(e,d,o,l,f,c),{positionAbsolute:x}=e.internals,_=h!==x.x||p!==x.y;(_||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:h,y:p}:x,z:g}})}function NC(e,t,n){const r=pn(e.zIndex)?e.zIndex:0;return Jv(n)?r:r+(e.selected?t:0)}function AU(e,t,n,r,s,i){const{x:o,y:l}=t.internals.positionAbsolute,c=Wn(e),u=ml(e,n),d=Fs(e.extent)?zs(u,e.extent,c):u;let f=zs({x:o+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=fC(f,c,t));const h=NC(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function ty(e,t,n,r=[0,0]){var o;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((o=i.get(l.parentId))==null?void 0:o.expandedRect)??Ha(c),d=hC(u,l.rect);i.set(l.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var m;const d=c.internals.positionAbsolute,f=Wn(c),h=c.origin??r,p=l.x<d.x?Math.round(Math.abs(d.x-l.x)):0,g=l.y<d.y?Math.round(Math.abs(d.y-l.y)):0,x=Math.max(f.width,Math.round(l.width)),_=Math.max(f.height,Math.round(l.height)),v=(x-f.width)*h[0],y=(_-f.height)*h[1];(p>0||g>0||v||y)&&(s.push({id:u,type:"position",position:{x:c.position.x-p+v,y:c.position.y-g+y}}),(m=n.get(u))==null||m.forEach(b=>{e.some(j=>j.id===b.id)||s.push({id:b.id,type:"position",position:{x:b.position.x+p,y:b.position.y+g}})})),(f.width<l.width||f.height<l.height||p||g)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(p?h[0]*p-v:0),height:_+(g?h[1]*g-y:0)}})}),s}function RU(e,t,n,r,s,i,o){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=[];for(const p of e.values()){const g=t.get(p.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Xv(p.nodeElement),_=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(_||!g.internals.handleBounds||p.force))){const y=p.nodeElement.getBoundingClientRect(),m=Fs(g.extent)?g.extent:i;let{positionAbsolute:b}=g.internals;if(g.parentId&&g.extent==="parent"){const k=t.get(g.parentId);k&&(b=fC(b,x,k))}else m&&(b=zs(b,m,x));const j={...g,measured:x,internals:{...g.internals,positionAbsolute:b,handleBounds:{source:ow("source",p.nodeElement,y,f,g.id),target:ow("target",p.nodeElement,y,f,g.id)}}};t.set(g.id,j),g.parentId&&ey(j,t,n,{nodeOrigin:s,zIndexMode:o}),c=!0,_&&(u.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&h.push({id:g.id,parentId:g.parentId,rect:Ha(j,s)}))}}if(h.length>0){const p=ty(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function IU({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return!1;const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function hw(e,t,n,r,s,i){let o=s;const l=r.get(o)||new Map;r.set(o,l.set(n,t)),o=`${s}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),i){o=`${s}-${e}-${i}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function EC(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:l},u=`${s}-${o}--${i}-${l}`,d=`${i}-${l}--${s}-${o}`;hw("source",c,d,e,s,o),hw("target",c,u,e,i,l),t.set(r.id,r)}}function CC(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:CC(n,t):!1}function pw(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function MU(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!CC(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(i);l&&s.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function nh({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,l,c;const s=[];for(const[u,d]of t){const f=(o=n.get(u))==null?void 0:o.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function OU({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},o=vl(i,t);return{x:o.x-i.x,y:o.y-i.y}}function LU({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,g=!1,x=null;function _({noDragClassName:y,handleSelector:m,domNode:b,isSelectable:j,nodeId:k,nodeClickDistance:S=0}){h=Nt(b);function N({x:M,y:z}){const{nodeLookup:T,nodeExtent:E,snapGrid:A,snapToGrid:P,nodeOrigin:I,onNodeDrag:C,onSelectionDrag:L,onError:F,updateNodePositions:V}=t();i={x:M,y:z};let H=!1;const U=l.size>1,W=U&&E?pm(gl(l)):null,G=U&&P?OU({dragItems:l,snapGrid:A,x:M,y:z}):null;for(const[Y,K]of l){if(!T.has(Y))continue;let X={x:M-K.distance.x,y:z-K.distance.y};P&&(X=G?{x:Math.round(X.x+G.x),y:Math.round(X.y+G.y)}:vl(X,A));let re=null;if(U&&E&&!K.extent&&W){const{positionAbsolute:ee}=K.internals,se=ee.x-W.x+E[0][0],pe=ee.x+K.measured.width-W.x2+E[1][0],ve=ee.y-W.y+E[0][1],Le=ee.y+K.measured.height-W.y2+E[1][1];re=[[se,ve],[pe,Le]]}const{position:te,positionAbsolute:Z}=dC({nodeId:Y,nextPosition:X,nodeLookup:T,nodeExtent:re||E,nodeOrigin:I,onError:F});H=H||K.position.x!==te.x||K.position.y!==te.y,K.position=te,K.internals.positionAbsolute=Z}if(g=g||H,!!H&&(V(l,!0),x&&(r||C||!k&&L))){const[Y,K]=nh({nodeId:k,dragItems:l,nodeLookup:T});r==null||r(x,l,Y,K),C==null||C(x,Y,K),k||L==null||L(x,K)}}async function R(){if(!d)return;const{transform:M,panBy:z,autoPanSpeed:T,autoPanOnNodeDrag:E}=t();if(!E){c=!1,cancelAnimationFrame(o);return}const[A,P]=qv(u,d,T);(A!==0||P!==0)&&(i.x=(i.x??0)-A/M[2],i.y=(i.y??0)-P/M[2],await z({x:A,y:P})&&N(i)),o=requestAnimationFrame(R)}function O(M){var U;const{nodeLookup:z,multiSelectionActive:T,nodesDraggable:E,transform:A,snapGrid:P,snapToGrid:I,selectNodesOnDrag:C,onNodeDragStart:L,onSelectionDragStart:F,unselectNodesAndEdges:V}=t();f=!0,(!C||!j)&&!T&&k&&((U=z.get(k))!=null&&U.selected||V()),j&&C&&k&&(e==null||e(k));const H=oa(M.sourceEvent,{transform:A,snapGrid:P,snapToGrid:I,containerBounds:d});if(i=H,l=MU(z,E,H,k),l.size>0&&(n||L||!k&&F)){const[W,G]=nh({nodeId:k,dragItems:l,nodeLookup:z});n==null||n(M.sourceEvent,l,W,G),L==null||L(M.sourceEvent,W,G),k||F==null||F(M.sourceEvent,G)}}const D=HE().clickDistance(S).on("start",M=>{const{domNode:z,nodeDragThreshold:T,transform:E,snapGrid:A,snapToGrid:P}=t();d=(z==null?void 0:z.getBoundingClientRect())||null,p=!1,g=!1,x=M.sourceEvent,T===0&&O(M),i=oa(M.sourceEvent,{transform:E,snapGrid:A,snapToGrid:P,containerBounds:d}),u=mn(M.sourceEvent,d)}).on("drag",M=>{const{autoPanOnNodeDrag:z,transform:T,snapGrid:E,snapToGrid:A,nodeDragThreshold:P,nodeLookup:I}=t(),C=oa(M.sourceEvent,{transform:T,snapGrid:E,snapToGrid:A,containerBounds:d});if(x=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||k&&!I.has(k))&&(p=!0),!p){if(!c&&z&&f&&(c=!0,R()),!f){const L=mn(M.sourceEvent,d),F=L.x-u.x,V=L.y-u.y;Math.sqrt(F*F+V*V)>P&&O(M)}(i.x!==C.xSnapped||i.y!==C.ySnapped)&&l&&f&&(u=mn(M.sourceEvent,d),N(C))}}).on("end",M=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(o),l.size>0){const{nodeLookup:z,updateNodePositions:T,onNodeDragStop:E,onSelectionDragStop:A}=t();if(g&&(T(l,!1),g=!1),s||E||!k&&A){const[P,I]=nh({nodeId:k,dragItems:l,nodeLookup:z,dragging:!1});s==null||s(M.sourceEvent,l,P,I),E==null||E(M.sourceEvent,P,I),k||A==null||A(M.sourceEvent,I)}}}).filter(M=>{const z=M.target;return!M.button&&(!y||!pw(z,`.${y}`,b))&&(!m||pw(z,m,b))});h.call(D)}function v(){h==null||h.on(".drag",null)}return{update:_,destroy:v}}function $U(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Uu(s,Ha(i))>0&&r.push(i);return r}const DU=250;function zU(e,t,n,r){var l,c;let s=[],i=1/0;const o=$U(e,n,t+DU);for(const u of o){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=Vs(u,f,f.position,!0),g=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));g>t||(g<i?(s=[{...f,x:h,y:p}],i=g):g===i&&s.push({...f,x:h,y:p}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function TC(e,t,n,r,s,i=!1){var u,d,f;const o=r.get(e);if(!o)return null;const l=s==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((d=o.internals.handleBounds)==null?void 0:d.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...Vs(o,c,c.position,!0)}:c}function PC(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function FU(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const AC=()=>!0;function VU(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:g,onConnect:x,onConnectEnd:_,isValidConnection:v=AC,onReconnectEnd:y,updateConnection:m,getTransform:b,getFromHandle:j,autoPanSpeed:k,dragThreshold:S=1,handleDomNode:N}){const R=yC(e.target);let O=0,D;const{x:M,y:z}=mn(e),T=PC(i,N),E=l==null?void 0:l.getBoundingClientRect();let A=!1;if(!E||!T)return;const P=TC(s,T,r,c,t);if(!P)return;let I=mn(e,E),C=!1,L=null,F=!1,V=null;function H(){if(!d||!E)return;const[te,Z]=qv(I,E,k);h({x:te,y:Z}),O=requestAnimationFrame(H)}const U={...P,nodeId:s,type:T,position:P.position},W=c.get(s);let Y={inProgress:!0,isValid:null,from:Vs(W,U,ne.Left,!0),fromHandle:U,fromPosition:U.position,fromNode:W,to:I,toHandle:null,toPosition:nw[U.position],toNode:null,pointer:I};function K(){A=!0,m(Y),g==null||g(e,{nodeId:s,handleId:r,handleType:T})}S===0&&K();function X(te){if(!A){const{x:Le,y:Ft}=mn(te),Nn=Le-M,En=Ft-z;if(!(Nn*Nn+En*En>S*S))return;K()}if(!j()||!U){re(te);return}const Z=b();I=mn(te,E),D=zU(yl(I,Z,!1,[1,1]),n,c,U),C||(H(),C=!0);const ee=RC(te,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:v,doc:R,lib:u,flowId:f,nodeLookup:c});V=ee.handleDomNode,L=ee.connection,F=FU(!!D,ee.isValid);const se=c.get(s),pe=se?Vs(se,U,ne.Left,!0):Y.from,ve={...Y,from:pe,isValid:F,to:ee.toHandle&&F?Ji({x:ee.toHandle.x,y:ee.toHandle.y},Z):I,toHandle:ee.toHandle,toPosition:F&&ee.toHandle?ee.toHandle.position:nw[U.position],toNode:ee.toHandle?c.get(ee.toHandle.nodeId):null,pointer:I};m(ve),Y=ve}function re(te){if(!("touches"in te&&te.touches.length>0)){if(A){(D||V)&&L&&F&&(x==null||x(L));const{inProgress:Z,...ee}=Y,se={...ee,toPosition:Y.toHandle?Y.toPosition:null};_==null||_(te,se),i&&(y==null||y(te,se))}p(),cancelAnimationFrame(O),C=!1,F=!1,L=null,V=null,R.removeEventListener("mousemove",X),R.removeEventListener("mouseup",re),R.removeEventListener("touchmove",X),R.removeEventListener("touchend",re)}}R.addEventListener("mousemove",X),R.addEventListener("mouseup",re),R.addEventListener("touchmove",X),R.addEventListener("touchend",re)}function RC(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:l,flowId:c,isValidConnection:u=AC,nodeLookup:d}){const f=i==="target",h=t?o.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:g}=mn(e),x=o.elementFromPoint(p,g),_=x!=null&&x.classList.contains(`${l}-flow__handle`)?x:h,v={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const y=PC(void 0,_),m=_.getAttribute("data-nodeid"),b=_.getAttribute("data-handleid"),j=_.classList.contains("connectable"),k=_.classList.contains("connectableend");if(!m||!y)return v;const S={source:f?m:r,sourceHandle:f?b:s,target:f?r:m,targetHandle:f?s:b};v.connection=S;const R=j&&k&&(n===Qi.Strict?f&&y==="source"||!f&&y==="target":m!==r||b!==s);v.isValid=R&&u(S),v.toHandle=TC(m,y,b,d,n,!0)}return v}const ym={onPointerDown:VU,isValid:RC};function BU({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Nt(e);function i({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const g=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const b=n(),j=m.sourceEvent.ctrlKey&&Wa()?10:1,k=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,S=b[2]*Math.pow(2,k*j);t.scaleTo(S)};let x=[0,0];const _=m=>{(m.sourceEvent.type==="mousedown"||m.sourceEvent.type==="touchstart")&&(x=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY])},v=m=>{const b=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const j=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],k=[j[0]-x[0],j[1]-x[1]];x=j;const S=r()*Math.max(b[2],Math.log(b[2]))*(p?-1:1),N={x:b[0]-k[0]*S,y:b[1]-k[1]*S},R=[[0,0],[c,u]];t.setViewportConstrained({x:N.x,y:N.y,zoom:b[2]},R,l)},y=iC().on("start",_).on("zoom",f?v:null).on("zoom.wheel",h?g:null);s.call(y,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:un}}const Fd=e=>({x:e.x,y:e.y,zoom:e.k}),rh=({x:e,y:t,zoom:n})=>$d.translate(e,t).scale(n),wi=(e,t)=>e.target.closest(`.${t}`),IC=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),UU=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,sh=(e,t=0,n=UU,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},MC=e=>{const t=e.ctrlKey&&Wa()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function HU({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(wi(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&o){const _=un(d),v=MC(d),y=f*Math.pow(2,v);r.scaleTo(n,y,_,d);return}const h=d.deltaMode===1?20:1;let p=s===Ns.Vertical?0:d.deltaX*h,g=s===Ns.Horizontal?0:d.deltaY*h;!Wa()&&d.shiftKey&&s!==Ns.Vertical&&(p=d.deltaY*h,g=0),r.translateBy(n,-(p/f)*i,-(g/f)*i,{internal:!0});const x=Fd(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c==null||c(d,x):(e.isPanScrolling=!0,l==null||l(d,x)),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,x),e.isPanScrolling=!1},150)}}function WU({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!t&&i&&!r.ctrlKey,l=wi(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,s)}}function KU({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Fd(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function GU({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,l;e.usedRightMouseButton=!!(n&&IC(t,e.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,Fd(i.transform)))}}function qU({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&IC(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Fd(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function YU({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var _;const h=e||t,p=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(wi(f,`${u}-flow__node`)||wi(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||o||d&&!g||wi(f,l)&&g||wi(f,c)&&(!g||s&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((_=f.touches)==null?void 0:_.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&x}}function XU({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect();let f=[[0,0],[d.width,d.height]];const h=typeof ResizeObserver<"u"?new ResizeObserver(z=>{const T=z[0];T&&(f=[[0,0],[T.contentRect.width,T.contentRect.height]])}):null;h==null||h.observe(e);const p=iC().extent(()=>f).scaleExtent([t,n]).translateExtent(r),g=Nt(e).call(p);b({x:s.x,y:s.y,zoom:Zi(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const x=g.on("wheel.zoom"),_=g.on("dblclick.zoom");p.wheelDelta(MC);async function v(z,T){return g?new Promise(E=>{p==null||p.interpolate((T==null?void 0:T.interpolate)==="linear"?ia:Oc).transform(sh(g,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>E(!0)),z)}):!1}function y({noWheelClassName:z,noPanClassName:T,onPaneContextMenu:E,userSelectionActive:A,panOnScroll:P,panOnDrag:I,panOnScrollMode:C,panOnScrollSpeed:L,preventScrolling:F,zoomOnPinch:V,zoomOnScroll:H,zoomOnDoubleClick:U,zoomActivationKeyPressed:W,lib:G,onTransformChange:Y,connectionInProgress:K,paneClickDistance:X,selectionOnDrag:re}){A&&!u.isZoomingOrPanning&&m();const te=P&&!W&&!A;p.clickDistance(re?1/0:!pn(X)||X<0?0:X);const Z=te?HU({zoomPanValues:u,noWheelClassName:z,d3Selection:g,d3Zoom:p,panOnScrollMode:C,panOnScrollSpeed:L,zoomOnPinch:V,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:l}):WU({noWheelClassName:z,preventScrolling:F,d3ZoomHandler:x});g.on("wheel.zoom",Z,{passive:!1});const ee=KU({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});p.on("start",ee);const se=GU({zoomPanValues:u,panOnDrag:I,onPaneContextMenu:!!E,onPanZoom:i,onTransformChange:Y});p.on("zoom",se);const pe=qU({zoomPanValues:u,panOnDrag:I,panOnScroll:P,onPaneContextMenu:E,onPanZoomEnd:l,onDraggingChange:c});p.on("end",pe);const ve=YU({zoomActivationKeyPressed:W,panOnDrag:I,zoomOnScroll:H,panOnScroll:P,zoomOnDoubleClick:U,zoomOnPinch:V,userSelectionActive:A,noPanClassName:T,noWheelClassName:z,lib:G,connectionInProgress:K});p.filter(ve),U?g.on("dblclick.zoom",_):g.on("dblclick.zoom",null)}function m(){p.on("zoom",null)}async function b(z,T,E){const A=rh(z),P=p==null?void 0:p.constrain()(A,T,E);return P&&await v(P),P}async function j(z,T){const E=rh(z);return await v(E,T),E}function k(z){if(g){const T=rh(z),E=g.property("__zoom");(E.k!==z.zoom||E.x!==z.x||E.y!==z.y)&&(p==null||p.transform(g,T,null,{sync:!0}))}}function S(){const z=g?sC(g.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}async function N(z,T){return g?new Promise(E=>{p==null||p.interpolate((T==null?void 0:T.interpolate)==="linear"?ia:Oc).scaleTo(sh(g,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>E(!0)),z)}):!1}async function R(z,T){return g?new Promise(E=>{p==null||p.interpolate((T==null?void 0:T.interpolate)==="linear"?ia:Oc).scaleBy(sh(g,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>E(!0)),z)}):!1}function O(z){p==null||p.scaleExtent(z)}function D(z){p==null||p.translateExtent(z)}function M(z){const T=!pn(z)||z<0?0:z;p==null||p.clickDistance(T)}return{update:y,destroy:m,setViewport:j,setViewportConstrained:b,getViewport:S,scaleTo:N,scaleBy:R,setScaleExtent:O,setTranslateExtent:D,syncViewport:k,setClickDistance:M}}var eo;(function(e){e.Line="line",e.Handle="handle"})(eo||(eo={}));function QU({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=e-t,l=n-r,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function mw(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function Er(e,t){return Math.max(0,t-e)}function Cr(e,t){return Math.max(0,e-t)}function ec(e,t,n){return Math.max(0,t-e,e-n)}function gw(e,t){return e?!t:t}function ZU(e,t,n,r,s,i,o,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:g}=n,{minWidth:x,maxWidth:_,minHeight:v,maxHeight:y}=r,{x:m,y:b,width:j,height:k,aspectRatio:S}=e;let N=Math.floor(d?p-e.pointerX:0),R=Math.floor(f?g-e.pointerY:0);const O=j+(c?-N:N),D=k+(u?-R:R),M=-i[0]*j,z=-i[1]*k;let T=ec(O,x,_),E=ec(D,v,y);if(o){let I=0,C=0;c&&N<0?I=Er(m+N+M,o[0][0]):!c&&N>0&&(I=Cr(m+O+M,o[1][0])),u&&R<0?C=Er(b+R+z,o[0][1]):!u&&R>0&&(C=Cr(b+D+z,o[1][1])),T=Math.max(T,I),E=Math.max(E,C)}if(l){let I=0,C=0;c&&N>0?I=Cr(m+N,l[0][0]):!c&&N<0&&(I=Er(m+O,l[1][0])),u&&R>0?C=Cr(b+R,l[0][1]):!u&&R<0&&(C=Er(b+D,l[1][1])),T=Math.max(T,I),E=Math.max(E,C)}if(s){if(d){const I=ec(O/S,v,y)*S;if(T=Math.max(T,I),o){let C=0;!c&&!u||c&&!u&&h?C=Cr(b+z+O/S,o[1][1])*S:C=Er(b+z+(c?N:-N)/S,o[0][1])*S,T=Math.max(T,C)}if(l){let C=0;!c&&!u||c&&!u&&h?C=Er(b+O/S,l[1][1])*S:C=Cr(b+(c?N:-N)/S,l[0][1])*S,T=Math.max(T,C)}}if(f){const I=ec(D*S,x,_)/S;if(E=Math.max(E,I),o){let C=0;!c&&!u||u&&!c&&h?C=Cr(m+D*S+M,o[1][0])/S:C=Er(m+(u?R:-R)*S+M,o[0][0])/S,E=Math.max(E,C)}if(l){let C=0;!c&&!u||u&&!c&&h?C=Er(m+D*S,l[1][0])/S:C=Cr(m+(u?R:-R)*S,l[0][0])/S,E=Math.max(E,C)}}}R=R+(R<0?E:-E),N=N+(N<0?T:-T),s&&(h?O>D*S?R=(gw(c,u)?-N:N)/S:N=(gw(c,u)?-R:R)*S:d?(R=N/S,u=c):(N=R*S,c=u));const A=c?m+N:m,P=u?b+R:b;return{width:j+(c?-N:N),height:k+(u?-R:R),x:i[0]*N*(c?-1:1)+A,y:i[1]*R*(u?-1:1)+P}}const OC={width:0,height:0,x:0,y:0},JU={...OC,pointerX:0,pointerY:0,aspectRatio:1};function eH(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,o=e.measured.height??0,l=n[0]*i,c=n[1]*o;return[[r-l,s-c],[r+i-l,s+o-c]]}function tH({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Nt(e);let o={controlDirection:mw("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:g,onResizeEnd:x,shouldResize:_}){let v={...OC},y={...JU};o={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:mw(u)};let m,b=null,j=[],k,S,N,R=!1;const O=HE().on("start",D=>{const{nodeLookup:M,transform:z,snapGrid:T,snapToGrid:E,nodeOrigin:A,paneDomNode:P}=n();if(m=M.get(t),!m)return;b=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:C}=oa(D.sourceEvent,{transform:z,snapGrid:T,snapToGrid:E,containerBounds:b});v={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},y={...v,pointerX:I,pointerY:C,aspectRatio:v.width/v.height},k=void 0,S=Fs(m.extent)?m.extent:void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(k=M.get(m.parentId)),k&&m.extent==="parent"&&(S=[[0,0],[k.measured.width,k.measured.height]]),j=[],N=void 0;for(const[L,F]of M)if(F.parentId===t&&(j.push({id:L,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const V=eH(F,m,F.origin??A);N?N=[[Math.min(V[0][0],N[0][0]),Math.min(V[0][1],N[0][1])],[Math.max(V[1][0],N[1][0]),Math.max(V[1][1],N[1][1])]]:N=V}p==null||p(D,{...v})}).on("drag",D=>{const{transform:M,snapGrid:z,snapToGrid:T,nodeOrigin:E}=n(),A=oa(D.sourceEvent,{transform:M,snapGrid:z,snapToGrid:T,containerBounds:b}),P=[];if(!m)return;const{x:I,y:C,width:L,height:F}=v,V={},H=m.origin??E,{width:U,height:W,x:G,y:Y}=ZU(y,o.controlDirection,A,o.boundaries,o.keepAspectRatio,H,S,N),K=U!==L,X=W!==F,re=G!==I&&K,te=Y!==C&&X;if(!re&&!te&&!K&&!X)return;if((re||te||H[0]===1||H[1]===1)&&(V.x=re?G:v.x,V.y=te?Y:v.y,v.x=V.x,v.y=V.y,j.length>0)){const pe=G-I,ve=Y-C;for(const Le of j)Le.position={x:Le.position.x-pe+H[0]*(U-L),y:Le.position.y-ve+H[1]*(W-F)},P.push(Le)}if((K||X)&&(V.width=K&&(!o.resizeDirection||o.resizeDirection==="horizontal")?U:v.width,V.height=X&&(!o.resizeDirection||o.resizeDirection==="vertical")?W:v.height,v.width=V.width,v.height=V.height),k&&m.expandParent){const pe=H[0]*(V.width??0);V.x&&V.x<pe&&(v.x=pe,y.x=y.x-(V.x-pe));const ve=H[1]*(V.height??0);V.y&&V.y<ve&&(v.y=ve,y.y=y.y-(V.y-ve))}const Z=QU({width:v.width,prevWidth:L,height:v.height,prevHeight:F,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),ee={...v,direction:Z};(_==null?void 0:_(D,ee))!==!1&&(R=!0,g==null||g(D,ee),r(V,P))}).on("end",D=>{R&&(x==null||x(D,{...v}),s==null||s({...v}),R=!1)});i.call(O)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var LC={exports:{}},$C={};/**
76
+ `),()=>{document.head.removeChild(d)}},[t]),a.jsx(k3,{isPresent:t,childRef:r,sizeRef:s,children:w.cloneElement(e,{ref:r})})}const E3=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const l=nv(C3),c=w.useId(),u=w.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;r&&r()},[l,r]),d=w.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),i?[Math.random(),u]:[n,u]);return w.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),w.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),o==="popLayout"&&(e=a.jsx(N3,{isPresent:n,children:e})),a.jsx(Nd.Provider,{value:d,children:e})};function C3(){return new Map}function Yk(e=!0){const t=w.useContext(Nd);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=w.useId();w.useEffect(()=>{e&&s(i)},[e]);const o=w.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const Hl=e=>e.key||"";function p_(e){const t=[];return w.Children.forEach(e,n=>{w.isValidElement(n)&&t.push(n)}),t}const sv=typeof window<"u",Xk=sv?w.useLayoutEffect:w.useEffect,ea=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1})=>{const[l,c]=Yk(o),u=w.useMemo(()=>p_(e),[e]),d=o&&!l?[]:u.map(Hl),f=w.useRef(!0),h=w.useRef(u),p=nv(()=>new Map),[g,x]=w.useState(u),[_,v]=w.useState(u);Xk(()=>{f.current=!1,h.current=u;for(let b=0;b<_.length;b++){const j=Hl(_[b]);d.includes(j)?p.delete(j):p.get(j)!==!0&&p.set(j,!1)}},[_,d.length,d.join("-")]);const y=[];if(u!==g){let b=[...u];for(let j=0;j<_.length;j++){const k=_[j],S=Hl(k);d.includes(S)||(b.splice(j,0,k),y.push(k))}i==="wait"&&y.length&&(b=y),v(p_(b)),x(u);return}const{forceRender:m}=w.useContext(tv);return a.jsx(a.Fragment,{children:_.map(b=>{const j=Hl(b),k=o&&!l?!1:u===_||d.includes(j),S=()=>{if(p.has(j))p.set(j,!0);else return;let N=!0;p.forEach(R=>{R||(N=!1)}),N&&(m==null||m(),v(h.current),o&&(c==null||c()),r&&r())};return a.jsx(E3,{isPresent:k,initial:!f.current||n?void 0:!1,custom:k?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:k?void 0:S,children:b},j)})})},At=e=>e;let Qk=At;const T3={useManualTiming:!1};function P3(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(u){i.has(u)&&(c.schedule(u),e()),u(o)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(l),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const Wl=["read","resolveKeyframes","update","preRender","render","postRender"],A3=40;function Zk(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=Wl.reduce((v,y)=>(v[y]=P3(i),v),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=o,p=()=>{const v=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(v-s.timestamp,A3),1),s.timestamp=v,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},g=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:Wl.reduce((v,y)=>{const m=o[y];return v[y]=(b,j=!1,k=!1)=>(n||g(),m.schedule(b,j,k)),v},{}),cancel:v=>{for(let y=0;y<Wl.length;y++)o[Wl[y]].cancel(v)},state:s,steps:o}}const{schedule:Ne,cancel:Xr,state:Qe,steps:Df}=Zk(typeof requestAnimationFrame<"u"?requestAnimationFrame:At,!0),Jk=w.createContext({strict:!1}),m_={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ki={};for(const e in m_)Ki[e]={isEnabled:t=>m_[e].some(n=>!!t[n])};function R3(e){for(const t in e)Ki[t]={...Ki[t],...e[t]}}const I3=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Nu(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||I3.has(e)}let eN=e=>!Nu(e);function M3(e){e&&(eN=t=>t.startsWith("on")?!Nu(t):e(t))}try{M3(require("@emotion/is-prop-valid").default)}catch{}function O3(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(eN(s)||n===!0&&Nu(s)||!t&&!Nu(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function L3(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const Ed=w.createContext({});function Ia(e){return typeof e=="string"||Array.isArray(e)}function Cd(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const iv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ov=["initial",...iv];function Td(e){return Cd(e.animate)||ov.some(t=>Ia(e[t]))}function tN(e){return!!(Td(e)||e.variants)}function $3(e,t){if(Td(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Ia(n)?n:void 0,animate:Ia(r)?r:void 0}}return e.inherit!==!1?t:{}}function D3(e){const{initial:t,animate:n}=$3(e,w.useContext(Ed));return w.useMemo(()=>({initial:t,animate:n}),[g_(t),g_(n)])}function g_(e){return Array.isArray(e)?e.join(" "):e}const z3=Symbol.for("motionComponentSymbol");function gi(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function F3(e,t,n){return w.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):gi(n)&&(n.current=r))},[t])}const av=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),V3="framerAppearId",nN="data-"+av(V3),{schedule:lv}=Zk(queueMicrotask,!1),rN=w.createContext({});function B3(e,t,n,r,s){var i,o;const{visualElement:l}=w.useContext(Ed),c=w.useContext(Jk),u=w.useContext(Nd),d=w.useContext(rv).reducedMotion,f=w.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=w.useContext(rN);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&U3(f.current,n,s,p);const g=w.useRef(!1);w.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const x=n[nN],_=w.useRef(!!x&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,x))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,x)));return Xk(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),lv.render(h.render),_.current&&h.animationState&&h.animationState.animateChanges())}),w.useEffect(()=>{h&&(!_.current&&h.animationState&&h.animationState.animateChanges(),_.current&&(queueMicrotask(()=>{var v;(v=window.MotionHandoffMarkAsComplete)===null||v===void 0||v.call(window,x)}),_.current=!1))}),h}function U3(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:sN(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&gi(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function sN(e){if(e)return e.options.allowProjection!==!1?e.projection:sN(e.parent)}function H3({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,o;e&&R3(e);function l(u,d){let f;const h={...w.useContext(rv),...u,layoutId:W3(u)},{isStatic:p}=h,g=D3(u),x=r(u,p);if(!p&&sv){K3();const _=G3(h);f=_.MeasureLayout,g.visualElement=B3(s,x,h,t,_.ProjectionNode)}return a.jsxs(Ed.Provider,{value:g,children:[f&&g.visualElement?a.jsx(f,{visualElement:g.visualElement,...h}):null,n(s,u,F3(x,g.visualElement,d),x,p,g.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const c=w.forwardRef(l);return c[z3]=s,c}function W3({layoutId:e}){const t=w.useContext(tv).id;return t&&e!==void 0?t+"-"+e:e}function K3(e,t){w.useContext(Jk).strict}function G3(e){const{drag:t,layout:n}=Ki;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const q3=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function cv(e){return typeof e!="string"||e.includes("-")?!1:!!(q3.indexOf(e)>-1||/[A-Z]/u.test(e))}function v_(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function uv(e,t,n,r){if(typeof t=="function"){const[s,i]=v_(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=v_(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const Up=e=>Array.isArray(e),Y3=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),X3=e=>Up(e)?e[e.length-1]||0:e,ot=e=>!!(e&&e.getVelocity);function Ac(e){const t=ot(e)?e.get():e;return Y3(t)?t.toValue():t}function Q3({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const o={latestValues:Z3(r,s,i,e),renderState:t()};return n&&(o.onMount=l=>n({props:r,current:l,...o}),o.onUpdate=l=>n(l)),o}const iN=e=>(t,n)=>{const r=w.useContext(Ed),s=w.useContext(Nd),i=()=>Q3(e,t,r,s);return n?i():nv(i)};function Z3(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=Ac(i[h]);let{initial:o,animate:l}=e;const c=Td(e),u=tN(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const f=d?l:o;if(f&&typeof f!="boolean"&&!Cd(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p<h.length;p++){const g=uv(e,h[p]);if(g){const{transitionEnd:x,transition:_,...v}=g;for(const y in v){let m=v[y];if(Array.isArray(m)){const b=d?m.length-1:0;m=m[b]}m!==null&&(s[y]=m)}for(const y in x)s[y]=x[y]}}}return s}const po=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xs=new Set(po),oN=e=>t=>typeof t=="string"&&t.startsWith(e),aN=oN("--"),J3=oN("var(--"),dv=e=>J3(e)?ez.test(e.split("/*")[0].trim()):!1,ez=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,lN=(e,t)=>t&&typeof e=="number"?t.transform(e):e,wr=(e,t,n)=>n>t?t:n<e?e:n,mo={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ma={...mo,transform:e=>wr(0,1,e)},Kl={...mo,default:1},cl=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Tr=cl("deg"),Vn=cl("%"),ie=cl("px"),tz=cl("vh"),nz=cl("vw"),y_={...Vn,parse:e=>Vn.parse(e)/100,transform:e=>Vn.transform(e*100)},rz={borderWidth:ie,borderTopWidth:ie,borderRightWidth:ie,borderBottomWidth:ie,borderLeftWidth:ie,borderRadius:ie,radius:ie,borderTopLeftRadius:ie,borderTopRightRadius:ie,borderBottomRightRadius:ie,borderBottomLeftRadius:ie,width:ie,maxWidth:ie,height:ie,maxHeight:ie,top:ie,right:ie,bottom:ie,left:ie,padding:ie,paddingTop:ie,paddingRight:ie,paddingBottom:ie,paddingLeft:ie,margin:ie,marginTop:ie,marginRight:ie,marginBottom:ie,marginLeft:ie,backgroundPositionX:ie,backgroundPositionY:ie},sz={rotate:Tr,rotateX:Tr,rotateY:Tr,rotateZ:Tr,scale:Kl,scaleX:Kl,scaleY:Kl,scaleZ:Kl,skew:Tr,skewX:Tr,skewY:Tr,distance:ie,translateX:ie,translateY:ie,translateZ:ie,x:ie,y:ie,z:ie,perspective:ie,transformPerspective:ie,opacity:Ma,originX:y_,originY:y_,originZ:ie},x_={...mo,transform:Math.round},fv={...rz,...sz,zIndex:x_,size:ie,fillOpacity:Ma,strokeOpacity:Ma,numOctaves:x_},iz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},oz=po.length;function az(e,t,n){let r="",s=!0;for(let i=0;i<oz;i++){const o=po[i],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=lN(l,fv[o]);if(!c){s=!1;const d=iz[o]||o;r+=`${d}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function hv(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let o=!1,l=!1;for(const c in t){const u=t[c];if(Xs.has(c)){o=!0;continue}else if(aN(c)){s[c]=u;continue}else{const d=lN(u,fv[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(t.transform||(o||n?r.transform=az(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${c} ${u} ${d}`}}const lz={offset:"stroke-dashoffset",array:"stroke-dasharray"},cz={offset:"strokeDashoffset",array:"strokeDasharray"};function uz(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?lz:cz;e[i.offset]=ie.transform(-r);const o=ie.transform(t),l=ie.transform(n);e[i.array]=`${o} ${l}`}function __(e,t,n){return typeof e=="string"?e:ie.transform(t+n*e)}function dz(e,t,n){const r=__(t,e.x,e.width),s=__(n,e.y,e.height);return`${r} ${s}`}function pv(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...u},d,f){if(hv(e,u,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:g}=e;h.transform&&(g&&(p.transform=h.transform),delete h.transform),g&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=dz(g,s!==void 0?s:.5,i!==void 0?i:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),o!==void 0&&uz(h,o,l,c,!1)}const mv=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),cN=()=>({...mv(),attrs:{}}),gv=e=>typeof e=="string"&&e.toLowerCase()==="svg";function uN(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const dN=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function fN(e,t,n,r){uN(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(dN.has(s)?s:av(s),t.attrs[s])}const Eu={};function fz(e){Object.assign(Eu,e)}function hN(e,{layout:t,layoutId:n}){return Xs.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Eu[e]||e==="opacity")}function vv(e,t,n){var r;const{style:s}=e,i={};for(const o in s)(ot(s[o])||t.style&&ot(t.style[o])||hN(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function pN(e,t,n){const r=vv(e,t,n);for(const s in e)if(ot(e[s])||ot(t[s])){const i=po.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function hz(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const w_=["x","y","width","height","cx","cy","r"],pz={useVisualState:iN({scrapeMotionValuesFromProps:pN,createRenderState:cN,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const l in s)if(Xs.has(l)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let l=0;l<w_.length;l++){const c=w_[l];e[c]!==t[c]&&(o=!0)}o&&Ne.read(()=>{hz(n,r),Ne.render(()=>{pv(r,s,gv(n.tagName),e.transformTemplate),fN(n,r)})})}})},mz={useVisualState:iN({scrapeMotionValuesFromProps:vv,createRenderState:mv})};function mN(e,t,n){for(const r in t)!ot(t[r])&&!hN(r,n)&&(e[r]=t[r])}function gz({transformTemplate:e},t){return w.useMemo(()=>{const n=mv();return hv(n,t,e),Object.assign({},n.vars,n.style)},[t])}function vz(e,t){const n=e.style||{},r={};return mN(r,n,e),Object.assign(r,gz(e,t)),r}function yz(e,t){const n={},r=vz(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function xz(e,t,n,r){const s=w.useMemo(()=>{const i=cN();return pv(i,t,gv(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};mN(i,e.style,e),s.style={...i,...s.style}}return s}function _z(e=!1){return(n,r,s,{latestValues:i},o)=>{const c=(cv(n)?xz:yz)(r,i,o,n),u=O3(r,typeof n=="string",e),d=n!==w.Fragment?{...u,...c,ref:s}:{},{children:f}=r,h=w.useMemo(()=>ot(f)?f.get():f,[f]);return w.createElement(n,{...d,children:h})}}function wz(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...cv(r)?pz:mz,preloadedFeatures:e,useRender:_z(s),createVisualElement:t,Component:r};return H3(o)}}function gN(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Pd(e,t,n){const r=e.getProps();return uv(r,t,n!==void 0?n:r.custom,e)}function yv(e,t){return e?e[t]||e.default||e:void 0}const vN=new Set(["width","height","top","left","right","bottom",...po]);let Rc;function bz(){Rc=void 0}const Bn={now:()=>(Rc===void 0&&Bn.set(Qe.isProcessing||T3.useManualTiming?Qe.timestamp:performance.now()),Rc),set:e=>{Rc=e,queueMicrotask(bz)}};function xv(e,t){e.indexOf(t)===-1&&e.push(t)}function _v(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class wv{constructor(){this.subscriptions=[]}add(t){return xv(this.subscriptions,t),()=>_v(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function yN(e,t){return t?e*(1e3/t):0}const b_=30,jz=e=>!isNaN(parseFloat(e));class Sz{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Bn.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Bn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=jz(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new wv);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ne.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Bn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>b_)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,b_);return yN(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Oa(e,t){return new Sz(e,t)}function kz(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Oa(n))}function Nz(e,t){const n=Pd(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=X3(i[o]);kz(e,o,l)}}function Ez(e){return!!(ot(e)&&e.add)}function Hp(e,t){const n=e.getValue("willChange");if(Ez(n))return n.add(t)}function xN(e){return e.props[nN]}function bv(e){let t;return()=>(t===void 0&&(t=e()),t)}const Cz=bv(()=>window.ScrollTimeline!==void 0);class Tz{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t,n){const r=this.animations.map(s=>{if(Cz()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n<this.animations.length;n++)t=Math.max(t,this.animations[n].duration);return t}runAll(t){this.animations.forEach(n=>n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Pz extends Tz{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const ur=e=>e*1e3,dr=e=>e/1e3;function jv(e){return typeof e=="function"}function j_(e,t){e.timeline=t,e.onfinish=null}const Sv=e=>Array.isArray(e)&&typeof e[0]=="number",Az={linearEasing:void 0};function Rz(e,t){const n=bv(e);return()=>{var r;return(r=Az[t])!==null&&r!==void 0?r:n()}}const Cu=Rz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Gi=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},_N=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=e(Gi(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function wN(e){return!!(typeof e=="function"&&Cu()||!e||typeof e=="string"&&(e in Wp||Cu())||Sv(e)||Array.isArray(e)&&e.every(wN))}const Lo=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Wp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Lo([0,.65,.55,1]),circOut:Lo([.55,0,1,.45]),backIn:Lo([.31,.01,.66,-.59]),backOut:Lo([.33,1.53,.69,.99])};function bN(e,t){if(e)return typeof e=="function"&&Cu()?_N(e,t):Sv(e)?Lo(e):Array.isArray(e)?e.map(n=>bN(n,t)||Wp.easeOut):Wp[e]}const jN=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Iz=1e-7,Mz=12;function Oz(e,t,n,r,s){let i,o,l=0;do o=t+(n-t)/2,i=jN(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>Iz&&++l<Mz);return o}function ul(e,t,n,r){if(e===t&&n===r)return At;const s=i=>Oz(i,0,1,e,n);return i=>i===0||i===1?i:jN(s(i),t,r)}const SN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,kN=e=>t=>1-e(1-t),NN=ul(.33,1.53,.69,.99),kv=kN(NN),EN=SN(kv),CN=e=>(e*=2)<1?.5*kv(e):.5*(2-Math.pow(2,-10*(e-1))),Nv=e=>1-Math.sin(Math.acos(e)),TN=kN(Nv),PN=SN(Nv),AN=e=>/^0[^.\s]+$/u.test(e);function Lz(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||AN(e):!0}const ta=e=>Math.round(e*1e5)/1e5,Ev=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function $z(e){return e==null}const Dz=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Cv=(e,t)=>n=>!!(typeof n=="string"&&Dz.test(n)&&n.startsWith(e)||t&&!$z(n)&&Object.prototype.hasOwnProperty.call(n,t)),RN=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(Ev);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},zz=e=>wr(0,255,e),zf={...mo,transform:e=>Math.round(zz(e))},xs={test:Cv("rgb","red"),parse:RN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+zf.transform(e)+", "+zf.transform(t)+", "+zf.transform(n)+", "+ta(Ma.transform(r))+")"};function Fz(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Kp={test:Cv("#"),parse:Fz,transform:xs.transform},vi={test:Cv("hsl","hue"),parse:RN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Vn.transform(ta(t))+", "+Vn.transform(ta(n))+", "+ta(Ma.transform(r))+")"},rt={test:e=>xs.test(e)||Kp.test(e)||vi.test(e),parse:e=>xs.test(e)?xs.parse(e):vi.test(e)?vi.parse(e):Kp.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?xs.transform(e):vi.transform(e)},Vz=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Bz(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Ev))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(Vz))===null||n===void 0?void 0:n.length)||0)>0}const IN="number",MN="color",Uz="var",Hz="var(",S_="${}",Wz=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function La(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=t.replace(Wz,c=>(rt.test(c)?(r.color.push(i),s.push(MN),n.push(rt.parse(c))):c.startsWith(Hz)?(r.var.push(i),s.push(Uz),n.push(c)):(r.number.push(i),s.push(IN),n.push(parseFloat(c))),++i,S_)).split(S_);return{values:n,split:l,indexes:r,types:s}}function ON(e){return La(e).values}function LN(e){const{split:t,types:n}=La(e),r=t.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=t[o],s[o]!==void 0){const l=n[o];l===IN?i+=ta(s[o]):l===MN?i+=rt.transform(s[o]):i+=s[o]}return i}}const Kz=e=>typeof e=="number"?0:e;function Gz(e){const t=ON(e);return LN(e)(t.map(Kz))}const Qr={test:Bz,parse:ON,createTransformer:LN,getAnimatableNone:Gz},qz=new Set(["brightness","contrast","saturate","opacity"]);function Yz(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Ev)||[];if(!r)return e;const s=n.replace(r,"");let i=qz.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const Xz=/\b([a-z-]*)\(.*?\)/gu,Gp={...Qr,getAnimatableNone:e=>{const t=e.match(Xz);return t?t.map(Yz).join(" "):e}},Qz={...fv,color:rt,backgroundColor:rt,outlineColor:rt,fill:rt,stroke:rt,borderColor:rt,borderTopColor:rt,borderRightColor:rt,borderBottomColor:rt,borderLeftColor:rt,filter:Gp,WebkitFilter:Gp},Tv=e=>Qz[e];function $N(e,t){let n=Tv(e);return n!==Gp&&(n=Qr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Zz=new Set(["auto","none","0"]);function Jz(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!Zz.has(i)&&La(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=$N(n,s)}const k_=e=>e===mo||e===ie,N_=(e,t)=>parseFloat(e.split(", ")[t]),E_=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return N_(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?N_(i[1],e):0}},eF=new Set(["x","y","z"]),tF=po.filter(e=>!eF.has(e));function nF(e){const t=[];return tF.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const qi={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:E_(4,13),y:E_(5,14)};qi.translateX=qi.x;qi.translateY=qi.y;const Ss=new Set;let qp=!1,Yp=!1;function DN(){if(Yp){const e=Array.from(Ss).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=nF(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))===null||l===void 0||l.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Yp=!1,qp=!1,Ss.forEach(e=>e.complete()),Ss.clear()}function zN(){Ss.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Yp=!0)})}function rF(){zN(),DN()}class Pv{constructor(t,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ss.add(this),qp||(qp=!0,Ne.read(zN),Ne.resolveKeyframes(DN))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i<t.length;i++)if(t[i]===null)if(i===0){const o=s==null?void 0:s.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const c=r.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),s&&o===void 0&&s.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ss.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ss.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const FN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),sF=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iF(e){const t=sF.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function VN(e,t,n=1){const[r,s]=iF(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return FN(o)?parseFloat(o):o}return dv(s)?VN(s,t,n+1):s}const BN=e=>t=>t.test(e),oF={test:e=>e==="auto",parse:e=>e},UN=[mo,ie,Vn,Tr,nz,tz,oF],C_=e=>UN.find(BN(e));class HN extends Pv{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let u=t[c];if(typeof u=="string"&&(u=u.trim(),dv(u))){const d=VN(u,n.current);d!==void 0&&(t[c]=d),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!vN.has(r)||t.length!==2)return;const[s,i]=t,o=C_(s),l=C_(i);if(o!==l)if(k_(o)&&k_(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)Lz(t[s])&&r.push(s);r.length&&Jz(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=qi[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var t;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,l=s[o];s[o]=qi[r](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([c,u])=>{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const T_=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Qr.test(e)||e==="0")&&!e.startsWith("url("));function aF(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function lF(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=T_(s,t),l=T_(i,t);return!o||!l?!1:aF(e)||(n==="spring"||jv(n))&&r}const cF=e=>e!==null;function Ad(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(cF),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const uF=40;class WN{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Bn.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>uF?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&rF(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Bn.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!lF(t,r,s,i))if(o)this.options.duration=0;else{c&&c(Ad(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Xp=2e4;function KN(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Xp;)t+=n,r=e.next(t);return t>=Xp?1/0:t}const Re=(e,t,n)=>e+(t-e)*n;function Ff(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function dF({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=Ff(c,l,e+1/3),i=Ff(c,l,e),o=Ff(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Tu(e,t){return n=>n>0?t:e}const Vf=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},fF=[Kp,xs,vi],hF=e=>fF.find(t=>t.test(e));function P_(e){const t=hF(e);if(!t)return!1;let n=t.parse(e);return t===vi&&(n=dF(n)),n}const A_=(e,t)=>{const n=P_(e),r=P_(t);if(!n||!r)return Tu(e,t);const s={...n};return i=>(s.red=Vf(n.red,r.red,i),s.green=Vf(n.green,r.green,i),s.blue=Vf(n.blue,r.blue,i),s.alpha=Re(n.alpha,r.alpha,i),xs.transform(s))},pF=(e,t)=>n=>t(e(n)),dl=(...e)=>e.reduce(pF),Qp=new Set(["none","hidden"]);function mF(e,t){return Qp.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function gF(e,t){return n=>Re(e,t,n)}function Av(e){return typeof e=="number"?gF:typeof e=="string"?dv(e)?Tu:rt.test(e)?A_:xF:Array.isArray(e)?GN:typeof e=="object"?rt.test(e)?A_:vF:Tu}function GN(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>Av(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function vF(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Av(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function yF(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],l=e.indexes[o][s[o]],c=(n=e.values[l])!==null&&n!==void 0?n:0;r[i]=c,s[o]++}return r}const xF=(e,t)=>{const n=Qr.createTransformer(t),r=La(e),s=La(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Qp.has(e)&&!s.values.length||Qp.has(t)&&!r.values.length?mF(e,t):dl(GN(yF(r,s),s.values),n):Tu(e,t)};function qN(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Re(e,t,n):Av(e)(e,t)}const _F=5;function YN(e,t,n){const r=Math.max(t-_F,0);return yN(n-e(r),t-r)}const $e={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Bf=.001;function wF({duration:e=$e.duration,bounce:t=$e.bounce,velocity:n=$e.velocity,mass:r=$e.mass}){let s,i,o=1-t;o=wr($e.minDamping,$e.maxDamping,o),e=wr($e.minDuration,$e.maxDuration,dr(e)),o<1?(s=u=>{const d=u*o,f=d*e,h=d-n,p=Zp(u,o),g=Math.exp(-f);return Bf-h/p*g},i=u=>{const f=u*o*e,h=f*n+n,p=Math.pow(o,2)*Math.pow(u,2)*e,g=Math.exp(-f),x=Zp(Math.pow(u,2),o);return(-s(u)+Bf>0?-1:1)*((h-p)*g)/x}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Bf+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=jF(s,i,l);if(e=ur(e),isNaN(c))return{stiffness:$e.stiffness,damping:$e.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const bF=12;function jF(e,t,n){let r=n;for(let s=1;s<bF;s++)r=r-e(r)/t(r);return r}function Zp(e,t){return e*Math.sqrt(1-t*t)}const SF=["duration","bounce"],kF=["stiffness","damping","mass"];function R_(e,t){return t.some(n=>e[n]!==void 0)}function NF(e){let t={velocity:$e.velocity,stiffness:$e.stiffness,damping:$e.damping,mass:$e.mass,isResolvedFromDuration:!1,...e};if(!R_(e,kF)&&R_(e,SF))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*wr(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:$e.mass,stiffness:s,damping:i}}else{const n=wF(e);t={...t,...n,mass:$e.mass},t.isResolvedFromDuration=!0}return t}function XN(e=$e.visualDuration,t=$e.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=NF({...n,velocity:-dr(n.velocity||0)}),g=h||0,x=u/(2*Math.sqrt(c*d)),_=o-i,v=dr(Math.sqrt(c/d)),y=Math.abs(_)<5;r||(r=y?$e.restSpeed.granular:$e.restSpeed.default),s||(s=y?$e.restDelta.granular:$e.restDelta.default);let m;if(x<1){const j=Zp(v,x);m=k=>{const S=Math.exp(-x*v*k);return o-S*((g+x*v*_)/j*Math.sin(j*k)+_*Math.cos(j*k))}}else if(x===1)m=j=>o-Math.exp(-v*j)*(_+(g+v*_)*j);else{const j=v*Math.sqrt(x*x-1);m=k=>{const S=Math.exp(-x*v*k),N=Math.min(j*k,300);return o-S*((g+x*v*_)*Math.sinh(N)+j*_*Math.cosh(N))/j}}const b={calculatedDuration:p&&f||null,next:j=>{const k=m(j);if(p)l.done=j>=f;else{let S=0;x<1&&(S=j===0?ur(g):YN(m,j,k));const N=Math.abs(S)<=r,R=Math.abs(o-k)<=s;l.done=N&&R}return l.value=l.done?o:k,l},toString:()=>{const j=Math.min(KN(b),Xp),k=_N(S=>b.next(j*S).value,j,30);return j+"ms "+k}};return b}function I_({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=N=>l!==void 0&&N<l||c!==void 0&&N>c,g=N=>l===void 0?c:c===void 0||Math.abs(l-N)<Math.abs(c-N)?l:c;let x=n*t;const _=f+x,v=o===void 0?_:o(_);v!==_&&(x=v-f);const y=N=>-x*Math.exp(-N/r),m=N=>v+y(N),b=N=>{const R=y(N),O=m(N);h.done=Math.abs(R)<=u,h.value=h.done?v:O};let j,k;const S=N=>{p(h.value)&&(j=N,k=XN({keyframes:[h.value,g(h.value)],velocity:YN(m,N,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return S(0),{calculatedDuration:null,next:N=>{let R=!1;return!k&&j===void 0&&(R=!0,b(N),S(N)),j!==void 0&&N>=j?k.next(N-j):(!R&&b(N),h)}}}const EF=ul(.42,0,1,1),CF=ul(0,0,.58,1),QN=ul(.42,0,.58,1),TF=e=>Array.isArray(e)&&typeof e[0]!="number",PF={linear:At,easeIn:EF,easeInOut:QN,easeOut:CF,circIn:Nv,circInOut:PN,circOut:TN,backIn:kv,backInOut:EN,backOut:NN,anticipate:CN},M_=e=>{if(Sv(e)){Qk(e.length===4);const[t,n,r,s]=e;return ul(t,n,r,s)}else if(typeof e=="string")return PF[e];return e};function AF(e,t,n){const r=[],s=n||qN,i=e.length-1;for(let o=0;o<i;o++){let l=s(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||At:t;l=dl(c,l)}r.push(l)}return r}function RF(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(Qk(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=AF(t,r,s),c=l.length,u=d=>{if(o&&d<e[0])return t[0];let f=0;if(c>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const h=Gi(e[f],e[f+1],d);return l[f](h)};return n?d=>u(wr(e[0],e[i-1],d)):u}function IF(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Gi(0,t,r);e.push(Re(n,1,s))}}function MF(e){const t=[0];return IF(t,e.length-1),t}function OF(e,t){return e.map(n=>n*t)}function LF(e,t){return e.map(()=>t||QN).splice(0,e.length-1)}function Pu({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=TF(r)?r.map(M_):M_(r),i={done:!1,value:t[0]},o=OF(n&&n.length===t.length?n:MF(t),e),l=RF(o,t,{ease:Array.isArray(s)?s:LF(t,s)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const $F=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Ne.update(t,!0),stop:()=>Xr(t),now:()=>Qe.isProcessing?Qe.timestamp:Bn.now()}},DF={decay:I_,inertia:I_,tween:Pu,keyframes:Pu,spring:XN},zF=e=>e/100;class Rv extends WN{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||Pv,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new o(i,l,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,l=jv(n)?n:DF[n]||Pu;let c,u;l!==Pu&&typeof t[0]!="number"&&(c=dl(zF,qN(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});i==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=KN(d));const{calculatedDuration:f}=d,h=f+s,p=h*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:N}=this.options;return{done:!0,value:N[N.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:g,repeatDelay:x,onUpdate:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?v<0:v>d;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let m=this.currentTime,b=i;if(p){const N=Math.min(this.currentTime,d)/f;let R=Math.floor(N),O=N%1;!O&&N>=1&&(O=1),O===1&&R--,R=Math.min(R,p+1),!!(R%2)&&(g==="reverse"?(O=1-O,x&&(O-=x/f)):g==="mirror"&&(b=o)),m=wr(0,1,O)*f}const j=y?{done:!1,value:c[0]}:b.next(m);l&&(j.value=l(j.value));let{done:k}=j;!y&&u!==null&&(k=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return S&&s!==void 0&&(j.value=Ad(c,this.options,s)),_&&_(j.value),S&&this.finish(),j}get duration(){const{resolved:t}=this;return t?dr(t.calculatedDuration):0}get time(){return dr(this.currentTime)}set time(t){t=ur(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=dr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=$F,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const FF=new Set(["opacity","clipPath","filter","transform"]);function VF(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=bN(l,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const BF=bv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Au=10,UF=2e4;function HF(e){return jv(e.type)||e.type==="spring"||!wN(e.ease)}function WF(e,t){const n=new Rv({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&i<UF;)r=n.sample(i),s.push(r.value),i+=Au;return{times:void 0,keyframes:s,duration:i-Au,ease:"linear"}}const ZN={anticipate:CN,backInOut:EN,circInOut:PN};function KF(e){return e in ZN}class O_ extends WN{constructor(t){super(t);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new HN(i,(o,l)=>this.onKeyframesResolved(o,l),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&Cu()&&KF(i)&&(i=ZN[i]),HF(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:g,...x}=this.options,_=WF(t,x);t=_.keyframes,t.length===1&&(t[1]=t[0]),r=_.duration,s=_.times,i=_.ease,o="keyframes"}const d=VF(l.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(j_(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(Ad(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:o,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return dr(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return dr(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=ur(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return At;const{animation:r}=n;j_(r,t)}return At}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,g=new Rv({...p,keyframes:r,duration:s,type:i,ease:o,times:l,isGenerator:!0}),x=ur(this.time);u.setWithVelocity(g.sample(x-Au).value,g.sample(x).value,Au)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return BF()&&r&&FF.has(r)&&!c&&!u&&!s&&i!=="mirror"&&o!==0&&l!=="inertia"}}const GF={type:"spring",stiffness:500,damping:25,restSpeed:10},qF=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),YF={type:"keyframes",duration:.8},XF={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},QF=(e,{keyframes:t})=>t.length>2?YF:Xs.has(e)?e.startsWith("scale")?qF(t[1]):GF:XF;function ZF({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Iv=(e,t,n,r={},s,i)=>o=>{const l=yv(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-ur(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:s};ZF(l)||(d={...d,...QF(e,d)}),d.duration&&(d.duration=ur(d.duration)),d.repeatDelay&&(d.repeatDelay=ur(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=Ad(d.keyframes,l);if(h!==void 0)return Ne.update(()=>{d.onUpdate(h),d.onComplete()}),new Pz([])}return!i&&O_.supports(d)?new O_(d):new Rv(d)};function JF({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function JN(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=e.getDefaultTransition(),transitionEnd:l,...c}=t;r&&(o=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in c){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),p=c[f];if(p===void 0||d&&JF(d,f))continue;const g={delay:n,...yv(o||{},f)};let x=!1;if(window.MotionHandoffAnimation){const v=xN(e);if(v){const y=window.MotionHandoffAnimation(v,f,Ne);y!==null&&(g.startTime=y,x=!0)}}Hp(e,f),h.start(Iv(f,h,p,e.shouldReduceMotion&&vN.has(f)?{type:!1}:g,e,x));const _=h.animation;_&&u.push(_)}return l&&Promise.all(u).then(()=>{Ne.update(()=>{l&&Nz(e,l)})}),u}function Jp(e,t,n={}){var r;const s=Pd(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(JN(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return e4(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[o,l]:[l,o];return u().then(()=>d())}else return Promise.all([o(),l(n.delay)])}function e4(e,t,n=0,r=0,s=1,i){const o=[],l=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(e.variantChildren).sort(t4).forEach((u,d)=>{u.notify("AnimationStart",t),o.push(Jp(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function t4(e,t){return e.sortNodePosition(t)}function n4(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>Jp(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=Jp(e,t,n);else{const s=typeof t=="function"?Pd(e,t,n.custom):t;r=Promise.all(JN(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const r4=ov.length;function eE(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?eE(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<r4;n++){const r=ov[n],s=e.props[r];(Ia(s)||s===!1)&&(t[r]=s)}return t}const s4=[...iv].reverse(),i4=iv.length;function o4(e){return t=>Promise.all(t.map(({animation:n,options:r})=>n4(e,n,r)))}function a4(e){let t=o4(e),n=L_(),r=!0;const s=c=>(u,d)=>{var f;const h=Pd(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:g,...x}=h;u={...u,...x,...g}}return u};function i(c){t=c(e)}function o(c){const{props:u}=e,d=eE(e.parent)||{},f=[],h=new Set;let p={},g=1/0;for(let _=0;_<i4;_++){const v=s4[_],y=n[v],m=u[v]!==void 0?u[v]:d[v],b=Ia(m),j=v===c?y.isActive:null;j===!1&&(g=_);let k=m===d[v]&&m!==u[v]&&b;if(k&&r&&e.manuallyAnimateOnMount&&(k=!1),y.protectedKeys={...p},!y.isActive&&j===null||!m&&!y.prevProp||Cd(m)||typeof m=="boolean")continue;const S=l4(y.prevProp,m);let N=S||v===c&&y.isActive&&!k&&b||_>g&&b,R=!1;const O=Array.isArray(m)?m:[m];let D=O.reduce(s(v),{});j===!1&&(D={});const{prevResolvedValues:M={}}=y,z={...M,...D},T=P=>{N=!0,h.has(P)&&(R=!0,h.delete(P)),y.needsAnimating[P]=!0;const I=e.getValue(P);I&&(I.liveStyle=!1)};for(const P in z){const I=D[P],C=M[P];if(p.hasOwnProperty(P))continue;let L=!1;Up(I)&&Up(C)?L=!gN(I,C):L=I!==C,L?I!=null?T(P):h.add(P):I!==void 0&&h.has(P)?T(P):y.protectedKeys[P]=!0}y.prevProp=m,y.prevResolvedValues=D,y.isActive&&(p={...p,...D}),r&&e.blockInitialAnimation&&(N=!1),N&&(!(k&&S)||R)&&f.push(...O.map(P=>({animation:P,options:{type:v}})))}if(h.size){const _={};h.forEach(v=>{const y=e.getBaseTarget(v),m=e.getValue(v);m&&(m.liveStyle=!0),_[v]=y??null}),f.push({animation:_})}let x=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,x?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=o(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=L_(),r=!0}}}function l4(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!gN(t,e):!1}function os(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function L_(){return{animate:os(!0),whileInView:os(),whileHover:os(),whileTap:os(),whileDrag:os(),whileFocus:os(),exit:os()}}class ns{constructor(t){this.isMounted=!1,this.node=t}update(){}}class c4 extends ns{constructor(t){super(t),t.animationState||(t.animationState=a4(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Cd(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let u4=0;class d4 extends ns{constructor(){super(...arguments),this.id=u4++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const f4={animation:{Feature:c4},exit:{Feature:d4}},an={x:!1,y:!1};function tE(){return an.x||an.y}function h4(e){return e==="x"||e==="y"?an[e]?null:(an[e]=!0,()=>{an[e]=!1}):an.x||an.y?null:(an.x=an.y=!0,()=>{an.x=an.y=!1})}const Mv=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function $a(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function fl(e){return{point:{x:e.pageX,y:e.pageY}}}const p4=e=>t=>Mv(t)&&e(t,fl(t));function na(e,t,n,r){return $a(e,t,p4(n),r)}const $_=(e,t)=>Math.abs(e-t);function m4(e,t){const n=$_(e.x,t.x),r=$_(e.y,t.y);return Math.sqrt(n**2+r**2)}class nE{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Hf(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=m4(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:g}=f,{timestamp:x}=Qe;this.history.push({...g,timestamp:x});const{onStart:_,onMove:v}=this.handlers;h||(_&&_(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Uf(h,this.transformPagePoint),Ne.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:g,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Hf(f.type==="pointercancel"?this.lastMoveEventInfo:Uf(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,_),g&&g(f,_)},!Mv(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=fl(t),l=Uf(o,this.transformPagePoint),{point:c}=l,{timestamp:u}=Qe;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Hf(l,this.history)),this.removeListeners=dl(na(this.contextWindow,"pointermove",this.handlePointerMove),na(this.contextWindow,"pointerup",this.handlePointerUp),na(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Xr(this.updatePoint)}}function Uf(e,t){return t?{point:t(e.point)}:e}function D_(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hf({point:e},t){return{point:e,delta:D_(e,rE(t)),offset:D_(e,g4(t)),velocity:v4(t,.1)}}function g4(e){return e[0]}function rE(e){return e[e.length-1]}function v4(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=rE(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>ur(t)));)n--;if(!r)return{x:0,y:0};const i=dr(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const sE=1e-4,y4=1-sE,x4=1+sE,iE=.01,_4=0-iE,w4=0+iE;function It(e){return e.max-e.min}function b4(e,t,n){return Math.abs(e-t)<=n}function z_(e,t,n,r=.5){e.origin=r,e.originPoint=Re(t.min,t.max,e.origin),e.scale=It(n)/It(t),e.translate=Re(n.min,n.max,e.origin)-e.originPoint,(e.scale>=y4&&e.scale<=x4||isNaN(e.scale))&&(e.scale=1),(e.translate>=_4&&e.translate<=w4||isNaN(e.translate))&&(e.translate=0)}function ra(e,t,n,r){z_(e.x,t.x,n.x,r?r.originX:void 0),z_(e.y,t.y,n.y,r?r.originY:void 0)}function F_(e,t,n){e.min=n.min+t.min,e.max=e.min+It(t)}function j4(e,t,n){F_(e.x,t.x,n.x),F_(e.y,t.y,n.y)}function V_(e,t,n){e.min=t.min-n.min,e.max=e.min+It(t)}function sa(e,t,n){V_(e.x,t.x,n.x),V_(e.y,t.y,n.y)}function S4(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Re(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Re(n,e,r.max):Math.min(e,n)),e}function B_(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function k4(e,{top:t,left:n,bottom:r,right:s}){return{x:B_(e.x,n,s),y:B_(e.y,t,r)}}function U_(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function N4(e,t){return{x:U_(e.x,t.x),y:U_(e.y,t.y)}}function E4(e,t){let n=.5;const r=It(e),s=It(t);return s>r?n=Gi(t.min,t.max-r,e.min):r>s&&(n=Gi(e.min,e.max-s,t.min)),wr(0,1,n)}function C4(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const em=.35;function T4(e=em){return e===!1?e=0:e===!0&&(e=em),{x:H_(e,"left","right"),y:H_(e,"top","bottom")}}function H_(e,t,n){return{min:W_(e,t),max:W_(e,n)}}function W_(e,t){return typeof e=="number"?e:e[t]||0}const K_=()=>({translate:0,scale:1,origin:0,originPoint:0}),yi=()=>({x:K_(),y:K_()}),G_=()=>({min:0,max:0}),ze=()=>({x:G_(),y:G_()});function Ut(e){return[e("x"),e("y")]}function oE({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function P4({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function A4(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Wf(e){return e===void 0||e===1}function tm({scale:e,scaleX:t,scaleY:n}){return!Wf(e)||!Wf(t)||!Wf(n)}function fs(e){return tm(e)||aE(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function aE(e){return q_(e.x)||q_(e.y)}function q_(e){return e&&e!=="0%"}function Ru(e,t,n){const r=e-n,s=t*r;return n+s}function Y_(e,t,n,r,s){return s!==void 0&&(e=Ru(e,s,r)),Ru(e,n,r)+t}function nm(e,t=0,n=1,r,s){e.min=Y_(e.min,t,n,r,s),e.max=Y_(e.max,t,n,r,s)}function lE(e,{x:t,y:n}){nm(e.x,t.translate,t.scale,t.originPoint),nm(e.y,n.translate,n.scale,n.originPoint)}const X_=.999999999999,Q_=1.0000000000001;function R4(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&_i(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,lE(e,o)),r&&fs(i.latestValues)&&_i(e,i.latestValues))}t.x<Q_&&t.x>X_&&(t.x=1),t.y<Q_&&t.y>X_&&(t.y=1)}function xi(e,t){e.min=e.min+t,e.max=e.max+t}function Z_(e,t,n,r,s=.5){const i=Re(e.min,e.max,s);nm(e,t,n,i,r)}function _i(e,t){Z_(e.x,t.x,t.scaleX,t.scale,t.originX),Z_(e.y,t.y,t.scaleY,t.scale,t.originY)}function cE(e,t){return oE(A4(e.getBoundingClientRect(),t))}function I4(e,t,n){const r=cE(e,n),{scroll:s}=t;return s&&(xi(r.x,s.offset.x),xi(r.y,s.offset.y)),r}const uE=({current:e})=>e?e.ownerDocument.defaultView:null,M4=new WeakMap;class O4{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ze(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(fl(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:g}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=h4(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ut(_=>{let v=this.getAxisMotionValue(_).get()||0;if(Vn.test(v)){const{projection:y}=this.visualElement;if(y&&y.layout){const m=y.layout.layoutBox[_];m&&(v=It(m)*(parseFloat(v)/100))}}this.originPoint[_]=v}),g&&Ne.postRender(()=>g(d,f)),Hp(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},o=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:g,onDrag:x}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:_}=f;if(p&&this.currentDirection===null){this.currentDirection=L4(_),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,_),this.updateAxis("y",f.point,_),this.visualElement.render(),x&&x(d,f)},l=(d,f)=>this.stop(d,f),c=()=>Ut(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new nE(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:uE(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&Ne.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Gl(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=S4(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&gi(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=k4(s.layoutBox,n):this.constraints=!1,this.elastic=T4(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Ut(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=C4(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!gi(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=I4(r,s.root,this.visualElement.getTransformPagePoint());let o=N4(s.layout.layoutBox,i);if(n){const l=n(P4(o));this.hasMutatedConstraints=!!l,l&&(o=oE(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Ut(d=>{if(!Gl(d,n,this.currentDirection))return;let f=c&&c[d]||{};o&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Hp(this.visualElement,t),r.start(Iv(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ut(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ut(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ut(n=>{const{drag:r}=this.getProps();if(!Gl(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];i.set(t[n]-Re(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!gi(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ut(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=E4({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ut(o=>{if(!Gl(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Re(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;M4.set(this.visualElement,this);const t=this.visualElement.current,n=na(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();gi(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Ne.read(r);const o=$a(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ut(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=em,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function Gl(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function L4(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class $4 extends ns{constructor(t){super(t),this.removeGroupControls=At,this.removeListeners=At,this.controls=new O4(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||At}unmount(){this.removeGroupControls(),this.removeListeners()}}const J_=e=>(t,n)=>{e&&Ne.postRender(()=>e(t,n))};class D4 extends ns{constructor(){super(...arguments),this.removePointerDownListener=At}onPointerDown(t){this.session=new nE(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:uE(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:J_(t),onStart:J_(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&Ne.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=na(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Ic={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function e0(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Co={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ie.test(e))e=parseFloat(e);else return e;const n=e0(e,t.target.x),r=e0(e,t.target.y);return`${n}% ${r}%`}},z4={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Qr.parse(e);if(s.length>5)return r;const i=Qr.createTransformer(e),o=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+o]/=l,s[1+o]/=c;const u=Re(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class F4 extends w.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;fz(V4),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Ic.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||Ne.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),lv.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function dE(e){const[t,n]=Yk(),r=w.useContext(tv);return a.jsx(F4,{...e,layoutGroup:r,switchLayoutGroup:w.useContext(rN),isPresent:t,safeToRemove:n})}const V4={borderRadius:{...Co,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Co,borderTopRightRadius:Co,borderBottomLeftRadius:Co,borderBottomRightRadius:Co,boxShadow:z4};function B4(e,t,n){const r=ot(e)?e:Oa(e);return r.start(Iv("",r,t,n)),r.animation}function U4(e){return e instanceof SVGElement&&e.tagName!=="svg"}const H4=(e,t)=>e.depth-t.depth;class W4{constructor(){this.children=[],this.isDirty=!1}add(t){xv(this.children,t),this.isDirty=!0}remove(t){_v(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(H4),this.isDirty=!1,this.children.forEach(t)}}function K4(e,t){const n=Bn.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Xr(r),e(i-t))};return Ne.read(r,!0),()=>Xr(r)}const fE=["TopLeft","TopRight","BottomLeft","BottomRight"],G4=fE.length,t0=e=>typeof e=="string"?parseFloat(e):e,n0=e=>typeof e=="number"||ie.test(e);function q4(e,t,n,r,s,i){s?(e.opacity=Re(0,n.opacity!==void 0?n.opacity:1,Y4(r)),e.opacityExit=Re(t.opacity!==void 0?t.opacity:1,0,X4(r))):i&&(e.opacity=Re(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<G4;o++){const l=`border${fE[o]}Radius`;let c=r0(t,l),u=r0(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||n0(c)===n0(u)?(e[l]=Math.max(Re(t0(c),t0(u),r),0),(Vn.test(u)||Vn.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=Re(t.rotate||0,n.rotate||0,r))}function r0(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const Y4=hE(0,.5,TN),X4=hE(.5,.95,At);function hE(e,t,n){return r=>r<e?0:r>t?1:n(Gi(e,t,r))}function s0(e,t){e.min=t.min,e.max=t.max}function Vt(e,t){s0(e.x,t.x),s0(e.y,t.y)}function i0(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function o0(e,t,n,r,s){return e-=t,e=Ru(e,1/n,r),s!==void 0&&(e=Ru(e,1/s,r)),e}function Q4(e,t=0,n=1,r=.5,s,i=e,o=e){if(Vn.test(t)&&(t=parseFloat(t),t=Re(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Re(i.min,i.max,r);e===i&&(l-=t),e.min=o0(e.min,t,n,l,s),e.max=o0(e.max,t,n,l,s)}function a0(e,t,[n,r,s],i,o){Q4(e,t[n],t[r],t[s],t.scale,i,o)}const Z4=["x","scaleX","originX"],J4=["y","scaleY","originY"];function l0(e,t,n,r){a0(e.x,t,Z4,n?n.x:void 0,r?r.x:void 0),a0(e.y,t,J4,n?n.y:void 0,r?r.y:void 0)}function c0(e){return e.translate===0&&e.scale===1}function pE(e){return c0(e.x)&&c0(e.y)}function u0(e,t){return e.min===t.min&&e.max===t.max}function eV(e,t){return u0(e.x,t.x)&&u0(e.y,t.y)}function d0(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function mE(e,t){return d0(e.x,t.x)&&d0(e.y,t.y)}function f0(e){return It(e.x)/It(e.y)}function h0(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class tV{constructor(){this.members=[]}add(t){xv(this.members,t),t.scheduleRender()}remove(t){if(_v(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function nV(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:g}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),g&&(r+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const hs={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},$o=typeof window<"u"&&window.MotionDebug!==void 0,Kf=["","X","Y","Z"],rV={visibility:"hidden"},p0=1e3;let sV=0;function Gf(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function gE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=xN(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ne,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&gE(r)}function vE({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=t==null?void 0:t()){this.id=sV++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,$o&&(hs.totalNodes=hs.resolvedTargetDeltas=hs.recalculatedProjection=0),this.nodes.forEach(aV),this.nodes.forEach(fV),this.nodes.forEach(hV),this.nodes.forEach(lV),$o&&window.MotionDebug.record(hs)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new W4)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new wv),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=U4(o),this.instance=o;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(u||c)&&(this.isLayoutDirty=!0),e){let f;const h=()=>this.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=K4(h,250),Ic.hasAnimatedSinceResize&&(Ic.hasAnimatedSinceResize=!1,this.nodes.forEach(g0))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||d.getDefaultTransition()||yV,{onLayoutAnimationStart:_,onLayoutAnimationComplete:v}=d.getProps(),y=!this.targetLayout||!mE(this.targetLayout,g)||p,m=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||m||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,m);const b={...yv(x,"layout"),onPlay:_,onComplete:v};(d.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else h||g0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Xr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pV),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&gE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(m0);return}this.isUpdating||this.nodes.forEach(uV),this.isUpdating=!1,this.nodes.forEach(dV),this.nodes.forEach(iV),this.nodes.forEach(oV),this.clearAllSnapshots();const l=Bn.now();Qe.delta=wr(0,1e3/60,l-Qe.timestamp),Qe.timestamp=l,Qe.isProcessing=!0,Df.update.process(Qe),Df.preRender.process(Qe),Df.render.process(Qe),Qe.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,lv.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(cV),this.sharedNodes.forEach(mV)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ne.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ne.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ze(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!pE(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&(l||fs(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),xV(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return ze();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(_V))){const{scroll:d}=this.root;d&&(xi(c.x,d.offset.x),xi(c.y,d.offset.y))}return c}removeElementScroll(o){var l;const c=ze();if(Vt(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:h}=d;d!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&Vt(c,o),xi(c.x,f.offset.x),xi(c.y,f.offset.y))}return c}applyTransform(o,l=!1){const c=ze();Vt(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&_i(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),fs(d.latestValues)&&_i(c,d.latestValues)}return fs(this.latestValues)&&_i(c,this.latestValues),c}removeTransform(o){const l=ze();Vt(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!fs(u.latestValues))continue;tm(u.latestValues)&&u.updateSnapshot();const d=ze(),f=u.measurePageBox();Vt(d,f),l0(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return fs(this.latestValues)&&l0(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Qe.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:h}=this.options;if(!(!this.layout||!(f||h))){if(this.resolvedRelativeTargetAt=Qe.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ze(),this.relativeTargetOrigin=ze(),sa(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Vt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=ze(),this.targetWithTransforms=ze()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),j4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Vt(this.target,this.layout.layoutBox),lE(this.target,this.targetDelta)):Vt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ze(),this.relativeTargetOrigin=ze(),sa(this.relativeTargetOrigin,this.target,p.target),Vt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}$o&&hs.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||tm(this.parent.latestValues)||aE(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===Qe.timestamp&&(u=!1),u)return;const{layout:d,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||f))return;Vt(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,p=this.treeScale.y;R4(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=ze());const{target:g}=l;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(i0(this.prevProjectionDelta.x,this.projectionDelta.x),i0(this.prevProjectionDelta.y,this.projectionDelta.y)),ra(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==p||!h0(this.projectionDelta.x,this.prevProjectionDelta.x)||!h0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g)),$o&&hs.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=yi(),this.projectionDelta=yi(),this.projectionDeltaWithTransform=yi()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=yi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const h=ze(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,x=p!==g,_=this.getStack(),v=!_||_.members.length<=1,y=!!(x&&!v&&this.options.crossfade===!0&&!this.path.some(vV));this.animationProgress=0;let m;this.mixTargetDelta=b=>{const j=b/1e3;v0(f.x,o.x,j),v0(f.y,o.y,j),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sa(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),gV(this.relativeTarget,this.relativeTargetOrigin,h,j),m&&eV(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=ze()),Vt(m,this.relativeTarget)),x&&(this.animationValues=d,q4(d,u,this.latestValues,j,y,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Xr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ne.update(()=>{Ic.hasAnimatedSinceResize=!0,this.currentAnimation=B4(0,p0,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(p0),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&yE(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ze();const f=It(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=It(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}Vt(l,c),_i(l,d),ra(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new tV),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&Gf("z",o,u,this.animationValues);for(let d=0;d<Kf.length;d++)Gf(`rotate${Kf[d]}`,o,u,this.animationValues),Gf(`skew${Kf[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return rV;const u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=Ac(o==null?void 0:o.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const x={};return this.options.layoutId&&(x.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,x.pointerEvents=Ac(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!fs(this.latestValues)&&(x.transform=d?d({},""):"none",this.hasProjected=!1),x}const h=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=nV(this.projectionDeltaWithTransform,this.treeScale,h),d&&(u.transform=d(h,u.transform));const{x:p,y:g}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${g.origin*100}% 0`,f.animationValues?u.opacity=f===this?(c=(l=h.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:u.opacity=f===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const x in Eu){if(h[x]===void 0)continue;const{correct:_,applyTo:v}=Eu[x],y=u.transform==="none"?h[x]:_(h[x],f);if(v){const m=v.length;for(let b=0;b<m;b++)u[v[b]]=y}else u[x]=y}return this.options.layoutId&&(u.pointerEvents=f===this?Ac(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(m0),this.root.sharedNodes.clear()}}}function iV(e){e.updateLayout()}function oV(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=n.source!==e.layout.source;i==="size"?Ut(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=It(h);h.min=r[f].min,h.max=h.min+p}):yE(i,n.layoutBox,r)&&Ut(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=It(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=yi();ra(l,r,n.layoutBox);const c=yi();o?ra(c,e.applyTransform(s,!0),n.measuredBox):ra(c,r,n.layoutBox);const u=!pE(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const g=ze();sa(g,n.layoutBox,h.layoutBox);const x=ze();sa(x,r,p.layoutBox),mE(g,x)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function aV(e){$o&&hs.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function lV(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function cV(e){e.clearSnapshot()}function m0(e){e.clearMeasurements()}function uV(e){e.isLayoutDirty=!1}function dV(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function g0(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function fV(e){e.resolveTargetDelta()}function hV(e){e.calcProjection()}function pV(e){e.resetSkewAndRotation()}function mV(e){e.removeLeadSnapshot()}function v0(e,t,n){e.translate=Re(t.translate,0,n),e.scale=Re(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function y0(e,t,n,r){e.min=Re(t.min,n.min,r),e.max=Re(t.max,n.max,r)}function gV(e,t,n,r){y0(e.x,t.x,n.x,r),y0(e.y,t.y,n.y,r)}function vV(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const yV={duration:.45,ease:[.4,0,.1,1]},x0=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),_0=x0("applewebkit/")&&!x0("chrome/")?Math.round:At;function w0(e){e.min=_0(e.min),e.max=_0(e.max)}function xV(e){w0(e.x),w0(e.y)}function yE(e,t,n){return e==="position"||e==="preserve-aspect"&&!b4(f0(t),f0(n),.2)}function _V(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const wV=vE({attachResizeListener:(e,t)=>$a(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),qf={current:void 0},xE=vE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!qf.current){const e=new wV({});e.mount(window),e.setOptions({layoutScroll:!0}),qf.current=e}return qf.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),bV={pan:{Feature:D4},drag:{Feature:$4,ProjectionNode:xE,MeasureLayout:dE}};function jV(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function _E(e,t){const n=jV(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function b0(e){return t=>{t.pointerType==="touch"||tE()||e(t)}}function SV(e,t,n={}){const[r,s,i]=_E(e,n),o=b0(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=b0(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}function j0(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Ne.postRender(()=>i(t,fl(t)))}class kV extends ns{mount(){const{current:t}=this.node;t&&(this.unmount=SV(t,n=>(j0(this.node,n,"Start"),r=>j0(this.node,r,"End"))))}unmount(){}}class NV extends ns{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=dl($a(this.node.current,"focus",()=>this.onFocus()),$a(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const wE=(e,t)=>t?e===t?!0:wE(e,t.parentElement):!1,EV=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function CV(e){return EV.has(e.tagName)||e.tabIndex!==-1}const Do=new WeakSet;function S0(e){return t=>{t.key==="Enter"&&e(t)}}function Yf(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const TV=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=S0(()=>{if(Do.has(n))return;Yf(n,"down");const s=S0(()=>{Yf(n,"up")}),i=()=>Yf(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function k0(e){return Mv(e)&&!tE()}function PV(e,t,n={}){const[r,s,i]=_E(e,n),o=l=>{const c=l.currentTarget;if(!k0(l)||Do.has(c))return;Do.add(c);const u=t(l),d=(p,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!k0(p)||!Do.has(c))&&(Do.delete(c),typeof u=="function"&&u(p,{success:g}))},f=p=>{d(p,n.useGlobalTarget||wE(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(l=>{!CV(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),l.addEventListener("focus",u=>TV(u,s),s)}),i}function N0(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Ne.postRender(()=>i(t,fl(t)))}class AV extends ns{mount(){const{current:t}=this.node;t&&(this.unmount=PV(t,n=>(N0(this.node,n,"Start"),(r,{success:s})=>N0(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const rm=new WeakMap,Xf=new WeakMap,RV=e=>{const t=rm.get(e.target);t&&t(e)},IV=e=>{e.forEach(RV)};function MV({root:e,...t}){const n=e||document;Xf.has(n)||Xf.set(n,{});const r=Xf.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(IV,{root:e,...t})),r[s]}function OV(e,t,n){const r=MV(t);return rm.set(e,n),r.observe(e),()=>{rm.delete(e),r.unobserve(e)}}const LV={some:0,all:1};class $V extends ns{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:LV[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return OV(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(DV(t,n))&&this.startObserver()}unmount(){}}function DV({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const zV={inView:{Feature:$V},tap:{Feature:AV},focus:{Feature:NV},hover:{Feature:kV}},FV={layout:{ProjectionNode:xE,MeasureLayout:dE}},sm={current:null},bE={current:!1};function VV(){if(bE.current=!0,!!sv)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>sm.current=e.matches;e.addListener(t),t()}else sm.current=!1}const BV=[...UN,rt,Qr],UV=e=>BV.find(BN(e)),E0=new WeakMap;function HV(e,t,n){for(const r in t){const s=t[r],i=n[r];if(ot(s))e.addValue(r,s);else if(ot(i))e.addValue(r,Oa(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,Oa(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const C0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class WV{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Pv,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Bn.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,Ne.render(this.render,!1,!0))};const{latestValues:c,renderState:u,onUpdate:d}=o;this.onUpdate=d,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=Td(n),this.isVariantNode=tN(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:f,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in h){const g=h[p];c[p]!==void 0&&ot(g)&&g.set(c[p],!1)}}mount(t){this.current=t,E0.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),bE.current||VV(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:sm.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){E0.delete(this.current),this.projection&&this.projection.unmount(),Xr(this.notifyUpdate),Xr(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Xs.has(t),s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Ne.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ki){const n=Ki[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ze()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<C0.length;r++){const s=C0[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=t[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=HV(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Oa(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(FN(s)||AN(s))?s=parseFloat(s):!UV(s)&&Qr.test(n)&&(s=$N(t,n)),this.setBaseTarget(t,ot(s)?s.get():s)),ot(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=uv(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!ot(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new wv),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class jE extends WV{constructor(){super(...arguments),this.KeyframeResolver=HN}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ot(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function KV(e){return window.getComputedStyle(e)}class GV extends jE{constructor(){super(...arguments),this.type="html",this.renderInstance=uN}readValueFromInstance(t,n){if(Xs.has(n)){const r=Tv(n);return r&&r.default||0}else{const r=KV(t),s=(aN(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return cE(t,n)}build(t,n,r){hv(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return vv(t,n,r)}}class qV extends jE{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ze}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Xs.has(n)){const r=Tv(n);return r&&r.default||0}return n=dN.has(n)?n:av(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return pN(t,n,r)}build(t,n,r){pv(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){fN(t,n,r,s)}mount(t){this.isSVGTag=gv(t.tagName),super.mount(t)}}const YV=(e,t)=>cv(e)?new qV(t):new GV(t,{allowProjection:e!==w.Fragment}),XV=wz({...f4,...zV,...bV,...FV},YV),Ze=L3(XV),Ov={type:"spring",stiffness:500,damping:30,mass:.8};({...Ov});const QV={hidden:{opacity:0,scale:.95},visible:{opacity:1,scale:1,transition:Ov},exit:{opacity:0,scale:.97,transition:{duration:.15}}},Ct={hidden:{opacity:0,y:8},visible:{opacity:1,y:0},exit:{opacity:0,y:-4,transition:{duration:.1}}},SE={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.06,delayChildren:.02}}},ZV={hidden:{opacity:0,scale:.9},visible:{opacity:1,scale:1,transition:{...Ov,stiffness:420,damping:26}}},T0=[{id:"hr-onboarding",name:"HR 入职协同",steps:[{id:"classify",name:"信息校验",recipe:"validate-onboarding",engine:"llm_only",auto:!0,inputs:["员工姓名","身份证号","入职日期"],outputs:["校验结论","异常项"]},{id:"investigate",name:"权限准备",recipe:"prepare-access",engine:"qoder",auto:!0,inputs:["员工姓名","部门","岗位","校验结论"],outputs:["权限清单"]},{id:"draft_reply",name:"入职指引草拟",recipe:"draft-onboarding-guide",engine:"llm_only",auto:!0,inputs:["员工姓名","部门","岗位","权限清单"],outputs:["入职指引"]},{id:"quality_check",name:"法务与 HR 复核",recipe:"hr-legal-review",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["入职指引","异常项"],outputs:["复核结论"]},{id:"send_reply",name:"发送入职通知",recipe:"send-onboarding-notice",engine:"llm_only",auto:!0,inputs:["员工姓名","入职指引","复核结论"],outputs:["发送状态"]}],edges:[{from:"classify",to:"investigate"},{from:"investigate",to:"draft_reply"},{from:"draft_reply",to:"quality_check"},{from:"quality_check",to:"send_reply"}]},{id:"customer-service",name:"客服工单处理",steps:[{id:"classify",name:"工单分类",recipe:"classify-ticket",engine:"llm_only",auto:!0,inputs:["标题","描述"],outputs:["类型","紧急度"]},{id:"investigate",name:"问题排查",recipe:"investigate",engine:"qoder",auto:!0,inputs:["标题","类型"],outputs:["解决方案"]},{id:"draft_reply",name:"草拟回复",recipe:"draft-reply",engine:"llm_only",auto:!0,inputs:["客户","解决方案"],outputs:["回复内容"]},{id:"quality_check",name:"质量审核",recipe:"quality-check",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["回复内容"],outputs:["审核结论"]},{id:"send_reply",name:"发送回复",recipe:"send-reply",engine:"llm_only",auto:!0,inputs:["客户","回复内容"],outputs:["发送状态"]}],edges:[{from:"classify",to:"investigate"},{from:"investigate",to:"draft_reply"},{from:"draft_reply",to:"quality_check"},{from:"quality_check",to:"send_reply"}]},{id:"message-triage",name:"消息分诊",steps:[{id:"investigate",name:"深度调查",recipe:"investigate",engine:"qoder",auto:!0,inputs:["消息内容","发送人"],outputs:["调查结论"]},{id:"reply",name:"群内回复",recipe:"reply-to-group",engine:"llm_only",auto:!0,inputs:["调查结论","对话ID"],outputs:["回复状态"]}],edges:[{from:"investigate",to:"reply"}]},{id:"daily-digest",name:"每日摘要",steps:[{id:"collect",name:"收集当日数据",recipe:"collect-daily",engine:"llm_only",auto:!0,inputs:["日期"],outputs:["统计数据"]},{id:"generate",name:"生成摘要",recipe:"generate-digest",engine:"llm_only",auto:!0,inputs:["统计数据"],outputs:["摘要内容"]},{id:"send",name:"发送到群",recipe:"send-to-group",engine:"llm_only",auto:!0,inputs:["摘要内容"],outputs:["发送状态"]}],edges:[{from:"collect",to:"generate"},{from:"generate",to:"send"}]},{id:"kb-im",name:"知识库问答",steps:[{id:"check_relevance",name:"判断问题相关性",recipe:"check-relevance",engine:"llm_only",auto:!0,inputs:["消息内容"],outputs:["是否相关"]},{id:"generate_answer",name:"生成回答",recipe:"generate-answer",engine:"qoder",auto:!0,inputs:["消息内容","知识库文章"],outputs:["回答内容"]},{id:"reply_to_group",name:"回复群消息",recipe:"reply-to-group",engine:"llm_only",auto:!0,inputs:["回答内容","群ID"],outputs:["发送状态"]}],edges:[{from:"check_relevance",to:"generate_answer"},{from:"generate_answer",to:"reply_to_group"}]},{id:"discovery-demo",name:"需求发现演示",steps:[{id:"classify",name:"工单分类",recipe:"classify",engine:"llm_only",auto:!0,inputs:["消息内容"],outputs:["问题类型","紧急程度"]},{id:"enrich",name:"信息补全",recipe:"enrich",engine:"qoder",auto:!0,inputs:["消息内容","订单号"],outputs:["客户记录","历史工单"]},{id:"draft",name:"回复草拟",recipe:"draft-reply",engine:"llm_only",auto:!0,inputs:["客户记录","历史工单"],outputs:["回复内容"]},{id:"review",name:"质检审核",recipe:"quality-check",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["回复内容"],outputs:["审核结果"]},{id:"send",name:"发送回复",recipe:"send-reply",engine:"llm_only",auto:!0,inputs:["回复内容"],outputs:["发送状态"]}],edges:[{from:"classify",to:"enrich"},{from:"enrich",to:"draft"},{from:"draft",to:"review"},{from:"review",to:"send"}]},{id:"plugin-i18n-upgrade",name:"插件国际化升级",steps:[{id:"prepare_workspace",name:"准备工作空间",recipe:"prepare-workspace",engine:"qoder",auto:!0,inputs:["插件名称","仓库地址"],outputs:["目标分支"]},{id:"upgrade_i18n",name:"国际化升级",recipe:"upgrade-i18n",engine:"qoder",auto:!0,inputs:["插件名称","目标分支"],outputs:["升级日志"]},{id:"submit_review",name:"提交代码评审",recipe:"submit-review",engine:"qoder",auto:!0,inputs:["目标分支"],outputs:["MR链接"]}],edges:[{from:"prepare_workspace",to:"upgrade_i18n"},{from:"upgrade_i18n",to:"submit_review"}]}];function kE(){return T0}function Qf(e){return kE().find(n=>n.id===e)??null}const P0=/\.(json|ya?ml|ts|js|md|txt)$/i,JV=new Set(["runtime","traces","node_modules"]),A0=/(^|\/)\.(_|DS_Store)/;function R0(e){const t=e.split("/")[0]??"";return JV.has(t)}async function e5(e){const t=Array.from(e),n=[];for(const s of t)if(s.name.toLowerCase().endsWith(".zip")){const o=await Kk(s),l=n5(Object.keys(o));for(const[c,u]of Object.entries(o)){const d=l(c).replace(/^\/+/,"");!d||A0.test(d)||R0(d)||!P0.test(d)||n.push({path:d,content:u})}}else{const o=t5(s);if(!o||A0.test(o)||R0(o)||!P0.test(o))continue;const l=await s.text();n.push({path:o,content:l})}const r=new Map;for(const s of n)r.set(s.path,s);return Array.from(r.values()).sort((s,i)=>s.path.localeCompare(i.path))}function t5(e){var n;const t=(n=e.webkitRelativePath)==null?void 0:n.trim();return t&&t.includes("/")?NE(t):e.name}function n5(e){if(e.length===0)return s=>s;const t=e.map(s=>s.split("/")).filter(s=>s.length>1).map(s=>s[0]);if(t.length===0)return s=>s;const n=t[0];return t.every(s=>s===n)?s=>NE(s):s=>s}function NE(e){const t=e.split("/");return t.length>1?t.slice(1).join("/"):e}function r5(e,t){return{identity:{id:"imported_init",projectId:e,stage:"init",attempt:1,startedAt:t,updatedAt:t,completedAt:t},state:{phase:"ready",warnings:[],roleFiles:[]},next:{kind:"idle"}}}function s5(e){const t=[],n=[];for(const o of e)t.push({path:o.path,status:"ok"});if(!e.some(o=>o.path==="aitable-workflow.config.yml"||o.path.endsWith(".config.yml")))t.push({path:"aitable-workflow.config.yml",status:"warning",detail:"缺失主配置文件,导入后可在「配置」阶段补齐"});else{const o=e.find(c=>c.path==="aitable-workflow.config.yml"||c.path.endsWith(".config.yml"));o&&!/^[ \t]*scene[ \t]*:[ \t]*\S/m.test(o.content)&&!/^[ \t]*scene[ \t]*:[ \t]*\|/m.test(o.content)&&t.push({path:"scene",status:"warning",detail:"config 缺少 scene 字段(业务场景描述)"})}return e.some(o=>o.path.startsWith("roles/")&&o.path.endsWith(".role.yml"))||t.push({path:"roles/",status:"warning",detail:"未检测到角色定义,可后续添加"}),e.some(o=>o.path==="workflow.yml"||o.path.endsWith("/workflow.yml"))||t.push({path:"workflow.yml",status:"warning",detail:"未包含工作流,导入后可在「设计」阶段生成"}),{items:t,envMissing:n}}function i5({onClose:e}){const t=Sr(),n=kE(),r=w.useRef(null),[s,i]=w.useState("upload"),[o,l]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState(null),[h,p]=w.useState([]),[g,x]=w.useState([]),[_,v]=w.useState([]),[y,m]=w.useState(null),[b,j]=w.useState(!1),[k,S]=w.useState(!1),[N,R]=w.useState(null),[O,D]=w.useState("");async function M(C){var L,F,V,H,U;u(!0),f(null);try{const W=Array.from(C),G=W.length>=1&&W.every(se=>/\.aitable-workflow\.zip$|\.zip$/i.test(se.name))?await z(W).catch(()=>null):null,Y=(G==null?void 0:G.files)??await e5(C);if(Y.length===0){f("未解析到可导入的文件(仅支持 .json/.yml/.yaml/.ts/.js/.md/.txt,且不能位于 runtime/traces/node_modules)"),l(!1),p([]),x([]),v([]);return}const{items:K,envMissing:X}=s5(Y);for(const se of(G==null?void 0:G.checksumWarnings)??[])K.push({path:se,status:"warning",detail:"checksum 校验"});p(Y),x(K),v(X),l(!0);const re=(L=G==null?void 0:G.title)==null?void 0:L.trim(),te=(F=Y.find(se=>se.path==="aitable-workflow.config.yml"||se.path.endsWith(".config.yml")))==null?void 0:F.content,Z=te?((V=/^name:\s*(?:"([^"]*)"|'([^']*)'|([^#\n]*))/m.exec(te))==null?void 0:V[1])??((H=/^name:\s*(?:"([^"]*)"|'([^']*)'|([^#\n]*))/m.exec(te))==null?void 0:H[3]):null,ee=re||(Z!=null&&Z.trim()?Z.trim():"")||((U=W.find(se=>/\.zip$/i.test(se.name)))==null?void 0:U.name.replace(/\.aitable-workflow\.zip$|\.zip$/i,""))||"导入项目";D(ee)}catch(W){f(W instanceof Error?W.message:String(W)),l(!1)}finally{u(!1)}}async function z(C){const L=[];let F;const V=[];let H=!1;const U=new Map;for(const W of C)try{const G=await h3(W);if(!G.manifest)continue;H=!0,!F&&G.title&&(F=G.title);for(const Y of G.checksumWarnings)V.push(Y);for(const Y of G.files)U.set(Y.path,Y)}catch{}if(!H)return null;for(const W of U.values())L.push(W);return L.sort((W,G)=>W.path.localeCompare(G.path)),{files:L,title:F,checksumWarnings:V}}function T(C){!C.target.files||C.target.files.length===0||(M(C.target.files),C.target.value="")}function E(C){m(C);const L=Qf(C);D((L==null?void 0:L.name)??C),p([]),f(null),x([{path:`examples/${C}/config.yml`,status:"ok"},{path:`examples/${C}/workflow.yml`,status:"ok"},{path:`examples/${C}/recipes/`,status:"ok"},{path:`examples/${C}/roles/`,status:"ok"}]),v([]),l(!0)}function A(){if(!O){const C=y?Qf(y):null;D((C==null?void 0:C.name)??"导入项目")}j(!0)}async function P(){if(S(!0),R(null),me)try{const{project:H}=await VL(O,h);B.setProjectSource("imported"),await bu(H.id),t(`/p/${H.id}/init`),e();return}catch(H){R(H instanceof Error?H.message:String(H)),S(!1);return}const C=`mock-imported-${Date.now()}`,L=y?Qf(y):null,F=((L==null?void 0:L.steps.length)??0)>0,V=new Date().toISOString();B.setProjectSource("imported"),B.applyLoadedProject({snapshot:{...ms(),projectId:C,projects:Ra(B.projects,{id:C,title:O,dir:"",createdAt:V,updatedAt:V}),files:h,workflow:L?{steps:L.steps,edges:L.edges}:null,projectState:{projectId:C,activeStage:null,stages:{init:r5(C,V)},updatedAt:V},init:{name:O,agentsSelected:[],selectedMachineId:"",tableConnected:!1,tableBaseId:"",tableId:"",llmProvider:"",llmModel:"",roles:[],sop:""}}}),t(`/p/${C}/${F?"setup":"design"}`),e()}const I=o&&(s==="upload"||y);return a.jsx("div",{className:"modal-overlay",onClick:e,children:a.jsxs("div",{className:"import-panel",onClick:C=>C.stopPropagation(),children:[a.jsxs("div",{className:"import-panel__head",children:[a.jsx("span",{className:"import-panel__title",children:"导入已有项目"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:e,children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"import-panel__body",children:b?a.jsxs("div",{className:"import-confirm",children:[a.jsx("div",{className:"import-confirm__icon",children:a.jsx($,{name:"file",size:22})}),a.jsx("h4",{className:"import-confirm__title",children:"确认导入到我的项目?"}),a.jsxs("p",{className:"import-confirm__desc",children:["将在你的账号下新建项目,并导入已解析的工作流配置。",y&&a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("span",{className:"cfg-muted",children:"导入后需在「搭建」阶段配置 AI 表格。"})]})]}),a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"项目名称"}),a.jsx("input",{className:"import-confirm__input",value:O,onChange:C=>D(C.target.value),placeholder:"输入项目名称"})]}),N&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),N]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"import-panel__sources",children:[a.jsxs("label",{className:`import-source${s==="upload"?" is-selected":""}`,children:[a.jsx("input",{type:"radio",name:"source",checked:s==="upload",onChange:()=>{i("upload"),l(!1),m(null),f(null),p([]),x([])}}),"上传项目包"]}),a.jsxs("label",{className:`import-source${s==="template"?" is-selected":""}`,children:[a.jsx("input",{type:"radio",name:"source",checked:s==="template",onChange:()=>{i("template"),l(!1),f(null),p([])}}),"从模板库选择"]})]}),s==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:r,type:"file",multiple:!0,accept:".zip,.json,.yml,.yaml,.ts,.js,.md,.txt",style:{display:"none"},onChange:T}),a.jsxs("button",{type:"button",className:"import-drop",disabled:c,onClick:()=>{var C;return(C=r.current)==null?void 0:C.click()},children:[a.jsx($,{name:"plus",size:20}),a.jsx("span",{children:c?"解析中...":o?"重新选择文件 (.zip / 多选 / 目录)":"拖拽或点击上传 (.zip / 多选)"})]}),d&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),d]})]}),s==="template"&&a.jsx("div",{className:"import-templates",children:n.map(C=>a.jsxs("button",{type:"button",className:`import-template${y===C.id?" is-selected":""}`,onClick:()=>E(C.id),children:[a.jsx("span",{className:"import-template__icon",children:a.jsx($,{name:"flow",size:14})}),a.jsx("span",{className:"import-template__name",children:C.name}),a.jsxs("span",{className:"cfg-muted",children:["examples/",C.id]})]},C.id))}),o&&a.jsxs("div",{className:"import-preview",children:[a.jsxs("div",{className:"import-preview__title",children:["解析结果预览(",h.length||g.length," 项):"]}),a.jsx("ul",{className:"import-preview__list",children:g.map(C=>a.jsxs("li",{className:`import-preview__item import-preview__item--${C.status}`,children:[a.jsx("span",{className:"import-preview__icon",children:C.status==="ok"?"✓":C.status==="warning"?"⚠":"✗"}),a.jsx("span",{className:"import-preview__path",children:C.path}),C.detail&&a.jsx("span",{className:"import-preview__detail",children:C.detail})]},C.path))}),_.length>0&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx($,{name:"warn",size:13}),"需要补齐 ",_.length," 个环境变量"]})]})]})}),a.jsx("div",{className:"import-panel__foot",children:b?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>j(!1),children:"返回"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!O.trim()||k,onClick:()=>void P(),children:k?"导入中...":"确认导入"})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:e,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!I,onClick:A,children:"下一步 →"})]})})]})})}function Rd({children:e}){return a.jsx("div",{className:"body body--norail",children:e})}const o5=[{icon:"robot",label:"配置",stage:"init",desc:"发现并接入 Agent、角色、SOP"},{icon:"flow",label:"设计",stage:"design",desc:"问答对齐后可视化编排工作流"},{icon:"table",label:"搭建",stage:"setup",desc:"自动创建字段与视图"},{icon:"sparkle",label:"试运行",stage:"test",desc:"用一条真实记录验证流程"}],a5=lt(function(){const[t,n]=w.useState(!1),[r,s]=w.useState(!1),i=Sr(),o=B.projects,[l,c]=w.useState(!1),[u,d]=w.useState(0);w.useEffect(()=>{if(!me)return;let g=!1;return Vg().then(x=>{g||(B.setProjects(x),c(!1))}).catch(()=>{g||c(!0)}),()=>{g=!0}},[u]);const[f,h]=w.useState(null);async function p(g){if(!me){const x=`mock-${Date.now()}`;B.beginNewProject(x,g),i(`/p/${x}/init`);return}h(null);try{const x=await Fg();B.beginNewProject(x.id,g),B.setProjects(Ra(B.projects,x)),i(`/p/${x.id}/init`)}catch(x){h(x instanceof Error?x.message:String(x))}}return a.jsx(Rd,{children:a.jsxs("div",{className:"home-hero",children:[a.jsx(Ze.span,{className:"home-hero__mark",variants:QV,initial:"hidden",animate:"visible",children:a.jsx($,{name:"sparkle",size:28,color:"#fff"})}),a.jsx("h1",{className:"home-hero__title",children:"用对话搭建你的 AI 表格工作流"}),a.jsxs("p",{className:"home-hero__desc",children:["从配置、设计、搭建到试运行,全程对话式引导。",a.jsx("br",{}),"以 HR、法务等专业岗位协作为例,四步落地一条可运行的业务流程。"]}),a.jsxs("div",{className:"home-hero__ctas",children:[a.jsxs("button",{type:"button",className:"primary home-hero__cta",onClick:()=>s(!0),children:[a.jsx($,{name:"play",size:16,color:"#fff"}),"新建项目"]}),a.jsxs("button",{type:"button",className:"home-hero__cta home-hero__cta--ghost",onClick:()=>n(!0),children:[a.jsx($,{name:"plus",size:16}),"导入已有项目"]})]}),f&&a.jsxs("div",{className:"home-hero__error",children:["新建项目失败:",f]}),a.jsxs("div",{className:"home-projects",children:[a.jsx("div",{className:"home-projects__title",children:"我的项目"}),l&&o.length===0?a.jsxs("div",{className:"home-projects__empty",children:["项目列表没取到。",a.jsx("button",{type:"button",className:"home-projects__retry",onClick:()=>d(g=>g+1),children:"重试"})]}):o.length===0?a.jsx("div",{className:"home-projects__empty",children:"还没有项目,从上面新建一个开始。"}):a.jsx("ul",{className:"home-projects__list",children:o.map((g,x)=>a.jsx("li",{children:a.jsxs(Ue,{className:"home-projects__item",to:`/p/${g.id}`,children:[a.jsx($,{name:"file",size:15}),a.jsx("span",{className:"home-projects__name",children:Bp(g,x)}),a.jsx("span",{className:"home-projects__id",children:g.id})]})},g.id))})]}),a.jsx(Ze.div,{className:"home-beats",variants:SE,initial:"hidden",animate:"visible",children:o5.map((g,x)=>a.jsxs(Ze.div,{className:"home-beat",variants:Ct,children:[a.jsx("span",{className:"home-beat__idx",children:x+1}),a.jsx("span",{className:"home-beat__icon",children:a.jsx($,{name:g.icon,size:18})}),a.jsx("span",{className:"home-beat__label",children:g.label}),a.jsx("span",{className:"home-beat__desc",children:g.desc})]},g.stage))}),t&&a.jsx(i5,{onClose:()=>n(!1)}),r&&a.jsx(Ek,{onConfirm:g=>{p(g),s(!1)},onCancel:()=>s(!1)})]})})});function l5({summary:e,allPassed:t,saving:n,onComplete:r}){return a.jsxs("div",{className:`cfg-summary${t?" cfg-summary--ok":""}`,children:[a.jsxs("div",{className:"cfg-summary__stats",children:[a.jsxs("span",{className:"cfg-summary__stat",children:[a.jsx($,{name:"check",size:14,color:"var(--green)"}),e.passedModules,"/",e.totalModules," 模块通过"]}),e.errors>0&&a.jsxs("span",{className:"cfg-summary__stat cfg-summary__stat--error",children:[e.errors," 错误"]}),e.warnings>0&&a.jsxs("span",{className:"cfg-summary__stat cfg-summary__stat--warn",children:[e.warnings," 警告"]})]}),a.jsx("button",{type:"button",className:"primary cfg-summary__btn",disabled:!t||n,onClick:r,children:n?"完成中…":t?"保存配置,继续搭建 →":"请先修复所有错误"})]})}const c5=".md,.txt,.text,.rst,.csv,.json,.yaml,.yml,.xml,.html,.htm,.docx,.pdf,.xlsx",u5=new Set([".docx",".pdf",".xlsx"]);let d5=0;function f5(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n)}function h5(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function p5({roleId:e,onIngestUrl:t,onUploadFiles:n}){const[r,s]=w.useState([]),[i,o]=w.useState([]),[l,c]=w.useState(!1),u=w.useRef(null),d=w.useRef(null),f=w.useRef(null),h=w.useCallback(()=>{s(b=>[...b,{id:++d5,type:"file",url:"",files:[]}])},[]),p=w.useCallback(b=>{s(j=>j.filter(k=>k.id!==b))},[]),g=w.useCallback((b,j)=>{s(k=>k.map(S=>S.id===b?{...S,type:j,url:"",files:[]}:S))},[]),x=w.useCallback((b,j)=>{s(k=>k.map(S=>S.id===b?{...S,url:j}:S))},[]),_=w.useCallback((b,j)=>{var k,S;f.current=b,j==="folder"?(k=d.current)==null||k.click():(S=u.current)==null||S.click()},[]),v=w.useCallback(b=>{const j=f.current;if(j===null)return;const k=Array.from(b.target.files??[]);k.length>0&&s(S=>S.map(N=>N.id===j?{...N,files:k}:N)),b.target.value=""},[]),y=w.useCallback(async()=>{if(l)return;c(!0);const b=[];for(const j of r)if(j.type==="url"){if(!j.url.trim())continue;try{const k=await t(e,j.url.trim());b.push({ok:k.ok,message:k.message??(k.ok?"导入成功":"导入失败")})}catch(k){b.push({ok:!1,message:k instanceof Error?k.message:"导入失败"})}}else{if(j.files.length===0)continue;try{const k=[];for(const N of j.files){const R=h5(N.name),O=N.webkitRelativePath||N.name;if(u5.has(R)){const D=await N.arrayBuffer();k.push({name:N.name,relativePath:O,content:f5(D),encoding:"base64"})}else{const D=await N.text();k.push({name:N.name,relativePath:O,content:D,encoding:"utf8"})}}const S=await n(e,k);b.push({ok:S.ok,message:S.message??(S.ok?`导入成功 (${j.files.length} 个文件)`:"导入失败")})}catch(k){b.push({ok:!1,message:k instanceof Error?k.message:"文件上传失败"})}}o(j=>[...j,...b]),s([]),c(!1)},[l,r,e,t,n]),m=r.some(b=>b.type==="url"&&b.url.trim()||b.type==="file"&&b.files.length>0);return a.jsxs("div",{className:"kb-panel",children:[a.jsx("input",{ref:u,type:"file",multiple:!0,accept:c5,style:{display:"none"},onChange:v}),a.jsx("input",{ref:d,type:"file",webkitdirectory:"",directory:"",multiple:!0,style:{display:"none"},onChange:v}),i.length>0&&a.jsx("div",{className:"kb-panel__results",children:i.map((b,j)=>a.jsxs("div",{className:`kb-panel__result ${b.ok?"is-ok":"is-error"}`,children:[a.jsx($,{name:b.ok?"check":"warn",size:12,color:b.ok?"var(--green)":"var(--red)"}),a.jsx("span",{children:b.message})]},j))}),r.length>0&&a.jsx("div",{className:"kb-panel__rows",children:r.map(b=>a.jsxs("div",{className:"kb-panel__row",children:[a.jsxs("select",{className:"kb-panel__type-select",value:b.type,onChange:j=>g(b.id,j.target.value),disabled:l,children:[a.jsx("option",{value:"file",children:"本地文件"}),a.jsx("option",{value:"url",children:"在线文档链接"})]}),b.type==="file"?a.jsxs("div",{className:"kb-panel__file-area",children:[b.files.length>0?a.jsxs("span",{className:"kb-panel__file-info",title:b.files.map(j=>j.name).join(`
77
+ `),children:["已选 ",b.files.length," 个文件"]}):a.jsx("span",{className:"kb-panel__file-placeholder",children:"未选择文件"}),a.jsx("button",{type:"button",className:"kb-panel__file-btn",onClick:()=>_(b.id,"file"),disabled:l,children:"选择文件"}),a.jsx("button",{type:"button",className:"kb-panel__file-btn",onClick:()=>_(b.id,"folder"),disabled:l,children:"选择文件夹"})]}):a.jsx("input",{type:"text",className:"qf-input kb-panel__url-input",value:b.url,placeholder:"输入在线文档链接",onChange:j=>x(b.id,j.target.value),disabled:l}),a.jsx("button",{type:"button",className:"kb-panel__row-remove",onClick:()=>p(b.id),disabled:l,title:"删除此行",children:a.jsx($,{name:"close",size:12})})]},b.id))}),a.jsxs("div",{className:"kb-panel__actions",children:[a.jsx("button",{type:"button",className:"cfg-item__edit-btn cfg-item__kb-btn",onClick:h,disabled:l,children:r.length>0||i.length>0?"继续添加知识库":"添加知识库"}),r.length>0&&a.jsx("button",{type:"button",className:"primary kb-panel__import-btn",onClick:()=>void y(),disabled:l||!m,children:l?"导入中…":"导入"})]})]})}function m5({fileRef:e}){const[t,n]=w.useState(!1),[r,s]=w.useState(null),[i,o]=w.useState(""),[l,c]=w.useState(!1),[u,d]=w.useState(!1),[f,h]=w.useState(!1),[p,g]=w.useState(null),[x,_]=w.useState(!1);async function v(){if(t){n(!1);return}if(n(!0),r===null){d(!0),g(null);try{const b=await wD(e.path);s(b.content),o(b.content)}catch(b){g(b instanceof Error?b.message:String(b))}finally{d(!1)}}}async function y(){h(!0),g(null);try{await bD(e.path,i),s(i),c(!1),_(!0),setTimeout(()=>_(!1),2400)}catch(b){g(b instanceof Error?b.message:String(b))}finally{h(!1)}}const m=(e.summary??[]).map(b=>b.count!==void 0?`${b.key} ${b.count}`:b.key).join(" · ");return a.jsxs("div",{className:"file-ref",children:[a.jsxs("button",{type:"button",className:"file-ref__toggle",onClick:()=>void v(),children:[a.jsx("span",{className:`file-ref__chevron${t?" is-open":""}`,children:a.jsx($,{name:"chevron-right",size:11})}),a.jsx($,{name:"file",size:12,color:"var(--text-muted)"}),a.jsx("code",{className:"file-ref__path",children:e.path}),e.exists?m&&a.jsx("span",{className:"file-ref__summary",children:m}):a.jsx("span",{className:"file-ref__missing",children:"文件不存在,展开可创建"})]}),e.exists&&a.jsxs("div",{className:"file-ref__locked-hint",children:[a.jsx($,{name:"lock",size:11,color:"var(--text-muted)"}),a.jsx("span",{children:"该配置指向上方文件,路径不可改;展开文件编辑其内容"})]}),t&&a.jsxs("div",{className:"file-ref__body",children:[u&&a.jsx("div",{className:"file-ref__hint",children:"读取中…"}),p&&a.jsxs("div",{className:"file-ref__error",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),a.jsx("span",{children:p})]}),!u&&r!==null&&!l&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"file-ref__pre",children:r||"(空文件)"}),a.jsxs("div",{className:"file-ref__actions",children:[a.jsx("button",{type:"button",className:"file-ref__btn",onClick:()=>{o(r),c(!0),g(null)},children:"编辑内容"}),x&&a.jsxs("span",{className:"file-ref__saved",children:[a.jsx($,{name:"check",size:12,color:"var(--green)"})," 已保存"]})]})]}),!u&&l&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{className:"qf-textarea file-ref__editor",value:i,spellCheck:!1,onChange:b=>o(b.target.value),autoFocus:!0}),a.jsxs("div",{className:"file-ref__actions",children:[a.jsx("button",{type:"button",className:"primary file-ref__btn",onClick:()=>void y(),disabled:f,children:f?"保存中…":`保存${e.format==="json"?" JSON":" YAML"}`}),a.jsx("button",{type:"button",className:"file-ref__btn",onClick:()=>{o(r??""),c(!1),g(null)},disabled:f,children:"取消"}),a.jsxs("span",{className:"file-ref__hint file-ref__hint--inline",children:["保存前会校验",e.format==="json"?" JSON":" YAML","语法,语法错误不会写入"]})]})]})]})]})}const g5=/secret|token|password|api_key/i;let EE=1;function v5(e,t){if(!e.trim())return[];try{const n=JSON.parse(e);return!n||typeof n!="object"||Array.isArray(n)?[]:Object.entries(n).map(([r,s])=>{const i={},o=[...t.valueFields];for(const l of Object.keys(s??{}))o.includes(l)||o.push(l);for(const l of o){const c=(s??{})[l];i[l]=c==null?"":String(c)}return{id:EE++,name:r,fields:i}})}catch{return[]}}function I0(e){const t={};for(const n of e.valueFields)t[n]="";return{id:EE++,name:"",fields:t}}function y5({spec:e,initialValue:t,saving:n,onSave:r,onCancel:s}){const[i,o]=w.useState(()=>{const p=v5(t,e);return p.length>0?p:[I0(e)]}),l=e.keyLabel??"名称",c=w.useMemo(()=>{const p=i.map(g=>g.name.trim());return p.some(g=>!g)?`每一项都需要填写「${l}」`:new Set(p).size!==p.length?`「${l}」不能重复`:null},[i,l]);function u(p,g){o(x=>x.map(_=>_.id===p?{..._,...g}:_))}function d(p,g,x){o(_=>_.map(v=>v.id===p?{...v,fields:{...v.fields,[g]:x}}:v))}function f(p){o(g=>g.filter(x=>x.id!==p))}async function h(){if(c)return;const p={};for(const g of i)p[g.name.trim()]=g.fields;await r(JSON.stringify(p))}return a.jsxs("div",{className:"env-map",children:[a.jsxs("p",{className:"env-map__hint",children:["按项填写,每项包含 ",e.valueFields.map(p=>a.jsx("code",{children:p},p)),",保存后自动写回配置。"]}),i.map((p,g)=>a.jsxs("div",{className:"env-map__entry",children:[a.jsxs("div",{className:"env-map__entry-head",children:[a.jsxs("span",{className:"env-map__entry-index",children:["#",g+1]}),a.jsx("input",{type:"text",className:"qf-input env-map__key-input",placeholder:l,value:p.name,onChange:x=>u(p.id,{name:x.target.value}),autoFocus:!p.name}),a.jsx("button",{type:"button",className:"env-map__remove-btn",title:"删除此项",onClick:()=>f(p.id),disabled:n,children:a.jsx($,{name:"close",size:13})})]}),a.jsx("div",{className:"env-map__fields",children:Object.keys(p.fields).map(x=>a.jsxs("label",{className:"env-map__field",children:[a.jsx("span",{className:"env-map__field-name",children:x}),a.jsx("input",{type:g5.test(x)?"password":"text",className:"qf-input env-map__field-input",placeholder:`输入 ${x}`,value:p.fields[x]??"",onChange:_=>d(p.id,x,_.target.value)})]},x))})]},p.id)),a.jsxs("button",{type:"button",className:"env-map__add-btn",onClick:()=>o(p=>[...p,I0(e)]),disabled:n,children:[a.jsx($,{name:"plus",size:13}),"添加一项"]}),c&&i.length>0&&a.jsx("div",{className:"env-map__error",children:c}),a.jsxs("div",{className:"cfg-item__edit-actions",children:[a.jsx("button",{type:"button",className:"primary cfg-item__save-btn",onClick:()=>void h(),disabled:n||!!c||i.length===0,children:n?"保存中…":"保存"}),a.jsx("button",{type:"button",className:"cfg-item__cancel-btn",onClick:s,disabled:n,children:"取消"})]})]})}const M0={ok:{icon:"check",color:"var(--green)"},error:{icon:"warn",color:"var(--red)"},warn:{icon:"warn",color:"var(--amber)"},suggestion:{icon:"dot",color:"var(--blue)"}},O0=".knowledge_scope.kb_collections";function x5(e){if(!e.endsWith(O0))return null;const t=e.slice(0,-O0.length),n=t.lastIndexOf(".");return n>=0?t.slice(n+1):t}function fn({item:e,onSave:t,onKbIngest:n,onKbUpload:r,suggestedDefault:s}){var k,S,N,R,O,D,M,z,T,E,A,P;const[i,o]=w.useState(!1),[l,c]=w.useState(zo(e)),[u,d]=w.useState(!1),f=((k=e.surface)==null?void 0:k.label)??e.key,h=((S=e.surface)==null?void 0:S.description)??e.message,p=e.writeTarget&&((N=e.surface)==null?void 0:N.editable)!==!1,g=e.sensitive,x=M0[e.status]??M0.suggestion,_=x5(e.key),y=_!==null&&n&&r,m=(R=e.surface)==null?void 0:R.envJsonSpec;async function b(I){if(!(!e.writeTarget||!I.trim())){d(!0);try{await t(e.writeTarget,I),o(!1)}finally{d(!1)}}}async function j(){await b(l)}return a.jsxs("div",{className:`cfg-item cfg-item--${e.status}`,children:[a.jsxs("div",{className:"cfg-item__head",children:[a.jsx("span",{className:"cfg-item__status",children:a.jsx($,{name:x.icon,size:14,color:x.color})}),a.jsx("span",{className:"cfg-item__label",children:f}),g&&a.jsx("span",{className:"cfg-item__badge cfg-item__badge--sensitive",children:"敏感"}),((O=e.surface)==null?void 0:O.required)&&a.jsx("span",{className:"cfg-item__badge cfg-item__badge--required",children:"必填"})]}),h&&!i&&a.jsx("div",{className:"cfg-item__desc",children:h}),!i&&a.jsxs("div",{className:"cfg-item__value-row",children:[a.jsx("span",{className:`cfg-item__value${((D=e.surface)==null?void 0:D.valueType)==="text"?" cfg-item__value--multiline":""}`,children:m?_5(e,m.keyLabel):g&&e.value?"***":e.value!==void 0&&String(e.value)!==""?String(e.value):"—"}),p&&a.jsx("button",{type:"button",className:"cfg-item__edit-btn",onClick:()=>{c(g?"":zo(e)||s||""),o(!0)},children:"编辑"})]}),!i&&p&&s&&!zo(e)&&a.jsxs("div",{className:"cfg-item__suggest",children:["默认沿用已配置的 Base ID:",a.jsx("code",{children:s}),"(点“编辑”已自动预填,直接保存即可)"]}),!i&&((M=e.surface)==null?void 0:M.fileRef)&&a.jsx(m5,{fileRef:e.surface.fileRef}),i&&m&&a.jsx("div",{className:"cfg-item__edit",children:a.jsx(y5,{spec:m,initialValue:g?"":zo(e),saving:u,onSave:b,onCancel:()=>o(!1)})}),i&&!m&&a.jsxs("div",{className:"cfg-item__edit",children:[((z=e.surface)==null?void 0:z.valueType)==="string[]"||((T=e.surface)==null?void 0:T.valueType)==="text"?a.jsx("textarea",{className:"qf-textarea cfg-item__input",rows:((E=e.surface)==null?void 0:E.valueType)==="text"?10:3,value:l,placeholder:((A=e.surface)==null?void 0:A.valueType)==="text"?`输入 ${f}`:"每行一个值,或用逗号分隔",onChange:I=>c(I.target.value),autoFocus:!0}):a.jsx("input",{type:g?"password":"text",className:"qf-input cfg-item__input",value:l,placeholder:((P=e.surface)==null?void 0:P.description)??`输入 ${f}`,onChange:I=>c(I.target.value),onKeyDown:I=>{I.key==="Enter"&&j()},autoFocus:!0}),a.jsxs("div",{className:"cfg-item__edit-actions",children:[a.jsx("button",{type:"button",className:"primary cfg-item__save-btn",onClick:()=>void j(),disabled:u||!l.trim(),children:u?"保存中…":"保存"}),a.jsx("button",{type:"button",className:"cfg-item__cancel-btn",onClick:()=>o(!1),disabled:u,children:"取消"})]})]}),y&&!p&&a.jsx(p5,{roleId:_,onIngestUrl:n,onUploadFiles:r})]})}function zo(e){return e.value===void 0||e.value===null?"":Array.isArray(e.value)?e.value.join(", "):String(e.value)}function _5(e,t){const n=zo(e);if(!n.trim())return"—";try{const r=JSON.parse(n),s=Object.keys(r);return s.length===0?"—":`已配 ${s.length} 项(${t??"名称"}: ${s.join(", ")})`}catch{return n}}function Iu({items:e}){const[t,n]=w.useState(!1);if(e.length===0)return null;const r=e.map(i=>`[${i.status}] ${i.key}: ${i.message}`).join(`
78
+ `);async function s(){try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),2e3)}catch{}}return a.jsxs("section",{className:"process-errors",children:[a.jsxs("div",{className:"process-errors__head",children:[a.jsx($,{name:"warn",size:14,color:"var(--red)"}),a.jsx("span",{children:"过程错误"}),a.jsx("button",{type:"button",className:"process-errors__copy",onClick:()=>void s(),children:t?"已复制":"复制"})]}),e.map((i,o)=>a.jsxs("div",{className:`process-errors__item process-errors__item--${i.status}`,children:[a.jsx("span",{className:"process-errors__icon",children:a.jsx($,{name:"warn",size:13,color:i.status==="error"?"var(--red)":"var(--amber)"})}),a.jsxs("div",{className:"process-errors__body",children:[i.key&&a.jsx("code",{className:"process-errors__key",children:i.key}),a.jsx("span",{className:"process-errors__msg",children:i.message})]})]},i.key??`pe-${o}`))]})}const w5=new Set(["workflow","agent.engine"]);function b5({config:e,engines:t,projectEnvRefs:n,onSave:r,onBatchSave:s}){const i=e.modules.find(m=>m.id==="project"),o=e.modules.find(m=>m.id==="coding_agent"),l=e.modules.find(m=>m.id==="env"),c=o==null?void 0:o.items.find(m=>m.key==="coding_agent.engine"),u=o==null?void 0:o.items.find(m=>m.key==="coding_agent.config.enabled"),d=c==null?void 0:c.value,[f,h]=w.useState(!1),p=w.useRef(!1),g=w.useCallback(async m=>{if(!(!(c!=null&&c.writeTarget)||!m)){h(!0);try{const b=[{writeTarget:c.writeTarget,value:m}];(u==null?void 0:u.status)==="error"&&u.writeTarget&&b.push({writeTarget:u.writeTarget,value:"true"}),await s(b)}finally{h(!1)}}},[c,u,s]);w.useEffect(()=>{p.current||(c==null?void 0:c.status)==="error"&&d&&t.available.some(m=>m.engine===d)&&c.writeTarget&&(p.current=!0,g(d))},[c,d,t.available,g]);const x=((i==null?void 0:i.items)??[]).filter(m=>!w5.has(m.key)&&(m.status!=="ok"||m.writeTarget)),_=((l==null?void 0:l.items)??[]).filter(m=>m.writeTarget&&(!n||n.includes(m.key))),v=((o==null?void 0:o.items)??[]).filter(m=>m.key!=="coding_agent.engine"&&m.writeTarget&&m.status==="error"),y=[...(i==null?void 0:i.items)??[],...(o==null?void 0:o.items)??[],...e.modules.filter(m=>m.id==="profile").flatMap(m=>m.items).filter(m=>!m.key.startsWith("kb_compile.")),...(l==null?void 0:l.items)??[]].filter(m=>!m.writeTarget&&(m.status==="error"||m.status==="warn"));return a.jsxs("div",{className:"adjust__tab-inner",children:[a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx($,{name:"robot",size:15}),"编码引擎"]}),a.jsxs("div",{className:"adjust__engine-row",children:[a.jsxs("select",{className:"qf-select adjust__engine-select",value:d??"",onChange:m=>void g(m.target.value),disabled:f,children:[a.jsx("option",{value:"",children:"请选择…"}),t.available.map(m=>a.jsxs("option",{value:m.engine,children:[m.engine," (",m.cmd,m.version?` v${m.version}`:"",")"]},m.engine)),!t.available.some(m=>m.engine==="llm_only")&&a.jsx("option",{value:"llm_only",children:"llm_only (无需本地 CLI)"})]}),(c==null?void 0:c.status)==="error"&&a.jsxs("span",{className:"adjust__engine-warn",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),c.message]}),(c==null?void 0:c.status)==="ok"&&a.jsx("span",{className:"adjust__engine-ok",children:a.jsx($,{name:"check",size:13,color:"var(--green)"})}),f&&a.jsx("span",{className:"adjust__engine-saving",children:"保存中…"})]}),t.recommended&&d!==t.recommended&&a.jsxs("p",{className:"adjust__hint-text",children:["推荐:",t.recommended]})]}),v.length>0&&a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx($,{name:"robot",size:15}),"引擎配置"]}),v.map(m=>a.jsx(fn,{item:m,onSave:r},m.key))]}),(x.length>0||_.length>0)&&a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx($,{name:"folder",size:15}),"项目参数"]}),x.map(m=>a.jsx(fn,{item:m,onSave:r},m.key)),_.map(m=>a.jsx(fn,{item:m,onSave:r},m.key))]}),x.length===0&&_.length===0&&v.length===0&&(c==null?void 0:c.status)==="ok"&&a.jsxs("div",{className:"adjust__empty",children:[a.jsx($,{name:"check",size:20,color:"var(--green)"}),a.jsx("span",{children:"项目参数已完整"})]}),a.jsx(Iu,{items:y})]})}const im=new Set(["roles.enabled","roles_dir","roles"]);function j5(e){const t=new Map;for(const n of e){if(im.has(n.key))continue;const r=n.key.match(/^role\.([^.]+)/);if(!r)continue;const s=r[1];t.has(s)||t.set(s,[]),t.get(s).push(n)}return Array.from(t.entries()).map(([n,r])=>({roleId:n,items:r}))}function S5({config:e,onSave:t,onKbIngest:n,onKbUpload:r}){const s=e.modules.find(d=>d.id==="roles");if(!s)return a.jsx("div",{className:"adjust__empty",children:"角色系统未启用"});const o=s.items.filter(d=>im.has(d.key)).find(d=>d.status==="error");if(o){const d=((s==null?void 0:s.items)??[]).filter(f=>!f.writeTarget&&f.status!=="ok"&&f!==o);return a.jsxs("div",{className:"adjust__tab-inner",children:[a.jsxs("div",{className:"adjust__error",children:[a.jsx($,{name:"warn",size:16,color:"var(--red)"}),a.jsx("span",{children:o.message})]}),a.jsx(Iu,{items:d})]})}const l=j5(s.items),c=new Map;for(const d of e.modules.filter(f=>f.id==="profile"))for(const f of d.items){const h=f.key.match(/^kb_compile\.([^.]+)\./);if(!h)continue;const p=h[1];c.has(p)||c.set(p,[]),c.get(p).push(f)}for(const d of c.values())d.sort((f,h)=>(f.status==="error"?0:1)-(h.status==="error"?0:1));if(l.length===0)return a.jsx("div",{className:"adjust__tab-inner",children:a.jsxs("div",{className:"adjust__empty",children:[a.jsx($,{name:"user",size:20,color:"var(--text-muted)"}),a.jsx("span",{children:"暂无角色配置"})]})});const u=((s==null?void 0:s.items)??[]).filter(d=>im.has(d.key)&&!d.writeTarget&&d.status!=="ok");return a.jsxs("div",{className:"adjust__tab-inner",children:[l.map(d=>a.jsx(k5,{role:d,kbItems:c.get(d.roleId)??[],onSave:t,onKbIngest:n,onKbUpload:r},d.roleId)),a.jsx(Iu,{items:u})]})}function k5({role:e,kbItems:t,onSave:n,onKbIngest:r,onKbUpload:s}){const i=e.items.find(c=>c.key===`role.${e.roleId}`),o=(i==null?void 0:i.status)==="ok"&&!t.some(c=>c.status==="error"),l=e.items.filter(c=>c.key!==`role.${e.roleId}`);return a.jsxs("div",{className:`role-card${o?" is-ok":""}`,children:[a.jsxs("div",{className:"role-card__head",children:[a.jsx($,{name:"user",size:15}),a.jsx("span",{className:"role-card__name",children:e.roleId}),a.jsx("span",{className:`role-card__status${o?" is-ok":""}`,children:o?a.jsxs(a.Fragment,{children:[a.jsx($,{name:"check",size:12})," 通过"]}):"需配置"})]}),(l.length>0||t.length>0)&&a.jsxs("div",{className:"role-card__body",children:[l.map(c=>a.jsx(fn,{item:c,onSave:n,onKbIngest:r,onKbUpload:s},c.key)),t.length>0&&a.jsxs("div",{className:"role-card__kb",children:[a.jsx("div",{className:"role-card__kb-title",children:"知识库编译配置"}),t.map(c=>a.jsx(fn,{item:c,onSave:n},c.key))]})]})]})}function He(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=He(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var N5={value:()=>{}};function Id(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Mc(n)}function Mc(e){this._=e}function E5(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Mc.prototype=Id.prototype={constructor:Mc,on:function(e,t){var n=this._,r=E5(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=C5(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(s=(e=r[i]).type)n[s]=L0(n[s],e.name,t);else if(t==null)for(s in n)n[s]=L0(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Mc(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function C5(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function L0(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=N5,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var om="http://www.w3.org/1999/xhtml";const $0={svg:"http://www.w3.org/2000/svg",xhtml:om,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Md(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),$0.hasOwnProperty(t)?{space:$0[t],local:e}:e}function T5(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===om&&t.documentElement.namespaceURI===om?t.createElement(e):t.createElementNS(n,e)}}function P5(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function CE(e){var t=Md(e);return(t.local?P5:T5)(t)}function A5(){}function Lv(e){return e==null?A5:function(){return this.querySelector(e)}}function R5(e){typeof e!="function"&&(e=Lv(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=new Array(o),c,u,d=0;d<o;++d)(c=i[d])&&(u=e.call(c,c.__data__,d,i))&&("__data__"in c&&(u.__data__=c.__data__),l[d]=u);return new Mt(r,this._parents)}function I5(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function M5(){return[]}function TE(e){return e==null?M5:function(){return this.querySelectorAll(e)}}function O5(e){return function(){return I5(e.apply(this,arguments))}}function L5(e){typeof e=="function"?e=O5(e):e=TE(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var o=t[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&(r.push(e.call(c,c.__data__,u,o)),s.push(c));return new Mt(r,s)}function PE(e){return function(){return this.matches(e)}}function AE(e){return function(t){return t.matches(e)}}var $5=Array.prototype.find;function D5(e){return function(){return $5.call(this.children,e)}}function z5(){return this.firstElementChild}function F5(e){return this.select(e==null?z5:D5(typeof e=="function"?e:AE(e)))}var V5=Array.prototype.filter;function B5(){return Array.from(this.children)}function U5(e){return function(){return V5.call(this.children,e)}}function H5(e){return this.selectAll(e==null?B5:U5(typeof e=="function"?e:AE(e)))}function W5(e){typeof e!="function"&&(e=PE(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new Mt(r,this._parents)}function RE(e){return new Array(e.length)}function K5(){return new Mt(this._enter||this._groups.map(RE),this._parents)}function Mu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Mu.prototype={constructor:Mu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function G5(e){return function(){return e}}function q5(e,t,n,r,s,i){for(var o=0,l,c=t.length,u=i.length;o<u;++o)(l=t[o])?(l.__data__=i[o],r[o]=l):n[o]=new Mu(e,i[o]);for(;o<c;++o)(l=t[o])&&(s[o]=l)}function Y5(e,t,n,r,s,i,o){var l,c,u=new Map,d=t.length,f=i.length,h=new Array(d),p;for(l=0;l<d;++l)(c=t[l])&&(h[l]=p=o.call(c,c.__data__,l,t)+"",u.has(p)?s[l]=c:u.set(p,c));for(l=0;l<f;++l)p=o.call(e,i[l],l,i)+"",(c=u.get(p))?(r[l]=c,c.__data__=i[l],u.delete(p)):n[l]=new Mu(e,i[l]);for(l=0;l<d;++l)(c=t[l])&&u.get(h[l])===c&&(s[l]=c)}function X5(e){return e.__data__}function Q5(e,t){if(!arguments.length)return Array.from(this,X5);var n=t?Y5:q5,r=this._parents,s=this._groups;typeof e!="function"&&(e=G5(e));for(var i=s.length,o=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var d=r[u],f=s[u],h=f.length,p=Z5(e.call(d,d&&d.__data__,u,r)),g=p.length,x=l[u]=new Array(g),_=o[u]=new Array(g),v=c[u]=new Array(h);n(d,f,x,_,v,p,t);for(var y=0,m=0,b,j;y<g;++y)if(b=x[y]){for(y>=m&&(m=y+1);!(j=_[m])&&++m<g;);b._next=j||null}}return o=new Mt(o,r),o._enter=l,o._exit=c,o}function Z5(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function J5(){return new Mt(this._exit||this._groups.map(RE),this._parents)}function eB(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function tB(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,o=Math.min(s,i),l=new Array(s),c=0;c<o;++c)for(var u=n[c],d=r[c],f=u.length,h=l[c]=new Array(f),p,g=0;g<f;++g)(p=u[g]||d[g])&&(h[g]=p);for(;c<s;++c)l[c]=n[c];return new Mt(l,this._parents)}function nB(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function rB(e){e||(e=sB);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],l=o.length,c=s[i]=new Array(l),u,d=0;d<l;++d)(u=o[d])&&(c[d]=u);c.sort(t)}return new Mt(s,this._parents).order()}function sB(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function iB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function oB(){return Array.from(this)}function aB(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function lB(){let e=0;for(const t of this)++e;return e}function cB(){return!this.node()}function uB(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,o=s.length,l;i<o;++i)(l=s[i])&&e.call(l,l.__data__,i,s);return this}function dB(e){return function(){this.removeAttribute(e)}}function fB(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hB(e,t){return function(){this.setAttribute(e,t)}}function pB(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function mB(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function gB(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function vB(e,t){var n=Md(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?fB:dB:typeof t=="function"?n.local?gB:mB:n.local?pB:hB)(n,t))}function IE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yB(e){return function(){this.style.removeProperty(e)}}function xB(e,t,n){return function(){this.style.setProperty(e,t,n)}}function _B(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function wB(e,t,n){return arguments.length>1?this.each((t==null?yB:typeof t=="function"?_B:xB)(e,t,n??"")):Yi(this.node(),e)}function Yi(e,t){return e.style.getPropertyValue(t)||IE(e).getComputedStyle(e,null).getPropertyValue(t)}function bB(e){return function(){delete this[e]}}function jB(e,t){return function(){this[e]=t}}function SB(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function kB(e,t){return arguments.length>1?this.each((t==null?bB:typeof t=="function"?SB:jB)(e,t)):this.node()[e]}function ME(e){return e.trim().split(/^|\s+/)}function $v(e){return e.classList||new OE(e)}function OE(e){this._node=e,this._names=ME(e.getAttribute("class")||"")}OE.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function LE(e,t){for(var n=$v(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function $E(e,t){for(var n=$v(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function NB(e){return function(){LE(this,e)}}function EB(e){return function(){$E(this,e)}}function CB(e,t){return function(){(t.apply(this,arguments)?LE:$E)(this,e)}}function TB(e,t){var n=ME(e+"");if(arguments.length<2){for(var r=$v(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?CB:t?NB:EB)(n,t))}function PB(){this.textContent=""}function AB(e){return function(){this.textContent=e}}function RB(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function IB(e){return arguments.length?this.each(e==null?PB:(typeof e=="function"?RB:AB)(e)):this.node().textContent}function MB(){this.innerHTML=""}function OB(e){return function(){this.innerHTML=e}}function LB(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function $B(e){return arguments.length?this.each(e==null?MB:(typeof e=="function"?LB:OB)(e)):this.node().innerHTML}function DB(){this.nextSibling&&this.parentNode.appendChild(this)}function zB(){return this.each(DB)}function FB(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function VB(){return this.each(FB)}function BB(e){var t=typeof e=="function"?e:CE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function UB(){return null}function HB(e,t){var n=typeof e=="function"?e:CE(e),r=t==null?UB:typeof t=="function"?t:Lv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function WB(){var e=this.parentNode;e&&e.removeChild(this)}function KB(){return this.each(WB)}function GB(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qB(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function YB(e){return this.select(e?qB:GB)}function XB(e){return arguments.length?this.property("__data__",e):this.node().__data__}function QB(e){return function(t){e.call(this,t,this.__data__)}}function ZB(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function JB(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function e6(e,t,n){return function(){var r=this.__on,s,i=QB(t);if(r){for(var o=0,l=r.length;o<l;++o)if((s=r[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function t6(e,t,n){var r=ZB(e+""),s,i=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,d;c<u;++c)for(s=0,d=l[c];s<i;++s)if((o=r[s]).type===d.type&&o.name===d.name)return d.value}return}for(l=t?e6:JB,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function DE(e,t,n){var r=IE(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function n6(e,t){return function(){return DE(this,e,t)}}function r6(e,t){return function(){return DE(this,e,t.apply(this,arguments))}}function s6(e,t){return this.each((typeof t=="function"?r6:n6)(e,t))}function*i6(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var zE=[null];function Mt(e,t){this._groups=e,this._parents=t}function hl(){return new Mt([[document.documentElement]],zE)}function o6(){return this}Mt.prototype=hl.prototype={constructor:Mt,select:R5,selectAll:L5,selectChild:F5,selectChildren:H5,filter:W5,data:Q5,enter:K5,exit:J5,join:eB,merge:tB,selection:o6,order:nB,sort:rB,call:iB,nodes:oB,node:aB,size:lB,empty:cB,each:uB,attr:vB,style:wB,property:kB,classed:TB,text:IB,html:$B,raise:zB,lower:VB,append:BB,insert:HB,remove:KB,clone:YB,datum:XB,on:t6,dispatch:s6,[Symbol.iterator]:i6};function Nt(e){return typeof e=="string"?new Mt([[document.querySelector(e)]],[document.documentElement]):new Mt([[e]],zE)}function a6(e){let t;for(;t=e.sourceEvent;)e=t;return e}function un(e,t){if(e=a6(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const l6={passive:!1},Da={capture:!0,passive:!1};function Zf(e){e.stopImmediatePropagation()}function Pi(e){e.preventDefault(),e.stopImmediatePropagation()}function FE(e){var t=e.document.documentElement,n=Nt(e).on("dragstart.drag",Pi,Da);"onselectstart"in t?n.on("selectstart.drag",Pi,Da):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function VE(e,t){var n=e.document.documentElement,r=Nt(e).on("dragstart.drag",null);t&&(r.on("click.drag",Pi,Da),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const ql=e=>()=>e;function am(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:o,y:l,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}am.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function c6(e){return!e.ctrlKey&&!e.button}function u6(){return this.parentNode}function d6(e,t){return t??{x:e.x,y:e.y}}function f6(){return navigator.maxTouchPoints||"ontouchstart"in this}function BE(){var e=c6,t=u6,n=d6,r=f6,s={},i=Id("start","drag","end"),o=0,l,c,u,d,f=0;function h(b){b.on("mousedown.drag",p).filter(r).on("touchstart.drag",_).on("touchmove.drag",v,l6).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(b,j){if(!(d||!e.call(this,b,j))){var k=m(this,t.call(this,b,j),b,j,"mouse");k&&(Nt(b.view).on("mousemove.drag",g,Da).on("mouseup.drag",x,Da),FE(b.view),Zf(b),u=!1,l=b.clientX,c=b.clientY,k("start",b))}}function g(b){if(Pi(b),!u){var j=b.clientX-l,k=b.clientY-c;u=j*j+k*k>f}s.mouse("drag",b)}function x(b){Nt(b.view).on("mousemove.drag mouseup.drag",null),VE(b.view,u),Pi(b),s.mouse("end",b)}function _(b,j){if(e.call(this,b,j)){var k=b.changedTouches,S=t.call(this,b,j),N=k.length,R,O;for(R=0;R<N;++R)(O=m(this,S,b,j,k[R].identifier,k[R]))&&(Zf(b),O("start",b,k[R]))}}function v(b){var j=b.changedTouches,k=j.length,S,N;for(S=0;S<k;++S)(N=s[j[S].identifier])&&(Pi(b),N("drag",b,j[S]))}function y(b){var j=b.changedTouches,k=j.length,S,N;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),S=0;S<k;++S)(N=s[j[S].identifier])&&(Zf(b),N("end",b,j[S]))}function m(b,j,k,S,N,R){var O=i.copy(),D=un(R||k,j),M,z,T;if((T=n.call(b,new am("beforestart",{sourceEvent:k,target:h,identifier:N,active:o,x:D[0],y:D[1],dx:0,dy:0,dispatch:O}),S))!=null)return M=T.x-D[0]||0,z=T.y-D[1]||0,function E(A,P,I){var C=D,L;switch(A){case"start":s[N]=E,L=o++;break;case"end":delete s[N],--o;case"drag":D=un(I||P,j),L=o;break}O.call(A,b,new am(A,{sourceEvent:P,subject:T,target:h,identifier:N,active:L,x:D[0]+M,y:D[1]+z,dx:D[0]-C[0],dy:D[1]-C[1],dispatch:O}),S)}}return h.filter=function(b){return arguments.length?(e=typeof b=="function"?b:ql(!!b),h):e},h.container=function(b){return arguments.length?(t=typeof b=="function"?b:ql(b),h):t},h.subject=function(b){return arguments.length?(n=typeof b=="function"?b:ql(b),h):n},h.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:ql(!!b),h):r},h.on=function(){var b=i.on.apply(i,arguments);return b===i?h:b},h.clickDistance=function(b){return arguments.length?(f=(b=+b)*b,h):Math.sqrt(f)},h}function Dv(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function UE(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function pl(){}var za=.7,Ou=1/za,Ai="\\s*([+-]?\\d+)\\s*",Fa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Un="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",h6=/^#([0-9a-f]{3,8})$/,p6=new RegExp(`^rgb\\(${Ai},${Ai},${Ai}\\)$`),m6=new RegExp(`^rgb\\(${Un},${Un},${Un}\\)$`),g6=new RegExp(`^rgba\\(${Ai},${Ai},${Ai},${Fa}\\)$`),v6=new RegExp(`^rgba\\(${Un},${Un},${Un},${Fa}\\)$`),y6=new RegExp(`^hsl\\(${Fa},${Un},${Un}\\)$`),x6=new RegExp(`^hsla\\(${Fa},${Un},${Un},${Fa}\\)$`),D0={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};Dv(pl,$s,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:z0,formatHex:z0,formatHex8:_6,formatHsl:w6,formatRgb:F0,toString:F0});function z0(){return this.rgb().formatHex()}function _6(){return this.rgb().formatHex8()}function w6(){return HE(this).formatHsl()}function F0(){return this.rgb().formatRgb()}function $s(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=h6.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?V0(t):n===3?new vt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Yl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Yl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=p6.exec(e))?new vt(t[1],t[2],t[3],1):(t=m6.exec(e))?new vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=g6.exec(e))?Yl(t[1],t[2],t[3],t[4]):(t=v6.exec(e))?Yl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=y6.exec(e))?H0(t[1],t[2]/100,t[3]/100,1):(t=x6.exec(e))?H0(t[1],t[2]/100,t[3]/100,t[4]):D0.hasOwnProperty(e)?V0(D0[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function V0(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function Yl(e,t,n,r){return r<=0&&(e=t=n=NaN),new vt(e,t,n,r)}function b6(e){return e instanceof pl||(e=$s(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function lm(e,t,n,r){return arguments.length===1?b6(e):new vt(e,t,n,r??1)}function vt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Dv(vt,lm,UE(pl,{brighter(e){return e=e==null?Ou:Math.pow(Ou,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?za:Math.pow(za,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(ks(this.r),ks(this.g),ks(this.b),Lu(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:B0,formatHex:B0,formatHex8:j6,formatRgb:U0,toString:U0}));function B0(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}`}function j6(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}${_s((isNaN(this.opacity)?1:this.opacity)*255)}`}function U0(){const e=Lu(this.opacity);return`${e===1?"rgb(":"rgba("}${ks(this.r)}, ${ks(this.g)}, ${ks(this.b)}${e===1?")":`, ${e})`}`}function Lu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ks(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _s(e){return e=ks(e),(e<16?"0":"")+e.toString(16)}function H0(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new hn(e,t,n,r)}function HE(e){if(e instanceof hn)return new hn(e.h,e.s,e.l,e.opacity);if(e instanceof pl||(e=$s(e)),!e)return new hn;if(e instanceof hn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new hn(o,l,c,e.opacity)}function S6(e,t,n,r){return arguments.length===1?HE(e):new hn(e,t,n,r??1)}function hn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Dv(hn,S6,UE(pl,{brighter(e){return e=e==null?Ou:Math.pow(Ou,e),new hn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?za:Math.pow(za,e),new hn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new vt(Jf(e>=240?e-240:e+120,s,r),Jf(e,s,r),Jf(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new hn(W0(this.h),Xl(this.s),Xl(this.l),Lu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Lu(this.opacity);return`${e===1?"hsl(":"hsla("}${W0(this.h)}, ${Xl(this.s)*100}%, ${Xl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function W0(e){return e=(e||0)%360,e<0?e+360:e}function Xl(e){return Math.max(0,Math.min(1,e||0))}function Jf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const zv=e=>()=>e;function k6(e,t){return function(n){return e+n*t}}function N6(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function E6(e){return(e=+e)==1?WE:function(t,n){return n-t?N6(t,n,e):zv(isNaN(t)?n:t)}}function WE(e,t){var n=t-e;return n?k6(e,n):zv(isNaN(e)?t:e)}const $u=function e(t){var n=E6(t);function r(s,i){var o=n((s=lm(s)).r,(i=lm(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=WE(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function C6(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function T6(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function P6(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=ia(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(l){for(o=0;o<r;++o)i[o]=s[o](l);return i}}function A6(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function An(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function R6(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=ia(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var cm=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,eh=new RegExp(cm.source,"g");function I6(e){return function(){return e}}function M6(e){return function(t){return e(t)+""}}function KE(e,t){var n=cm.lastIndex=eh.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=cm.exec(e))&&(s=eh.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:An(r,s)})),n=eh.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?M6(c[0].x):I6(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function ia(e,t){var n=typeof t,r;return t==null||n==="boolean"?zv(t):(n==="number"?An:n==="string"?(r=$s(t))?(t=r,$u):KE:t instanceof $s?$u:t instanceof Date?A6:T6(t)?C6:Array.isArray(t)?P6:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?R6:An)(e,t)}var K0=180/Math.PI,um={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function GE(e,t,n,r,s,i){var o,l,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*K0,skewX:Math.atan(c)*K0,scaleX:o,scaleY:l}}var Ql;function O6(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?um:GE(t.a,t.b,t.c,t.d,t.e,t.f)}function L6(e){return e==null||(Ql||(Ql=document.createElementNS("http://www.w3.org/2000/svg","g")),Ql.setAttribute("transform",e),!(e=Ql.transform.baseVal.consolidate()))?um:(e=e.matrix,GE(e.a,e.b,e.c,e.d,e.e,e.f))}function qE(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,d,f,h,p,g){if(u!==f||d!==h){var x=p.push("translate(",null,t,null,n);g.push({i:x-4,x:An(u,f)},{i:x-2,x:An(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function o(u,d,f,h){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,r)-2,x:An(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function l(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,r)-2,x:An(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,h,p,g){if(u!==f||d!==h){var x=p.push(s(p)+"scale(",null,",",null,")");g.push({i:x-4,x:An(u,f)},{i:x-2,x:An(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,f,h),o(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var g=-1,x=h.length,_;++g<x;)f[(_=h[g]).i]=_.x(p);return f.join("")}}}var $6=qE(O6,"px, ","px)","deg)"),D6=qE(L6,", ",")",")"),z6=1e-12;function G0(e){return((e=Math.exp(e))+1/e)/2}function F6(e){return((e=Math.exp(e))-1/e)/2}function V6(e){return((e=Math.exp(2*e))-1)/(e+1)}const Oc=function e(t,n,r){function s(i,o){var l=i[0],c=i[1],u=i[2],d=o[0],f=o[1],h=o[2],p=d-l,g=f-c,x=p*p+g*g,_,v;if(x<z6)v=Math.log(h/u)/t,_=function(S){return[l+S*p,c+S*g,u*Math.exp(t*S*v)]};else{var y=Math.sqrt(x),m=(h*h-u*u+r*x)/(2*u*n*y),b=(h*h-u*u-r*x)/(2*h*n*y),j=Math.log(Math.sqrt(m*m+1)-m),k=Math.log(Math.sqrt(b*b+1)-b);v=(k-j)/t,_=function(S){var N=S*v,R=G0(j),O=u/(n*y)*(R*V6(t*N+j)-F6(j));return[l+O*p,c+O*g,u*R/G0(t*N+j)]}}return _.duration=v*1e3*t/Math.SQRT2,_}return s.rho=function(i){var o=Math.max(.001,+i),l=o*o,c=l*l;return e(o,l,c)},s}(Math.SQRT2,2,4);var Xi=0,Fo=0,To=0,YE=1e3,Du,Vo,zu=0,Ds=0,Od=0,Va=typeof performance=="object"&&performance.now?performance:Date,XE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fv(){return Ds||(XE(B6),Ds=Va.now()+Od)}function B6(){Ds=0}function Fu(){this._call=this._time=this._next=null}Fu.prototype=QE.prototype={constructor:Fu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Fv():+n)+(t==null?0:+t),!this._next&&Vo!==this&&(Vo?Vo._next=this:Du=this,Vo=this),this._call=e,this._time=n,dm()},stop:function(){this._call&&(this._call=null,this._time=1/0,dm())}};function QE(e,t,n){var r=new Fu;return r.restart(e,t,n),r}function U6(){Fv(),++Xi;for(var e=Du,t;e;)(t=Ds-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Xi}function q0(){Ds=(zu=Va.now())+Od,Xi=Fo=0;try{U6()}finally{Xi=0,W6(),Ds=0}}function H6(){var e=Va.now(),t=e-zu;t>YE&&(Od-=t,zu=e)}function W6(){for(var e,t=Du,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Du=n);Vo=e,dm(r)}function dm(e){if(!Xi){Fo&&(Fo=clearTimeout(Fo));var t=e-Ds;t>24?(e<1/0&&(Fo=setTimeout(q0,e-Va.now()-Od)),To&&(To=clearInterval(To))):(To||(zu=Va.now(),To=setInterval(H6,YE)),Xi=1,XE(q0))}}function Y0(e,t,n){var r=new Fu;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var K6=Id("start","end","cancel","interrupt"),G6=[],ZE=0,X0=1,fm=2,Lc=3,Q0=4,hm=5,$c=6;function Ld(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;q6(e,n,{name:t,index:r,group:s,on:K6,tween:G6,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ZE})}function Vv(e,t){var n=kn(e,t);if(n.state>ZE)throw new Error("too late; already scheduled");return n}function Hn(e,t){var n=kn(e,t);if(n.state>Lc)throw new Error("too late; already running");return n}function kn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function q6(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=QE(i,0,n.time);function i(u){n.state=X0,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var d,f,h,p;if(n.state!==X0)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===Lc)return Y0(o);p.state===Q0?(p.state=$c,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+d<t&&(p.state=$c,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[d])}if(Y0(function(){n.state===Lc&&(n.state=Q0,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=fm,n.on.call("start",e,e.__data__,n.index,n.group),n.state===fm){for(n.state=Lc,s=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(s[++f]=p);s.length=f+1}}function l(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=hm,1),f=-1,h=s.length;++f<h;)s[f].call(e,d);n.state===hm&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=$c,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Dc(e,t){var n=e.__transition,r,s,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}s=r.state>fm&&r.state<hm,r.state=$c,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function Y6(e){return this.each(function(){Dc(this,e)})}function X6(e,t){var n,r;return function(){var s=Hn(this,e),i=s.tween;if(i!==n){r=n=i;for(var o=0,l=r.length;o<l;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function Q6(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Hn(this,e),o=i.tween;if(o!==r){s=(r=o).slice();for(var l={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=l;break}c===u&&s.push(l)}i.tween=s}}function Z6(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=kn(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===e)return o.value;return null}return this.each((t==null?X6:Q6)(n,e,t))}function Bv(e,t,n){var r=e._id;return e.each(function(){var s=Hn(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return kn(s,r).value[t]}}function JE(e,t){var n;return(typeof t=="number"?An:t instanceof $s?$u:(n=$s(t))?(t=n,$u):KE)(e,t)}function J6(e){return function(){this.removeAttribute(e)}}function e8(e){return function(){this.removeAttributeNS(e.space,e.local)}}function t8(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttribute(e);return o===s?null:o===r?i:i=t(r=o,n)}}function n8(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===r?i:i=t(r=o,n)}}function r8(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function s8(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function i8(e,t){var n=Md(e),r=n==="transform"?D6:JE;return this.attrTween(e,typeof t=="function"?(n.local?s8:r8)(n,r,Bv(this,"attr."+e,t)):t==null?(n.local?e8:J6)(n):(n.local?n8:t8)(n,r,t))}function o8(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function a8(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function l8(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&a8(e,i)),n}return s._value=t,s}function c8(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&o8(e,i)),n}return s._value=t,s}function u8(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Md(e);return this.tween(n,(r.local?l8:c8)(r,t))}function d8(e,t){return function(){Vv(this,e).delay=+t.apply(this,arguments)}}function f8(e,t){return t=+t,function(){Vv(this,e).delay=t}}function h8(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?d8:f8)(t,e)):kn(this.node(),t).delay}function p8(e,t){return function(){Hn(this,e).duration=+t.apply(this,arguments)}}function m8(e,t){return t=+t,function(){Hn(this,e).duration=t}}function g8(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?p8:m8)(t,e)):kn(this.node(),t).duration}function v8(e,t){if(typeof t!="function")throw new Error;return function(){Hn(this,e).ease=t}}function y8(e){var t=this._id;return arguments.length?this.each(v8(t,e)):kn(this.node(),t).ease}function x8(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Hn(this,e).ease=n}}function _8(e){if(typeof e!="function")throw new Error;return this.each(x8(this._id,e))}function w8(e){typeof e!="function"&&(e=PE(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new br(r,this._parents,this._name,this._id)}function b8(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),o=new Array(r),l=0;l<i;++l)for(var c=t[l],u=n[l],d=c.length,f=o[l]=new Array(d),h,p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;l<r;++l)o[l]=t[l];return new br(o,this._parents,this._name,this._id)}function j8(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function S8(e,t,n){var r,s,i=j8(t)?Vv:Hn;return function(){var o=i(this,e),l=o.on;l!==r&&(s=(r=l).copy()).on(t,n),o.on=s}}function k8(e,t){var n=this._id;return arguments.length<2?kn(this.node(),n).on.on(e):this.each(S8(n,e,t))}function N8(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function E8(){return this.on("end.remove",N8(this._id))}function C8(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Lv(e));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var l=r[o],c=l.length,u=i[o]=new Array(c),d,f,h=0;h<c;++h)(d=l[h])&&(f=e.call(d,d.__data__,h,l))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f,Ld(u[h],t,n,h,u,kn(d,n)));return new br(i,this._parents,t,n)}function T8(e){var t=this._name,n=this._id;typeof e!="function"&&(e=TE(e));for(var r=this._groups,s=r.length,i=[],o=[],l=0;l<s;++l)for(var c=r[l],u=c.length,d,f=0;f<u;++f)if(d=c[f]){for(var h=e.call(d,d.__data__,f,c),p,g=kn(d,n),x=0,_=h.length;x<_;++x)(p=h[x])&&Ld(p,t,n,x,h,g);i.push(h),o.push(d)}return new br(i,o,t,n)}var P8=hl.prototype.constructor;function A8(){return new P8(this._groups,this._parents)}function R8(e,t){var n,r,s;return function(){var i=Yi(this,e),o=(this.style.removeProperty(e),Yi(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function eC(e){return function(){this.style.removeProperty(e)}}function I8(e,t,n){var r,s=n+"",i;return function(){var o=Yi(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function M8(e,t,n){var r,s,i;return function(){var o=Yi(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Yi(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l))}}function O8(e,t){var n,r,s,i="style."+t,o="end."+i,l;return function(){var c=Hn(this,e),u=c.on,d=c.value[i]==null?l||(l=eC(t)):void 0;(u!==n||s!==d)&&(r=(n=u).copy()).on(o,s=d),c.on=r}}function L8(e,t,n){var r=(e+="")=="transform"?$6:JE;return t==null?this.styleTween(e,R8(e,r)).on("end.style."+e,eC(e)):typeof t=="function"?this.styleTween(e,M8(e,r,Bv(this,"style."+e,t))).each(O8(this._id,e)):this.styleTween(e,I8(e,r,t),n).on("end.style."+e,null)}function $8(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function D8(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&$8(e,o,n)),r}return i._value=t,i}function z8(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,D8(e,t,n??""))}function F8(e){return function(){this.textContent=e}}function V8(e){return function(){var t=e(this);this.textContent=t??""}}function B8(e){return this.tween("text",typeof e=="function"?V8(Bv(this,"text",e)):F8(e==null?"":e+""))}function U8(e){return function(t){this.textContent=e.call(this,t)}}function H8(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&U8(s)),t}return r._value=e,r}function W8(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,H8(e))}function K8(){for(var e=this._name,t=this._id,n=tC(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)if(c=o[u]){var d=kn(c,t);Ld(c,e,n,u,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new br(r,this._parents,e,n)}function G8(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var l={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var u=Hn(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var q8=0;function br(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function tC(){return++q8}var Yn=hl.prototype;br.prototype={constructor:br,select:C8,selectAll:T8,selectChild:Yn.selectChild,selectChildren:Yn.selectChildren,filter:w8,merge:b8,selection:A8,transition:K8,call:Yn.call,nodes:Yn.nodes,node:Yn.node,size:Yn.size,empty:Yn.empty,each:Yn.each,on:k8,attr:i8,attrTween:u8,style:L8,styleTween:z8,text:B8,textTween:W8,remove:E8,tween:Z6,delay:h8,duration:g8,ease:y8,easeVarying:_8,end:G8,[Symbol.iterator]:Yn[Symbol.iterator]};function Y8(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var X8={time:null,delay:0,duration:250,ease:Y8};function Q8(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Z8(e){var t,n;e instanceof br?(t=e._id,e=e._name):(t=tC(),(n=X8).time=Fv(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&Ld(c,e,t,u,o,n||Q8(c,t));return new br(r,this._parents,e,t)}hl.prototype.interrupt=Y6;hl.prototype.transition=Z8;const Zl=e=>()=>e;function J8(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function sr(e,t,n){this.k=e,this.x=t,this.y=n}sr.prototype={constructor:sr,scale:function(e){return e===1?this:new sr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new sr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $d=new sr(1,0,0);nC.prototype=sr.prototype;function nC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $d;return e.__zoom}function th(e){e.stopImmediatePropagation()}function Po(e){e.preventDefault(),e.stopImmediatePropagation()}function eU(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function tU(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Z0(){return this.__zoom||$d}function nU(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function rU(){return navigator.maxTouchPoints||"ontouchstart"in this}function sU(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function rC(){var e=eU,t=tU,n=sU,r=nU,s=rU,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Oc,u=Id("start","zoom","end"),d,f,h,p=500,g=150,x=0,_=10;function v(T){T.property("__zoom",Z0).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",O).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(T,E,A,P){var I=T.selection?T.selection():T;I.property("__zoom",Z0),T!==I?j(T,E,A,P):I.interrupt().each(function(){k(this,arguments).event(P).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},v.scaleBy=function(T,E,A,P){v.scaleTo(T,function(){var I=this.__zoom.k,C=typeof E=="function"?E.apply(this,arguments):E;return I*C},A,P)},v.scaleTo=function(T,E,A,P){v.transform(T,function(){var I=t.apply(this,arguments),C=this.__zoom,L=A==null?b(I):typeof A=="function"?A.apply(this,arguments):A,F=C.invert(L),V=typeof E=="function"?E.apply(this,arguments):E;return n(m(y(C,V),L,F),I,o)},A,P)},v.translateBy=function(T,E,A,P){v.transform(T,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),o)},null,P)},v.translateTo=function(T,E,A,P,I){v.transform(T,function(){var C=t.apply(this,arguments),L=this.__zoom,F=P==null?b(C):typeof P=="function"?P.apply(this,arguments):P;return n($d.translate(F[0],F[1]).scale(L.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof A=="function"?-A.apply(this,arguments):-A),C,o)},P,I)};function y(T,E){return E=Math.max(i[0],Math.min(i[1],E)),E===T.k?T:new sr(E,T.x,T.y)}function m(T,E,A){var P=E[0]-A[0]*T.k,I=E[1]-A[1]*T.k;return P===T.x&&I===T.y?T:new sr(T.k,P,I)}function b(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function j(T,E,A,P){T.on("start.zoom",function(){k(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(P).end()}).tween("zoom",function(){var I=this,C=arguments,L=k(I,C).event(P),F=t.apply(I,C),V=A==null?b(F):typeof A=="function"?A.apply(I,C):A,H=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),U=I.__zoom,W=typeof E=="function"?E.apply(I,C):E,G=c(U.invert(V).concat(H/U.k),W.invert(V).concat(H/W.k));return function(Y){if(Y===1)Y=W;else{var K=G(Y),X=H/K[2];Y=new sr(X,V[0]-K[0]*X,V[1]-K[1]*X)}L.zoom(null,Y)}})}function k(T,E,A){return!A&&T.__zooming||new S(T,E)}function S(T,E){this.that=T,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,E),this.taps=0}S.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,E){return this.mouse&&T!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var E=Nt(this.that).datum();u.call(T,this.that,new J8(T,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:u}),E)}};function N(T,...E){if(!e.apply(this,arguments))return;var A=k(this,E).event(T),P=this.__zoom,I=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,r.apply(this,arguments)))),C=un(T);if(A.wheel)(A.mouse[0][0]!==C[0]||A.mouse[0][1]!==C[1])&&(A.mouse[1]=P.invert(A.mouse[0]=C)),clearTimeout(A.wheel);else{if(P.k===I)return;A.mouse=[C,P.invert(C)],Dc(this),A.start()}Po(T),A.wheel=setTimeout(L,g),A.zoom("mouse",n(m(y(P,I),A.mouse[0],A.mouse[1]),A.extent,o));function L(){A.wheel=null,A.end()}}function R(T,...E){if(h||!e.apply(this,arguments))return;var A=T.currentTarget,P=k(this,E,!0).event(T),I=Nt(T.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",H,!0),C=un(T,A),L=T.clientX,F=T.clientY;FE(T.view),th(T),P.mouse=[C,this.__zoom.invert(C)],Dc(this),P.start();function V(U){if(Po(U),!P.moved){var W=U.clientX-L,G=U.clientY-F;P.moved=W*W+G*G>x}P.event(U).zoom("mouse",n(m(P.that.__zoom,P.mouse[0]=un(U,A),P.mouse[1]),P.extent,o))}function H(U){I.on("mousemove.zoom mouseup.zoom",null),VE(U.view,P.moved),Po(U),P.event(U).end()}}function O(T,...E){if(e.apply(this,arguments)){var A=this.__zoom,P=un(T.changedTouches?T.changedTouches[0]:T,this),I=A.invert(P),C=A.k*(T.shiftKey?.5:2),L=n(m(y(A,C),P,I),t.apply(this,E),o);Po(T),l>0?Nt(this).transition().duration(l).call(j,L,P,T):Nt(this).call(v.transform,L,P,T)}}function D(T,...E){if(e.apply(this,arguments)){var A=T.touches,P=A.length,I=k(this,E,T.changedTouches.length===P).event(T),C,L,F,V;for(th(T),L=0;L<P;++L)F=A[L],V=un(F,this),V=[V,this.__zoom.invert(V),F.identifier],I.touch0?!I.touch1&&I.touch0[2]!==V[2]&&(I.touch1=V,I.taps=0):(I.touch0=V,C=!0,I.taps=1+!!d);d&&(d=clearTimeout(d)),C&&(I.taps<2&&(f=V[0],d=setTimeout(function(){d=null},p)),Dc(this),I.start())}}function M(T,...E){if(this.__zooming){var A=k(this,E).event(T),P=T.changedTouches,I=P.length,C,L,F,V;for(Po(T),C=0;C<I;++C)L=P[C],F=un(L,this),A.touch0&&A.touch0[2]===L.identifier?A.touch0[0]=F:A.touch1&&A.touch1[2]===L.identifier&&(A.touch1[0]=F);if(L=A.that.__zoom,A.touch1){var H=A.touch0[0],U=A.touch0[1],W=A.touch1[0],G=A.touch1[1],Y=(Y=W[0]-H[0])*Y+(Y=W[1]-H[1])*Y,K=(K=G[0]-U[0])*K+(K=G[1]-U[1])*K;L=y(L,Math.sqrt(Y/K)),F=[(H[0]+W[0])/2,(H[1]+W[1])/2],V=[(U[0]+G[0])/2,(U[1]+G[1])/2]}else if(A.touch0)F=A.touch0[0],V=A.touch0[1];else return;A.zoom("touch",n(m(L,F,V),A.extent,o))}}function z(T,...E){if(this.__zooming){var A=k(this,E).event(T),P=T.changedTouches,I=P.length,C,L;for(th(T),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),C=0;C<I;++C)L=P[C],A.touch0&&A.touch0[2]===L.identifier?delete A.touch0:A.touch1&&A.touch1[2]===L.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(L=un(L,this),Math.hypot(f[0]-L[0],f[1]-L[1])<_)){var F=Nt(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return v.wheelDelta=function(T){return arguments.length?(r=typeof T=="function"?T:Zl(+T),v):r},v.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Zl(!!T),v):e},v.touchable=function(T){return arguments.length?(s=typeof T=="function"?T:Zl(!!T),v):s},v.extent=function(T){return arguments.length?(t=typeof T=="function"?T:Zl([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),v):t},v.scaleExtent=function(T){return arguments.length?(i[0]=+T[0],i[1]=+T[1],v):[i[0],i[1]]},v.translateExtent=function(T){return arguments.length?(o[0][0]=+T[0][0],o[1][0]=+T[1][0],o[0][1]=+T[0][1],o[1][1]=+T[1][1],v):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},v.constrain=function(T){return arguments.length?(n=T,v):n},v.duration=function(T){return arguments.length?(l=+T,v):l},v.interpolate=function(T){return arguments.length?(c=T,v):c},v.on=function(){var T=u.on.apply(u,arguments);return T===u?v:T},v.clickDistance=function(T){return arguments.length?(x=(T=+T)*T,v):Math.sqrt(x)},v.tapDistance=function(T){return arguments.length?(_=+T,v):_},v}const jn={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Ba=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],sC=["Enter"," ","Escape"],iC={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Qi;(function(e){e.Strict="strict",e.Loose="loose"})(Qi||(Qi={}));var Ns;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ns||(Ns={}));var Ua;(function(e){e.Partial="partial",e.Full="full"})(Ua||(Ua={}));const oC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Mr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Mr||(Mr={}));var Vu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Vu||(Vu={}));var ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ne||(ne={}));const J0={[ne.Left]:ne.Right,[ne.Right]:ne.Left,[ne.Top]:ne.Bottom,[ne.Bottom]:ne.Top};function aC(e){return e===null?null:e?"valid":"invalid"}const lC=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,iU=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Uv=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ml=(e,t=[0,0])=>{const{width:n,height:r}=Wn(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},oU=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let o=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(o=i?t.nodeLookup.get(s):Uv(s)?s:t.nodeLookup.get(s.id));const l=o?Bu(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Dd(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zd(n)},gl=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Dd(n,Bu(s)),r=!0)}),r?zd(n):{x:0,y:0,width:0,height:0}},Hv=(e,t,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const l=(t.x-n)/s,c=(t.y-r)/s,u=t.width/s,d=t.height/s,f=[];for(const h of e.values()){const{measured:p,selectable:g=!0,hidden:x=!1}=h;if(o&&!g||x)continue;const _=p.width??h.width??h.initialWidth??0,v=p.height??h.height??h.initialHeight??0,{x:y,y:m}=h.internals.positionAbsolute,b=fC(l,c,u,d,y,m,_,v),j=_*v,k=i&&b>0;(!h.internals.handleBounds||k||b>=j||h.dragging)&&f.push(h)}return f},aU=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function lU(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{let i;if(t!=null&&t.includeHiddenNodes){const{width:o,height:l}=Wn(s);i=o>0&&l>0}else i=!!(s.measured.width&&s.measured.height&&!s.hidden);i&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function cU({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return!0;const l=lU(e,o),c=gl(l),u=Kv(c,t,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(u,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),!0}function cC({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=o.origin??r;let f=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!l)i==null||i("005",jn.error005());else{const p=l.measured.width,g=l.measured.height;p&&g&&(f=[[c,u],[c+p,u+g]])}else l&&Fs(o.extent)&&(f=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const h=Fs(f)?zs(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",jn.error015())),{position:{x:h.x-c+(o.measured.width??0)*d[0],y:h.y-u+(o.measured.height??0)*d[1]},positionAbsolute:h}}async function uU({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(h=>h.id)),o=[];for(const h of n){if(h.deletable===!1)continue;const p=i.has(h.id),g=!p&&h.parentId&&o.find(x=>x.id===h.parentId);(p||g)&&o.push(h)}const l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=aU(o,c);for(const h of c)l.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:o};const f=await s({nodes:o,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:o}:{edges:[],nodes:[]}:f}const Zi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),zs=(e={x:0,y:0},t,n)=>({x:Zi(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Zi(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function uC(e,t,n){const{width:r,height:s}=Wn(n),{x:i,y:o}=n.internals.positionAbsolute;return zs(e,[[i,o],[i+r,o+s]],t)}const ew=(e,t,n)=>e<t?Zi(Math.abs(e-t),1,t)/t:e>n?-Zi(Math.abs(e-n),1,t)/t:0,Wv=(e,t,n=15,r=40)=>{const s=ew(e.x,r,t.width-r)*n,i=ew(e.y,r,t.height-r)*n;return[s,i]},Dd=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),pm=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),zd=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ha=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Uv(e)?e.internals.positionAbsolute:ml(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Bu=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Uv(e)?e.internals.positionAbsolute:ml(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},dC=(e,t)=>zd(Dd(pm(e),pm(t))),fC=(e,t,n,r,s,i,o,l)=>{const c=Math.max(0,Math.min(e+n,s+o)-Math.max(e,s)),u=Math.max(0,Math.min(t+r,i+l)-Math.max(t,i));return Math.ceil(c*u)},Uu=(e,t)=>fC(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),tw=e=>pn(e.width)&&pn(e.height)&&pn(e.x)&&pn(e.y),pn=e=>!isNaN(e)&&isFinite(e),hC=(e,t)=>(n,r)=>{},vl=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yl=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?vl(l,o):l},Ji=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Js(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function dU(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Js(e,n),s=Js(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Js(e.top??e.y??0,n),s=Js(e.bottom??e.y??0,n),i=Js(e.left??e.x??0,t),o=Js(e.right??e.x??0,t);return{top:r,right:o,bottom:s,left:i,x:i+o,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function fU(e,t,n,r,s,i){const{x:o,y:l}=Ji(e,[t,n,r]),{x:c,y:u}=Ji({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,f=i-u;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const Kv=(e,t,n,r,s,i)=>{const o=dU(i,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(l,c),d=Zi(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,g=n/2-h*d,x=fU(e,p,g,d,t,n),_={left:Math.min(x.left-o.left,0),top:Math.min(x.top-o.top,0),right:Math.min(x.right-o.right,0),bottom:Math.min(x.bottom-o.bottom,0)};return{x:p-_.left+_.right,y:g-_.top+_.bottom,zoom:d}},Wa=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Fs(e){return e!=null&&e!=="parent"}function Wn(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function pC(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function mC(e,t={width:0,height:0},n,r,s){const i={...e},o=r.get(n);if(o){const l=o.origin||s;i.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function nw(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function hU(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function pU(e){return{...iC,...e||{}}}function oa(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=mn(e),l=yl({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?vl(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Gv=e=>({width:e.offsetWidth,height:e.offsetHeight}),gC=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},mU=["INPUT","SELECT","TEXTAREA"];function vC(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:mU.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const yC=e=>"clientX"in e,mn=(e,t)=>{var i,o;const n=yC(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},rw=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...Gv(o)}})};function xC({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:l}){const c=e*.125+s*.375+o*.375+n*.125,u=t*.125+i*.375+l*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function Jl(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function sw({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case ne.Left:return[t-Jl(t-r,i),n];case ne.Right:return[t+Jl(r-t,i),n];case ne.Top:return[t,n-Jl(n-s,i)];case ne.Bottom:return[t,n+Jl(s-n,i)]}}function _C({sourceX:e,sourceY:t,sourcePosition:n=ne.Bottom,targetX:r,targetY:s,targetPosition:i=ne.Top,curvature:o=.25}){const[l,c]=sw({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[u,d]=sw({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[f,h,p,g]=xC({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${r},${s}`,f,h,p,g]}function wC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,o=Math.abs(r-t)/2,l=r<t?r+o:r-o;return[i,l,s,o]}function gU({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const o=s&&n?r+1e3:r,l=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return o+l}function vU({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Dd(Bu(e),Bu(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return Uu(o,zd(i))>0}const yU=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,xU=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),_U=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",jn.error006()),t;const r=n.getEdgeId||yU;let s;return lC(e)?s={...e}:s={...e,id:r(e)},xU(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function bC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,l]=wC({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,l]}const iw={[ne.Left]:{x:-1,y:0},[ne.Right]:{x:1,y:0},[ne.Top]:{x:0,y:-1},[ne.Bottom]:{x:0,y:1}},wU=({source:e,sourcePosition:t=ne.Bottom,target:n})=>t===ne.Left||t===ne.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},ow=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function bU({source:e,sourcePosition:t=ne.Bottom,target:n,targetPosition:r=ne.Top,center:s,offset:i,stepPosition:o}){const l=iw[t],c=iw[r],u={x:e.x+l.x*i,y:e.y+l.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=wU({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let g=[],x,_;const v={x:0,y:0},y={x:0,y:0},[,,m,b]=wC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(x=s.x??u.x+(d.x-u.x)*o,_=s.y??(u.y+d.y)/2):(x=s.x??(u.x+d.x)/2,_=s.y??u.y+(d.y-u.y)*o);const N=[{x,y:u.y},{x,y:d.y}],R=[{x:u.x,y:_},{x:d.x,y:_}];l[h]===p?g=h==="x"?N:R:g=h==="x"?R:N}else{const N=[{x:u.x,y:d.y}],R=[{x:d.x,y:u.y}];if(h==="x"?g=l.x===p?R:N:g=l.y===p?N:R,t===r){const T=Math.abs(e[h]-n[h]);if(T<=i){const E=Math.min(i-1,i-T);l[h]===p?v[h]=(u[h]>e[h]?-1:1)*E:y[h]=(d[h]>n[h]?-1:1)*E}}if(t!==r){const T=h==="x"?"y":"x",E=l[h]===c[T],A=u[T]>d[T],P=u[T]<d[T];(l[h]===1&&(!E&&A||E&&P)||l[h]!==1&&(!E&&P||E&&A))&&(g=h==="x"?N:R)}const O={x:u.x+v.x,y:u.y+v.y},D={x:d.x+y.x,y:d.y+y.y},M=Math.max(Math.abs(O.x-g[0].x),Math.abs(D.x-g[0].x)),z=Math.max(Math.abs(O.y-g[0].y),Math.abs(D.y-g[0].y));M>=z?(x=(O.x+D.x)/2,_=g[0].y):(x=g[0].x,_=(O.y+D.y)/2)}const j={x:u.x+v.x,y:u.y+v.y},k={x:d.x+y.x,y:d.y+y.y};return[[e,...j.x!==g[0].x||j.y!==g[0].y?[j]:[],...g,...k.x!==g[g.length-1].x||k.y!==g[g.length-1].y?[k]:[],n],x,_,m,b]}function jU(e,t,n,r){const s=Math.min(ow(e,t)/2,ow(t,n)/2,r),{x:i,y:o}=t;if(e.x===i&&i===n.x||e.y===o&&o===n.y)return`L${i} ${o}`;if(e.y===o){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+s*u},${o}Q ${i},${o} ${i},${o+s*d}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*l},${o}`}function mm({sourceX:e,sourceY:t,sourcePosition:n=ne.Bottom,targetX:r,targetY:s,targetPosition:i=ne.Top,borderRadius:o=5,centerX:l,centerY:c,offset:u=20,stepPosition:d=.5}){const[f,h,p,g,x]=bU({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:d});let _=`M${f[0].x} ${f[0].y}`;for(let v=1;v<f.length-1;v++)_+=jU(f[v-1],f[v],f[v+1],o);return _+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[_,h,p,g,x]}function aw(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function SU(e){var f;const{sourceNode:t,targetNode:n}=e;if(!aw(t)||!aw(n))return null;const r=t.internals.handleBounds||lw(t.handles),s=n.internals.handleBounds||lw(n.handles),i=cw((r==null?void 0:r.source)??[],e.sourceHandle),o=cw(e.connectionMode===Qi.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!o)return(f=e.onError)==null||f.call(e,"008",jn.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||ne.Bottom,c=(o==null?void 0:o.position)||ne.Top,u=Vs(t,i,l),d=Vs(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}function lw(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Vs(e,t,n=ne.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=t??Wn(e);if(r)return{x:s+o/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case ne.Top:return{x:s+o/2,y:i};case ne.Right:return{x:s+o,y:i+l/2};case ne.Bottom:return{x:s+o/2,y:i+l};case ne.Left:return{x:s,y:i+l/2}}}function cw(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function gm(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function kU(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((o,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=gm(c,t);i.has(u)||(o.push({id:u,color:c.color||n,...c}),i.add(u))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const jC=1e3,NU=10,qv={nodeOrigin:[0,0],nodeExtent:Ba,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},EU={...qv,checkEquality:!0};function Yv(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function CU(e,t,n){const r=Yv(qv,n);for(const s of e.values())if(s.parentId)Qv(s,e,t,r);else{const i=ml(s,r.nodeOrigin),o=Fs(s.extent)?s.extent:r.nodeExtent,l=zs(i,o,Wn(s));s.internals.positionAbsolute=l}}function TU(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function Xv(e){return e==="manual"}function vm(e,t,n,r={}){var d,f;const s=Yv(EU,r),i={i:0},o=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Xv(s.zIndexMode)?jC:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=o.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const g=ml(h,s.nodeOrigin),x=Fs(h.extent)?h.extent:s.nodeExtent,_=zs(g,x,Wn(h));p={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:_,handleBounds:TU(h,p),z:SC(h,l,s.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&Qv(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function PU(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Qv(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=Yv(qv,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}PU(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*NU),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!Xv(c)?jC:0,{x:h,y:p,z:g}=AU(e,d,o,l,f,c),{positionAbsolute:x}=e.internals,_=h!==x.x||p!==x.y;(_||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:h,y:p}:x,z:g}})}function SC(e,t,n){const r=pn(e.zIndex)?e.zIndex:0;return Xv(n)?r:r+(e.selected?t:0)}function AU(e,t,n,r,s,i){const{x:o,y:l}=t.internals.positionAbsolute,c=Wn(e),u=ml(e,n),d=Fs(e.extent)?zs(u,e.extent,c):u;let f=zs({x:o+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=uC(f,c,t));const h=SC(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function Zv(e,t,n,r=[0,0]){var o;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((o=i.get(l.parentId))==null?void 0:o.expandedRect)??Ha(c),d=dC(u,l.rect);i.set(l.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var m;const d=c.internals.positionAbsolute,f=Wn(c),h=c.origin??r,p=l.x<d.x?Math.round(Math.abs(d.x-l.x)):0,g=l.y<d.y?Math.round(Math.abs(d.y-l.y)):0,x=Math.max(f.width,Math.round(l.width)),_=Math.max(f.height,Math.round(l.height)),v=(x-f.width)*h[0],y=(_-f.height)*h[1];(p>0||g>0||v||y)&&(s.push({id:u,type:"position",position:{x:c.position.x-p+v,y:c.position.y-g+y}}),(m=n.get(u))==null||m.forEach(b=>{e.some(j=>j.id===b.id)||s.push({id:b.id,type:"position",position:{x:b.position.x+p,y:b.position.y+g}})})),(f.width<l.width||f.height<l.height||p||g)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(p?h[0]*p-v:0),height:_+(g?h[1]*g-y:0)}})}),s}function RU(e,t,n,r,s,i,o){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=[];for(const p of e.values()){const g=t.get(p.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Gv(p.nodeElement),_=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(_||!g.internals.handleBounds||p.force))){const y=p.nodeElement.getBoundingClientRect(),m=Fs(g.extent)?g.extent:i;let{positionAbsolute:b}=g.internals;if(g.parentId&&g.extent==="parent"){const k=t.get(g.parentId);k&&(b=uC(b,x,k))}else m&&(b=zs(b,m,x));const j={...g,measured:x,internals:{...g.internals,positionAbsolute:b,handleBounds:{source:rw("source",p.nodeElement,y,f,g.id),target:rw("target",p.nodeElement,y,f,g.id)}}};t.set(g.id,j),g.parentId&&Qv(j,t,n,{nodeOrigin:s,zIndexMode:o}),c=!0,_&&(u.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&h.push({id:g.id,parentId:g.parentId,rect:Ha(j,s)}))}}if(h.length>0){const p=Zv(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function IU({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return!1;const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function uw(e,t,n,r,s,i){let o=s;const l=r.get(o)||new Map;r.set(o,l.set(n,t)),o=`${s}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),i){o=`${s}-${e}-${i}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function kC(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:l},u=`${s}-${o}--${i}-${l}`,d=`${i}-${l}--${s}-${o}`;uw("source",c,d,e,s,o),uw("target",c,u,e,i,l),t.set(r.id,r)}}function NC(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:NC(n,t):!1}function dw(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function MU(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!NC(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(i);l&&s.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function nh({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,l,c;const s=[];for(const[u,d]of t){const f=(o=n.get(u))==null?void 0:o.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function OU({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},o=vl(i,t);return{x:o.x-i.x,y:o.y-i.y}}function LU({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,g=!1,x=null;function _({noDragClassName:y,handleSelector:m,domNode:b,isSelectable:j,nodeId:k,nodeClickDistance:S=0}){h=Nt(b);function N({x:M,y:z}){const{nodeLookup:T,nodeExtent:E,snapGrid:A,snapToGrid:P,nodeOrigin:I,onNodeDrag:C,onSelectionDrag:L,onError:F,updateNodePositions:V}=t();i={x:M,y:z};let H=!1;const U=l.size>1,W=U&&E?pm(gl(l)):null,G=U&&P?OU({dragItems:l,snapGrid:A,x:M,y:z}):null;for(const[Y,K]of l){if(!T.has(Y))continue;let X={x:M-K.distance.x,y:z-K.distance.y};P&&(X=G?{x:Math.round(X.x+G.x),y:Math.round(X.y+G.y)}:vl(X,A));let re=null;if(U&&E&&!K.extent&&W){const{positionAbsolute:ee}=K.internals,se=ee.x-W.x+E[0][0],pe=ee.x+K.measured.width-W.x2+E[1][0],ve=ee.y-W.y+E[0][1],Le=ee.y+K.measured.height-W.y2+E[1][1];re=[[se,ve],[pe,Le]]}const{position:te,positionAbsolute:Z}=cC({nodeId:Y,nextPosition:X,nodeLookup:T,nodeExtent:re||E,nodeOrigin:I,onError:F});H=H||K.position.x!==te.x||K.position.y!==te.y,K.position=te,K.internals.positionAbsolute=Z}if(g=g||H,!!H&&(V(l,!0),x&&(r||C||!k&&L))){const[Y,K]=nh({nodeId:k,dragItems:l,nodeLookup:T});r==null||r(x,l,Y,K),C==null||C(x,Y,K),k||L==null||L(x,K)}}async function R(){if(!d)return;const{transform:M,panBy:z,autoPanSpeed:T,autoPanOnNodeDrag:E}=t();if(!E){c=!1,cancelAnimationFrame(o);return}const[A,P]=Wv(u,d,T);(A!==0||P!==0)&&(i.x=(i.x??0)-A/M[2],i.y=(i.y??0)-P/M[2],await z({x:A,y:P})&&N(i)),o=requestAnimationFrame(R)}function O(M){var U;const{nodeLookup:z,multiSelectionActive:T,nodesDraggable:E,transform:A,snapGrid:P,snapToGrid:I,selectNodesOnDrag:C,onNodeDragStart:L,onSelectionDragStart:F,unselectNodesAndEdges:V}=t();f=!0,(!C||!j)&&!T&&k&&((U=z.get(k))!=null&&U.selected||V()),j&&C&&k&&(e==null||e(k));const H=oa(M.sourceEvent,{transform:A,snapGrid:P,snapToGrid:I,containerBounds:d});if(i=H,l=MU(z,E,H,k),l.size>0&&(n||L||!k&&F)){const[W,G]=nh({nodeId:k,dragItems:l,nodeLookup:z});n==null||n(M.sourceEvent,l,W,G),L==null||L(M.sourceEvent,W,G),k||F==null||F(M.sourceEvent,G)}}const D=BE().clickDistance(S).on("start",M=>{const{domNode:z,nodeDragThreshold:T,transform:E,snapGrid:A,snapToGrid:P}=t();d=(z==null?void 0:z.getBoundingClientRect())||null,p=!1,g=!1,x=M.sourceEvent,T===0&&O(M),i=oa(M.sourceEvent,{transform:E,snapGrid:A,snapToGrid:P,containerBounds:d}),u=mn(M.sourceEvent,d)}).on("drag",M=>{const{autoPanOnNodeDrag:z,transform:T,snapGrid:E,snapToGrid:A,nodeDragThreshold:P,nodeLookup:I}=t(),C=oa(M.sourceEvent,{transform:T,snapGrid:E,snapToGrid:A,containerBounds:d});if(x=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||k&&!I.has(k))&&(p=!0),!p){if(!c&&z&&f&&(c=!0,R()),!f){const L=mn(M.sourceEvent,d),F=L.x-u.x,V=L.y-u.y;Math.sqrt(F*F+V*V)>P&&O(M)}(i.x!==C.xSnapped||i.y!==C.ySnapped)&&l&&f&&(u=mn(M.sourceEvent,d),N(C))}}).on("end",M=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(o),l.size>0){const{nodeLookup:z,updateNodePositions:T,onNodeDragStop:E,onSelectionDragStop:A}=t();if(g&&(T(l,!1),g=!1),s||E||!k&&A){const[P,I]=nh({nodeId:k,dragItems:l,nodeLookup:z,dragging:!1});s==null||s(M.sourceEvent,l,P,I),E==null||E(M.sourceEvent,P,I),k||A==null||A(M.sourceEvent,I)}}}).filter(M=>{const z=M.target;return!M.button&&(!y||!dw(z,`.${y}`,b))&&(!m||dw(z,m,b))});h.call(D)}function v(){h==null||h.on(".drag",null)}return{update:_,destroy:v}}function $U(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Uu(s,Ha(i))>0&&r.push(i);return r}const DU=250;function zU(e,t,n,r){var l,c;let s=[],i=1/0;const o=$U(e,n,t+DU);for(const u of o){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=Vs(u,f,f.position,!0),g=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));g>t||(g<i?(s=[{...f,x:h,y:p}],i=g):g===i&&s.push({...f,x:h,y:p}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function EC(e,t,n,r,s,i=!1){var u,d,f;const o=r.get(e);if(!o)return null;const l=s==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((d=o.internals.handleBounds)==null?void 0:d.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...Vs(o,c,c.position,!0)}:c}function CC(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function FU(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const TC=()=>!0;function VU(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:g,onConnect:x,onConnectEnd:_,isValidConnection:v=TC,onReconnectEnd:y,updateConnection:m,getTransform:b,getFromHandle:j,autoPanSpeed:k,dragThreshold:S=1,handleDomNode:N}){const R=gC(e.target);let O=0,D;const{x:M,y:z}=mn(e),T=CC(i,N),E=l==null?void 0:l.getBoundingClientRect();let A=!1;if(!E||!T)return;const P=EC(s,T,r,c,t);if(!P)return;let I=mn(e,E),C=!1,L=null,F=!1,V=null;function H(){if(!d||!E)return;const[te,Z]=Wv(I,E,k);h({x:te,y:Z}),O=requestAnimationFrame(H)}const U={...P,nodeId:s,type:T,position:P.position},W=c.get(s);let Y={inProgress:!0,isValid:null,from:Vs(W,U,ne.Left,!0),fromHandle:U,fromPosition:U.position,fromNode:W,to:I,toHandle:null,toPosition:J0[U.position],toNode:null,pointer:I};function K(){A=!0,m(Y),g==null||g(e,{nodeId:s,handleId:r,handleType:T})}S===0&&K();function X(te){if(!A){const{x:Le,y:Ft}=mn(te),Nn=Le-M,En=Ft-z;if(!(Nn*Nn+En*En>S*S))return;K()}if(!j()||!U){re(te);return}const Z=b();I=mn(te,E),D=zU(yl(I,Z,!1,[1,1]),n,c,U),C||(H(),C=!0);const ee=PC(te,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:v,doc:R,lib:u,flowId:f,nodeLookup:c});V=ee.handleDomNode,L=ee.connection,F=FU(!!D,ee.isValid);const se=c.get(s),pe=se?Vs(se,U,ne.Left,!0):Y.from,ve={...Y,from:pe,isValid:F,to:ee.toHandle&&F?Ji({x:ee.toHandle.x,y:ee.toHandle.y},Z):I,toHandle:ee.toHandle,toPosition:F&&ee.toHandle?ee.toHandle.position:J0[U.position],toNode:ee.toHandle?c.get(ee.toHandle.nodeId):null,pointer:I};m(ve),Y=ve}function re(te){if(!("touches"in te&&te.touches.length>0)){if(A){(D||V)&&L&&F&&(x==null||x(L));const{inProgress:Z,...ee}=Y,se={...ee,toPosition:Y.toHandle?Y.toPosition:null};_==null||_(te,se),i&&(y==null||y(te,se))}p(),cancelAnimationFrame(O),C=!1,F=!1,L=null,V=null,R.removeEventListener("mousemove",X),R.removeEventListener("mouseup",re),R.removeEventListener("touchmove",X),R.removeEventListener("touchend",re)}}R.addEventListener("mousemove",X),R.addEventListener("mouseup",re),R.addEventListener("touchmove",X),R.addEventListener("touchend",re)}function PC(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:l,flowId:c,isValidConnection:u=TC,nodeLookup:d}){const f=i==="target",h=t?o.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:g}=mn(e),x=o.elementFromPoint(p,g),_=x!=null&&x.classList.contains(`${l}-flow__handle`)?x:h,v={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const y=CC(void 0,_),m=_.getAttribute("data-nodeid"),b=_.getAttribute("data-handleid"),j=_.classList.contains("connectable"),k=_.classList.contains("connectableend");if(!m||!y)return v;const S={source:f?m:r,sourceHandle:f?b:s,target:f?r:m,targetHandle:f?s:b};v.connection=S;const R=j&&k&&(n===Qi.Strict?f&&y==="source"||!f&&y==="target":m!==r||b!==s);v.isValid=R&&u(S),v.toHandle=EC(m,y,b,d,n,!0)}return v}const ym={onPointerDown:VU,isValid:PC};function BU({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Nt(e);function i({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const g=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const b=n(),j=m.sourceEvent.ctrlKey&&Wa()?10:1,k=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,S=b[2]*Math.pow(2,k*j);t.scaleTo(S)};let x=[0,0];const _=m=>{(m.sourceEvent.type==="mousedown"||m.sourceEvent.type==="touchstart")&&(x=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY])},v=m=>{const b=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const j=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],k=[j[0]-x[0],j[1]-x[1]];x=j;const S=r()*Math.max(b[2],Math.log(b[2]))*(p?-1:1),N={x:b[0]-k[0]*S,y:b[1]-k[1]*S},R=[[0,0],[c,u]];t.setViewportConstrained({x:N.x,y:N.y,zoom:b[2]},R,l)},y=rC().on("start",_).on("zoom",f?v:null).on("zoom.wheel",h?g:null);s.call(y,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:un}}const Fd=e=>({x:e.x,y:e.y,zoom:e.k}),rh=({x:e,y:t,zoom:n})=>$d.translate(e,t).scale(n),wi=(e,t)=>e.target.closest(`.${t}`),AC=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),UU=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,sh=(e,t=0,n=UU,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},RC=e=>{const t=e.ctrlKey&&Wa()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function HU({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(wi(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&o){const _=un(d),v=RC(d),y=f*Math.pow(2,v);r.scaleTo(n,y,_,d);return}const h=d.deltaMode===1?20:1;let p=s===Ns.Vertical?0:d.deltaX*h,g=s===Ns.Horizontal?0:d.deltaY*h;!Wa()&&d.shiftKey&&s!==Ns.Vertical&&(p=d.deltaY*h,g=0),r.translateBy(n,-(p/f)*i,-(g/f)*i,{internal:!0});const x=Fd(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c==null||c(d,x):(e.isPanScrolling=!0,l==null||l(d,x)),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,x),e.isPanScrolling=!1},150)}}function WU({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!t&&i&&!r.ctrlKey,l=wi(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,s)}}function KU({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Fd(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function GU({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,l;e.usedRightMouseButton=!!(n&&AC(t,e.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,Fd(i.transform)))}}function qU({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&AC(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Fd(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function YU({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var _;const h=e||t,p=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(wi(f,`${u}-flow__node`)||wi(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||o||d&&!g||wi(f,l)&&g||wi(f,c)&&(!g||s&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((_=f.touches)==null?void 0:_.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&x}}function XU({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect();let f=[[0,0],[d.width,d.height]];const h=typeof ResizeObserver<"u"?new ResizeObserver(z=>{const T=z[0];T&&(f=[[0,0],[T.contentRect.width,T.contentRect.height]])}):null;h==null||h.observe(e);const p=rC().extent(()=>f).scaleExtent([t,n]).translateExtent(r),g=Nt(e).call(p);b({x:s.x,y:s.y,zoom:Zi(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const x=g.on("wheel.zoom"),_=g.on("dblclick.zoom");p.wheelDelta(RC);async function v(z,T){return g?new Promise(E=>{p==null||p.interpolate((T==null?void 0:T.interpolate)==="linear"?ia:Oc).transform(sh(g,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>E(!0)),z)}):!1}function y({noWheelClassName:z,noPanClassName:T,onPaneContextMenu:E,userSelectionActive:A,panOnScroll:P,panOnDrag:I,panOnScrollMode:C,panOnScrollSpeed:L,preventScrolling:F,zoomOnPinch:V,zoomOnScroll:H,zoomOnDoubleClick:U,zoomActivationKeyPressed:W,lib:G,onTransformChange:Y,connectionInProgress:K,paneClickDistance:X,selectionOnDrag:re}){A&&!u.isZoomingOrPanning&&m();const te=P&&!W&&!A;p.clickDistance(re?1/0:!pn(X)||X<0?0:X);const Z=te?HU({zoomPanValues:u,noWheelClassName:z,d3Selection:g,d3Zoom:p,panOnScrollMode:C,panOnScrollSpeed:L,zoomOnPinch:V,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:l}):WU({noWheelClassName:z,preventScrolling:F,d3ZoomHandler:x});g.on("wheel.zoom",Z,{passive:!1});const ee=KU({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});p.on("start",ee);const se=GU({zoomPanValues:u,panOnDrag:I,onPaneContextMenu:!!E,onPanZoom:i,onTransformChange:Y});p.on("zoom",se);const pe=qU({zoomPanValues:u,panOnDrag:I,panOnScroll:P,onPaneContextMenu:E,onPanZoomEnd:l,onDraggingChange:c});p.on("end",pe);const ve=YU({zoomActivationKeyPressed:W,panOnDrag:I,zoomOnScroll:H,panOnScroll:P,zoomOnDoubleClick:U,zoomOnPinch:V,userSelectionActive:A,noPanClassName:T,noWheelClassName:z,lib:G,connectionInProgress:K});p.filter(ve),U?g.on("dblclick.zoom",_):g.on("dblclick.zoom",null)}function m(){p.on("zoom",null)}async function b(z,T,E){const A=rh(z),P=p==null?void 0:p.constrain()(A,T,E);return P&&await v(P),P}async function j(z,T){const E=rh(z);return await v(E,T),E}function k(z){if(g){const T=rh(z),E=g.property("__zoom");(E.k!==z.zoom||E.x!==z.x||E.y!==z.y)&&(p==null||p.transform(g,T,null,{sync:!0}))}}function S(){const z=g?nC(g.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}async function N(z,T){return g?new Promise(E=>{p==null||p.interpolate((T==null?void 0:T.interpolate)==="linear"?ia:Oc).scaleTo(sh(g,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>E(!0)),z)}):!1}async function R(z,T){return g?new Promise(E=>{p==null||p.interpolate((T==null?void 0:T.interpolate)==="linear"?ia:Oc).scaleBy(sh(g,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>E(!0)),z)}):!1}function O(z){p==null||p.scaleExtent(z)}function D(z){p==null||p.translateExtent(z)}function M(z){const T=!pn(z)||z<0?0:z;p==null||p.clickDistance(T)}return{update:y,destroy:m,setViewport:j,setViewportConstrained:b,getViewport:S,scaleTo:N,scaleBy:R,setScaleExtent:O,setTranslateExtent:D,syncViewport:k,setClickDistance:M}}var eo;(function(e){e.Line="line",e.Handle="handle"})(eo||(eo={}));function QU({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=e-t,l=n-r,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function fw(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function Er(e,t){return Math.max(0,t-e)}function Cr(e,t){return Math.max(0,e-t)}function ec(e,t,n){return Math.max(0,t-e,e-n)}function hw(e,t){return e?!t:t}function ZU(e,t,n,r,s,i,o,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:g}=n,{minWidth:x,maxWidth:_,minHeight:v,maxHeight:y}=r,{x:m,y:b,width:j,height:k,aspectRatio:S}=e;let N=Math.floor(d?p-e.pointerX:0),R=Math.floor(f?g-e.pointerY:0);const O=j+(c?-N:N),D=k+(u?-R:R),M=-i[0]*j,z=-i[1]*k;let T=ec(O,x,_),E=ec(D,v,y);if(o){let I=0,C=0;c&&N<0?I=Er(m+N+M,o[0][0]):!c&&N>0&&(I=Cr(m+O+M,o[1][0])),u&&R<0?C=Er(b+R+z,o[0][1]):!u&&R>0&&(C=Cr(b+D+z,o[1][1])),T=Math.max(T,I),E=Math.max(E,C)}if(l){let I=0,C=0;c&&N>0?I=Cr(m+N,l[0][0]):!c&&N<0&&(I=Er(m+O,l[1][0])),u&&R>0?C=Cr(b+R,l[0][1]):!u&&R<0&&(C=Er(b+D,l[1][1])),T=Math.max(T,I),E=Math.max(E,C)}if(s){if(d){const I=ec(O/S,v,y)*S;if(T=Math.max(T,I),o){let C=0;!c&&!u||c&&!u&&h?C=Cr(b+z+O/S,o[1][1])*S:C=Er(b+z+(c?N:-N)/S,o[0][1])*S,T=Math.max(T,C)}if(l){let C=0;!c&&!u||c&&!u&&h?C=Er(b+O/S,l[1][1])*S:C=Cr(b+(c?N:-N)/S,l[0][1])*S,T=Math.max(T,C)}}if(f){const I=ec(D*S,x,_)/S;if(E=Math.max(E,I),o){let C=0;!c&&!u||u&&!c&&h?C=Cr(m+D*S+M,o[1][0])/S:C=Er(m+(u?R:-R)*S+M,o[0][0])/S,E=Math.max(E,C)}if(l){let C=0;!c&&!u||u&&!c&&h?C=Er(m+D*S,l[1][0])/S:C=Cr(m+(u?R:-R)*S,l[0][0])/S,E=Math.max(E,C)}}}R=R+(R<0?E:-E),N=N+(N<0?T:-T),s&&(h?O>D*S?R=(hw(c,u)?-N:N)/S:N=(hw(c,u)?-R:R)*S:d?(R=N/S,u=c):(N=R*S,c=u));const A=c?m+N:m,P=u?b+R:b;return{width:j+(c?-N:N),height:k+(u?-R:R),x:i[0]*N*(c?-1:1)+A,y:i[1]*R*(u?-1:1)+P}}const IC={width:0,height:0,x:0,y:0},JU={...IC,pointerX:0,pointerY:0,aspectRatio:1};function eH(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,o=e.measured.height??0,l=n[0]*i,c=n[1]*o;return[[r-l,s-c],[r+i-l,s+o-c]]}function tH({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Nt(e);let o={controlDirection:fw("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:g,onResizeEnd:x,shouldResize:_}){let v={...IC},y={...JU};o={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:fw(u)};let m,b=null,j=[],k,S,N,R=!1;const O=BE().on("start",D=>{const{nodeLookup:M,transform:z,snapGrid:T,snapToGrid:E,nodeOrigin:A,paneDomNode:P}=n();if(m=M.get(t),!m)return;b=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:C}=oa(D.sourceEvent,{transform:z,snapGrid:T,snapToGrid:E,containerBounds:b});v={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},y={...v,pointerX:I,pointerY:C,aspectRatio:v.width/v.height},k=void 0,S=Fs(m.extent)?m.extent:void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(k=M.get(m.parentId)),k&&m.extent==="parent"&&(S=[[0,0],[k.measured.width,k.measured.height]]),j=[],N=void 0;for(const[L,F]of M)if(F.parentId===t&&(j.push({id:L,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const V=eH(F,m,F.origin??A);N?N=[[Math.min(V[0][0],N[0][0]),Math.min(V[0][1],N[0][1])],[Math.max(V[1][0],N[1][0]),Math.max(V[1][1],N[1][1])]]:N=V}p==null||p(D,{...v})}).on("drag",D=>{const{transform:M,snapGrid:z,snapToGrid:T,nodeOrigin:E}=n(),A=oa(D.sourceEvent,{transform:M,snapGrid:z,snapToGrid:T,containerBounds:b}),P=[];if(!m)return;const{x:I,y:C,width:L,height:F}=v,V={},H=m.origin??E,{width:U,height:W,x:G,y:Y}=ZU(y,o.controlDirection,A,o.boundaries,o.keepAspectRatio,H,S,N),K=U!==L,X=W!==F,re=G!==I&&K,te=Y!==C&&X;if(!re&&!te&&!K&&!X)return;if((re||te||H[0]===1||H[1]===1)&&(V.x=re?G:v.x,V.y=te?Y:v.y,v.x=V.x,v.y=V.y,j.length>0)){const pe=G-I,ve=Y-C;for(const Le of j)Le.position={x:Le.position.x-pe+H[0]*(U-L),y:Le.position.y-ve+H[1]*(W-F)},P.push(Le)}if((K||X)&&(V.width=K&&(!o.resizeDirection||o.resizeDirection==="horizontal")?U:v.width,V.height=X&&(!o.resizeDirection||o.resizeDirection==="vertical")?W:v.height,v.width=V.width,v.height=V.height),k&&m.expandParent){const pe=H[0]*(V.width??0);V.x&&V.x<pe&&(v.x=pe,y.x=y.x-(V.x-pe));const ve=H[1]*(V.height??0);V.y&&V.y<ve&&(v.y=ve,y.y=y.y-(V.y-ve))}const Z=QU({width:v.width,prevWidth:L,height:v.height,prevHeight:F,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),ee={...v,direction:Z};(_==null?void 0:_(D,ee))!==!1&&(R=!0,g==null||g(D,ee),r(V,P))}).on("end",D=>{R&&(x==null||x(D,{...v}),s==null||s({...v}),R=!1)});i.call(O)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var MC={exports:{}},OC={};/**
79
79
  * @license React
80
80
  * use-sync-external-store-shim/with-selector.production.js
81
81
  *
@@ -83,16 +83,16 @@ export default ...`,onChange:_=>c(_.target.value),disabled:u})]}),a.jsxs("label"
83
83
  *
84
84
  * This source code is licensed under the MIT license found in the
85
85
  * LICENSE file in the root directory of this source tree.
86
- */var Vd=w,nH=Z1;function rH(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sH=typeof Object.is=="function"?Object.is:rH,iH=nH.useSyncExternalStore,oH=Vd.useRef,aH=Vd.useEffect,lH=Vd.useMemo,cH=Vd.useDebugValue;$C.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=oH(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=lH(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var g=o.value;if(s(g,p))return f=g}return f=p}if(g=f,sH(d,p))return g;var x=r(p);return s!==void 0&&s(g,x)?(d=p,g):(d=p,f=x)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,r,s]);var l=iH(e,i[0],i[1]);return aH(function(){o.hasValue=!0,o.value=l},[l]),cH(l),l};LC.exports=$C;var uH=LC.exports;const dH=yb(uH),fH={},vw=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(fH?"local-app":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},hH=e=>e?vw(e):vw,{useDebugValue:pH}=or,{useSyncExternalStoreWithSelector:mH}=dH,gH=e=>e;function DC(e,t=gH,n){const r=mH(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return pH(r),r}const yw=(e,t)=>{const n=hH(e),r=(s,i=t)=>DC(n,s,i);return Object.assign(r,n),r},vH=(e,t)=>e?yw(e,t):yw;function Oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Bd=w.createContext(null),yH=Bd.Provider,zC=jn.error001("react");function he(e,t){const n=w.useContext(Bd);if(n===null)throw new Error(zC);return DC(n,e,t)}function Ce(){const e=w.useContext(Bd);if(e===null)throw new Error(zC);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xw={display:"none"},xH={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},FC="react-flow__node-desc",VC="react-flow__edge-desc",_H="react-flow__aria-live",wH=e=>e.ariaLiveMessage,bH=e=>e.ariaLabelConfig;function jH({rfId:e}){const t=he(wH);return a.jsx("div",{id:`${_H}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:xH,children:t})}function SH({rfId:e,disableKeyboardA11y:t}){const n=he(bH);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${FC}-${e}`,style:xw,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${VC}-${e}`,style:xw,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(jH,{rfId:e})]})}const Ud=w.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const o=`${e}`.split("-");return a.jsx("div",{className:He(["react-flow__panel",n,...o]),style:r,ref:i,...s,children:t})});Ud.displayName="Panel";const _w="https://reactflow.dev?utm_source=attribution";function kH({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(Ud,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${_w}`,children:a.jsx("a",{href:_w,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const NH=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},tc=e=>e.id;function EH(e,t){return Oe(e.selectedNodes.map(tc),t.selectedNodes.map(tc))&&Oe(e.selectedEdges.map(tc),t.selectedEdges.map(tc))}function CH({onSelectionChange:e}){const t=Ce(),{selectedNodes:n,selectedEdges:r}=he(NH,EH);return w.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const TH=e=>!!e.onSelectionChangeHandlers;function PH({onSelectionChange:e}){const t=he(TH);return e||t?a.jsx(CH,{onSelectionChange:e}):null}const BC=[0,0],AH={x:0,y:0,zoom:1},RH=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ww=[...RH,"rfId"],IH=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),bw={translateExtent:Ba,nodeOrigin:BC,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function MH(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=he(IH,Oe),u=Ce();w.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=bw,l()}),[]);const d=w.useRef(bw);return w.useEffect(()=>{for(const f of ww){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?s(h):f==="translateExtent"?i(h):f==="nodeExtent"?o(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:pU(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},ww.map(f=>e[f])),null}function jw(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function OH(e){var r;const[t,n]=w.useState(e==="system"?null:e);return w.useEffect(()=>{if(e!=="system"){n(e);return}const s=jw(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=jw())!=null&&r.matches?"dark":"light"}const Sw=typeof document<"u"?document:null;function Ka(e=null,t={target:Sw,actInsideInputWithModifier:!0}){const[n,r]=w.useState(!1),s=w.useRef(!1),i=w.useRef(new Set([])),[o,l]=w.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
86
+ */var Vd=w,nH=Q1;function rH(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sH=typeof Object.is=="function"?Object.is:rH,iH=nH.useSyncExternalStore,oH=Vd.useRef,aH=Vd.useEffect,lH=Vd.useMemo,cH=Vd.useDebugValue;OC.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=oH(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=lH(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var g=o.value;if(s(g,p))return f=g}return f=p}if(g=f,sH(d,p))return g;var x=r(p);return s!==void 0&&s(g,x)?(d=p,g):(d=p,f=x)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,r,s]);var l=iH(e,i[0],i[1]);return aH(function(){o.hasValue=!0,o.value=l},[l]),cH(l),l};MC.exports=OC;var uH=MC.exports;const dH=mb(uH),fH={},pw=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(fH?"local-app":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},hH=e=>e?pw(e):pw,{useDebugValue:pH}=or,{useSyncExternalStoreWithSelector:mH}=dH,gH=e=>e;function LC(e,t=gH,n){const r=mH(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return pH(r),r}const mw=(e,t)=>{const n=hH(e),r=(s,i=t)=>LC(n,s,i);return Object.assign(r,n),r},vH=(e,t)=>e?mw(e,t):mw;function Oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Bd=w.createContext(null),yH=Bd.Provider,$C=jn.error001("react");function he(e,t){const n=w.useContext(Bd);if(n===null)throw new Error($C);return LC(n,e,t)}function Ce(){const e=w.useContext(Bd);if(e===null)throw new Error($C);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const gw={display:"none"},xH={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},DC="react-flow__node-desc",zC="react-flow__edge-desc",_H="react-flow__aria-live",wH=e=>e.ariaLiveMessage,bH=e=>e.ariaLabelConfig;function jH({rfId:e}){const t=he(wH);return a.jsx("div",{id:`${_H}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:xH,children:t})}function SH({rfId:e,disableKeyboardA11y:t}){const n=he(bH);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${DC}-${e}`,style:gw,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${zC}-${e}`,style:gw,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(jH,{rfId:e})]})}const Ud=w.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const o=`${e}`.split("-");return a.jsx("div",{className:He(["react-flow__panel",n,...o]),style:r,ref:i,...s,children:t})});Ud.displayName="Panel";const vw="https://reactflow.dev?utm_source=attribution";function kH({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(Ud,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${vw}`,children:a.jsx("a",{href:vw,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const NH=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},tc=e=>e.id;function EH(e,t){return Oe(e.selectedNodes.map(tc),t.selectedNodes.map(tc))&&Oe(e.selectedEdges.map(tc),t.selectedEdges.map(tc))}function CH({onSelectionChange:e}){const t=Ce(),{selectedNodes:n,selectedEdges:r}=he(NH,EH);return w.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const TH=e=>!!e.onSelectionChangeHandlers;function PH({onSelectionChange:e}){const t=he(TH);return e||t?a.jsx(CH,{onSelectionChange:e}):null}const FC=[0,0],AH={x:0,y:0,zoom:1},RH=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],yw=[...RH,"rfId"],IH=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),xw={translateExtent:Ba,nodeOrigin:FC,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function MH(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=he(IH,Oe),u=Ce();w.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=xw,l()}),[]);const d=w.useRef(xw);return w.useEffect(()=>{for(const f of yw){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?s(h):f==="translateExtent"?i(h):f==="nodeExtent"?o(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:pU(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},yw.map(f=>e[f])),null}function _w(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function OH(e){var r;const[t,n]=w.useState(e==="system"?null:e);return w.useEffect(()=>{if(e!=="system"){n(e);return}const s=_w(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=_w())!=null&&r.matches?"dark":"light"}const ww=typeof document<"u"?document:null;function Ka(e=null,t={target:ww,actInsideInputWithModifier:!0}){const[n,r]=w.useState(!1),s=w.useRef(!1),i=w.useRef(new Set([])),[o,l]=w.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
87
87
  `).replace(`
88
88
 
89
89
  `,`
90
90
  +`).split(`
91
- `)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return w.useEffect(()=>{const c=(t==null?void 0:t.target)??Sw,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var _,v;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&xC(p))return!1;const x=Nw(p.code,l);if(i.current.add(p[x]),kw(o,i.current,!1)){const y=((v=(_=p.composedPath)==null?void 0:_.call(p))==null?void 0:v[0])||p.target,m=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";t.preventDefault!==!1&&(s.current||!m)&&p.preventDefault(),r(!0)}},f=p=>{const g=Nw(p.code,l);kw(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[g]),p.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function kw(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function Nw(e,t){return t.includes(e)?"code":"key"}const LH=()=>{const e=Ce();return w.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:l}=e.getState(),c=Yv(t,r,s,i,o,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??s,f=n.snapToGrid??i;return yl(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),o=Ji(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function UC(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of t){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...i};for(const c of o)$H(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function $H(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function DH(e,t){return UC(e,t)}function zH(e,t){return UC(e,t)}function ps(e,t){return{id:e,type:"select",selected:t}}function bi(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const o=t.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(ps(i.id,o)))}return r}function Ew({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const l=t.get(o.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function Cw(e){return{id:e.id,type:"remove"}}const FH=mC();function VH(e,t,n={}){return _U(e,t,{...n,onError:n.onError??FH})}const Tw=e=>iU(e),BH=e=>uC(e);function HC(e){return w.forwardRef(e)}const WC=typeof window<"u"?w.useLayoutEffect:w.useEffect;function Pw(e){const[t,n]=w.useState(BigInt(0)),[r]=w.useState(()=>UH(()=>n(s=>s+BigInt(1))));return WC(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function UH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const KC=w.createContext(null);function HH({children:e}){const t=Ce(),n=w.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:g}=t.getState();let x=c;for(const v of l)x=typeof v=="function"?v(x):v;let _=Ew({items:x,lookup:h});for(const v of g.values())_=v(_);d&&u(x),_.length>0?f==null||f(_):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:v,nodes:y,setNodes:m}=t.getState();v&&m(y)})},[]),r=Pw(n),s=w.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const g of l)p=typeof g=="function"?g(p):g;d?u(p):f&&f(Ew({items:p,lookup:h}))},[]),i=Pw(s),o=w.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return a.jsx(KC.Provider,{value:o,children:e})}function WH(){const e=w.useContext(KC);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const KH=e=>!!e.panZoom;function ny(){const e=LH(),t=Ce(),n=WH(),r=he(KH),s=w.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var v,y;const{nodeLookup:h,nodeOrigin:p}=t.getState(),g=Tw(f)?f:h.get(f.id),x=g.parentId?vC(g.position,g.measured,g.parentId,h,p):g.position,_={...g,position:x,width:((v=g.measured)==null?void 0:v.width)??g.width,height:((y=g.measured)==null?void 0:y.height)??g.height};return Ha(_)},u=(f,h,p={replace:!1})=>{o(g=>g.map(x=>{if(x.id===f){const _=typeof h=="function"?h(x):h;return p.replace&&Tw(_)?_:{...x,..._}}return x}))},d=(f,h,p={replace:!1})=>{l(g=>g.map(x=>{if(x.id===f){const _=typeof h=="function"?h(x):h;return p.replace&&BH(_)?_:{...x,..._}}return x}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=i(f))==null?void 0:h.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[g,x,_]=p;return{nodes:f.map(v=>({...v})),edges:h.map(v=>({...v})),viewport:{x:g,y:x,zoom:_}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:g,onNodesDelete:x,onEdgesDelete:_,triggerNodeChanges:v,triggerEdgeChanges:y,onDelete:m,onBeforeDelete:b}=t.getState(),{nodes:j,edges:k}=await uU({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:g,onBeforeDelete:b}),S=k.length>0,N=j.length>0;if(S){const R=k.map(Cw);_==null||_(k),y(R)}if(N){const R=j.map(Cw);x==null||x(j),v(R)}return(N||S)&&(m==null||m({nodes:j,edges:k})),{deletedNodes:j,deletedEdges:k}},getIntersectingNodes:(f,h=!0,p)=>{const g=sw(f),x=g?f:c(f),_=p!==void 0;return x?(p||t.getState().nodes).filter(v=>{const y=t.getState().nodeLookup.get(v.id);if(y&&!g&&(v.id===f.id||!y.internals.positionAbsolute))return!1;const m=Ha(_?v:y),b=Uu(m,x);return h&&b>0||b>=m.width*m.height||b>=x.width*x.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const x=sw(f)?f:c(f);if(!x)return!1;const _=Uu(x,h);return p&&_>0||_>=h.width*h.height||_>=x.width*x.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,g=>{const x=typeof h=="function"?h(g):h;return p.replace?{...g,data:x}:{...g,data:{...g.data,...x}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,g=>{const x=typeof h=="function"?h(g):h;return p.replace?{...g,data:x}:{...g,data:{...g.data,...x}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return oU(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??hU();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return w.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const Aw=e=>e.selected,GH=typeof window<"u"?window:void 0;function qH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ce(),{deleteElements:r}=ny(),s=Ka(e,{actInsideInputWithModifier:!1}),i=Ka(t,{target:GH});w.useEffect(()=>{if(s){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(Aw),edges:o.filter(Aw)}),n.setState({nodesSelectionActive:!1})}},[s]),w.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function YH(e){const t=Ce();w.useEffect(()=>{const n=()=>{var s,i,o,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Xv(e.current);(r.height===0||r.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",jn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Hd={position:"absolute",width:"100%",height:"100%",top:0,left:0},XH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function QH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Ns.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:g,noWheelClassName:x,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:m,selectionOnDrag:b}){const j=Ce(),k=w.useRef(null),{userSelectionActive:S,lib:N,connectionInProgress:R}=he(XH,Oe),O=Ka(h),D=w.useRef();YH(k);const M=w.useCallback(z=>{v==null||v({x:z[0],y:z[1],zoom:z[2]}),y||j.setState({transform:z})},[v,y]);return w.useEffect(()=>{if(k.current){D.current=XU({domNode:k.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:A=>j.setState(P=>P.paneDragging===A?P:{paneDragging:A}),onPanZoomStart:(A,P)=>{const{onViewportChangeStart:I,onMoveStart:C}=j.getState();C==null||C(A,P),I==null||I(P)},onPanZoom:(A,P)=>{const{onViewportChange:I,onMove:C}=j.getState();C==null||C(A,P),I==null||I(P)},onPanZoomEnd:(A,P)=>{const{onViewportChangeEnd:I,onMoveEnd:C}=j.getState();C==null||C(A,P),I==null||I(P)}});const{x:z,y:T,zoom:E}=D.current.getViewport();return j.setState({panZoom:D.current,transform:[z,T,E],domNode:k.current.closest(".react-flow")}),()=>{var A;(A=D.current)==null||A.destroy()}}},[]),w.useEffect(()=>{var z;(z=D.current)==null||z.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:O,preventScrolling:p,noPanClassName:_,userSelectionActive:S,noWheelClassName:x,lib:N,onTransformChange:M,connectionInProgress:R,selectionOnDrag:b,paneClickDistance:m})},[e,t,n,r,s,i,o,l,O,p,_,S,x,N,M,R,b,m]),a.jsx("div",{className:"react-flow__renderer",ref:k,style:Hd,children:g})}const ZH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function JH(){const{userSelectionActive:e,userSelectionRect:t}=he(ZH,Oe);return e&&t?a.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const ih=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},eW=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function tW({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ua.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:o,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:g,children:x}){const _=w.useRef(0),v=Ce(),{userSelectionActive:y,elementsSelectable:m,dragging:b,panBy:j,autoPanSpeed:k}=he(eW,Oe),S=m&&(e||y),N=w.useRef(null),R=w.useRef(),O=w.useRef(new Set),D=w.useRef(new Set),M=w.useRef(!1),z=w.useRef(!1),T=w.useRef({x:0,y:0}),E=w.useRef(!1),A=K=>{if(z.current||M.current||v.getState().connection.inProgress){z.current=!1,M.current=!1;return}u==null||u(K),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},P=K=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){K.preventDefault();return}d==null||d(K)},I=f?K=>f(K):void 0,C=K=>{z.current&&(K.stopPropagation(),z.current=!1)},L=K=>{var Le,Ft;const{domNode:X,transform:re}=v.getState();if(R.current=X==null?void 0:X.getBoundingClientRect(),!R.current)return;const te=K.target===N.current;if(!te&&!!K.target.closest(".nokey")||!e||!(o&&te||t)||K.button!==0||!K.isPrimary)return;(Ft=(Le=K.target)==null?void 0:Le.setPointerCapture)==null||Ft.call(Le,K.pointerId),z.current=!1;const{x:se,y:pe}=mn(K.nativeEvent,R.current),ve=yl({x:se,y:pe},re);v.setState({userSelectionRect:{width:0,height:0,startX:ve.x,startY:ve.y,x:se,y:pe}}),te||(K.stopPropagation(),K.preventDefault())};function F(K,X){const{userSelectionRect:re}=v.getState();if(!re)return;const{transform:te,nodeLookup:Z,edgeLookup:ee,connectionLookup:se,triggerNodeChanges:pe,triggerEdgeChanges:ve,defaultEdgeOptions:Le}=v.getState(),Ft={x:re.startX,y:re.startY},{x:Nn,y:En}=Ji(Ft,te),Kn={startX:Ft.x,startY:Ft.y,x:K<Nn?K:Nn,y:X<En?X:En,width:Math.abs(K-Nn),height:Math.abs(X-En)},go=O.current,rs=D.current;O.current=new Set(Gv(Z,Kn,te,n===Ua.Partial,!0).map(sn=>sn.id)),D.current=new Set;const ss=(Le==null?void 0:Le.selectable)??!0;for(const sn of O.current){const Gn=se.get(sn);if(Gn)for(const{edgeId:qn}of Gn.values()){const is=ee.get(qn);is&&(is.selectable??ss)&&D.current.add(qn)}}if(!iw(go,O.current)){const sn=bi(Z,O.current,!0);pe(sn)}if(!iw(rs,D.current)){const sn=bi(ee,D.current);ve(sn)}v.setState({userSelectionRect:Kn,userSelectionActive:!0,nodesSelectionActive:!1})}function V(){if(!s||!R.current)return;const[K,X]=qv(T.current,R.current,k);j({x:K,y:X}).then(re=>{if(!z.current||!re){_.current=requestAnimationFrame(V);return}const{x:te,y:Z}=T.current;F(te,Z),_.current=requestAnimationFrame(V)})}const H=()=>{cancelAnimationFrame(_.current),_.current=0,E.current=!1};w.useEffect(()=>()=>H(),[]);const U=K=>{const{userSelectionRect:X,transform:re,resetSelectedElements:te}=v.getState();if(!R.current||!X)return;const{x:Z,y:ee}=mn(K.nativeEvent,R.current);T.current={x:Z,y:ee};const se=Ji({x:X.startX,y:X.startY},re);if(!z.current){const pe=t?0:i;if(Math.hypot(Z-se.x,ee-se.y)<=pe)return;te(),l==null||l(K)}z.current=!0,E.current||(V(),E.current=!0),F(Z,ee)},W=K=>{var X,re;if(!S){K.target===N.current&&v.getState().connection.inProgress&&(M.current=!0);return}K.button===0&&((re=(X=K.target)==null?void 0:X.releasePointerCapture)==null||re.call(X,K.pointerId),!y&&K.target===N.current&&v.getState().userSelectionRect&&(A==null||A(K)),v.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(c==null||c(K),v.setState({nodesSelectionActive:O.current.size>0})),H())},G=K=>{var X,re;(re=(X=K.target)==null?void 0:X.releasePointerCapture)==null||re.call(X,K.pointerId),H()},Y=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:He(["react-flow__pane",{draggable:Y,dragging:b,selection:e}]),onClick:S?void 0:ih(A,N),onContextMenu:ih(P,N),onWheel:ih(I,N),onPointerEnter:S?void 0:h,onPointerMove:S?U:p,onPointerUp:W,onPointerCancel:S?G:void 0,onPointerDownCapture:S?L:void 0,onClickCapture:S?C:void 0,onPointerLeave:g,ref:N,style:Hd,children:[x,a.jsx(JH,{})]})}function xm({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",jn.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function GC({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const l=Ce(),[c,u]=w.useState(!1),d=w.useRef();return w.useEffect(()=>{if(!t)return d.current=LU({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{xm({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}}),()=>{var f;(f=d.current)==null||f.destroy(),d.current=void 0}},[t,l,e]),w.useEffect(()=>{t||!e.current||!d.current||d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:o})},[n,r,t,i,e,s,o]),c}const nW=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function qC(){const e=Ce();return w.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=nW(o),p=s?i[0]:5,g=s?i[1]:5,x=n.direction.x*p*n.factor,_=n.direction.y*g*n.factor;for(const[,v]of u){if(!h(v))continue;let y={x:v.internals.positionAbsolute.x+x,y:v.internals.positionAbsolute.y+_};s&&(y=vl(y,i));const{position:m,positionAbsolute:b}=dC({nodeId:v.id,nextPosition:y,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});v.position=m,v.internals.positionAbsolute=b,f.set(v.id,v)}c(f)},[])}const ry=w.createContext(null),rW=ry.Provider;ry.Consumer;const YC=()=>w.useContext(ry),sW=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),XC=w.createContext(null);function iW({children:e}){const t=he(sW,Oe);return a.jsx(XC.Provider,{value:t,children:e})}function oW(){const e=w.useContext(XC);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const aW={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},lW=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:l,toHandle:c,isValid:u}=o;if(!l&&!s)return aW;const d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Qi.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:d&&u}};function cW({type:e="source",position:t=ne.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var E,A;const g=o||null,x=e==="target",_=Ce(),v=YC(),{connectOnClick:y,noPanClassName:m,rfId:b}=oW(),{connectingFrom:j,connectingTo:k,clickConnecting:S,isPossibleEndHandle:N,connectionInProcess:R,clickConnectionInProcess:O,valid:D}=he(lW(v,g,e),Oe);v||(A=(E=_.getState()).onError)==null||A.call(E,"010",jn.error010());const M=P=>{const{defaultEdgeOptions:I,onConnect:C,hasDefaultEdges:L}=_.getState(),F={...I,...P};if(L){const{edges:V,setEdges:H,onError:U}=_.getState();H(VH(F,V,{onError:U}))}C==null||C(F),l==null||l(F)},z=P=>{if(!v)return;const I=_C(P.nativeEvent);if(s&&(I&&P.button===0||!I)){const C=_.getState();ym.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:C.autoPanOnConnect,connectionMode:C.connectionMode,connectionRadius:C.connectionRadius,domNode:C.domNode,nodeLookup:C.nodeLookup,lib:C.lib,isTarget:x,handleId:g,nodeId:v,flowId:C.rfId,panBy:C.panBy,cancelConnection:C.cancelConnection,onConnectStart:C.onConnectStart,onConnectEnd:(...L)=>{var F,V;return(V=(F=_.getState()).onConnectEnd)==null?void 0:V.call(F,...L)},updateConnection:C.updateConnection,onConnect:M,isValidConnection:n||((...L)=>{var F,V;return((V=(F=_.getState()).isValidConnection)==null?void 0:V.call(F,...L))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:C.autoPanSpeed,dragThreshold:C.connectionDragThreshold})}I?d==null||d(P):f==null||f(P)},T=P=>{const{onClickConnectStart:I,onClickConnectEnd:C,connectionClickStartHandle:L,connectionMode:F,isValidConnection:V,lib:H,rfId:U,nodeLookup:W,connection:G}=_.getState();if(!v||!L&&!s)return;if(!L){I==null||I(P.nativeEvent,{nodeId:v,handleId:g,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:v,type:e,id:g}});return}const Y=yC(P.target),K=n||V,{connection:X,isValid:re}=ym.isValid(P.nativeEvent,{handle:{nodeId:v,id:g,type:e},connectionMode:F,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:K,flowId:U,doc:Y,lib:H,nodeLookup:W});re&&X&&M(X);const te=structuredClone(G);delete te.inProgress,te.toPosition=te.toHandle?te.toHandle.position:null,C==null||C(P,te),_.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":g,"data-nodeid":v,"data-handlepos":t,"data-id":`${b}-${v}-${g}-${e}`,className:He(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,u,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:i,clickconnecting:S,connectingfrom:j,connectingto:k,valid:D,connectionindicator:r&&(!R||N)&&(R||O?i:s)}]),onMouseDown:z,onTouchStart:z,onClick:y?T:void 0,ref:p,...h,children:c})}const to=w.memo(HC(cW));function uW({data:e,isConnectable:t,sourcePosition:n=ne.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(to,{type:"source",position:n,isConnectable:t})]})}function dW({data:e,isConnectable:t,targetPosition:n=ne.Top,sourcePosition:r=ne.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(to,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(to,{type:"source",position:r,isConnectable:t})]})}function fW(){return null}function hW({data:e,isConnectable:t,targetPosition:n=ne.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(to,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Hu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Rw={input:uW,default:dW,output:hW,group:fW};function pW(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const mW=e=>{const{width:t,height:n,x:r,y:s}=gl(e.nodeLookup,{filter:i=>!!i.selected});return{width:pn(t)?t:null,height:pn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function gW({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ce(),{width:s,height:i,transformString:o,userSelectionActive:l}=he(mW,Oe),c=qC(),u=w.useRef(null);w.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&s!==null&&i!==null;if(GC({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const g=r.getState().nodes.filter(x=>x.selected);e(p,g)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Hu,p.key)&&(p.preventDefault(),c({direction:Hu[p.key],factor:p.shiftKey?4:1}))};return a.jsx("div",{className:He(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const Iw=typeof window<"u"?window:void 0,vW=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function QC({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:g,panActivationKeyCode:x,zoomActivationKeyCode:_,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:b,panOnScrollSpeed:j,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:N,autoPanOnSelection:R,defaultViewport:O,translateExtent:D,minZoom:M,maxZoom:z,preventScrolling:T,onSelectionContextMenu:E,noWheelClassName:A,noPanClassName:P,disableKeyboardA11y:I,onViewportChange:C,isControlledViewport:L}){const{nodesSelectionActive:F,userSelectionActive:V}=he(vW,Oe),H=Ka(u,{target:Iw}),U=Ka(x,{target:Iw}),W=U||N,G=U||b,Y=d&&W!==!0,K=H||V||Y;return qH({deleteKeyCode:c,multiSelectionKeyCode:g}),a.jsx(QH,{onPaneContextMenu:i,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:G,panOnScrollSpeed:j,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:!H&&W,defaultViewport:O,translateExtent:D,minZoom:M,maxZoom:z,zoomActivationKeyCode:_,preventScrolling:T,noWheelClassName:A,noPanClassName:P,onViewportChange:C,isControlledViewport:L,paneClickDistance:l,selectionOnDrag:Y,children:a.jsxs(tW,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:W,autoPanOnSelection:R,isSelecting:!!K,selectionMode:f,selectionKeyPressed:H,paneClickDistance:l,selectionOnDrag:Y,children:[e,F&&a.jsx(gW,{onSelectionContextMenu:E,noPanClassName:P,disableKeyboardA11y:I})]})})}QC.displayName="FlowRenderer";const yW=w.memo(QC),xW=e=>t=>e?Gv(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function _W(e){return he(w.useCallback(xW(e),[e]),Oe)}const wW=e=>e.updateNodeInternals;function bW(){const e=he(wW),[t]=w.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return w.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function jW({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Ce(),i=w.useRef(null),o=w.useRef(null),l=w.useRef(e.sourcePosition),c=w.useRef(e.targetPosition),u=w.useRef(t),d=n&&!!e.internals.handleBounds;return w.useEffect(()=>{i.current&&!e.hidden&&(!d||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[d,e.hidden]),w.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),w.useEffect(()=>{if(i.current){const f=u.current!==t,h=l.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function SW({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:g,rfId:x,nodeTypes:_,nodeClickDistance:v,onError:y}){const{node:m,internals:b,isParent:j}=he(K=>{const X=K.nodeLookup.get(e),re=K.parentLookup.has(e);return{node:X,internals:X.internals,isParent:re}},Oe);let k=m.type||"default",S=(_==null?void 0:_[k])||Rw[k];S===void 0&&(y==null||y("003",jn.error003(k)),k="default",S=(_==null?void 0:_.default)||Rw.default);const N=!!(m.draggable||l&&typeof m.draggable>"u"),R=!!(m.selectable||c&&typeof m.selectable>"u"),O=!!(m.connectable||u&&typeof m.connectable>"u"),D=!!(m.focusable||d&&typeof m.focusable>"u"),M=Ce(),z=gC(m),T=jW({node:m,nodeType:k,hasDimensions:z,resizeObserver:f}),E=GC({nodeRef:T,disabled:m.hidden||!N,noDragClassName:h,handleSelector:m.dragHandle,nodeId:e,isSelectable:R,nodeClickDistance:v}),A=qC();if(m.hidden)return null;const P=Wn(m),I=pW(m),C=R||N||t||n||r||s,L=n?K=>n(K,{...b.userNode}):void 0,F=r?K=>r(K,{...b.userNode}):void 0,V=s?K=>s(K,{...b.userNode}):void 0,H=i?K=>i(K,{...b.userNode}):void 0,U=o?K=>o(K,{...b.userNode}):void 0,W=K=>{const{selectNodesOnDrag:X,nodeDragThreshold:re}=M.getState();R&&(!X||!N||re>0)&&xm({id:e,store:M,nodeRef:T}),t&&t(K,{...b.userNode})},G=K=>{if(!(xC(K.nativeEvent)||g)){if(oC.includes(K.key)&&R){const X=K.key==="Escape";xm({id:e,store:M,unselect:X,nodeRef:T})}else if(N&&m.selected&&Object.prototype.hasOwnProperty.call(Hu,K.key)){K.preventDefault();const{ariaLabelConfig:X}=M.getState();M.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:K.key.replace("Arrow","").toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),A({direction:Hu[K.key],factor:K.shiftKey?4:1})}}},Y=()=>{var se;if(g||!((se=T.current)!=null&&se.matches(":focus-visible")))return;const{transform:K,width:X,height:re,autoPanOnNodeFocus:te,setCenter:Z}=M.getState();if(!te)return;Gv(new Map([[e,m]]),{x:0,y:0,width:X,height:re},K,!0).length>0||Z(m.position.x+P.width/2,m.position.y+P.height/2,{zoom:K[2]})};return a.jsx("div",{className:He(["react-flow__node",`react-flow__node-${k}`,{[p]:N},m.className,{selected:m.selected,selectable:R,parent:j,draggable:N,dragging:E}]),ref:T,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:C?"all":"none",visibility:z?"visible":"hidden",...m.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:F,onMouseLeave:V,onContextMenu:H,onClick:W,onDoubleClick:U,onKeyDown:D?G:void 0,tabIndex:D?0:void 0,onFocus:D?Y:void 0,role:m.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${FC}-${x}`,"aria-label":m.ariaLabel,...m.domAttributes,children:a.jsx(rW,{value:e,children:a.jsx(S,{id:e,data:m.data,type:k,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:m.selected??!1,selectable:R,draggable:N,deletable:m.deletable??!0,isConnectable:O,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:E,dragHandle:m.dragHandle,zIndex:b.z,parentId:m.parentId,...P})})})}var kW=w.memo(SW);const NW=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ZC(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:s}=he(NW,Oe),i=_W(e.onlyRenderVisibleElements),o=bW();return a.jsx("div",{className:"react-flow__nodes",style:Hd,children:i.map(l=>a.jsx(kW,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}ZC.displayName="NodeRenderer";const EW=w.memo(ZC);function CW(e){return he(w.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&vU({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),Oe)}const TW=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},PW=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Mw={[Vu.Arrow]:TW,[Vu.ArrowClosed]:PW};function AW(e){const t=Ce();return w.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(Mw,e)?Mw[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",jn.error009(e)),null)},[e])}const RW=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=AW(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},JC=({defaultColor:e,rfId:t})=>{const n=he(i=>i.edges),r=he(i=>i.defaultEdgeOptions),s=w.useMemo(()=>kU(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:s.map(i=>a.jsx(RW,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};JC.displayName="MarkerDefinitions";var IW=w.memo(JC);function eT({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=w.useState({x:1,y:0,width:0,height:0}),p=He(["react-flow__edge-textwrapper",u]),g=w.useRef(null);return w.useEffect(()=>{if(g.current){const x=g.current.getBBox();h({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&a.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}eT.displayName="EdgeText";const MW=w.memo(eT);function Wd({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...d,d:e,fill:"none",className:He(["react-flow__edge-path",d.className])}),u?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&pn(t)&&pn(n)?a.jsx(MW,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function Ow({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===ne.Left||e===ne.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function tT({sourceX:e,sourceY:t,sourcePosition:n=ne.Bottom,targetX:r,targetY:s,targetPosition:i=ne.Top}){const[o,l]=Ow({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=Ow({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=wC({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${l} ${c},${u} ${r},${s}`,d,f,h,p]}function nT(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:_,interactionWidth:v})=>{const[y,m,b]=tT({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l}),j=e.isInternal?void 0:t;return a.jsx(Wd,{id:j,path:y,labelX:m,labelY:b,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:_,interactionWidth:v})})}const OW=nT({isInternal:!1}),rT=nT({isInternal:!0});OW.displayName="SimpleBezierEdge";rT.displayName="SimpleBezierEdgeInternal";function sT(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=ne.Bottom,targetPosition:g=ne.Top,markerEnd:x,markerStart:_,pathOptions:v,interactionWidth:y})=>{const[m,b,j]=mm({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:g,borderRadius:v==null?void 0:v.borderRadius,offset:v==null?void 0:v.offset,stepPosition:v==null?void 0:v.stepPosition}),k=e.isInternal?void 0:t;return a.jsx(Wd,{id:k,path:m,labelX:b,labelY:j,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:x,markerStart:_,interactionWidth:y})})}const iT=sT({isInternal:!1}),oT=sT({isInternal:!0});iT.displayName="SmoothStepEdge";oT.displayName="SmoothStepEdgeInternal";function aT(e){return w.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return a.jsx(iT,{...n,id:r,pathOptions:w.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const LW=aT({isInternal:!1}),lT=aT({isInternal:!0});LW.displayName="StepEdge";lT.displayName="StepEdgeInternal";function cT(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:x})=>{const[_,v,y]=SC({sourceX:n,sourceY:r,targetX:s,targetY:i}),m=e.isInternal?void 0:t;return a.jsx(Wd,{id:m,path:_,labelX:v,labelY:y,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:x})})}const $W=cT({isInternal:!1}),uT=cT({isInternal:!0});$W.displayName="StraightEdge";uT.displayName="StraightEdgeInternal";function dT(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=ne.Bottom,targetPosition:l=ne.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:_,pathOptions:v,interactionWidth:y})=>{const[m,b,j]=bC({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l,curvature:v==null?void 0:v.curvature}),k=e.isInternal?void 0:t;return a.jsx(Wd,{id:k,path:m,labelX:b,labelY:j,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:_,interactionWidth:y})})}const DW=dT({isInternal:!1}),fT=dT({isInternal:!0});DW.displayName="BezierEdge";fT.displayName="BezierEdgeInternal";const Lw={default:fT,straight:uT,step:lT,smoothstep:oT,simplebezier:rT},$w={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},zW=(e,t,n)=>n===ne.Left?e-t:n===ne.Right?e+t:e,FW=(e,t,n)=>n===ne.Top?e-t:n===ne.Bottom?e+t:e,Dw="react-flow__edgeupdater";function zw({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:He([Dw,`${Dw}-${l}`]),cx:zW(t,r,e),cy:FW(n,r,e),r,stroke:"transparent",fill:"transparent"})}function VW({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=Ce(),x=(b,j)=>{if(b.button!==0)return;const{autoPanOnConnect:k,domNode:S,connectionMode:N,connectionRadius:R,lib:O,onConnectStart:D,cancelConnection:M,nodeLookup:z,rfId:T,panBy:E,updateConnection:A}=g.getState(),P=j.type==="target",I=(F,V)=>{h(!1),f==null||f(F,n,j.type,V)},C=F=>u==null?void 0:u(n,F),L=(F,V)=>{h(!0),d==null||d(b,n,j.type),D==null||D(F,V)};ym.onPointerDown(b.nativeEvent,{autoPanOnConnect:k,connectionMode:N,connectionRadius:R,domNode:S,handleId:j.id,nodeId:j.nodeId,nodeLookup:z,isTarget:P,edgeUpdaterType:j.type,lib:O,flowId:T,cancelConnection:M,panBy:E,isValidConnection:(...F)=>{var V,H;return((H=(V=g.getState()).isValidConnection)==null?void 0:H.call(V,...F))??!0},onConnect:C,onConnectStart:L,onConnectEnd:(...F)=>{var V,H;return(H=(V=g.getState()).onConnectEnd)==null?void 0:H.call(V,...F)},onReconnectEnd:I,updateConnection:A,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:b.currentTarget})},_=b=>x(b,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),v=b=>x(b,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),y=()=>p(!0),m=()=>p(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(zw,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:_,onMouseEnter:y,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&a.jsx(zw,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:v,onMouseEnter:y,onMouseOut:m,type:"target"})]})}function BW({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:g,edgeTypes:x,noPanClassName:_,onError:v,disableKeyboardA11y:y}){let m=he(Z=>Z.edgeLookup.get(e));const b=he(Z=>Z.defaultEdgeOptions);m=b?{...b,...m}:m;let j=m.type||"default",k=(x==null?void 0:x[j])||Lw[j];k===void 0&&(v==null||v("011",jn.error011(j)),j="default",k=(x==null?void 0:x.default)||Lw.default);const S=!!(m.focusable||t&&typeof m.focusable>"u"),N=typeof f<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),R=!!(m.selectable||r&&typeof m.selectable>"u"),O=w.useRef(null),[D,M]=w.useState(!1),[z,T]=w.useState(!1),E=Ce(),{zIndex:A=m.zIndex,sourceX:P,sourceY:I,targetX:C,targetY:L,sourcePosition:F,targetPosition:V}=he(w.useCallback(Z=>{const ee=Z.nodeLookup.get(m.source),se=Z.nodeLookup.get(m.target);if(!ee||!se)return $w;const pe=SU({id:e,sourceNode:ee,targetNode:se,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:Z.connectionMode,onError:v}),ve=gU({selected:m.selected,zIndex:m.zIndex,sourceNode:ee,targetNode:se,elevateOnSelect:Z.elevateEdgesOnSelect,zIndexMode:Z.zIndexMode});return{...pe||$w,zIndex:ve}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),Oe),H=w.useMemo(()=>m.markerStart?`url('#${gm(m.markerStart,g)}')`:void 0,[m.markerStart,g]),U=w.useMemo(()=>m.markerEnd?`url('#${gm(m.markerEnd,g)}')`:void 0,[m.markerEnd,g]);if(m.hidden||P===null||I===null||C===null||L===null)return null;const W=Z=>{var ve;const{addSelectedEdges:ee,unselectNodesAndEdges:se,multiSelectionActive:pe}=E.getState();R&&(E.setState({nodesSelectionActive:!1}),m.selected&&pe?(se({nodes:[],edges:[m]}),(ve=O.current)==null||ve.blur()):ee([e])),s&&s(Z,m)},G=i?Z=>{i(Z,{...m})}:void 0,Y=o?Z=>{o(Z,{...m})}:void 0,K=l?Z=>{l(Z,{...m})}:void 0,X=c?Z=>{c(Z,{...m})}:void 0,re=u?Z=>{u(Z,{...m})}:void 0,te=Z=>{var ee;if(!y&&oC.includes(Z.key)&&R){const{unselectNodesAndEdges:se,addSelectedEdges:pe}=E.getState();Z.key==="Escape"?((ee=O.current)==null||ee.blur(),se({edges:[m]})):pe([e])}};return a.jsx("svg",{style:{zIndex:A},children:a.jsxs("g",{className:He(["react-flow__edge",`react-flow__edge-${j}`,m.className,_,{selected:m.selected,animated:m.animated,inactive:!R&&!s,updating:D,selectable:R}]),onClick:W,onDoubleClick:G,onContextMenu:Y,onMouseEnter:K,onMouseMove:X,onMouseLeave:re,onKeyDown:S?te:void 0,tabIndex:S?0:void 0,role:m.ariaRole??(S?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":m.ariaLabel===null?void 0:m.ariaLabel||`Edge from ${m.source} to ${m.target}`,"aria-describedby":S?`${VC}-${g}`:void 0,ref:O,...m.domAttributes,children:[!z&&a.jsx(k,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:R,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:P,sourceY:I,targetX:C,targetY:L,sourcePosition:F,targetPosition:V,data:m.data,style:m.style,sourceHandleId:m.sourceHandle,targetHandleId:m.targetHandle,markerStart:H,markerEnd:U,pathOptions:"pathOptions"in m?m.pathOptions:void 0,interactionWidth:m.interactionWidth}),N&&a.jsx(VW,{edge:m,isReconnectable:N,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:P,sourceY:I,targetX:C,targetY:L,sourcePosition:F,targetPosition:V,setUpdateHover:M,setReconnecting:T})]})})}var UW=w.memo(BW);const HW=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function hT({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:g,disableKeyboardA11y:x}){const{edgesFocusable:_,edgesReconnectable:v,elementsSelectable:y,onError:m}=he(HW,Oe),b=CW(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(IW,{defaultColor:e,rfId:n}),b.map(j=>a.jsx(UW,{id:j,edgesFocusable:_,edgesReconnectable:v,elementsSelectable:y,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:g,rfId:n,onError:m,edgeTypes:r,disableKeyboardA11y:x},j))]})}hT.displayName="EdgeRenderer";const WW=w.memo(hT),Fw=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function KW({children:e}){const t=Ce(),n=w.useRef(null),[r]=w.useState(()=>t.getState().transform);return WC(()=>{let s=null;const i=()=>{const o=t.getState().transform;s&&o[0]===s[0]&&o[1]===s[1]&&o[2]===s[2]||(s=o,n.current&&(n.current.style.transform=Fw(o)))};return i(),t.subscribe(i)},[t]),a.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Fw(r)},children:e})}function GW(e){const t=ny(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const qW=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function YW(e){const t=he(qW),n=Ce();return w.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function XW(e){return e.connection.inProgress?{...e.connection,to:yl(e.connection.to,e.transform)}:{...e.connection}}function QW(e){return XW}function ZW(e){const t=QW();return he(t,Oe)}const JW=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function e7({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:l,inProgress:c}=he(JW,Oe);return!(i&&s&&c)?null:a.jsx("svg",{style:e,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:He(["react-flow__connection",cC(l)]),children:a.jsx(pT,{style:t,type:n,CustomComponent:r,isValid:l})})})}const pT=({style:e,type:t=Mr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=ZW();if(!s)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:cC(r),toNode:d,toHandle:f,pointer:p});let g="";const x={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Mr.Bezier:[g]=bC(x);break;case Mr.SimpleBezier:[g]=tT(x);break;case Mr.Step:[g]=mm({...x,borderRadius:0});break;case Mr.SmoothStep:[g]=mm(x);break;default:[g]=SC(x)}return a.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};pT.displayName="ConnectionLine";const t7={};function Vw(e=t7){w.useRef(e),Ce(),w.useEffect(()=>{},[e])}function n7(){Ce(),w.useRef(!1),w.useEffect(()=>{},[])}function mT({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:g,connectionLineStyle:x,connectionLineComponent:_,connectionLineContainerStyle:v,selectionKeyCode:y,selectionOnDrag:m,selectionMode:b,multiSelectionKeyCode:j,panActivationKeyCode:k,zoomActivationKeyCode:S,deleteKeyCode:N,onlyRenderVisibleElements:R,elementsSelectable:O,defaultViewport:D,translateExtent:M,minZoom:z,maxZoom:T,preventScrolling:E,defaultMarkerColor:A,zoomOnScroll:P,zoomOnPinch:I,panOnScroll:C,panOnScrollSpeed:L,panOnScrollMode:F,zoomOnDoubleClick:V,panOnDrag:H,autoPanOnSelection:U,onPaneClick:W,onPaneMouseEnter:G,onPaneMouseMove:Y,onPaneMouseLeave:K,onPaneScroll:X,onPaneContextMenu:re,paneClickDistance:te,nodeClickDistance:Z,onEdgeContextMenu:ee,onEdgeMouseEnter:se,onEdgeMouseMove:pe,onEdgeMouseLeave:ve,reconnectRadius:Le,onReconnect:Ft,onReconnectStart:Nn,onReconnectEnd:En,noDragClassName:Kn,noWheelClassName:go,noPanClassName:rs,disableKeyboardA11y:ss,nodeExtent:sn,rfId:Gn,viewport:qn,onViewportChange:is,nodesDraggable:qd}){return Vw(e),Vw(t),n7(),GW(n),YW(qn),a.jsx(yW,{onPaneClick:W,onPaneMouseEnter:G,onPaneMouseMove:Y,onPaneMouseLeave:K,onPaneContextMenu:re,onPaneScroll:X,paneClickDistance:te,deleteKeyCode:N,selectionKeyCode:y,selectionOnDrag:m,selectionMode:b,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:O,zoomOnScroll:P,zoomOnPinch:I,zoomOnDoubleClick:V,panOnScroll:C,panOnScrollSpeed:L,panOnScrollMode:F,panOnDrag:H,autoPanOnSelection:U,defaultViewport:D,translateExtent:M,minZoom:z,maxZoom:T,onSelectionContextMenu:f,preventScrolling:E,noDragClassName:Kn,noWheelClassName:go,noPanClassName:rs,disableKeyboardA11y:ss,onViewportChange:is,isControlledViewport:!!qn,children:a.jsxs(KW,{children:[a.jsx(WW,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:Ft,onReconnectStart:Nn,onReconnectEnd:En,onlyRenderVisibleElements:R,onEdgeContextMenu:ee,onEdgeMouseEnter:se,onEdgeMouseMove:pe,onEdgeMouseLeave:ve,reconnectRadius:Le,defaultMarkerColor:A,noPanClassName:rs,disableKeyboardA11y:ss,rfId:Gn}),a.jsx(e7,{style:x,type:g,component:_,containerStyle:v}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(EW,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Z,onlyRenderVisibleElements:R,noPanClassName:rs,noDragClassName:Kn,disableKeyboardA11y:ss,nodeExtent:sn,rfId:Gn,nodesDraggable:qd}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}mT.displayName="GraphView";const r7=w.memo(mT),s7=mC(),Bw=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,g=new Map,x=new Map,_=new Map,v=r??t??[],y=n??e??[],m=d??[0,0],b=f??Ba;EC(x,_,v);const{nodesInitialized:j}=vm(y,p,g,{nodeOrigin:m,nodeExtent:b,zIndexMode:h});let k=[0,0,1];if(o&&s&&i){const S=gl(p,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:N,y:R,zoom:O}=Yv(S,s,i,c,u,(l==null?void 0:l.padding)??.1);k=[N,R,O]}return{rfId:"1",width:s??0,height:i??0,transform:k,nodes:y,nodesInitialized:j,nodeLookup:p,parentLookup:g,edges:v,edgeLookup:_,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Ba,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Qi.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:m,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...lC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:s7,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:aC,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},i7=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>vH((p,g)=>{async function x(){const{nodeLookup:_,panZoom:v,fitViewOptions:y,fitViewResolver:m,width:b,height:j,minZoom:k,maxZoom:S}=g();v&&(await cU({nodes:_,width:b,height:j,panZoom:v,minZoom:k,maxZoom:S},y),m==null||m.resolve(!0),p({fitViewResolver:null}))}return{...Bw({nodes:e,edges:t,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:_=>{const{nodeLookup:v,parentLookup:y,nodeOrigin:m,elevateNodesOnSelect:b,fitViewQueued:j,zIndexMode:k,nodesSelectionActive:S}=g(),{nodesInitialized:N,hasSelectedNodes:R}=vm(_,v,y,{nodeOrigin:m,nodeExtent:f,elevateNodesOnSelect:b,checkEquality:!0,zIndexMode:k}),O=S&&R;j&&N?(x(),p({nodes:_,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:O})):p({nodes:_,nodesInitialized:N,nodesSelectionActive:O})},setEdges:_=>{const{connectionLookup:v,edgeLookup:y}=g();EC(v,y,_),p({edges:_})},setDefaultNodesAndEdges:(_,v)=>{if(_){const{setNodes:y}=g();y(_),p({hasDefaultNodes:!0})}if(v){const{setEdges:y}=g();y(v),p({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:v,nodeLookup:y,parentLookup:m,domNode:b,nodeOrigin:j,nodeExtent:k,debug:S,fitViewQueued:N,zIndexMode:R}=g(),{changes:O,updatedInternals:D}=RU(_,y,m,b,j,k,R);D&&(CU(y,m,{nodeOrigin:j,nodeExtent:k,zIndexMode:R}),N?(x(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(O==null?void 0:O.length)>0&&(S&&console.log("React Flow: trigger node changes",O),v==null||v(O)))},updateNodePositions:(_,v=!1)=>{const y=[];let m=[];const{nodeLookup:b,triggerNodeChanges:j,connection:k,updateConnection:S,onNodesChangeMiddlewareMap:N}=g();for(const[R,O]of _){const D=b.get(R),M=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(O!=null&&O.position)),z={id:R,type:"position",position:M?{x:Math.max(0,O.position.x),y:Math.max(0,O.position.y)}:O.position,dragging:v};if(D&&k.inProgress&&k.fromNode.id===D.id){const T=Vs(D,k.fromHandle,ne.Left,!0);S({...k,from:T})}M&&D.parentId&&y.push({id:R,parentId:D.parentId,rect:{...O.internals.positionAbsolute,width:O.measured.width??0,height:O.measured.height??0}}),m.push(z)}if(y.length>0){const{parentLookup:R,nodeOrigin:O}=g(),D=ty(y,b,R,O);m.push(...D)}for(const R of N.values())m=R(m);j(m)},triggerNodeChanges:_=>{const{onNodesChange:v,setNodes:y,nodes:m,hasDefaultNodes:b,debug:j}=g();if(_!=null&&_.length){if(b){const k=DH(_,m);y(k)}j&&console.log("React Flow: trigger node changes",_),v==null||v(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:v,setEdges:y,edges:m,hasDefaultEdges:b,debug:j}=g();if(_!=null&&_.length){if(b){const k=zH(_,m);y(k)}j&&console.log("React Flow: trigger edge changes",_),v==null||v(_)}},addSelectedNodes:_=>{const{multiSelectionActive:v,edgeLookup:y,nodeLookup:m,triggerNodeChanges:b,triggerEdgeChanges:j}=g();if(v){const k=_.map(S=>ps(S,!0));b(k);return}b(bi(m,new Set([..._]),!0)),j(bi(y))},addSelectedEdges:_=>{const{multiSelectionActive:v,edgeLookup:y,nodeLookup:m,triggerNodeChanges:b,triggerEdgeChanges:j}=g();if(v){const k=_.map(S=>ps(S,!0));j(k);return}j(bi(y,new Set([..._]))),b(bi(m,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:v}={})=>{const{edges:y,nodes:m,nodeLookup:b,triggerNodeChanges:j,triggerEdgeChanges:k}=g(),S=_||m,N=v||y,R=[];for(const D of S){if(!D.selected)continue;const M=b.get(D.id);M&&(M.selected=!1),R.push(ps(D.id,!1))}const O=[];for(const D of N)D.selected&&O.push(ps(D.id,!1));j(R),k(O)},setMinZoom:_=>{const{panZoom:v,maxZoom:y}=g();v==null||v.setScaleExtent([_,y]),p({minZoom:_})},setMaxZoom:_=>{const{panZoom:v,minZoom:y}=g();v==null||v.setScaleExtent([y,_]),p({maxZoom:_})},setTranslateExtent:_=>{var v;(v=g().panZoom)==null||v.setTranslateExtent(_),p({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:v,triggerNodeChanges:y,triggerEdgeChanges:m,elementsSelectable:b}=g();if(!b)return;const j=v.reduce((S,N)=>N.selected?[...S,ps(N.id,!1)]:S,[]),k=_.reduce((S,N)=>N.selected?[...S,ps(N.id,!1)]:S,[]);y(j),m(k)},setNodeExtent:_=>{const{nodes:v,nodeLookup:y,parentLookup:m,nodeOrigin:b,elevateNodesOnSelect:j,nodeExtent:k,zIndexMode:S}=g();_[0][0]===k[0][0]&&_[0][1]===k[0][1]&&_[1][0]===k[1][0]&&_[1][1]===k[1][1]||(vm(v,y,m,{nodeOrigin:b,nodeExtent:_,elevateNodesOnSelect:j,checkEquality:!1,zIndexMode:S}),p({nodeExtent:_}))},panBy:_=>{const{transform:v,width:y,height:m,panZoom:b,translateExtent:j}=g();return IU({delta:_,panZoom:b,transform:v,translateExtent:j,width:y,height:m})},setCenter:async(_,v,y)=>{const{width:m,height:b,maxZoom:j,panZoom:k}=g();if(!k)return!1;const S=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:j;return await k.setViewport({x:m/2-_*S,y:b/2-v*S,zoom:S},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),!0},cancelConnection:()=>{p({connection:{...lC}})},updateConnection:_=>{p({connection:_})},reset:()=>p({...Bw()})}},Object.is);function o7({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[g]=w.useState(()=>i7({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return a.jsx(yH,{value:g,children:a.jsx(HH,{children:a.jsx(iW,{children:p})})})}function a7({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return w.useContext(Bd)?a.jsx(a.Fragment,{children:e}):a.jsx(o7,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const l7={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function c7({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:g,onConnectEnd:x,onClickConnectStart:_,onClickConnectEnd:v,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:b,onNodeContextMenu:j,onNodeDoubleClick:k,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:R,onNodesDelete:O,onEdgesDelete:D,onDelete:M,onSelectionChange:z,onSelectionDragStart:T,onSelectionDrag:E,onSelectionDragStop:A,onSelectionContextMenu:P,onSelectionStart:I,onSelectionEnd:C,onBeforeDelete:L,connectionMode:F,connectionLineType:V=Mr.Bezier,connectionLineStyle:H,connectionLineComponent:U,connectionLineContainerStyle:W,deleteKeyCode:G="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:K=!1,selectionMode:X=Ua.Full,panActivationKeyCode:re="Space",multiSelectionKeyCode:te=Wa()?"Meta":"Control",zoomActivationKeyCode:Z=Wa()?"Meta":"Control",snapToGrid:ee,snapGrid:se,onlyRenderVisibleElements:pe=!1,selectNodesOnDrag:ve,nodesDraggable:Le,autoPanOnNodeFocus:Ft,nodesConnectable:Nn,nodesFocusable:En,nodeOrigin:Kn=BC,edgesFocusable:go,edgesReconnectable:rs,elementsSelectable:ss=!0,defaultViewport:sn=AH,minZoom:Gn=.5,maxZoom:qn=2,translateExtent:is=Ba,preventScrolling:qd=!0,nodeExtent:Yd,defaultMarkerColor:ZT="#b1b1b7",zoomOnScroll:JT=!0,zoomOnPinch:eP=!0,panOnScroll:tP=!1,panOnScrollSpeed:nP=.5,panOnScrollMode:rP=Ns.Free,zoomOnDoubleClick:sP=!0,panOnDrag:iP=!0,onPaneClick:oP,onPaneMouseEnter:aP,onPaneMouseMove:lP,onPaneMouseLeave:cP,onPaneScroll:uP,onPaneContextMenu:dP,paneClickDistance:fP=1,nodeClickDistance:hP=0,children:pP,onReconnect:mP,onReconnectStart:gP,onReconnectEnd:vP,onEdgeContextMenu:yP,onEdgeDoubleClick:xP,onEdgeMouseEnter:_P,onEdgeMouseMove:wP,onEdgeMouseLeave:bP,reconnectRadius:jP=10,onNodesChange:SP,onEdgesChange:kP,noDragClassName:NP="nodrag",noWheelClassName:EP="nowheel",noPanClassName:fy="nopan",fitView:hy,fitViewOptions:py,connectOnClick:CP,attributionPosition:TP,proOptions:PP,defaultEdgeOptions:AP,elevateNodesOnSelect:RP=!0,elevateEdgesOnSelect:IP=!1,disableKeyboardA11y:my=!1,autoPanOnConnect:MP,autoPanOnNodeDrag:OP,autoPanOnSelection:LP=!0,autoPanSpeed:$P,connectionRadius:DP,isValidConnection:zP,onError:FP,style:VP,id:gy,nodeDragThreshold:BP,connectionDragThreshold:UP,viewport:HP,onViewportChange:WP,width:KP,height:GP,colorMode:qP="light",debug:YP,onScroll:_l,ariaLabelConfig:XP,zIndexMode:vy="basic",...QP},ZP){const Xd=gy||"1",JP=OH(qP),eA=w.useCallback(yy=>{yy.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),_l==null||_l(yy)},[_l]);return a.jsx("div",{"data-testid":"rf__wrapper",...QP,onScroll:eA,style:{...VP,...l7},ref:ZP,className:He(["react-flow",s,JP]),id:gy,role:"application",children:a.jsxs(a7,{nodes:e,edges:t,width:KP,height:GP,fitView:hy,fitViewOptions:py,minZoom:Gn,maxZoom:qn,nodeOrigin:Kn,nodeExtent:Yd,zIndexMode:vy,children:[a.jsx(MH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:g,onConnectEnd:x,onClickConnectStart:_,onClickConnectEnd:v,nodesDraggable:Le,autoPanOnNodeFocus:Ft,nodesConnectable:Nn,nodesFocusable:En,edgesFocusable:go,edgesReconnectable:rs,elementsSelectable:ss,elevateNodesOnSelect:RP,elevateEdgesOnSelect:IP,minZoom:Gn,maxZoom:qn,nodeExtent:Yd,onNodesChange:SP,onEdgesChange:kP,snapToGrid:ee,snapGrid:se,connectionMode:F,translateExtent:is,connectOnClick:CP,defaultEdgeOptions:AP,fitView:hy,fitViewOptions:py,onNodesDelete:O,onEdgesDelete:D,onDelete:M,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:R,onSelectionDrag:E,onSelectionDragStart:T,onSelectionDragStop:A,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:fy,nodeOrigin:Kn,rfId:Xd,autoPanOnConnect:MP,autoPanOnNodeDrag:OP,autoPanSpeed:$P,onError:FP,connectionRadius:DP,isValidConnection:zP,selectNodesOnDrag:ve,nodeDragThreshold:BP,connectionDragThreshold:UP,onBeforeDelete:L,debug:YP,ariaLabelConfig:XP,zIndexMode:vy}),a.jsx(r7,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:b,onNodeContextMenu:j,onNodeDoubleClick:k,nodeTypes:i,edgeTypes:o,connectionLineType:V,connectionLineStyle:H,connectionLineComponent:U,connectionLineContainerStyle:W,selectionKeyCode:Y,selectionOnDrag:K,selectionMode:X,deleteKeyCode:G,multiSelectionKeyCode:te,panActivationKeyCode:re,zoomActivationKeyCode:Z,onlyRenderVisibleElements:pe,defaultViewport:sn,translateExtent:is,minZoom:Gn,maxZoom:qn,preventScrolling:qd,zoomOnScroll:JT,zoomOnPinch:eP,zoomOnDoubleClick:sP,panOnScroll:tP,panOnScrollSpeed:nP,panOnScrollMode:rP,panOnDrag:iP,autoPanOnSelection:LP,onPaneClick:oP,onPaneMouseEnter:aP,onPaneMouseMove:lP,onPaneMouseLeave:cP,onPaneScroll:uP,onPaneContextMenu:dP,paneClickDistance:fP,nodeClickDistance:hP,onSelectionContextMenu:P,onSelectionStart:I,onSelectionEnd:C,onReconnect:mP,onReconnectStart:gP,onReconnectEnd:vP,onEdgeContextMenu:yP,onEdgeDoubleClick:xP,onEdgeMouseEnter:_P,onEdgeMouseMove:wP,onEdgeMouseLeave:bP,reconnectRadius:jP,defaultMarkerColor:ZT,noDragClassName:NP,noWheelClassName:EP,noPanClassName:fy,rfId:Xd,disableKeyboardA11y:my,nodeExtent:Yd,viewport:HP,onViewportChange:WP,nodesDraggable:Le}),a.jsx(PH,{onSelectionChange:z}),pP,a.jsx(kH,{proOptions:PP,position:TP}),a.jsx(SH,{rfId:Xd,disableKeyboardA11y:my})]})})}var u7=HC(c7);function d7({dimensions:e,lineWidth:t,variant:n,className:r}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:He(["react-flow__background-pattern",n,r])})}function f7({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:He(["react-flow__background-pattern","dots",t])})}var fr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(fr||(fr={}));const h7={[fr.Dots]:1,[fr.Lines]:1,[fr.Cross]:6},p7=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function gT({id:e,variant:t=fr.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:l,style:c,className:u,patternClassName:d}){const f=w.useRef(null),{transform:h,patternId:p}=he(p7,Oe),g=r||h7[t],x=t===fr.Dots,_=t===fr.Cross,v=Array.isArray(n)?n:[n,n],y=[v[0]*h[2]||1,v[1]*h[2]||1],m=g*h[2],b=Array.isArray(i)?i:[i,i],j=_?[m,m]:y,k=[b[0]*h[2]||1+j[0]/2,b[1]*h[2]||1+j[1]/2],S=`${p}${e||""}`;return a.jsxs("svg",{className:He(["react-flow__background",u]),style:{...c,...Hd,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[a.jsx("pattern",{id:S,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:x?a.jsx(f7,{radius:m/2,className:d}):a.jsx(d7,{dimensions:j,lineWidth:s,variant:t,className:d})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${S})`})]})}gT.displayName="Background";const m7=w.memo(gT);function g7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function v7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function y7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function x7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function _7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function nc({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:He(["react-flow__controls-button",t]),...n,children:e})}const w7=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function vT({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const g=Ce(),{isInteractive:x,minZoomReached:_,maxZoomReached:v,ariaLabelConfig:y}=he(w7,Oe),{zoomIn:m,zoomOut:b,fitView:j}=ny(),k=()=>{m(),i==null||i()},S=()=>{b(),o==null||o()},N=()=>{j(s),l==null||l()},R=()=>{g.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),c==null||c(!x)},O=h==="horizontal"?"horizontal":"vertical";return a.jsxs(Ud,{className:He(["react-flow__controls",O,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??y["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(nc,{onClick:k,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:v,children:a.jsx(g7,{})}),a.jsx(nc,{onClick:S,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:_,children:a.jsx(v7,{})})]}),n&&a.jsx(nc,{className:"react-flow__controls-fitview",onClick:N,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:a.jsx(y7,{})}),r&&a.jsx(nc,{className:"react-flow__controls-interactive",onClick:R,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:x?a.jsx(_7,{}):a.jsx(x7,{})}),d]})}vT.displayName="Controls";const b7=w.memo(vT);function j7({id:e,x:t,y:n,width:r,height:s,style:i,color:o,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:g,backgroundColor:x}=i||{},_=o||g||x;return a.jsx("rect",{className:He(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:_,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?v=>p(v,e):void 0})}const S7=w.memo(j7),k7=e=>e.nodes.map(t=>t.id),oh=e=>e instanceof Function?e:()=>e;function N7({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=S7,onClick:o}){const l=he(k7,Oe),c=oh(t),u=oh(e),d=oh(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(h=>a.jsx(C7,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:f},h))})}function E7({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=he(g=>{const x=g.nodeLookup.get(e);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const _=x.internals.userNode,{x:v,y}=x.internals.positionAbsolute,{width:m,height:b}=Wn(_);return{node:_,x:v,y,width:m,height:b}},Oe);return!u||u.hidden||!gC(u)?null:a.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:o,onClick:c,id:u.id})}const C7=w.memo(E7);var T7=w.memo(N7);const P7=200,A7=150,R7=e=>!e.hidden,I7=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?hC(gl(e.nodeLookup,{filter:R7}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Uw=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,M7=(e,t)=>Uw(e.viewBB,t.viewBB)&&Uw(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,O7="react-flow__minimap-desc";function yT({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:g,pannable:x=!1,zoomable:_=!1,ariaLabel:v,inversePan:y,zoomStep:m=1,offsetScale:b=5}){const j=Ce(),k=w.useRef(null),{boundingRect:S,viewBB:N,rfId:R,panZoom:O,translateExtent:D,flowWidth:M,flowHeight:z,ariaLabelConfig:T}=he(I7,M7),E=(e==null?void 0:e.width)??P7,A=(e==null?void 0:e.height)??A7,P=S.width/E,I=S.height/A,C=Math.max(P,I),L=C*E,F=C*A,V=b*C,H=S.x-(L-S.width)/2-V,U=S.y-(F-S.height)/2-V,W=L+V*2,G=F+V*2,Y=`${O7}-${R}`,K=w.useRef(0),X=w.useRef();K.current=C,w.useEffect(()=>{if(k.current&&O)return X.current=BU({domNode:k.current,panZoom:O,getTransform:()=>j.getState().transform,getViewScale:()=>K.current}),()=>{var ee;(ee=X.current)==null||ee.destroy()}},[O]),w.useEffect(()=>{var ee;(ee=X.current)==null||ee.update({translateExtent:D,width:M,height:z,inversePan:y,pannable:x,zoomStep:m,zoomable:_})},[x,_,y,m,D,M,z]);const re=p?ee=>{var ve;const[se,pe]=((ve=X.current)==null?void 0:ve.pointer(ee))||[0,0];p(ee,{x:se,y:pe})}:void 0,te=g?w.useCallback((ee,se)=>{const pe=j.getState().nodeLookup.get(se).internals.userNode;g(ee,pe)},[]):void 0,Z=v??T["minimap.ariaLabel"];return a.jsx(Ud,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*C:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:He(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:E,height:A,viewBox:`${H} ${U} ${W} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Y,ref:k,onClick:re,children:[Z&&a.jsx("title",{id:Y,children:Z}),a.jsx(T7,{onClick:te,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-V},${U-V}h${W+V*2}v${G+V*2}h${-W-V*2}z
92
- M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}yT.displayName="MiniMap";w.memo(yT);const L7=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,$7={[eo.Line]:"right",[eo.Handle]:"bottom-right"};function D7({nodeId:e,position:t,variant:n=eo.Handle,className:r,style:s=void 0,children:i,color:o,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:g,onResizeStart:x,onResize:_,onResizeEnd:v}){const y=YC(),m=typeof e=="string"?e:y,b=Ce(),j=w.useRef(null),k=n===eo.Handle,S=he(w.useCallback(L7(k&&p),[k,p]),Oe),N=w.useRef(null),R=t??$7[n];w.useEffect(()=>{if(!(!j.current||!m))return N.current||(N.current=tH({domNode:j.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:D,transform:M,snapGrid:z,snapToGrid:T,nodeOrigin:E,domNode:A}=b.getState();return{nodeLookup:D,transform:M,snapGrid:z,snapToGrid:T,nodeOrigin:E,paneDomNode:A}},onChange:(D,M)=>{const{triggerNodeChanges:z,nodeLookup:T,parentLookup:E,nodeOrigin:A}=b.getState(),P=[],I={x:D.x,y:D.y},C=T.get(m);if(C&&C.expandParent&&C.parentId){const L=C.origin??A,F=D.width??C.measured.width??0,V=D.height??C.measured.height??0,H={id:C.id,parentId:C.parentId,rect:{width:F,height:V,...vC({x:D.x??C.position.x,y:D.y??C.position.y},{width:F,height:V},C.parentId,T,L)}},U=ty([H],T,E,A);P.push(...U),I.x=D.x?Math.max(L[0]*F,D.x):void 0,I.y=D.y?Math.max(L[1]*V,D.y):void 0}if(I.x!==void 0&&I.y!==void 0){const L={id:m,type:"position",position:{...I}};P.push(L)}if(D.width!==void 0&&D.height!==void 0){const F={id:m,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};P.push(F)}for(const L of M){const F={...L,type:"position"};P.push(F)}z(P)},onEnd:({width:D,height:M})=>{const z={id:m,type:"dimensions",resizing:!1,dimensions:{width:D,height:M}};b.getState().triggerNodeChanges([z])}})),N.current.update({controlPosition:R,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:x,onResize:_,onResizeEnd:v,shouldResize:g}),()=>{var D;(D=N.current)==null||D.destroy()}},[R,l,c,u,d,f,x,_,v,g]);const O=R.split("-");return a.jsx("div",{className:He(["react-flow__resize-control","nodrag",...O,n,r]),ref:j,style:{...s,scale:S,...o&&{[k?"backgroundColor":"borderColor"]:o}},children:i})}w.memo(D7);const z7={llm_only:"AI",claude:"Claude",codex:"Codex",qoder:"Qoder",qwenwork:"千问办公"};function F7(e){return e.requiresAgent?{key:e.engine==="llm_only"?"llm":e.engine,label:z7[e.engine]}:null}function V7({data:e,selected:t}){var l;const n=e.step,r=F7(n),s=n.status??"idle",i=n.configStatus==="missing",o=((l=n.missingConfigKeys)==null?void 0:l.length)??0;return a.jsxs(Ze.div,{variants:ZV,initial:"hidden",animate:"visible",className:`wf-node is-${s}${t?" is-selected":""}`+(i?" is-config-missing":""),style:{"--engine":r?`var(--agent-${r.key})`:"var(--border-strong)"},children:[a.jsx(to,{type:"target",position:ne.Top,className:"wf-node__handle"}),a.jsx("div",{className:"wf-node__bar"}),a.jsxs("div",{className:"wf-node__body",children:[a.jsxs("div",{className:"wf-node__top",children:[r?a.jsx("span",{className:"wf-node__engine",children:r.label}):a.jsx("span",{}),a.jsxs("div",{className:"wf-node__top-right",children:[i&&a.jsxs("span",{className:"wf-node__config-badge",title:`缺 ${o} 项配置`,children:["⚠ ",o]}),n.needsHuman?a.jsx("span",{className:"wf-node__flag wf-node__flag--human",title:"人工审批",children:a.jsx($,{name:"user",size:11})}):a.jsx("span",{className:"wf-node__flag",title:"自动",children:a.jsx($,{name:"bolt",size:11})})]})]}),a.jsx("div",{className:"wf-node__name",children:n.name}),a.jsx("div",{className:"wf-node__recipe",children:n.recipe}),i&&a.jsx("div",{className:"wf-node__config-warn",children:"⚠ 缺少参数 · 点击补齐"})]}),a.jsx(to,{type:"source",position:ne.Bottom,className:"wf-node__handle"})]})}const B7={step:V7};function xT({steps:e,edges:t,selectedId:n,onSelect:r}){const s=w.useMemo(()=>e.map((o,l)=>({id:o.id,type:"step",position:{x:60,y:l*128},data:{step:o},selected:o.id===n,draggable:!0})),[e,n]),i=w.useMemo(()=>t.map(o=>{const l=o.from===n||o.to===n;return{id:`${o.from}-${o.to}`,source:o.from,target:o.to,type:"smoothstep",animated:l,style:{stroke:l?"var(--accent)":"var(--border-strong)",strokeWidth:l?2:1.5}}}),[t,n]);return a.jsx("div",{className:"wf-canvas",children:a.jsxs(u7,{nodes:s,edges:i,nodeTypes:B7,fitView:!0,fitViewOptions:{padding:.25},minZoom:.4,maxZoom:1.5,proOptions:{hideAttribution:!0},onNodeClick:(o,l)=>r(l.id),onPaneClick:()=>r(null),children:[a.jsx(m7,{variant:fr.Dots,gap:16,size:1}),a.jsx(b7,{showInteractive:!1})]})})}function zc(e){const t=e.slice(e.lastIndexOf(".")+1);return t==="base_id"||t==="baseId"}function U7({config:e,workflowTopology:t,onSave:n}){const r=e.modules.find(u=>u.id==="workflow"),s=e.modules.find(u=>u.id==="env"),[i,o]=w.useState(null),l=(r==null?void 0:r.workflows)??[],c=w.useMemo(()=>{for(const u of l)for(const d of u.items)if(zc(d.key)&&typeof d.value=="string"&&d.value.trim())return d.value.trim()},[l]);return l.length===0?a.jsx("div",{className:"adjust__tab-inner",children:a.jsxs("div",{className:"adjust__empty",children:[a.jsx($,{name:"flow",size:20,color:"var(--text-muted)"}),a.jsx("span",{children:"暂无工作流"})]})}):a.jsx("div",{className:"adjust__tab-inner",children:l.map(u=>a.jsx(H7,{workflow:u,topology:t[u.id],envItems:(s==null?void 0:s.items)??[],suggestedBaseId:c,isOpen:i===u.id,onToggle:()=>o(d=>d===u.id?null:u.id),onSave:n},u.id))})}function H7({workflow:e,topology:t,envItems:n,suggestedBaseId:r,isOpen:s,onToggle:i,onSave:o}){const[l,c]=w.useState(null),u=e.items.filter(S=>S.key==="tracker.base_id"||S.key==="tracker.table_id"),d=e.items.filter(S=>S.key.startsWith("event_source.")&&S.writeTarget),f=w.useMemo(()=>{const S=new Set((t==null?void 0:t.envRefs)??[]);for(const N of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const R of N){const O=n.find(D=>D.key===R);O&&O.status==="error"&&S.add(R)}return[...S].map(N=>n.find(R=>R.key===N)).filter(N=>!!N&&!!N.writeTarget)},[t,n]),h=w.useMemo(()=>{const S=new Set((t==null?void 0:t.envRefs)??[]);for(const N of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const R of N)S.add(R);return n.filter(N=>S.has(N.key)&&N.status==="error")},[t,n]),p=e.ok&&h.length===0,g=e.items.filter(S=>S.writeTarget&&S.status==="error").length+h.filter(S=>S.writeTarget).length,x=e.items.filter(S=>!S.writeTarget&&S.status==="error").length+h.filter(S=>!S.writeTarget).length,_=w.useMemo(()=>{const S=new Set((t==null?void 0:t.envRefs)??[]);for(const N of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const R of N)S.add(R);return[...e.items.filter(N=>!N.writeTarget&&(N.status==="error"||N.status==="warn")),...n.filter(N=>S.has(N.key)&&!N.writeTarget&&(N.status==="error"||N.status==="warn"))]},[t,n,e.items]),v=w.useMemo(()=>t?t.steps.map(S=>{const N=e.items.filter(R=>R.key.startsWith(`step.${S.id}.config.`)&&R.status==="error");return{id:S.id,name:S.name,recipe:S.recipe??"",engine:S.engine??"llm_only",auto:S.auto,inputs:[],outputs:[],configStatus:N.length>0?"missing":"ok",missingConfigKeys:N.map(R=>R.key)}}):[],[t,e.items]),y=w.useMemo(()=>t?t.edges:[],[t]),m=w.useMemo(()=>l?e.items.filter(S=>S.key.startsWith(`step.${l}.config.`)&&S.writeTarget):[],[l,e.items]),b=w.useMemo(()=>!l||!t?[]:(t.stepEnvRefs[l]??[]).map(N=>n.find(R=>R.key===N)).filter(N=>!!N&&N.status!=="ok"),[l,t,n]),j=t==null?void 0:t.steps.find(S=>S.id===l),k=l&&(m.length>0||b.length>0);return a.jsxs("div",{className:`wf-card${p?" is-done":""}`,children:[a.jsxs("button",{type:"button",className:"wf-card__head",onClick:i,children:[a.jsx("span",{className:"wf-card__icon",children:a.jsx($,{name:"flow",size:15})}),a.jsx("span",{className:"wf-card__name",children:e.name}),g>0&&a.jsxs("span",{className:"wf-card__badge",children:[g," 项需配置"]}),x>0&&a.jsxs("span",{className:"wf-card__badge wf-card__badge--process",children:[x," 项过程错误"]}),a.jsx("span",{className:`wf-card__status${p?" is-ok":""}`,children:p?a.jsxs(a.Fragment,{children:[a.jsx($,{name:"check",size:12})," 通过"]}):g>0?"需配置":"有异常"}),a.jsx("span",{className:`wf-card__chevron${s?" is-open":""}`,children:a.jsx($,{name:"chevron-right",size:12})})]}),s&&a.jsxs("div",{className:"wf-card__body",children:[u.length>0&&a.jsx("div",{className:"wf-card__tracker",children:u.map(S=>a.jsx(fn,{item:S,onSave:o,suggestedDefault:zc(S.key)?r:void 0},S.key))}),t&&v.length>0&&a.jsxs("div",{className:`wf-card__canvas-row${k?" has-panel":""}`,children:[a.jsx("div",{className:"wf-card__canvas",children:a.jsx(xT,{steps:v,edges:y,selectedId:l,onSelect:c})}),k&&j&&a.jsxs("div",{className:"wf-card__panel",children:[a.jsxs("div",{className:"wf-card__panel-head",children:[a.jsx($,{name:"bolt",size:14}),a.jsxs("span",{children:["步骤配置 · ",j.name]}),a.jsx("button",{type:"button",className:"wf-card__panel-close",onClick:()=>c(null),children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"wf-card__panel-body",children:[m.map(S=>a.jsx(fn,{item:S,onSave:o,suggestedDefault:zc(S.key)?r:void 0},S.key)),b.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"wf-card__panel-divider",children:"参数与凭据"}),b.map(S=>a.jsx(fn,{item:S,onSave:o},S.key))]})]})]}),l&&!k&&j&&a.jsxs("div",{className:"wf-card__panel",children:[a.jsxs("div",{className:"wf-card__panel-head",children:[a.jsx($,{name:"bolt",size:14}),a.jsxs("span",{children:["步骤配置 · ",j.name]}),a.jsx("button",{type:"button",className:"wf-card__panel-close",onClick:()=>c(null),children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"wf-card__panel-body",children:a.jsxs("div",{className:"adjust__empty",style:{padding:"24px 16px"},children:[a.jsx($,{name:"check",size:16,color:"var(--green)"}),a.jsx("span",{children:"此步骤配置完整"})]})})]})]}),d.length>0&&a.jsxs("div",{className:"wf-card__events",children:[a.jsxs("div",{className:"wf-card__events-title",children:[a.jsx($,{name:"bolt",size:13,color:"var(--text-muted)"}),"事件源配置"]}),d.map(S=>a.jsx(fn,{item:S,onSave:o,suggestedDefault:zc(S.key)?r:void 0},S.key))]}),f.length>0&&a.jsxs("div",{className:"wf-card__events",children:[a.jsxs("div",{className:"wf-card__events-title",children:[a.jsx($,{name:"lock",size:13,color:"var(--text-muted)"}),"参数与凭据"]}),f.map(S=>a.jsx(fn,{item:S,onSave:o},S.key))]}),a.jsx(Iu,{items:_})]})]})}const W7=[{id:"project",label:"项目配置",icon:"folder"},{id:"roles",label:"角色配置",icon:"user"},{id:"workflows",label:"工作流配置",icon:"flow"}];function K7(){const[e,t]=w.useState(null),[n,r]=w.useState(!0),[s,i]=w.useState(null),[o,l]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState("project"),[h,p]=w.useState(!1),g=w.useRef(!1),x=w.useCallback(async()=>{var j,k,S;r(!0),i(null);try{const N=await Sk();if(t(N),!N.config.ok){const R=((j=N.config.modules.find(M=>M.id==="project"))==null?void 0:j.ok)??!0,O=((k=N.config.modules.find(M=>M.id==="coding_agent"))==null?void 0:k.ok)??!0,D=((S=N.config.modules.find(M=>M.id==="roles"))==null?void 0:S.ok)??!0;f(!R||!O?"project":D?"workflows":"roles")}}catch(N){i(N instanceof Error?N.message:String(N))}finally{r(!1)}},[]);w.useEffect(()=>{x()},[x]),w.useEffect(()=>{if(e&&!c){const j=k=>{k.preventDefault()};return window.addEventListener("beforeunload",j),()=>window.removeEventListener("beforeunload",j)}},[e,c]);const _=w.useCallback(async()=>{if(!(g.current||c)){g.current=!0,l(!0);try{await jk(),u(!0)}catch(j){i(j instanceof Error?j.message:String(j))}finally{l(!1),g.current=!1}}},[c]),v=w.useCallback(async(j,k)=>{const S=await Ip([{writeTarget:j,value:k}]);t(N=>N&&{...N,config:S.recheck})},[]),y=w.useCallback(async j=>{const k=await Ip(j);t(S=>S&&{...S,config:k.recheck})},[]),m=w.useCallback(async(j,k)=>{try{const S=await wD(j,k);return t(N=>N&&{...N,config:S.recheck}),{ok:S.ok,message:S.message}}catch(S){const N=S instanceof Error?S.message:"知识库导入失败";return i(N),{ok:!1,message:N}}},[]),b=w.useCallback(async(j,k)=>{try{const S=await _D(j,k);return t(N=>N&&{...N,config:S.recheck}),{ok:S.ok,message:S.message}}catch(S){const N=S instanceof Error?S.message:"文件上传失败";return i(N),{ok:!1,message:N}}},[]);return c?a.jsx("div",{className:"adjust",children:a.jsxs("div",{className:"adjust__done",children:[a.jsx("span",{className:"adjust__done-icon",children:a.jsx($,{name:"check",size:32,color:"var(--green)"})}),a.jsx("h2",{className:"adjust__done-title",children:"配置完成"}),a.jsx("p",{className:"adjust__done-text",children:"所有配置项已保存到本地文件,CLI 将继续 setup 流程。"}),a.jsx("p",{className:"adjust__done-hint",children:"可以关闭此页面。"})]})}):a.jsxs("div",{className:"adjust",children:[a.jsxs("div",{className:"adjust__head",children:[a.jsx("h1",{className:"adjust__title",children:"参数调整"}),a.jsx("p",{className:"adjust__sub",children:"配置项目参数、角色和工作流"})]}),n&&a.jsx("div",{className:"adjust__loading",children:"正在加载配置状态…"}),s&&a.jsxs("div",{className:"adjust__error",children:[a.jsx($,{name:"warn",size:16,color:"var(--red)"}),a.jsx("span",{children:s}),a.jsx("button",{type:"button",className:"adjust__retry",onClick:()=>void x(),children:"重试"})]}),e&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"adjust__hint",children:[a.jsx($,{name:"folder",size:14,color:"var(--text-muted)"}),a.jsx("code",{children:e.config.projectPath})]}),a.jsxs("div",{className:"adjust__tab-area",children:[a.jsx("div",{className:"adjust__tabs",children:W7.map(j=>{var D,M,z,T,E;const k=((D=e.config.modules.find(A=>A.id==="env"))==null?void 0:D.items)??[],S=new Set(e.projectEnvRefs??k.map(A=>A.key)),N=new Set;for(const A of Object.values(e.workflowTopology)){for(const P of A.envRefs??[])N.add(P);for(const P of Object.values(A.stepEnvRefs??{}))for(const I of P)N.add(I)}const R=A=>k.some(P=>P.status==="error"&&A.has(P.key)),O=j.id==="project"?(((M=e.config.modules.find(A=>A.id==="project"))==null?void 0:M.ok)??!0)&&(((z=e.config.modules.find(A=>A.id==="coding_agent"))==null?void 0:z.ok)??!0)&&!R(S):j.id==="roles"?((T=e.config.modules.find(A=>A.id==="roles"))==null?void 0:T.ok)??!0:(((E=e.config.modules.find(A=>A.id==="workflow"))==null?void 0:E.ok)??!0)&&!R(N);return a.jsxs("button",{type:"button",className:`adjust__tab${d===j.id?" is-active":""}${O?"":" has-error"}`,onClick:()=>f(j.id),children:[a.jsx($,{name:j.icon,size:13}),j.label,!O&&a.jsx("span",{className:"adjust__tab-dot"})]},j.id)})}),a.jsxs("div",{className:"adjust__tab-content",children:[d==="project"&&a.jsx(b5,{config:e.config,engines:e.engines,projectEnvRefs:e.projectEnvRefs,onSave:v,onBatchSave:y}),d==="roles"&&a.jsx(S5,{config:e.config,onSave:v,onKbIngest:m,onKbUpload:b}),d==="workflows"&&a.jsx(U7,{config:e.config,workflowTopology:e.workflowTopology,onSave:v})]})]}),a.jsx(l5,{summary:e.config.summary,allPassed:e.config.ok,saving:o,onComplete:()=>p(!0)}),h&&a.jsx("div",{className:"modal-overlay",onClick:()=>p(!1),children:a.jsxs("div",{className:"modal-card",onClick:j=>j.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__icon",style:{background:"var(--accent-tint)",color:"var(--accent)"},children:a.jsx($,{name:"check",size:16})}),a.jsx("span",{className:"modal-card__title",children:"确认进入搭建"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>p(!1),children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"modal-card__body",children:a.jsx("p",{style:{margin:0,fontSize:14,color:"var(--text)"},children:"确认不再修改配置,进入下一步搭建流程?"})}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>p(!1),children:"继续修改"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:o,onClick:()=>{p(!1),_()},children:o?"完成中…":"确认,继续搭建"})]})]})})]})]})}function G7(){const[e]=Ag(),t=e.get("general")==="1",n=wk()&&!t,[r,s]=w.useState(n?null:!1);return w.useEffect(()=>{if(!n)return;let i=!1;return kk().then(o=>{i||s(o.detected)}).catch(()=>{i||s(!1)}),()=>{i=!0}},[n]),r===null?a.jsx(Xg,{stage:"adjust"}):r?a.jsx(Eg,{to:"/workbench",replace:!0}):a.jsx(Rd,{children:a.jsx(K7,{})})}function _T({onCancel:e,onConfirm:t}){const[n,r]=w.useState([]),[s,i]=w.useState(!0),[o,l]=w.useState(null),[c,u]=w.useState(""),[d,f]=w.useState(new Set);async function h(){i(!0),l(null);try{const _=await ED();_.ok?r(_.groups):l(_.message)}catch(_){l(_ instanceof Error?_.message:String(_))}finally{i(!1)}}w.useEffect(()=>{h()},[]);const p=w.useMemo(()=>{const _=c.trim().toLowerCase();return _?n.filter(v=>v.title.toLowerCase().includes(_)):n},[n,c]);function g(_){f(v=>{const y=new Set(v);return y.has(_)?y.delete(_):y.add(_),y})}function x(){const _=n.filter(v=>d.has(v.conversationId));t(_)}return a.jsxs("div",{className:"console-sub",children:[a.jsxs("div",{className:"console-sub__head",children:[a.jsxs("button",{type:"button",className:"console-sub__back",onClick:e,children:[a.jsx($,{name:"chevron-left",size:14}),"返回首页"]}),a.jsx("h2",{className:"console-sub__title",children:"选择要绑定的群聊"}),a.jsx("p",{className:"console-sub__desc",children:"从你作为群主/管理员的钉钉群中多选,确认后为每个群绑定机器人"})]}),a.jsx("div",{className:"group-select__search",children:a.jsx("input",{className:"qf-input",placeholder:"搜索群名…",value:c,onChange:_=>u(_.target.value)})}),s?a.jsx("div",{className:"console-sub__saving",children:"正在拉取你管理的群…"}):o?a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),o,a.jsx("button",{type:"button",className:"console-retry",onClick:()=>void h(),children:"重试"})]}):a.jsx("div",{className:"group-select__list",children:p.length===0?a.jsx("div",{className:"console-sub__saving",children:"没有匹配的群"}):p.map(_=>a.jsxs("label",{className:"group-select__item",children:[a.jsx("input",{type:"checkbox",checked:d.has(_.conversationId),onChange:()=>g(_.conversationId)}),a.jsx("span",{className:"group-select__name",children:_.title||_.conversationId}),a.jsx("span",{className:"group-select__type",children:wT(_.groupType)})]},_.conversationId))}),a.jsxs("div",{className:"console-sub__foot",children:[a.jsxs("span",{className:"group-select__count",children:["已选 ",d.size," 个群"]}),a.jsxs("div",{className:"group-select__foot-actions",children:[a.jsx("button",{type:"button",className:"ghost",onClick:e,children:"取消"}),a.jsx("button",{type:"button",className:"primary",onClick:x,disabled:d.size===0,children:"确认选择"})]})]})]})}function wT(e){return e==="internal"?"内部群":e==="external"?"外部群":"未知"}function bT({rows:e,mode:t,onBack:n,onAddBot:r,onEditBot:s,onToggleEnabled:i,footer:o}){return a.jsxs("div",{className:"console-sub",children:[a.jsxs("div",{className:"console-sub__head",children:[a.jsxs("button",{type:"button",className:"console-sub__back",onClick:n,children:[a.jsx($,{name:"chevron-left",size:14}),"返回首页"]}),a.jsx("h2",{className:"console-sub__title",children:"群聊-机器人配置"}),a.jsx("p",{className:"console-sub__desc",children:t==="view"?"当前群配置表内容,可编辑机器人或启停群":"为每个群绑定机器人后即可开始搭建"})]}),a.jsxs("div",{className:"group-bot-table",children:[a.jsxs("div",{className:"group-bot-table__head",children:[a.jsx("span",{className:"group-bot-table__col group-bot-table__col--name",children:"群名"}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--type",children:"类型"}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--bot",children:"机器人"}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--enabled",children:"是否启用"})]}),e.length===0?a.jsx("div",{className:"console-sub__saving",children:"还没有群配置"}):e.map(l=>a.jsxs("div",{className:"group-bot-table__row",children:[a.jsx("span",{className:"group-bot-table__col group-bot-table__col--name",title:l.title,children:l.title||l.conversationId}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--type",children:wT(l.groupType)}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--bot",children:l.botLabel?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"group-bot-table__bot-name",children:[a.jsx($,{name:"robot",size:13,color:"var(--accent)"}),l.botLabel]}),a.jsxs("button",{type:"button",className:"group-bot-table__edit",onClick:()=>s(l),children:[a.jsx($,{name:"bolt",size:12}),"编辑"]})]}):a.jsxs("button",{type:"button",className:"ghost group-bot-table__add",onClick:()=>r(l),children:[a.jsx($,{name:"plus",size:12}),"添加机器人"]})}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--enabled",children:a.jsxs("label",{className:"group-bot-table__switch",children:[a.jsx("input",{type:"checkbox",checked:l.enabled,onChange:c=>i(l,c.target.checked)}),a.jsx("span",{children:l.enabled?"已启用":"已停用"})]})})]},l.conversationId))]}),o&&a.jsx("div",{className:"console-sub__foot",children:o})]})}function jT({conversationId:e,groupTitle:t,groupType:n,onCancel:r,onEnterpriseDone:s,onPickCustom:i}){const o=n==="external",[l,c]=w.useState(null),[u,d]=w.useState(!1),[f,h]=w.useState(null),p=l==="custom"||l==="enterprise"&&!o&&!u;async function g(){if(l==="custom"){i();return}if(!(l!=="enterprise"||o)){d(!0),h(null);try{const x=await CD({conversationId:e,title:t,...n?{groupType:n}:{}});x.ok?s():h(x.message)}catch(x){h(x instanceof Error?x.message:String(x))}finally{d(!1)}}}return a.jsx("div",{className:"modal-overlay",onClick:r,children:a.jsxs("div",{className:"modal-card",onClick:x=>x.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsxs("span",{className:"modal-card__title",children:["为「",t,"」添加机器人"]}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:r,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsxs("label",{className:`addbot__option${l==="enterprise"?" is-active":""}${o?" is-disabled":""}`,children:[a.jsx("input",{type:"radio",name:"botChoice",disabled:o,checked:l==="enterprise",onChange:()=>c("enterprise")}),a.jsxs("div",{children:[a.jsx("div",{className:"addbot__option-title",children:"一键添加「企业机器人」"}),a.jsx("div",{className:"addbot__option-desc",children:o?"外部群仅支持自定义机器人 webhook":"仅内部群可用,自动创建/复用「ai表格群答疑助手」并入群"})]})]}),l==="enterprise"&&!o&&a.jsx("div",{className:"addbot__creds",children:a.jsxs("div",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"企业机器人"}),a.jsx("div",{className:"addbot__enterprise-hint",children:"ai表格群答疑助手(按当前 dws 组织自动创建/复用)"})]})}),a.jsxs("label",{className:`addbot__option${l==="custom"?" is-active":""}`,children:[a.jsx("input",{type:"radio",name:"botChoice",checked:l==="custom",onChange:()=>c("custom")}),a.jsxs("div",{children:[a.jsx("div",{className:"addbot__option-title",children:"配置「自定义机器人」"}),a.jsx("div",{className:"addbot__option-desc",children:"所有群都可用,需手动在群设置里添加 Webhook"})]})]}),f&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"qf-btn qf-btn--secondary",onClick:r,children:"取消"}),a.jsx("button",{type:"button",className:"qf-btn qf-btn--primary",disabled:!p,onClick:g,children:u?"添加中…":l==="custom"?"去配置":"去添加"})]})]})})}function ST({groupTitle:e,onCancel:t,onSave:n}){const[r,s]=w.useState(""),[i,o]=w.useState(""),[l,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(null),p=/^https?:\/\//.test(i.trim()),g=r.trim().length>0&&p&&l.trim().length>0&&!u;async function x(){d(!0),h(null);try{await n({name:r.trim(),webhook:i.trim(),secret:l.trim()})}catch(_){h(_ instanceof Error?_.message:String(_)),d(!1)}}return a.jsx("div",{className:"modal-overlay",onClick:t,children:a.jsxs("div",{className:"modal-card",onClick:_=>_.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsxs("span",{className:"modal-card__title",children:["为「",e,"」配置自定义机器人"]}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:t,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsxs("div",{className:"console-note",children:[a.jsx($,{name:"bolt",size:13,color:"var(--blue)"}),a.jsxs("div",{children:["请按以下步骤在钉钉群里添加自定义机器人:",a.jsx("br",{}),"1. 打开群设置 → 2. 选择「机器人」→ 3. 选择「自定义机器人」→ 4. 输入机器人名字",a.jsx("br",{}),"完成后把 Webhook 地址与加签密钥填入下方。"]})]}),a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"机器人名字"}),a.jsx("input",{className:"qf-input",value:r,placeholder:"如:群答疑助手",onChange:_=>s(_.target.value)})]}),a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"Webhook URL"}),a.jsx("input",{className:"qf-input",value:i,placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",onChange:_=>o(_.target.value)})]}),i.trim()&&!p&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),"Webhook 需以 http(s):// 开头"]}),a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"Secret"}),a.jsx("input",{className:"qf-input",type:"password",value:l,placeholder:"加签密钥",onChange:_=>c(_.target.value)})]}),f&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:t,children:"取消"}),a.jsx("button",{type:"button",className:"modal-card__btn primary",onClick:()=>void x(),disabled:!g,children:u?"保存中…":"保存"})]})]})})}function q7(e){return e?e.type==="enterprise"?e.name?`企业机器人-「${e.name}」`:"企业机器人":`自定义机器人-「${e.name}」`:null}function Y7(e){return e.appKey?e.botNick?`企业机器人-「${e.botNick}」`:"企业机器人":e.webhookUrl?`自定义机器人-「${e.botNick||"自定义"}」`:null}function X7({mode:e,state:t,onBack:n,onReload:r}){return e==="view"?a.jsx(Z7,{onBack:n}):a.jsx(Q7,{state:t,onBack:n,onReload:r})}function Q7({state:e,onBack:t,onReload:n}){const r=e.groupBotsStaging??[],[s,i]=w.useState(null),[o,l]=w.useState(r.length===0),[c,u]=w.useState(null);if(o)return a.jsx(_T,{onCancel:()=>{r.length>0||(s??[]).length>0?l(!1):t()},onConfirm:g=>{i(x=>{const _=new Map((x??[]).map(v=>[v.conversationId,v]));for(const v of g)_.set(v.conversationId,v);return Array.from(_.values())}),l(!1)}});const d=new Map(r.map(g=>[g.conversationId,g])),f=new Map;for(const g of s??[])f.set(g.conversationId,g);for(const g of r)f.has(g.conversationId)||f.set(g.conversationId,{conversationId:g.conversationId,title:g.title,groupType:g.groupType});const h=Array.from(f.values()).map(g=>{const x=d.get(g.conversationId);return{conversationId:g.conversationId,title:g.title,...g.groupType?{groupType:g.groupType}:{},botLabel:x?q7(x.bot):null,enabled:(x==null?void 0:x.enabled)??!0}}),p=()=>{u(null),n()};return a.jsxs(a.Fragment,{children:[a.jsx(bT,{rows:h,mode:"setup",onBack:t,onAddBot:g=>u({kind:"add",row:g}),onEditBot:g=>u({kind:"add",row:g}),onToggleEnabled:()=>{},footer:a.jsxs("div",{className:"console-sub__foot",style:{display:"flex",gap:12},children:[a.jsx("button",{type:"button",className:"ghost",onClick:()=>l(!0),children:"添加更多群"}),a.jsx("button",{type:"button",className:"primary",onClick:t,children:"完成,返回首页"})]})}),(c==null?void 0:c.kind)==="add"&&a.jsx(jT,{conversationId:c.row.conversationId,groupTitle:c.row.title,...c.row.groupType?{groupType:c.row.groupType}:{},onCancel:()=>u(null),onEnterpriseDone:p,onPickCustom:()=>u({kind:"custom",row:c.row})}),(c==null?void 0:c.kind)==="custom"&&a.jsx(ST,{groupTitle:c.row.title,onCancel:()=>u(null),onSave:async({name:g,webhook:x,secret:_})=>{await Nk({conversationId:c.row.conversationId,title:c.row.title,...c.row.groupType?{groupType:c.row.groupType}:{},name:g,webhook:x,secret:_}),p()}})]})}function Z7({onBack:e}){const[t,n]=w.useState([]),[r,s]=w.useState(!1),[i,o]=w.useState(!0),[l,c]=w.useState(null),[u,d]=w.useState(null),[f,h]=w.useState([]),[p,g]=w.useState(!1),x=w.useCallback(async()=>{o(!0),c(null);try{const j=await Ek();j.ok?n(j.groups):c("群配置表尚未就绪")}catch(j){c(j instanceof Error?j.message:String(j))}finally{s(!0),o(!1)}},[]);w.useEffect(()=>{x()},[x]);const _=w.useCallback(async()=>{const j=await TD().catch(()=>null);j!=null&&j.ok&&h([]),await x()},[x]);if(r&&!i&&!l&&t.length===0&&f.length===0||p)return a.jsx(_T,{onCancel:()=>{t.length>0||f.length>0?g(!1):e()},onConfirm:j=>{h(k=>{const S=new Map(k.map(N=>[N.conversationId,N]));for(const N of j)S.set(N.conversationId,N);return Array.from(S.values())}),g(!1)}});if(i)return a.jsx("div",{className:"console-sub",children:a.jsx("div",{className:"console-sub__saving",children:"正在读取群配置表…"})});const y=t.map(j=>({conversationId:j.groupId,title:j.groupName,...j.groupType?{groupType:j.groupType}:{},botLabel:Y7(j),enabled:j.enabled,recordId:j.recordId})),m=new Set(t.map(j=>j.groupId)),b=f.filter(j=>!m.has(j.conversationId)).map(j=>({conversationId:j.conversationId,title:j.title,...j.groupType?{groupType:j.groupType}:{},botLabel:null,enabled:!0}));return a.jsxs(a.Fragment,{children:[a.jsx(bT,{rows:[...y,...b],mode:"view",onBack:e,onAddBot:j=>d({kind:"add",row:j}),onEditBot:j=>d({kind:"add",row:j}),onToggleEnabled:async(j,k)=>{j.recordId&&(await d_(j.recordId,{enabled:k}),await x())},footer:l?a.jsx("span",{className:"console-sub__err",children:l}):a.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[a.jsx("button",{type:"button",className:"ghost",onClick:()=>g(!0),children:"添加群聊"}),a.jsx("span",{className:"console-build__hint",children:"修改后将在下一次配置同步(约 5 分钟)后生效"})]})}),(u==null?void 0:u.kind)==="add"&&a.jsx(jT,{conversationId:u.row.conversationId,groupTitle:u.row.title,...u.row.groupType?{groupType:u.row.groupType}:{},onCancel:()=>d(null),onEnterpriseDone:()=>{d(null),u.row.recordId?x():_()},onPickCustom:()=>d({kind:"custom",row:u.row})}),(u==null?void 0:u.kind)==="custom"&&a.jsx(ST,{groupTitle:u.row.title,onCancel:()=>d(null),onSave:async({name:j,webhook:k,secret:S})=>{u.row.recordId?(await d_(u.row.recordId,{inbound:"dws",outbound:"webhook",botNick:j,webhookUrl:k,...S?{webhookSecret:S}:{}}),d(null),await x()):(await Nk({conversationId:u.row.conversationId,title:u.row.title,...u.row.groupType?{groupType:u.row.groupType}:{},name:j,webhook:k,secret:S}),d(null),await _())}})]})}const Hw=[{id:"home",label:"首页",icon:"folder"},{id:"kb",label:"知识库",icon:"file"},{id:"records",label:"答疑记录",icon:"table"},{id:"experts",label:"专家配置",icon:"user"}];function Ga(e,t){if(!(e!=null&&e.baseId)||!e.tableId)return null;const n=`https://docs.dingtalk.com/i/nodes/${e.baseId}?iframeQuery=sheetId%3D${encodeURIComponent(e.tableId)}`;if(!(t!=null&&t.embed))return n;const r=`sheetId=${encodeURIComponent(e.tableId)}&side_bar=false&top_bar=false&foot_bar=false&disable_guide=true&ntCatalogCollapsed=true&ntDisableGuide=true`;return`https://docs.dingtalk.com/i/nodes/${e.baseId}?iframeQuery=${encodeURIComponent(r)}&sideCollapsed=true&ntCatalogCollapsed=true&ntDisableGuide=true`}function J7(e,t,n,r={}){var d;const i=(n??[]).filter(f=>f.enabled&&f.bot),o=i.length>0,l=r.groupsLoading===!0,c=(d=t==null?void 0:t.modules.find(f=>f.id==="coding_agent"))==null?void 0:d.items.find(f=>f.key==="coding_agent.engine"),u=(c==null?void 0:c.status)==="ok";return[{id:"groups",title:"一键添加群聊并绑定机器人",desc:"拉取你管理的钉钉群,多选后为每个群绑定企业机器人或自定义机器人",done:o,loading:l,hint:l?"正在读取群配置…":o?`已配置 ${i.length} 个群`:"还没添加群聊或有群未配置机器人"},{id:"other",title:"其他配置",desc:"选择本机用于作答的 Coding Agent 引擎",done:!0,hint:u?`引擎:${String((c==null?void 0:c.value)??"")}`:"默认使用 qoder,可点击修改"}]}function e9(e){return e.map(t=>({conversationId:t.groupId,title:t.groupName,...t.groupType?{groupType:t.groupType}:{},enabled:t.enabled,bot:t.appKey?{type:"enterprise",appKey:t.appKey,...t.botNick?{name:t.botNick}:{}}:t.webhookUrl?{type:"custom",name:t.botNick||"自定义",webhookUrl:t.webhookUrl}:null}))}function Ww(e){return e.length>0&&e.every(t=>t.done)}function t9(e){return e!=null&&e.tableId?"view":"setup"}function Kw(e){const t=(e==null?void 0:e.pending)??null;return t?{label:{start:"正在启动…",stop:"正在停止…"}[t.action],action:t.action,tone:"primary",disabled:!0,statusLabel:"等待本机执行"}:(e==null?void 0:e.status)==="starting"?{label:"正在启动…",action:"start",tone:"primary",disabled:!0,statusLabel:"启动中"}:(e==null?void 0:e.status)==="stopping"?{label:"正在停止…",action:"stop",tone:"danger",disabled:!0,statusLabel:"停止中"}:(e==null?void 0:e.status)==="running"?{label:"停止",action:"stop",tone:"danger",disabled:!1,statusLabel:"运行中"}:(e==null?void 0:e.status)==="stopped"?{label:"重启运行",action:"start",tone:"primary",disabled:!1,statusLabel:"已停止"}:(e==null?void 0:e.status)==="error"?{label:"重启运行",action:"start",tone:"primary",disabled:!1,statusLabel:"运行异常"}:{label:"启动运行",action:"start",tone:"primary",disabled:!1,statusLabel:(e==null?void 0:e.status)==="idle"?"未运行":"状态未知"}}function n9(e,t){const n=r=>{if(r)return r.baseId?r:{...r,baseId:t}};return[{field:"admin_table",label:"管理员配置表",purpose:"指定哪些人是管理员。管理员可以在「知识收件箱」里补充答案,补充后会自动沉淀进知识库。",howTo:"在表格中每行填一位管理员的钉钉 userId(或按表内列说明填写)。改完点下方「同步配置」,助手会立刻重新读取名单。",ref:n(e==null?void 0:e.admin_table)},{field:"owner_table",label:"模块负责人配置表",purpose:"按功能模块指定专家。助手判定问题属于某模块且需要升级时,会在群里 @ 对应负责人。",howTo:"每行填「模块名 + 负责人 userId」。模块名要和助手回答里出现的模块口径一致。改完点下方「同步配置」,助手会立刻重新读取名单。",ref:n(e==null?void 0:e.owner_table)}]}function sy(e,t){var n;if(e)return t&&((n=e[t])!=null&&n.tableId)?e[t]:Object.values(e).find(r=>r.baseId&&r.tableId)}function r9({mode:e,state:t,config:n,engines:r,artifacts:s,buildDone:i,buildBaseUrl:o,onSave:l,onReload:c,onStartBuild:u,building:d}){const[f,h]=w.useState(null),p=t9(t==null?void 0:t.groupTableRef),[g,x]=w.useState(null),[_,v]=w.useState(!1),[y,m]=w.useState("idle"),[b,j]=w.useState(null),[k,S]=w.useState(null),N=w.useRef([]),R=P=>(N.current.push(P),P);w.useEffect(()=>()=>N.current.forEach(P=>clearInterval(P)),[]),w.useEffect(()=>{let P=!1;return u_().then(I=>{P||v(!I.loggedIn)}).catch(()=>{}),()=>{P=!0}},[]);async function O(){S(null),m("starting");const P=await kD().catch(L=>({ok:!1,message:String(L)}));if(!P.ok){S(P.message??"登录发起失败"),m("idle");return}m("waiting-link");const I=Date.now()+6e4,C=R(window.setInterval(async()=>{const L=await ND().catch(()=>({verifyUrl:null}));if(L.verifyUrl){clearInterval(C),j(L.verifyUrl),m("waiting-auth");const F=R(window.setInterval(async()=>{const V=await u_().catch(()=>null);V!=null&&V.loggedIn&&(clearInterval(F),v(!1),m("idle"),j(null),c())},5e3))}else Date.now()>I&&(clearInterval(C),S("等待授权链接超时,请重试或在终端手动执行 dws auth login"),m("idle"))},2e3))}w.useEffect(()=>{if(p!=="view"){x(null);return}let P=!1;return Ek().then(I=>{P||x(I.ok?I.groups:[])}).catch(()=>{P||x([])}),()=>{P=!0}},[p]);const D=p==="view"&&g?e9(g):t==null?void 0:t.groupBotsStaging,z=J7(t,n,D,{groupsLoading:p==="view"&&g===null}),T=sy(s==null?void 0:s.trackers,(t==null?void 0:t.workflowId)??null),E=o??Ga(T),A=w.useRef(!1);return w.useEffect(()=>{var F,V;if(A.current)return;const P=n==null?void 0:n.modules.find(H=>H.id==="coding_agent"),I=P==null?void 0:P.items.find(H=>H.key==="coding_agent.engine");if(!(I!=null&&I.writeTarget)||I.status!=="error")return;const C=((F=r.find(H=>H.engine==="qoder"))==null?void 0:F.engine)??((V=r[0])==null?void 0:V.engine);if(!C)return;A.current=!0;const L=P==null?void 0:P.items.find(H=>H.key==="coding_agent.config.enabled");(async()=>(await l(I.writeTarget,C),(L==null?void 0:L.status)==="error"&&L.writeTarget&&await l(L.writeTarget,"true")))()},[n,r,l]),f==="groups"&&t?a.jsx(X7,{mode:p,state:t,onBack:()=>h(null),onReload:c}):f==="other"?a.jsx(s9,{config:n,engines:r,onSave:l,onBack:()=>h(null)}):a.jsxs("div",{className:"console-page",children:[_&&a.jsxs("div",{className:"console-auth-banner",children:[a.jsx($,{name:"warn",size:14,color:"var(--red)"}),a.jsxs("span",{className:"console-auth-banner__text",children:["钉钉(dws)登录已失效:引擎无法装配、群配置与表格读写都会失败。",y==="waiting-auth"&&b?" 请在浏览器完成授权,本页会自动恢复。":" 请重新登录。"]}),y==="idle"&&a.jsx("button",{type:"button",className:"primary console-auth-banner__btn",onClick:()=>void O(),children:"重新登录"}),(y==="starting"||y==="waiting-link")&&a.jsx("span",{className:"console-auth-banner__wait",children:"正在启动登录…"}),y==="waiting-auth"&&b&&a.jsx("a",{className:"primary console-auth-banner__btn",href:b,target:"_blank",rel:"noreferrer",children:"打开授权页面"}),k&&a.jsx("span",{className:"console-auth-banner__err",children:k})]}),a.jsxs("section",{className:"console-section",children:[a.jsx("h2",{className:"console-section__title",children:"答疑助手能做什么"}),a.jsxs("div",{className:"console-intro",children:[a.jsxs("div",{className:"console-intro__item",children:[a.jsx("span",{className:"console-intro__icon",children:a.jsx($,{name:"robot",size:16,color:"var(--accent)"})}),a.jsxs("div",{children:[a.jsx("div",{className:"console-intro__head",children:"自动回答群里的常见问题"}),a.jsx("div",{className:"console-intro__body",children:"监听你指定的钉钉群,识别出真正的提问后,基于知识库给出有依据的回答; 没有依据时保持静默,不编造答案。"})]})]}),a.jsxs("div",{className:"console-intro__item",children:[a.jsx("span",{className:"console-intro__icon",children:a.jsx($,{name:"user",size:16,color:"var(--accent)"})}),a.jsxs("div",{children:[a.jsx("div",{className:"console-intro__head",children:"该找人的时候自动找人"}),a.jsx("div",{className:"console-intro__body",children:"判定为缺陷、需求或知识库缺口时,按「模块负责人配置表」在群里 @ 对应专家, 并把待处理事项留痕到 AI 表格。"})]})]})]})]}),a.jsxs("section",{className:"console-section",children:[a.jsx("h2",{className:"console-section__title",children:"快速配置"}),a.jsx("p",{className:"console-section__sub",children:"下面两项配齐后就能开始搭建 AI 表格"}),a.jsx("div",{className:"console-quick",children:z.map(P=>{const I=P.id==="groups"&&p==="view"?"查看配置":P.done?"查看 / 修改":"去配置";return a.jsxs("div",{className:`console-quick__card${P.done?" is-done":""}`,children:[a.jsx("span",{className:`console-quick__badge${P.loading?" is-loading":""}`,children:a.jsx($,{name:P.loading?"refresh":P.done?"check":"dot",size:13,color:P.loading?"var(--text-faint)":P.done?"var(--green)":"var(--amber)"})}),a.jsx("div",{className:"console-quick__title",children:P.title}),a.jsx("div",{className:"console-quick__desc",children:P.desc}),a.jsx("div",{className:`console-quick__hint${P.done?" is-done":""}${P.loading?" is-loading":""}`,children:P.hint}),a.jsxs("button",{type:"button",className:P.done?"ghost console-quick__cta":"primary console-quick__cta",onClick:()=>h(P.id),children:[I,a.jsx($,{name:"chevron-right",size:13})]})]},P.id)})}),a.jsx("div",{className:"console-build",children:i?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"console-build__icon",children:a.jsx($,{name:"check",size:18,color:"var(--green)"})}),a.jsx("span",{className:"console-build__hint",children:e==="runtime"?"已搭建。点右上角「启动运行」开始服务;群配置修改在下一次配置同步(约 5 分钟)后生效。点击「重新搭建」自动补齐。":"已搭建。如需启动运行请使用 aitable-workflow start 命令。点击「重新搭建」自动补齐。"}),E&&a.jsx("a",{href:E,target:"_blank",rel:"noreferrer",className:"console-build__link",children:"查看 AI 表格"}),a.jsxs("button",{type:"button",className:"ghost console-build__rebuild",onClick:u,disabled:d,title:"自动检查并补齐缺失的表、字段与视图,已有数据不受影响",children:[a.jsx($,{name:"refresh",size:13}),d?"搭建中…":"重新搭建"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"primary console-build__btn",onClick:u,disabled:!Ww(z)||d,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),d?"搭建中…":"开始搭建"]}),a.jsx("span",{className:"console-build__hint",children:Ww(z)?"将自动创建「群问答记录表」「群配置表」及其字段与视图":"两项配置全部完成后可开始搭建"})]})})]})]})}function s9({config:e,engines:t,onSave:n,onBack:r}){const s=e==null?void 0:e.modules.find(f=>f.id==="coding_agent"),i=s==null?void 0:s.items.find(f=>f.key==="coding_agent.engine"),o=s==null?void 0:s.items.find(f=>f.key==="coding_agent.config.enabled"),[l,c]=w.useState(!1);async function u(f){if(!(!(i!=null&&i.writeTarget)||!f)){c(!0);try{await n(i.writeTarget,f),(o==null?void 0:o.status)==="error"&&o.writeTarget&&await n(o.writeTarget,"true")}finally{c(!1)}}}const d=((s==null?void 0:s.items)??[]).filter(f=>f.key!=="coding_agent.engine"&&f.writeTarget&&f.status==="error");return a.jsxs("div",{className:"console-sub",children:[a.jsxs("div",{className:"console-sub__head",children:[a.jsxs("button",{type:"button",className:"console-sub__back",onClick:r,children:[a.jsx($,{name:"chevron-left",size:14}),"返回首页"]}),a.jsx("h2",{className:"console-sub__title",children:"配置其他"}),a.jsx("p",{className:"console-sub__desc",children:"选择本机用于作答的 Coding Agent 引擎"})]}),a.jsxs("div",{className:"console-card",children:[a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"执行引擎"}),a.jsxs("select",{className:"qf-select",value:(i==null?void 0:i.value)??"",disabled:l,onChange:f=>void u(f.target.value),children:[a.jsx("option",{value:"",children:"请选择…"}),t.map(f=>a.jsxs("option",{value:f.engine,children:[f.engine,"(",f.cmd,f.version?` v${f.version}`:"",")"]},f.engine)),!t.some(f=>f.engine==="llm_only")&&a.jsx("option",{value:"llm_only",children:"llm_only(无需本地 CLI)"})]})]}),(i==null?void 0:i.status)==="error"&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),i.message]}),l&&a.jsx("div",{className:"console-sub__saving",children:"保存中…"})]}),d.length>0&&a.jsxs("div",{className:"console-card",children:[a.jsx("div",{className:"console-card__head",children:a.jsx("span",{className:"console-card__title",children:"引擎补充配置"})}),d.map(f=>a.jsx(fn,{item:f,onSave:n},f.key))]})]})}function iy({ref_:e,placeholder:t}){const n=Ga(e,{embed:!0}),r=Ga(e),[s,i]=w.useState(!1);return w.useEffect(()=>{i(!1)},[n]),!n||!r?a.jsxs("div",{className:"console-frame__empty",children:[a.jsx($,{name:"table",size:26,color:"var(--text-faint)"}),a.jsx("p",{className:"console-frame__empty-text",children:t})]}):a.jsxs("div",{className:"console-frame",children:[a.jsxs("div",{className:"console-frame__stage",children:[!s&&a.jsxs("div",{className:"console-frame__loading",children:[a.jsx("span",{className:"console-frame__spinner"}),"正在加载表格…"]}),a.jsx("iframe",{className:"console-frame__iframe",src:n,title:(e==null?void 0:e.label)??"AI 表格",allow:"clipboard-read; clipboard-write",onLoad:()=>i(!0)})]}),a.jsxs("div",{className:"console-frame__foot",children:[a.jsx($,{name:"link",size:11,color:"var(--text-muted)"}),a.jsx("span",{children:"若显示登录页,请先在浏览器登录钉钉"}),a.jsx("a",{className:"console-frame__link",href:r,target:"_blank",rel:"noreferrer",children:"在新标签页打开"})]})]})}const i9="wiki/official-aitable-faq",o9="knowledge-ingest";function a9({state:e,artifacts:t,onReload:n}){var y;const[r,s]=w.useState(null),[i,o]=w.useState(null),l=(e==null?void 0:e.kbRoleId)??null,c=(e==null?void 0:e.kb.userCollection)??null,u=(e==null?void 0:e.kb.officialOn)??!1,d=(e==null?void 0:e.kb.stats)??{},f=c?d[c]:void 0,h=d[i9],p=(y=t==null?void 0:t.trackers)==null?void 0:y[o9],g=(c?1:0)+(u?1:0),x=Object.values(d).some(m=>m.status==="compiling"),_=w.useRef(n);_.current=n,w.useEffect(()=>{if(!x)return;const m=setInterval(()=>_.current(),4e3);return()=>clearInterval(m)},[x]);async function v(m){if(l){s("official"),o(null);try{const b=await PD(l,m);if(!b.ok){o(b.message);return}n()}catch(b){o(b instanceof Error?b.message:String(b))}finally{s(null)}}}return a.jsx("div",{className:"console-page console-page--frame",children:a.jsxs("section",{className:"console-section console-section--frame",children:[a.jsxs("div",{className:"console-kb__title-row",children:[a.jsx("h2",{className:"console-section__title",children:"知识库"}),a.jsxs("span",{className:"console-kb__count",children:["已启用 ",g," 个"]})]}),a.jsx("p",{className:"console-section__sub",children:"助手可同时使用多个知识库作答:在「我的知识库」上传你自己的知识,添加后助手会自动学习; 官方知识库是内置的 AI 表格官方答疑知识库,只读,可随时启用作为补充。"}),!l&&a.jsxs("div",{className:"console-note console-note--warn",children:[a.jsx($,{name:"warn",size:13,color:"var(--amber)"}),a.jsx("div",{children:"未在 profile 中找到带知识库的角色,知识库功能不可用。"})]}),a.jsxs("div",{className:"console-kb",children:[a.jsxs("div",{className:"console-kb__card console-kb__card--official",children:[a.jsxs("div",{className:"console-kb__head",children:[a.jsx($,{name:"file",size:16,color:"var(--accent)"}),a.jsx("span",{className:"console-kb__title",children:"官方知识库 · 钉钉 AI 表格 FAQ"}),a.jsx("span",{className:"console-kb__badge",children:"只读"}),a.jsxs("label",{className:"console-kb__switch",children:[a.jsx("input",{type:"checkbox",checked:u,disabled:r!==null||!l,onChange:m=>void v(m.target.checked)}),r==="official"?"切换中…":u?"已启用":"未启用"]})]}),a.jsx("p",{className:"console-kb__desc",children:"内置的 AI 表格官方答疑知识库,覆盖快速入门、字段与视图、自动化、仪表盘等常见问题。 只读,不可查看或修改;启用后助手会把它和你的知识库一起作为作答参考。"}),a.jsx("div",{className:"console-kb__stats",children:u?Gw(h):"未启用,不参与作答"})]}),a.jsxs("div",{className:"console-kb__card",children:[a.jsxs("div",{className:"console-kb__head",children:[a.jsx($,{name:"table",size:16,color:"var(--accent)"}),a.jsx("span",{className:"console-kb__title",children:"我的知识库"}),a.jsx("span",{className:"console-kb__stats",children:Gw(f)})]}),a.jsx("p",{className:"console-kb__desc",children:"在这里上传和管理你自己的知识。在下方表格新增一行就是一条知识:填写「标题」和「内容」, 或提供「来源附件」/「来源链接」;然后把「状态」拨为「待处理」, 助手运行期间会自动学习并编译,完成后状态变为「就绪」。"}),a.jsx(iy,{ref_:p,placeholder:"还没有「我的知识库」表。请先在首页完成配置并点「开始搭建」,系统会自动创建这张录入表。"})]})]}),i&&a.jsxs("div",{className:"console-note console-note--err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),a.jsx("div",{children:i})]})]})})}function Gw(e){if(!e||e.status==="unknown")return"尚未编译";if(e.status==="compiling")return"正在编译…";const t=[];return typeof e.sourceCount=="number"&&t.push(`${e.sourceCount} 个来源`),typeof e.articleCount=="number"&&t.push(`${e.articleCount} 篇知识文章`),e.finishedAt&&t.push(`更新于 ${l9(e.finishedAt)}`),t.length===0?e.status==="failed"?"上次编译失败":"尚未编译":e.status==="failed"?`${t.join(" · ")}(上次编译失败)`:t.join(" · ")}function l9(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function c9({artifacts:e,workflowId:t}){const n=sy(e==null?void 0:e.trackers,t),r=Ga(n);return a.jsx("div",{className:"console-page console-page--frame",children:a.jsxs("section",{className:"console-section console-section--frame",children:[a.jsx("h2",{className:"console-section__title",children:"答疑记录"}),a.jsx("p",{className:"console-section__sub",children:"助手处理过的每条群消息都会留痕在这里:原始提问、处置动作、回答内容与知识沉淀状态。 管理员在「★ 知识收件箱」视图里补充答案,即可把缺口沉淀进知识库。"}),r&&a.jsxs("p",{className:"console-section__tablelink",children:["详情可见 AI 表格 ——"," ",a.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",children:["「",(n==null?void 0:n.label)??"群问答记录表","」"]})]}),a.jsx(iy,{ref_:n,placeholder:"还没有「群问答记录表」。请先在首页完成配置并点「开始搭建」,系统会自动创建这张表。"})]})})}function u9({artifacts:e,workflowId:t}){const n=sy(e==null?void 0:e.trackers,t),r=n9(e==null?void 0:e.configTables,(n==null?void 0:n.baseId)??""),[s,i]=w.useState(0),[o,l]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState(null),h=r[s]??r[0],p=Ga(h.ref);async function g(){l(!0),f(null),u(null);try{const x=await MD(d9);u(x.actions>0?{tone:"ok",text:`同步完成:处理了 ${x.actions} 条配置动作,新的管理员与负责人名单已生效。`}:{tone:"warn",text:"配置同步已执行,但没有产出任何动作。请检查表格里是否有可用行(空表、必填列没填都会这样)。"})}catch(x){f(x instanceof Error?x.message:String(x))}finally{l(!1)}}return a.jsx("div",{className:"console-page console-page--frame",children:a.jsxs("section",{className:"console-section console-section--frame",children:[a.jsx("h2",{className:"console-section__title",children:"专家配置"}),a.jsx("div",{className:"console-tabs",children:r.map((x,_)=>a.jsxs("button",{type:"button",className:`console-tabs__tab${_===s?" is-active":""}`,onClick:()=>i(_),children:[x.label,!f9(x.ref)&&a.jsx("span",{className:"console-tabs__dot"})]},x.field))}),a.jsxs("div",{className:"console-note",children:[a.jsx($,{name:"user",size:13,color:"var(--blue)"}),a.jsxs("div",{children:[a.jsxs("div",{className:"console-note__title",children:[h.label,"有什么用"]}),a.jsx("div",{children:h.purpose}),a.jsxs("div",{className:"console-note__howto",children:[a.jsx("strong",{children:"怎么配:"}),h.howTo]})]})]}),p&&a.jsxs("p",{className:"console-section__tablelink",children:["详情可见 AI 表格 ——"," ",a.jsxs("a",{href:p,target:"_blank",rel:"noreferrer",children:["「",h.label,"」"]})]}),a.jsx(iy,{ref_:h.ref,placeholder:`还没有「${h.label}」。请先在首页完成搭建,系统会在同一个 AI 表格里创建这张配置表。`}),a.jsxs("div",{className:"console-sync",children:[a.jsxs("button",{type:"button",className:"primary",onClick:()=>void g(),disabled:o,children:[a.jsx($,{name:"refresh",size:14,color:"#fff"}),o?"同步中…":"同步配置"]}),a.jsx("span",{className:"console-sync__hint",children:"在表格里改完管理员或模块负责人后,点这里让助手立刻重新读取名单"}),(c==null?void 0:c.tone)==="ok"&&a.jsxs("span",{className:"console-sub__ok",children:[a.jsx($,{name:"check",size:13,color:"var(--green)"}),c.text]}),(c==null?void 0:c.tone)==="warn"&&a.jsxs("span",{className:"console-sub__warn",children:[a.jsx($,{name:"warn",size:13,color:"var(--amber)"}),c.text]}),d&&a.jsxs("span",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),d]})]})]})})}const d9="config-sync";function f9(e){return!!(e!=null&&e.baseId)&&!!e.tableId}const qw=8e3,h9=2e3;function p9({mode:e,onFallback:t}){var V;const[n,r]=w.useState(e),[s,i]=w.useState("home"),[o,l]=w.useState(null),[c,u]=w.useState(null),[d,f]=w.useState(null),[h,p]=w.useState(null),[g,x]=w.useState(!0),[_,v]=w.useState(null),[y,m]=w.useState(!1),[b,j]=w.useState(!1),[k,S]=w.useState(null),[N,R]=w.useState(null),[O,D]=w.useState(!1),[M,z]=w.useState(null),T=w.useRef(!1),E=w.useCallback(async(H=!1)=>{v(null);try{const[U,W,G]=await Promise.all([H?Promise.resolve(null):Sk(),kk(),c_().catch(()=>null)]);U&&l(U),u(W),f(G),G!=null&&G.ready&&j(!0)}catch(U){v(U instanceof Error?U.message:String(U))}finally{x(!1)}},[]);w.useEffect(()=>{E()},[E]),w.useEffect(()=>{if(n){Mp().then(U=>D(!!U.promotable)).catch(()=>{});return}let H=!1;return Mp().then(U=>{H||(r(U.mode),D(!!U.promotable))}).catch(()=>{H||r("setup")}),()=>{H=!0}},[n]),w.useEffect(()=>{if(n!=="runtime")return;let H=!1,U;const W=async()=>{try{const G=await AD();if(H)return;p(G);const Y=G.pending||G.status==="starting"||G.status==="stopping";U=setTimeout(()=>void W(),Y?h9:qw)}catch{H||(U=setTimeout(()=>void W(),qw))}};return W(),()=>{H=!0,U&&clearTimeout(U)}},[n]);const A=w.useCallback(async(H,U)=>{const W=await Ip([{writeTarget:H,value:U}]);l(G=>G&&{...G,config:W.recheck})},[]);async function P(){m(!0),S({phase:"running",logs:[]});try{await jk()}catch(U){const W=U instanceof Error?U.message:String(U);v(W),m(!1),S({phase:"error",message:W});return}const H=async()=>{try{const U=await l_();if(S(U),U.phase==="done"){j(!0),R(U.baseUrl),m(!1),z(U.promotionError??null),U.mode&&U.mode!==n&&r(U.mode);const W=await c_().catch(()=>null);W&&f(W)}else U.phase==="error"?(v(U.message),m(!1)):setTimeout(()=>void H(),2e3)}catch(U){const W=U instanceof Error?U.message:String(U);v(W),m(!1),S({phase:"error",message:W})}};H()}async function I(){if(T.current)return;const H=Kw(h);if(!H.disabled){T.current=!0;try{const U=await ID(H.action);p(U.status)}catch(U){v(U instanceof Error?U.message:String(U))}finally{T.current=!1}}}async function C(){try{await SD(),r("runtime"),z(null);const H=await l_().catch(()=>null);(H==null?void 0:H.phase)==="done"&&S(H)}catch(H){z(H instanceof Error?H.message:String(H))}}const L=n==="runtime"?Kw(h):null,F=((L==null?void 0:L.disabled)??!0)||!b;return a.jsxs("div",{className:"console",children:[a.jsxs("aside",{className:"console__rail",children:[a.jsxs("div",{className:"console__brand",children:[a.jsx("span",{className:"console__brand-mark",children:a.jsx($,{name:"sparkle",size:14,color:"#fff"})}),a.jsx("span",{className:"console__brand-text",children:"群答疑助手"})]}),a.jsx("nav",{className:"console__nav",children:Hw.map(H=>a.jsxs("button",{type:"button",className:`console__nav-item${s===H.id?" is-active":""}`,onClick:()=>i(H.id),children:[a.jsx($,{name:H.icon,size:15}),H.label]},H.id))}),a.jsxs("button",{type:"button",className:"console__fallback",onClick:t,children:[a.jsx($,{name:"bolt",size:13}),"切换到通用配置"]})]}),a.jsxs("div",{className:"console__main",children:[a.jsxs("header",{className:"console__topbar",children:[a.jsx("div",{className:"console__topbar-title",children:(V=Hw.find(H=>H.id===s))==null?void 0:V.label}),a.jsx("div",{className:"console__spacer"}),n==="runtime"&&L&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:`console__status console__status--${(h==null?void 0:h.status)??"unknown"}`,children:[a.jsx($,{name:"dot",size:11}),L.statusLabel]}),a.jsxs("button",{type:"button",className:L.tone==="danger"?"ghost console__run console__run--danger":"primary console__run",onClick:()=>void I(),disabled:F,title:b?void 0:"请先完成搭建",children:[a.jsx($,{name:L.action==="stop"?"pause":"play",size:13,color:L.tone==="danger"?void 0:"#fff"}),L.label]})]}),n==="setup"&&O&&a.jsxs("button",{type:"button",className:"primary console__run",disabled:!0,title:"完成搭建后可启动运行",children:[a.jsx($,{name:"play",size:13,color:"#fff"}),"启动运行"]})]}),_&&a.jsxs("div",{className:"console__error",children:[a.jsx($,{name:"warn",size:14,color:"var(--red)"}),a.jsx("span",{children:_}),a.jsx("button",{type:"button",className:"console__retry",onClick:()=>void E(),children:"重试"})]}),n==="setup"&&M&&a.jsxs("div",{className:"console__error",children:[a.jsx($,{name:"warn",size:14,color:"var(--red)"}),a.jsxs("span",{children:["进入运行模式失败:",M]}),a.jsx("button",{type:"button",className:"console__retry",onClick:()=>void C(),children:"重试进入运行模式"})]}),(h==null?void 0:h.lastError)&&a.jsxs("div",{className:"console__error",children:[a.jsx($,{name:"warn",size:14,color:"var(--amber)"}),a.jsxs("span",{children:["上次运行报错:",h.lastError]})]}),g||!n?a.jsx("div",{className:"console__loading",children:"正在读取配置…"}):y?a.jsx(m9,{progress:k}):s==="home"?a.jsx(r9,{mode:n,state:c,config:(o==null?void 0:o.config)??null,engines:(o==null?void 0:o.engines.available)??[],artifacts:d,buildDone:b,buildBaseUrl:N,onSave:A,onReload:()=>void E(),onStartBuild:()=>void P(),building:y}):s==="kb"?a.jsx(a9,{state:c,artifacts:d,onReload:()=>void E(!0)}):s==="records"?a.jsx(c9,{artifacts:d,workflowId:(c==null?void 0:c.workflowId)??null}):a.jsx(u9,{artifacts:d,workflowId:(c==null?void 0:c.workflowId)??null})]})]})}function m9({progress:e}){return a.jsx("div",{className:"console-page",children:a.jsxs("div",{className:"console-build console-build--center",children:[a.jsx("span",{className:"console-build__spinner"}),a.jsx("h2",{className:"console-build__title",children:"正在搭建 AI 表格"}),a.jsx("p",{className:"console-build__hint",children:(e==null?void 0:e.phase)==="running"?"正在创建数据表、字段、视图与自动化…":"正在启动搭建任务…"})]})})}function g9(){const e=Sr(),[t]=w.useState(()=>(bk(),Mp().then(s=>r(s.mode)).catch(()=>r("setup")),null)),[n,r]=w.useState(t);return a.jsx(p9,{mode:n,onFallback:()=>e("/setup?general=1")})}async function v9(){return(await(await ue("/api/account/profile")).json()).user}async function oy(){return(await(await ue("/api/account/machines")).json()).machines}async function y9(e){await ue(`/api/account/machines/${e}`,{method:"DELETE"})}async function x9(e,t){await ue(`/api/account/machines/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}async function _9(e){return(await(await ue(`/api/account/machines/${e}/regenerate-key`,{method:"POST"})).json()).key}async function kT(){return(await(await ue("/api/account/owner-token")).json()).token}let _m;async function w9(){try{const e=await fetch(`${rk}/api/public-config`);if(e.ok){const t=await e.json();t.relayGatewayUrl&&(_m=t.relayGatewayUrl)}}catch{}}function NT(){return _m||(typeof window<"u"?window.location.origin.replace(/^http/,"ws"):"ws://your-server:8787")}const Yw="@ali/aitable-workflow@latest",b9="";function j9(e){return e?`npm i -g --registry=${e} ${Yw}`:`npm i -g ${Yw}`}function S9(e=b9){return j9(e)}function k9(e,t=NT()){return["aitable-workflow connect",` --server-url ${t}`,` --key ${e}`," --name <此机器名>"].join(` \\
93
- `)}function N9(e,t="<此机器名>",n=NT()){return["aitable-workflow connect",` --server-url ${n}`,` --token ${e}`,` --name ${t}`].join(` \\
94
- `)}function wm({machineKey:e,ownerToken:t,machineName:n,title:r,persistent:s,onClose:i}){const[o,l]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState(!1),h=!!t,p=t??e??"",g=h?"Owner Token":"Machine Key",x=S9(),_=h?N9(t,n||void 0):k9(e??"");function v(y,m){navigator.clipboard.writeText(y).then(()=>{m(!0),setTimeout(()=>m(!1),2e3)})}return a.jsxs("div",{className:"daemon-connect-card",children:[a.jsxs("div",{className:"daemon-connect-card__header",children:[a.jsx($,{name:"check",size:16,color:"var(--green)"}),a.jsx("span",{className:"daemon-connect-card__title",children:r??(h?"添加执行引擎":`机器「${n??""}」创建成功`)})]}),a.jsxs("div",{className:"daemon-connect-card__warn",children:[a.jsx($,{name:"warn",size:14}),h?"该 owner-token 是账号级长期凭证,请妥善保管勿外泄(可在账号中心轮换)":s?"该命令含接入密钥,请妥善保管勿外泄":"密钥仅此一次展示,请立即复制保管"]}),a.jsxs("div",{className:"daemon-connect-card__section",children:[a.jsx("div",{className:"daemon-connect-card__label",children:g}),a.jsxs("div",{className:"daemon-connect-card__copyable",children:[a.jsx("code",{className:"daemon-connect-card__code",children:p}),a.jsxs("button",{type:"button",className:"daemon-connect-card__copy-btn",onClick:()=>v(p,l),title:"复制凭证",children:[o?a.jsx($,{name:"check",size:12}):a.jsx($,{name:"link",size:12}),o?"已复制":"复制"]})]})]}),a.jsxs("div",{className:"daemon-connect-card__section",children:[a.jsx("div",{className:"daemon-connect-card__label",children:"首次安装(一次性)"}),a.jsxs("div",{className:"daemon-connect-card__copyable daemon-connect-card__copyable--cmd",children:[a.jsx("pre",{className:"daemon-connect-card__pre",children:x}),a.jsxs("button",{type:"button",className:"daemon-connect-card__copy-btn",onClick:()=>v(x,f),title:"复制安装命令",children:[d?a.jsx($,{name:"check",size:12}):a.jsx($,{name:"link",size:12}),d?"已复制":"复制"]})]}),a.jsx("div",{className:"daemon-connect-card__hint",children:"仅首次安装或升级 CLI 时执行一次,之后无需重复。"})]}),a.jsxs("div",{className:"daemon-connect-card__section",children:[a.jsx("div",{className:"daemon-connect-card__label",children:"Daemon 接入命令(后台运行)"}),a.jsxs("div",{className:"daemon-connect-card__copyable daemon-connect-card__copyable--cmd",children:[a.jsx("pre",{className:"daemon-connect-card__pre",children:_}),a.jsxs("button",{type:"button",className:"daemon-connect-card__copy-btn",onClick:()=>v(_,u),title:"复制命令",children:[c?a.jsx($,{name:"check",size:12}):a.jsx($,{name:"link",size:12}),c?"已复制":"复制"]})]}),a.jsx("div",{className:"daemon-connect-card__hint",children:h?a.jsxs(a.Fragment,{children:["将 ",a.jsx("code",{children:"<此机器名>"})," 改为该机器的稳定名称(相同名字复用同一台,不同名字新增一台), 在目标机器上执行即可:保存凭证 → ",a.jsx("strong",{children:"后台启动 daemon"}),", 终端随后打印 status / logs / stop 等常用命令指引。工作区默认为"," ",a.jsx("code",{children:"~/.aitable-workflow/workspaces/<机器名>"}),",如需自定义可加"," ",a.jsx("code",{children:"--workspace-root <目录>"}),"。",a.jsx("br",{}),"多网关 / 多台机器请为每台使用",a.jsxs("strong",{children:["不同的 ",a.jsx("code",{children:"--name"})]}),"(相同 name 连不同 gateway 会覆盖本机凭证)。"]}):a.jsxs(a.Fragment,{children:["在目标机器上执行即可:保存凭证 → ",a.jsx("strong",{children:"后台启动 daemon"}),", 终端随后打印 status / logs / stop 等常用命令指引。工作区默认为"," ",a.jsx("code",{children:"~/.aitable-workflow/workspaces/<机器名>"}),",如需自定义可加"," ",a.jsx("code",{children:"--workspace-root <目录>"}),"。",a.jsx("br",{}),"多网关 / 多台机器请为每台使用",a.jsxs("strong",{children:["不同的 ",a.jsx("code",{children:"--name"})]}),"(相同 name 连不同 gateway 会覆盖本机凭证)。"]})})]}),a.jsx("div",{className:"daemon-connect-card__actions",children:a.jsx("button",{type:"button",className:"daemon-connect-card__close",onClick:i,children:"我已复制,关闭"})})]})}function E9(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(Number.isNaN(r))return e;const s=Math.floor(r/1e3);if(s<60)return"刚刚";const i=Math.floor(s/60);if(i<60)return`${i}分钟前`;const o=Math.floor(i/60);if(o<24)return`${o}小时前`;const l=Math.floor(o/24);if(l<30)return`${l}天前`;const c=Math.floor(l/30);return c<12?`${c}个月前`:`${Math.floor(c/12)}年前`}function C9(e){return e.length<=12?e:e.slice(0,6)+"..."+e.slice(-4)}const T9={claudecode:"Claude",codex:"Codex",qoder:"Qoder",codebuddy:"Codebuddy",opencode:"OpenCode",qwen:"Qwen",deepseek:"DeepSeek",trae:"Trae",qwenwork:"千问办公"};function P9({machine:e,onRevoke:t,onUpdated:n}){const[r,s]=w.useState(!1),[i,o]=w.useState(!1),[l,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(null),[p,g]=w.useState(null);function x(){navigator.clipboard.writeText(e.machineId).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})}async function _(){d(!0);try{const N=await kT();h(N)}catch(N){window.alert("获取接入指令失败:"+(N instanceof Error?N.message:String(N)))}finally{d(!1)}}async function v(){if(window.confirm(`确定要为「${e.displayName||e.name}」重新生成密钥吗?旧密钥将立即失效,需用新密钥重新接入。`)){d(!0);try{const R=await _9(e.machineId);g(R)}catch(R){window.alert("重新生成失败:"+(R instanceof Error?R.message:String(R)))}finally{d(!1)}}}function y(){window.confirm(`确定要撤销执行引擎「${e.displayName||e.name}」吗?撤销后该机器将无法连接。`)&&t(e.machineId)}function m(){c(e.displayName||e.name),o(!0)}async function b(){const N=l.trim();if(N){try{await x9(e.machineId,{displayName:N}),n==null||n(e.machineId,{displayName:N})}catch(R){window.alert("修改失败:"+(R instanceof Error?R.message:String(R)))}o(!1)}}const j=e.displayName||e.name,k=e.status==="online",S=e.runtimes??[];return a.jsxs("div",{className:"machine-card",children:[a.jsxs("div",{className:"machine-card__header",children:[a.jsx("span",{className:`machine-status ${k?"machine-status--online":"machine-status--offline"}`}),i?a.jsxs("span",{className:"machine-card__edit-row",children:[a.jsx("input",{className:"machine-card__edit-input",type:"text",value:l,onChange:N=>c(N.target.value),onKeyDown:N=>{N.key==="Enter"&&b(),N.key==="Escape"&&o(!1)},autoFocus:!0}),a.jsx("button",{type:"button",className:"machine-card__edit-save",onClick:()=>void b(),title:"保存",children:a.jsx($,{name:"check",size:12})}),a.jsx("button",{type:"button",className:"machine-card__edit-cancel",onClick:()=>o(!1),title:"取消",children:a.jsx($,{name:"close",size:12})})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"machine-card__name",onDoubleClick:m,title:"双击编辑名称",children:j}),e.displayName&&e.name!==e.displayName&&a.jsx("span",{className:"machine-card__slug",children:e.name})]})]}),e.description&&a.jsx("div",{className:"machine-card__desc",children:e.description}),S.length>0?a.jsxs("div",{className:`machine-card__runtimes${k?"":" machine-card__runtimes--offline"}`,children:[S.map(N=>a.jsx("span",{className:"machine-card__runtime-tag",children:T9[N]??N},N)),e.hasDws&&a.jsx("span",{className:"machine-card__runtime-tag machine-card__runtime-tag--dws",children:"dws"})]}):a.jsx("div",{className:"machine-card__runtimes machine-card__runtimes--offline",children:a.jsx("span",{className:"machine-card__runtime-hint",children:"未探测到引擎"})}),a.jsxs("div",{className:"machine-card__meta",children:[a.jsxs("span",{className:"machine-card__id",title:e.machineId,children:["ID: ",C9(e.machineId),a.jsx("button",{type:"button",className:"machine-card__copy",onClick:x,title:"复制 Machine ID",children:r?a.jsx($,{name:"check",size:12}):a.jsx($,{name:"link",size:12})})]}),a.jsx("span",{className:"machine-card__seen",children:k?"在线":e.lastSeen?`最后在线 ${E9(e.lastSeen)}`:"从未连接"})]}),a.jsxs("div",{className:"machine-card__actions",children:[a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:m,title:"编辑名称",children:[a.jsx($,{name:"file",size:12})," 编辑"]}),a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:()=>void _(),disabled:u,title:"查看该机器的接入指令(Key + 启动命令)",children:[a.jsx($,{name:"link",size:12})," 查看指令"]}),a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:()=>void v(),disabled:u,title:"重新生成密钥(旧密钥失效)",children:[a.jsx($,{name:"refresh",size:12})," 重生成密钥"]}),a.jsx("button",{type:"button",className:"machine-card__revoke",onClick:y,children:"撤销"})]}),f&&a.jsx(wm,{ownerToken:f,machineName:e.name,title:`「${j}」接入指令`,onClose:()=>h(null)}),p&&a.jsx(wm,{machineKey:p,machineName:j,title:`「${j}」新密钥已生成`,onClose:()=>g(null)})]})}function ET(){const[e,t]=w.useState([]),[n,r]=w.useState(!0),[s,i]=w.useState(""),[o,l]=w.useState(!1),[c,u]=w.useState(null);async function d(){r(!0),i("");try{const _=await oy();t(_)}catch(_){i(_ instanceof Error?_.message:String(_))}finally{r(!1)}}w.useEffect(()=>{d()},[]);async function f(){l(!0);try{const _=await kT();u(_)}catch(_){window.alert("获取接入指令失败:"+(_ instanceof Error?_.message:String(_)))}finally{l(!1)}}async function h(_){try{await y9(_),t(v=>v.filter(y=>y.machineId!==_))}catch(v){window.alert("撤销失败:"+(v instanceof Error?v.message:String(v)))}}function p(_,v){t(y=>y.map(m=>m.machineId===_?{...m,...v}:m))}if(n)return a.jsx("div",{className:"machine-list__loading",children:"加载中..."});if(s)return a.jsxs("div",{className:"machine-list__error",children:[a.jsx("span",{children:s}),a.jsx("button",{type:"button",className:"machine-list__retry",onClick:()=>void d(),children:"重试"})]});const g=e.filter(_=>_.status==="online"||_.lastSeen),x=g.filter(_=>_.status==="online").length;return a.jsxs("div",{className:"machine-list",children:[a.jsxs("div",{className:"machine-list__header",children:[a.jsxs("span",{className:"machine-list__count",children:["已接入 ",g.length," 台 · 在线 ",x," 台"]}),a.jsxs("div",{className:"machine-list__header-actions",children:[a.jsxs("button",{type:"button",className:"machine-list__refresh",onClick:()=>void d(),title:"刷新(daemon 接入后点此更新列表)",children:[a.jsx($,{name:"refresh",size:14}),"刷新"]}),a.jsxs("button",{type:"button",className:"primary machine-list__add",onClick:()=>void f(),disabled:o,children:[a.jsx($,{name:"plus",size:14}),o?"获取中...":"添加引擎"]})]})]}),c&&a.jsx(wm,{ownerToken:c,title:"添加执行引擎",onClose:()=>u(null)}),g.length===0&&!c?a.jsx("div",{className:"machine-list__empty",children:"暂无已接入的执行引擎。点击「添加引擎」获取自注册接入指令,在目标机器上执行 daemon 启动命令(填入机器名);接入成功后点「刷新」即可看到。"}):a.jsx("div",{className:"machine-list__grid",children:g.map(_=>a.jsx(P9,{machine:_,onRevoke:h,onUpdated:p},_.machineId))})]})}const A9={admin:"管理员",user:"普通用户"};function R9(e){try{return new Date(e).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"})}catch{return e}}function I9(){var u,d,f;const e=_k(),[t,n]=w.useState(null),[r,s]=w.useState(!0);w.useEffect(()=>{(async()=>{try{const h=await v9();n(h)}catch{}finally{s(!1)}})()},[]);const i=(t==null?void 0:t.username)??((u=e.user)==null?void 0:u.username)??"---",o=(t==null?void 0:t.role)??((d=e.user)==null?void 0:d.role)??"user",l=(t==null?void 0:t.createdAt)??null,c=(t==null?void 0:t.avatarUrl)||((f=e.user)==null?void 0:f.avatarUrl)||"";return a.jsx(Rd,{children:a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{className:"work-head__left",children:[a.jsxs(Ue,{className:"account-back-btn",to:"/",title:"返回首页",children:[a.jsx($,{name:"chevron-left",size:16}),"返回"]}),a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:"用户中心"}),a.jsx("div",{className:"work-head__sub",children:"管理账号信息与执行引擎"})]})]})}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"account-page",children:[a.jsxs("section",{className:"account-section",children:[a.jsx("h3",{className:"account-section__title",children:"账号信息"}),a.jsx("div",{className:"account-card",children:r?a.jsx("div",{className:"account-card__loading",children:"加载中..."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"account-card__row",children:[a.jsx("span",{className:"account-card__avatar",children:c?a.jsx("img",{className:"account-card__avatar-img",src:c,alt:""}):a.jsx($,{name:"user",size:24})}),a.jsxs("div",{className:"account-card__info",children:[a.jsx("span",{className:"account-card__username",children:i}),a.jsx("span",{className:`account-card__role account-card__role--${o}`,children:A9[o]??o})]})]}),l&&a.jsxs("div",{className:"account-card__detail",children:[a.jsx("span",{className:"account-card__label",children:"注册时间"}),a.jsx("span",{className:"account-card__value",children:R9(l)})]})]})})]}),a.jsxs("section",{className:"account-section",children:[a.jsx("h3",{className:"account-section__title",children:"执行引擎管理"}),a.jsx(ET,{})]})]})})]})})})}function M9(){return a.jsx(Rd,{children:a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{className:"work-head__left",children:[a.jsxs(Ue,{className:"account-back-btn",to:"/",title:"返回首页",children:[a.jsx($,{name:"chevron-left",size:16}),"返回"]}),a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:"执行引擎"}),a.jsx("div",{className:"work-head__sub",children:"生成接入密钥、查看启动命令,管理已接入的引擎"})]})]})}),a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"account-page",children:a.jsx("section",{className:"account-section",children:a.jsx(ET,{})})})})]})})})}function O9(e,t){return ck(e,t)}function bm(e,t){return e.questions.filter(n=>O9(n,t))}const ah={required:()=>"此项必填",max_selections:e=>`最多选 ${e.maxSelections} 项`};function L9(e,t){var s;const n=new Map(e.questions.map(i=>[i.id,i])),r={};for(const i of b$(e,t)){const o=n.get(i.questionId);r[i.questionId]=o?((s=ah[i.code])==null?void 0:s.call(ah,o))??i.message:i.message}return r}function $9(e){if(!e)return;const t=e.map(n=>typeof n=="string"?{label:n,value:n}:n);return t.length>0?t:void 0}function ay(e){return{id:e.id,title:e.title,...e.description?{description:e.description}:{},...e.submitLabel?{submitLabel:e.submitLabel}:{},questions:e.questions.map(t=>({...t,options:$9(t.options)}))}}function D9(e,t){var r;const n=(r=e.options)==null?void 0:r.find(s=>s.value===t||s.label===t);return(n==null?void 0:n.label)??t}function Xw(e,t){var r;const n=(r=e.options)==null?void 0:r.find(s=>s.value===t||s.label===t);return(n==null?void 0:n.value)??t}function Qw(e,t){return D9(e,t)}function jm(e,t){const n=[`[表单答复 · ${e.title}]`];for(const r of bm(e,t)){const s=t[r.id];let i;Array.isArray(s)?i=s.length>0?s.map(o=>Qw(r,o)).join("、"):"(跳过)":typeof s=="string"&&s.trim().length>0?i=Qw(r,s.trim()):typeof s=="boolean"?i=s?"是":"否":i="(跳过)",n.push(`· ${r.label}:${i}`)}return n.join(`
95
- `)}let z9=0;const wt=e=>`${e}_${(z9++).toString(36)}`,as=e=>new Promise(t=>setTimeout(t,e));class ly{constructor(){le(this,"state",{messages:[],busy:!1,pendingForm:null,formTransitioning:!1});le(this,"listeners",new Set);le(this,"formResolver",null);le(this,"currentAssistantId",null);le(this,"currentTextId",null);le(this,"agentTextMsgId",null);le(this,"agentTextSegId",null);le(this,"agentThinkingMsgId",null);le(this,"agentThinkingSegId",null);le(this,"animQueue",[]);le(this,"consuming",!1);le(this,"activeTasks",0);le(this,"onFormSubmit",null);le(this,"subscribe",t=>(this.listeners.add(t),()=>this.listeners.delete(t)));le(this,"getState",()=>this.state)}emit(){this.listeners.forEach(t=>t())}set(t){this.state={...this.state,...t},this.emit()}pushMessage(t){this.set({messages:[...this.state.messages,t]})}patchMessage(t,n){this.set({messages:this.state.messages.map(r=>r.id===t?n(r):r)})}ensureAssistant(){if(this.currentAssistantId)return this.currentAssistantId;const t=wt("a");return this.currentAssistantId=t,this.currentTextId=null,this.pushMessage({id:t,role:"assistant",segments:[]}),t}addSegment(t){const n=this.ensureAssistant();this.patchMessage(n,r=>({...r,segments:[...r.segments,t]}))}patchSegment(t,n,r){this.patchMessage(t,s=>({...s,segments:s.segments.map(i=>i.id===n?r(i):i)}))}addUserMessage(t){this.pushMessage({id:wt("u"),role:"user",segments:[{kind:"text",id:wt("t"),text:t}]})}run(t){return new Promise(n=>{this.animQueue.push({script:t,resolve:n}),this.ensureConsumer()})}enqueue(t){this.animQueue.push({script:t}),this.ensureConsumer()}beginTask(t,n){const r=this.ensureAssistant(),s=wt("tool");this.resetAgentStream(),this.addSegment({kind:"tool",id:s,tool:{id:wt("tr"),label:t,detail:n,status:"running"}}),this.activeTasks+=1,this.state.busy||this.set({busy:!0});let i=!1;return(o="done")=>{i||(i=!0,this.patchSegment(r,s,l=>l.kind==="tool"?{...l,tool:{...l.tool,status:o}}:l),this.activeTasks=Math.max(0,this.activeTasks-1),this.currentAssistantId=null,this.currentTextId=null,this.activeTasks===0&&!this.consuming&&this.set({busy:!1}))}}ensureConsumer(){this.consuming||(this.consuming=!0,this.state.busy||this.set({busy:!0}),this.consume())}async consume(){var t;for(;this.animQueue.length>0;){const n=this.animQueue.shift();for(const r of n.script)await this.step(r);this.currentAssistantId=null,this.currentTextId=null,(t=n.resolve)==null||t.call(n)}this.consuming=!1,this.set({busy:this.activeTasks>0,formTransitioning:!1})}pendingBeats(){let t=0;for(const n of this.animQueue)t+=n.script.length;return t}async pace(t){const n=this.pendingBeats();if(!(n>=24)){if(n>=8){await as(Math.min(t,6));return}await as(t)}}async step(t){var n;switch(t.kind){case"wait":await as(t.ms);return;case"do":t.run();return;case"say":this.resetAgentStream(),await this.streamText(t.text);return;case"agent-text":this.appendAgentText(t.content),await this.pace(24);return;case"agent-thinking":this.appendAgentThinking(t.content),await this.pace(24);return;case"todo":{const r=t.items.map((s,i)=>({id:wt("td"),text:s,status:i===0?"active":"pending"}));this.addSegment({kind:"todo",id:wt("todo"),items:r}),await as(240);return}case"todo-advance":this.advanceTodo(),await as(300);return;case"tool":{this.resetAgentStream();const r=this.ensureAssistant(),s=wt("tool"),i={id:wt("tr"),label:t.label,detail:t.detail,status:"running"};this.addSegment({kind:"tool",id:s,tool:i}),await this.pace(t.ms??700),this.patchSegment(r,s,o=>o.kind==="tool"?{...o,tool:{...o.tool,status:"done"}}:o),this.currentTextId=null,await this.pace(160);return}case"form":{if(((n=this.state.pendingForm)==null?void 0:n.form.id)===t.form.id)return;const r=this.ensureAssistant(),s=wt("form");this.addSegment({kind:"form",id:s,form:t.form}),this.set({pendingForm:{messageId:r,segmentId:s,form:t.form},formTransitioning:!1}),await new Promise(i=>{this.formResolver=i}),this.currentAssistantId=null,this.currentTextId=null;return}}}advanceTodo(){const t=this.state.messages.map(n=>{let r=!1;const s=n.segments.map(i=>{if(r||i.kind!=="todo")return i;const o=i.items.findIndex(c=>c.status==="active");if(o===-1)return i;r=!0;const l=i.items.map((c,u)=>u===o?{...c,status:"done"}:u===o+1?{...c,status:"active"}:c);return{...i,items:l}});return r?{...n,segments:s}:n});this.set({messages:t})}resetAgentStream(){this.agentTextMsgId=null,this.agentTextSegId=null,this.agentThinkingMsgId=null,this.agentThinkingSegId=null}appendAgentText(t){if(this.agentTextMsgId&&this.agentTextSegId){this.patchSegment(this.agentTextMsgId,this.agentTextSegId,s=>s.kind==="agent-text"?{...s,text:s.text+t}:s);return}this.currentTextId=null;const n=this.ensureAssistant(),r=wt("atext");this.agentTextMsgId=n,this.agentTextSegId=r,this.addSegment({kind:"agent-text",id:r,text:t})}appendAgentThinking(t){if(this.agentThinkingMsgId&&this.agentThinkingSegId){this.patchSegment(this.agentThinkingMsgId,this.agentThinkingSegId,s=>s.kind==="agent-thinking"?{...s,text:s.text+t}:s);return}this.currentTextId=null;const n=this.ensureAssistant(),r=wt("athink");this.agentThinkingMsgId=n,this.agentThinkingSegId=r,this.addSegment({kind:"agent-thinking",id:r,text:t})}async streamText(t){const n=this.ensureAssistant(),r=wt("t");this.currentTextId=r,this.addSegment({kind:"text",id:r,text:""});const s=2;for(let i=0;i<t.length;i+=s){const o=t.slice(0,i+s);this.patchSegment(n,r,l=>l.kind==="text"?{...l,text:o}:l),await as(12)}this.patchSegment(n,r,i=>i.kind==="text"?{...i,text:t}:i),await as(80)}submitForm(t){var s;const n=this.state.pendingForm;if(!n)return;this.patchSegment(n.messageId,n.segmentId,i=>i.kind==="form"?{...i,answers:t}:i),this.addUserMessage(jm(n.form,t)),(s=this.onFormSubmit)==null||s.call(this,n.form.id,t),this.set({pendingForm:null,formTransitioning:!0});const r=this.formResolver;this.formResolver=null,r==null||r()}reset(){var t;for(const n of this.animQueue)(t=n.resolve)==null||t.call(n);this.animQueue=[],this.consuming=!1,this.activeTasks=0,this.currentAssistantId=null,this.currentTextId=null,this.resetAgentStream(),this.formResolver=null,this.set({messages:[],busy:!1,pendingForm:null,formTransitioning:!1})}}function CT(e){return w.useSyncExternalStore(e.subscribe,e.getState,e.getState)}function TT({items:e}){const t=e.filter(n=>n.status==="done").length;return a.jsxs("div",{className:"todo-card",children:[a.jsxs("div",{className:"todo-card__head",children:[a.jsx($,{name:"check",size:14}),a.jsx("span",{children:"执行清单"}),a.jsxs("span",{className:"todo-card__count",children:[t,"/",e.length]})]}),a.jsx(Ze.ul,{className:"todo-card__list",variants:NE,initial:"hidden",animate:"visible",children:e.map(n=>a.jsxs(Ze.li,{className:`todo-item is-${n.status}`,variants:Ct,children:[a.jsx("span",{className:"todo-item__mark",children:n.status==="done"?a.jsx($,{name:"check",size:12}):n.status==="active"?a.jsx("span",{className:"todo-item__spinner"}):a.jsx("span",{className:"todo-item__dot"})}),a.jsx("span",{className:"todo-item__text",children:n.text})]},n.id))})]})}function F9({tool:e}){return a.jsxs("div",{className:`tool-card is-${e.status}`,children:[a.jsx("span",{className:"tool-card__icon",children:e.status==="running"?a.jsx("span",{className:"tool-card__spinner"}):e.status==="error"?a.jsx($,{name:"warn",size:14}):a.jsx($,{name:"check",size:14})}),a.jsx("span",{className:"tool-card__label",children:e.label}),e.detail?a.jsx("span",{className:"tool-card__detail",children:e.detail}):null]})}const PT=w.forwardRef(function({form:t,interactive:n,submittedAnswers:r,hideInternalSubmit:s=!1,onReadyChange:i,onSubmit:o},l){const c=w.useMemo(()=>U9(t,r),[t,r]),[u,d]=w.useState(c),[f,h]=w.useState({}),[p,g]=w.useState({}),x=!n||!o||r!==void 0,_=r??u;w.useEffect(()=>{d(M=>{let z=!1;const T={...M};for(const E of t.questions)T[E.id]===void 0&&(z=!0,T[E.id]=E.defaultValue!==void 0?Sm(E,E.defaultValue):AT(E));return z?T:M})},[t]);function v(M,z){x||(h(T=>T[M]?T:{...T,[M]:!0}),d(T=>({...T,[M]:z})))}function y(M,z,T){x||(h(E=>E[M]?E:{...E,[M]:!0}),d(E=>{const A=Array.isArray(E[M])?E[M]:[],P=A.includes(z);if(!P&&T!==void 0&&A.length>=T)return E;const I=P?A.filter(C=>C!==z):[...A,z];return{...E,[M]:I}}))}function m(M){x||(g(z=>({...z,[M]:!0})),h(z=>z[M]?z:{...z,[M]:!0}),d(z=>({...z,[M]:""})))}function b(M,z){x||(g(T=>T[M]?{...T,[M]:!1}:T),v(M,z))}function j(M,z){if(x)return;h(A=>A[M.id]?A:{...A,[M.id]:!0});const T=new Set((M.options??[]).map(A=>A.value)),E=z.split(/[,,]/).map(A=>A.trim()).filter(Boolean);d(A=>{const P=Array.isArray(A[M.id])?A[M.id]:[];return{...A,[M.id]:[...P.filter(I=>T.has(I)),...E]}})}const k=bm(t,_),S=L9(t,_),N=Object.keys(S).length===0;function R(M){const z={};for(const T of bm(t,M)){const E=M[T.id];E!==void 0&&(z[T.id]=E)}return z}function O(){if(x||!o||!N)return;const M=R(u);o(jm(t,M),M)}function D(){x||!o||o(jm(t,{}),{})}return w.useImperativeHandle(l,()=>({submit:O,skipAll:D})),w.useEffect(()=>{i==null||i(!x&&N)},[i,x,N]),a.jsxs("div",{className:`question-form${x?" question-form-locked":""}`,"data-form-id":t.id,children:[a.jsxs("div",{className:"question-form-head",children:[a.jsx("span",{className:"question-form-icon","aria-hidden":!0,children:"?"}),a.jsxs("div",{className:"question-form-titles",children:[a.jsx("div",{className:"question-form-title",children:t.title}),t.description?a.jsx("div",{className:"question-form-desc",children:t.description}):null]}),x?a.jsx("span",{className:"question-form-pill",children:"已回答"}):null]}),a.jsx("div",{className:"question-form-body",children:k.map(M=>{const z=_[M.id],T=f[M.id]?S[M.id]:void 0;return a.jsxs("div",{className:`qf-field${T?" qf-field-error":""}`,children:[a.jsxs("label",{className:"qf-label",children:[a.jsx("span",{children:M.label}),M.required?a.jsx("span",{className:"qf-required",children:"*"}):null]}),M.help?a.jsx("div",{className:"qf-help",children:M.help}):null,T?a.jsx("div",{className:"qf-error",children:T}):null,M.type==="radio"&&M.options?a.jsxs("div",{className:"qf-choices",role:"radiogroup",children:[M.options.map(E=>a.jsxs("label",{className:`qf-choice${z===E.value?" is-on":""}${x?" is-disabled":""}`,title:E.description,children:[a.jsx("input",{type:"radio",name:`${t.id}-${M.id}`,checked:!rc(M,z,p)&&z===E.value,disabled:x,onChange:()=>b(M.id,E.value)}),a.jsx(lh,{option:E})]},E.value)),Fc(M)?a.jsxs("label",{className:`qf-choice${rc(M,z,p)?" is-on":""}${x?" is-disabled":""}`,children:[a.jsx("input",{type:"radio",name:`${t.id}-${M.id}`,checked:rc(M,z,p),disabled:x,onChange:()=>m(M.id)}),a.jsx(lh,{option:{label:"其他 — 我自己说",value:V9}})]}):null,Fc(M)&&rc(M,z,p)?a.jsx("input",{type:"text",className:"qf-input",value:typeof z=="string"?z:"",placeholder:M.placeholder??"按你的想法写,不用挑上面的选项",disabled:x,onChange:E=>v(M.id,E.target.value)}):null]}):null,M.type==="checkbox"&&M.options?a.jsxs("div",{className:"qf-choices",children:[M.options.map(E=>{const A=Array.isArray(z)?z:[],P=A.includes(E.value),I=M.maxSelections!==void 0&&!P&&A.length>=M.maxSelections;return a.jsxs("label",{title:E.description,className:`qf-choice${P?" is-on":""}${I||x?" is-disabled":""}`,children:[a.jsx("input",{type:"checkbox",checked:P,disabled:x||I,onChange:()=>y(M.id,E.value,M.maxSelections)}),a.jsx(lh,{option:E})]},E.value)}),Fc(M)?a.jsx("input",{type:"text",className:"qf-input",value:B9(M,z).join(","),placeholder:"其他(多个用逗号分隔)",disabled:x,onChange:E=>j(M,E.target.value)}):null]}):null,M.type==="select"&&M.options?a.jsxs("select",{className:"qf-select",value:typeof z=="string"?z:"",disabled:x,onChange:E=>v(M.id,E.target.value),children:[a.jsx("option",{value:"",disabled:!0,children:M.placeholder??"请选择…"}),M.options.map(E=>a.jsx("option",{value:E.value,children:E.label},E.value))]}):null,M.type==="text"?a.jsx("input",{type:"text",className:"qf-input",value:typeof z=="string"?z:"",placeholder:M.placeholder,disabled:x,onChange:E=>v(M.id,E.target.value)}):null,M.type==="number"?a.jsx("input",{type:"number",className:"qf-input",value:typeof z=="string"?z:"",placeholder:M.placeholder,min:M.min,max:M.max,step:M.step,disabled:x,onChange:E=>v(M.id,E.target.value)}):null,M.type==="textarea"?a.jsx("textarea",{className:"qf-textarea",value:typeof z=="string"?z:"",placeholder:M.placeholder,rows:3,disabled:x,onChange:E=>v(M.id,E.target.value)}):null,M.type==="range"?a.jsxs("div",{className:"qf-range-wrap",children:[a.jsx("input",{type:"range",className:"qf-range",value:typeof z=="string"&&z.trim()?z:String(M.min??0),min:M.min,max:M.max,step:M.step,disabled:x,onChange:E=>v(M.id,E.target.value)}),a.jsx("output",{className:"qf-range-value",children:typeof z=="string"&&z.trim()?z:String(M.min??0)})]}):null,M.type==="color"?a.jsx("input",{type:"color",className:"qf-color",value:H9(z),disabled:x,onChange:E=>v(M.id,E.target.value)}):null,M.type==="switch"?a.jsxs("label",{className:"qf-switch",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:z===!0||z==="true",disabled:x,onChange:E=>v(M.id,E.target.checked?"true":"false")}),a.jsx("span",{"aria-hidden":!0})]}):null]},M.id)})}),s?null:a.jsxs("div",{className:"question-form-foot",children:[x?a.jsx("span",{className:"qf-locked-note",children:"已提交答复"}):a.jsx("span",{className:"qf-hint",children:"选择或填写后提交,未答项将记为跳过"}),x?null:a.jsx("button",{type:"button",className:"primary",onClick:O,disabled:!N,children:t.submitLabel??"提交"})]})]})}),V9="__custom__";function Fc(e){return e.type!=="radio"&&e.type!=="checkbox"?!1:e.allowCustom!==!1}function rc(e,t,n){return!Fc(e)||e.type!=="radio"?!1:n[e.id]?!0:typeof t!="string"||t===""?!1:!(e.options??[]).some(r=>r.value===t)}function B9(e,t){if(!Array.isArray(t))return[];const n=new Set((e.options??[]).map(r=>r.value));return t.filter(r=>!n.has(r))}function lh({option:e}){return a.jsxs("span",{className:"qf-chip-copy",children:[a.jsx("span",{children:e.label}),e.description?a.jsx("span",{className:"qf-chip-desc",children:e.description}):null]})}function U9(e,t){const n={};for(const r of e.questions)t&&t[r.id]!==void 0?n[r.id]=Sm(r,t[r.id]):r.defaultValue!==void 0?n[r.id]=Sm(r,r.defaultValue):n[r.id]=AT(r);return n}function AT(e){return e.type==="checkbox"?[]:e.type==="switch"?!1:e.type==="range"?String(e.min??0):e.type==="color"?"#000000":""}function Sm(e,t){return typeof t=="boolean"?t:Array.isArray(t)?t.map(n=>Xw(e,n)):Xw(e,t)}function H9(e){return typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e)?e:"#000000"}function W9({msg:e}){if(e.role==="user"){const t=e.segments.map(n=>n.kind==="text"?n.text:"").join("");return a.jsx(Ze.div,{className:"msg msg--user",variants:Ct,initial:"hidden",animate:"visible",children:a.jsx("div",{className:"msg__bubble",children:t})})}return a.jsxs(Ze.div,{className:"msg msg--assistant",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("div",{className:"msg__avatar","aria-hidden":!0,children:a.jsx($,{name:"sparkle",size:13,color:"#fff"})}),a.jsx("div",{className:"msg__content",children:e.segments.map(t=>{switch(t.kind){case"text":return a.jsx("p",{className:"msg__text",children:t.text},t.id);case"agent-text":return a.jsx("p",{className:"msg__text msg__text--agent",children:t.text},t.id);case"agent-thinking":return a.jsx(K9,{text:t.text},t.id);case"todo":return a.jsx(TT,{items:t.items},t.id);case"tool":return a.jsx(F9,{tool:t.tool},t.id);case"form":return t.answers?a.jsx(PT,{form:t.form,interactive:!1,submittedAnswers:t.answers},t.id):a.jsxs("div",{className:"msg__form-hint",children:[a.jsx($,{name:"chevron-right",size:14}),"请在右侧「问题」面板作答"]},t.id)}})})]})}function K9({text:e}){return a.jsxs("details",{className:"think-block",children:[a.jsxs("summary",{className:"think-block__summary",children:[a.jsx($,{name:"sparkle",size:12}),"思考过程"]}),a.jsx("div",{className:"think-block__body",children:e})]})}function G9({chat:e,placeholder:t,emptyHint:n,onSend:r,title:s,subtitle:i}){const{messages:o,busy:l}=CT(e),[c,u]=w.useState(""),d=w.useRef(null);w.useEffect(()=>{const h=d.current;h&&(h.scrollTop=h.scrollHeight)},[o,l]);function f(){const h=c.trim();!h||l||!r||(u(""),r(h))}return a.jsxs("div",{className:"chat",children:[s?a.jsxs("div",{className:"chat__head",children:[a.jsx("div",{className:"chat__head-title",children:s}),i?a.jsx("div",{className:"chat__head-sub",children:i}):null]}):null,a.jsxs("div",{className:"chat__body",ref:d,children:[o.length===0?a.jsx("div",{className:"chat__empty",children:n??"开始对话,agent 将引导你完成配置。"}):a.jsx(ea,{initial:!1,children:o.map(h=>a.jsx(W9,{msg:h},h.id))}),l?a.jsxs("div",{className:"chat__typing","aria-hidden":!0,children:[a.jsx("span",{}),a.jsx("span",{}),a.jsx("span",{})]}):null]}),r?a.jsxs("div",{className:"chat__composer",children:[a.jsx("textarea",{className:"chat__input",rows:1,value:c,placeholder:t??"输入消息…",disabled:l,onChange:h=>u(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),f())}}),a.jsx("button",{type:"button",className:"primary chat__send",disabled:l||!c.trim(),onClick:f,"aria-label":"发送",children:a.jsx($,{name:"send",size:16,color:"#fff"})})]}):null]})}const q9=280;function Y9({form:e,formKey:t=null,interactive:n,submittedAnswers:r,onSubmit:s}){const i=w.useRef(null),[o,l]=w.useState(!1),c=(e==null?void 0:e.questions.length)??0,u=r!==void 0,[d,f]=w.useState(0);w.useEffect(()=>{f(u?c:0)},[t,u,c]),w.useEffect(()=>{if(u){f(c);return}if(d>=c)return;const y=window.setTimeout(()=>f(m=>Math.min(m+1,c)),q9);return()=>window.clearTimeout(y)},[u,c,d]);const h=d>=c,p=u?c:Math.min(d,c),g=e?{...e,questions:e.questions.slice(0,p)}:null,x=!u&&!h,_=!!e&&n&&!x,v=_&&o;return a.jsxs("div",{className:"questions-panel",children:[a.jsx("div",{className:"questions-panel-body",children:g?a.jsxs(a.Fragment,{children:[a.jsx(PT,{ref:i,form:g,interactive:n,submittedAnswers:r,hideInternalSubmit:!0,onReadyChange:l,onSubmit:s}),x?a.jsxs("div",{className:"questions-panel-typing","aria-hidden":!0,children:[a.jsx("span",{className:"questions-panel-dot"}),a.jsx("span",{className:"questions-panel-dot"}),a.jsx("span",{className:"questions-panel-dot"})]}):null]}):a.jsx("div",{className:"questions-panel-skeleton",children:"正在生成问题…"})}),u?null:a.jsxs("div",{className:"questions-panel-foot",children:[a.jsx("span",{className:"questions-panel-status",children:x?"正在生成问题…":"选择或填写后继续"}),a.jsx("button",{type:"button",className:"ghost questions-skip",disabled:!_,onClick:()=>{var y;return(y=i.current)==null?void 0:y.skipAll()},children:"全部跳过"}),a.jsx("button",{type:"button",className:"primary questions-continue",disabled:!v,onClick:()=>{var y;return(y=i.current)==null?void 0:y.submit()},children:"继续"})]})]})}const Wu=lt(function({chat:t,work:n,workHead:r,hideWork:s=!1,onSend:i,chatTitle:o,chatSubtitle:l,chatPlaceholder:c,chatEmptyHint:u}){const{pendingForm:d,formTransitioning:f}=CT(t),h=B.layout,p=!s&&h.chatCollapsed;function g(_){_.preventDefault();const v=_.clientX,y=h.chatWidth,m=_.pointerId;_.currentTarget.setPointerCapture(m);function b(k){const S=Math.max(280,Math.min(720,y+k.clientX-v));B.setChatWidth(S)}function j(k){y+k.clientX-v<340&&B.setChatCollapsed(!0),window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",j)}window.addEventListener("pointermove",b),window.addEventListener("pointerup",j,{once:!0})}const x={"--chat-width":`${h.chatWidth}px`};return a.jsxs("div",{className:"split"+(p?" split--chat-collapsed":"")+(s?" split--work-hidden":""),style:x,children:[p?a.jsx("button",{type:"button",className:"split-chat-peek",onClick:()=>B.setChatCollapsed(!1),title:"展开对话","aria-label":"展开对话",children:a.jsx(X9,{})}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"split__chat",children:a.jsx(G9,{chat:t,onSend:i,title:o,subtitle:l,placeholder:c,emptyHint:u})}),!s&&a.jsx("button",{type:"button",className:"split-resizer",onPointerDown:g,title:"拖拽调整对话宽度;拖到较窄会自动收起","aria-label":"拖拽调整对话宽度"})]}),!s&&a.jsx("div",{className:"split__work",children:d?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"work-head",children:[a.jsx("div",{className:"work-head__title",children:"问题"}),a.jsx("div",{className:"work-head__sub",children:"回答后继续"})]}),a.jsx(Y9,{form:d.form,formKey:d.segmentId,interactive:!0,onSubmit:(_,v)=>t.submitForm(v)})]}):f?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"work-head",children:[a.jsx("div",{className:"work-head__title",children:"问题"}),a.jsx("div",{className:"work-head__sub",children:"生成下一步"})]}),a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"empty-hint",children:"正在生成下一步配置问题…"})})]}):a.jsxs(a.Fragment,{children:[r,n]})})]})});function X9(){return a.jsx("span",{"aria-hidden":!0,children:"›"})}function RT({title:e,missing:t,warnings:n=[],onClose:r,onLocate:s}){return a.jsx("div",{className:"modal-overlay",onClick:r,children:a.jsxs("div",{className:"modal-card",onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__icon",children:a.jsx($,{name:"warn",size:16})}),a.jsx("span",{className:"modal-card__title",children:e??"无法进入下一步"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:r,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[t.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"modal-card__section-label",children:"当前阶段还缺少以下必填配置:"}),a.jsx("ul",{className:"modal-card__list",children:t.map((i,o)=>a.jsxs("li",{className:"modal-card__item modal-card__item--error",children:[a.jsxs("span",{className:"modal-card__item-scope",children:["[",Zw(i.scope),"]"]}),a.jsx("span",{className:"modal-card__item-target",children:i.target}),a.jsx("span",{className:"modal-card__item-label",children:i.label}),a.jsx("button",{type:"button",className:"modal-card__locate",onClick:()=>s(i),children:"定位 →"})]},`${i.code}-${i.target}-${o}`))})]}),n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"modal-card__section-label modal-card__section-label--warn",children:"以下为建议项(不阻断):"}),a.jsx("ul",{className:"modal-card__list",children:n.map((i,o)=>a.jsxs("li",{className:"modal-card__item modal-card__item--warn",children:[a.jsxs("span",{className:"modal-card__item-scope",children:["[",Zw(i.scope),"]"]}),a.jsx("span",{className:"modal-card__item-label",children:i.label})]},`${i.code}-${i.target}-${o}`))})]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:r,children:"稍后处理"}),t.length>0&&a.jsx("button",{type:"button",className:"primary modal-card__btn",onClick:()=>s(t[0]),children:"去补齐第一项 →"})]})]})})}function Zw(e){switch(e){case"project":return"项目";case"workflow":return"工作流";case"step":return"步骤";case"env":return"环境变量"}}const Q9=[{id:"claude",name:"Claude Code",vendor:"Anthropic",detected:!0,selected:!0,capabilities:["编码","推理","长上下文"],desc:"本地已检测到 CLI,可作为工作流设计与复杂步骤执行引擎"},{id:"qoder",name:"Qoder",vendor:"Qoder",detected:!0,selected:!0,capabilities:["编码","仓库理解"],desc:"适合把业务流程落成配置、脚本与可审查产物"},{id:"codex",name:"Codex",vendor:"OpenAI",detected:!1,selected:!1,capabilities:["编码","自动修复"],desc:"未检测到,安装 CLI 后可作为候选执行引擎"},{id:"qwenwork",name:"千问办公",vendor:"Alibaba",detected:!1,selected:!1,capabilities:["办公智能体","业务流程"],desc:"启动千问办公桌面应用后可作为候选执行引擎"}],Z9=[{id:"classify",name:"信息校验",recipe:"validate-onboarding",engine:"llm_only",auto:!0,inputs:["员工姓名","身份证号","入职日期"],outputs:["校验结论","异常项"]},{id:"investigate",name:"权限准备",recipe:"prepare-access",engine:"qoder",auto:!0,inputs:["员工姓名","部门","岗位","校验结论"],outputs:["权限清单"]},{id:"draft_reply",name:"入职指引草拟",recipe:"draft-onboarding-guide",engine:"llm_only",auto:!0,inputs:["员工姓名","部门","岗位","权限清单"],outputs:["入职指引"]},{id:"quality_check",name:"法务与 HR 复核",recipe:"hr-legal-review",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["入职指引","异常项"],outputs:["复核结论"]},{id:"send_reply",name:"发送入职通知",recipe:"send-onboarding-notice",engine:"llm_only",auto:!0,inputs:["员工姓名","入职指引","复核结论"],outputs:["发送状态"]}],IT=[{id:"fld_employee_name",name:"员工姓名",type:"text",required:!0,group:"business"},{id:"fld_department",name:"部门",type:"text",required:!0,group:"business"},{id:"fld_position",name:"岗位",type:"text",group:"business"},{id:"fld_priority",name:"入职紧急度",type:"single_select",options:["P0-紧急","P1-高","P2-中","P3-低"],group:"business"},{id:"fld_category",name:"事项类型",type:"single_select",options:["入职办理","合同确认","设备申领","权限开通","其他"],group:"business"},{id:"fld_reply_content",name:"入职指引",type:"text",group:"business"},{id:"fld_resolution",name:"权限清单",type:"text",group:"business"},{id:"fld_satisfaction",name:"复核结论",type:"single_select",options:["通过","需补充材料","需法务复核"],group:"business"},{id:"fld_status",name:"状态",type:"single_select",options:["待处理","校验中","权限准备中","草拟指引中","复核中","发送中","已完成"],group:"process"},{id:"fld_current_step",name:"当前步骤",type:"text",group:"process"},{id:"fld_assignee",name:"处理人",type:"user",group:"process"},{id:"fld_sla_deadline",name:"SLA截止时间",type:"datetime",group:"process"},{id:"fld_event_log",name:"事件日志",type:"text",group:"process"}],MT=[{id:"v_grid",name:"全部入职事项",kind:"grid",desc:"全量入职事项列表视图"},{id:"v_kanban",name:"入职进度看板",kind:"kanban",desc:"按状态分列的看板"},{id:"v_form",name:"入职信息提交",kind:"form",desc:"给 HR 或用人团队的提交表单"},{id:"v_calendar",name:"入职日历",kind:"calendar",desc:"按入职日期查看事项"}],cy="ZQYprEoWoPLkorKyuBeBDRd9V1waOeDk",OT="1HixpC7",J9="epHNF75";function LT(e,t,n){const r=new URLSearchParams({entrance:"data",sheetId:t});return n!=null&&n.trim()&&r.set("viewId",n.trim()),`https://alidocs.dingtalk.com/i/nodes/${e}?iframeQuery=${encodeURIComponent(r.toString())}`}LT(cy,OT,J9);const eK=[{id:"hr_partner",name:"HR 业务伙伴",persona:"你是谨慎、温和且注重证据的 HR 业务伙伴。你负责把员工相关流程转化为可执行步骤,先核对制度和人员条件,再给出清晰的处理建议。涉及员工权益、绩效、离职、纪律处分等敏感事项时,必须标出风险点、建议人工复核,并避免使用带倾向性的判断语言。",skills:["policy_interpretation","eligibility_check","document_draft","handoff_summary"],knowledge:["kb_hr_policy","kb_org_people"]},{id:"legal_counsel",name:"法务顾问",persona:"你是业务友好型法务顾问,负责识别合同、合规和隐私风险,并把复杂法务意见转成业务能执行的下一步动作。你不会直接替业务做最终法律承诺;对高风险条款、责任限制、数据出境、劳动争议和监管风险,需要给出风险等级、修改建议和升级路径。",skills:["risk_review","approval_gate","document_draft","handoff_summary"],knowledge:["kb_contract_templates","kb_legal_playbook"]}],tK=`# HR 入职协同 — 工作流模板
91
+ `)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return w.useEffect(()=>{const c=(t==null?void 0:t.target)??ww,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var _,v;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&vC(p))return!1;const x=jw(p.code,l);if(i.current.add(p[x]),bw(o,i.current,!1)){const y=((v=(_=p.composedPath)==null?void 0:_.call(p))==null?void 0:v[0])||p.target,m=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";t.preventDefault!==!1&&(s.current||!m)&&p.preventDefault(),r(!0)}},f=p=>{const g=jw(p.code,l);bw(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[g]),p.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function bw(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function jw(e,t){return t.includes(e)?"code":"key"}const LH=()=>{const e=Ce();return w.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:l}=e.getState(),c=Kv(t,r,s,i,o,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??s,f=n.snapToGrid??i;return yl(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),o=Ji(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function VC(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of t){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...i};for(const c of o)$H(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function $H(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function DH(e,t){return VC(e,t)}function zH(e,t){return VC(e,t)}function ps(e,t){return{id:e,type:"select",selected:t}}function bi(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const o=t.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(ps(i.id,o)))}return r}function Sw({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const l=t.get(o.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function kw(e){return{id:e.id,type:"remove"}}const FH=hC();function VH(e,t,n={}){return _U(e,t,{...n,onError:n.onError??FH})}const Nw=e=>iU(e),BH=e=>lC(e);function BC(e){return w.forwardRef(e)}const UC=typeof window<"u"?w.useLayoutEffect:w.useEffect;function Ew(e){const[t,n]=w.useState(BigInt(0)),[r]=w.useState(()=>UH(()=>n(s=>s+BigInt(1))));return UC(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function UH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const HC=w.createContext(null);function HH({children:e}){const t=Ce(),n=w.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:g}=t.getState();let x=c;for(const v of l)x=typeof v=="function"?v(x):v;let _=Sw({items:x,lookup:h});for(const v of g.values())_=v(_);d&&u(x),_.length>0?f==null||f(_):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:v,nodes:y,setNodes:m}=t.getState();v&&m(y)})},[]),r=Ew(n),s=w.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const g of l)p=typeof g=="function"?g(p):g;d?u(p):f&&f(Sw({items:p,lookup:h}))},[]),i=Ew(s),o=w.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return a.jsx(HC.Provider,{value:o,children:e})}function WH(){const e=w.useContext(HC);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const KH=e=>!!e.panZoom;function Jv(){const e=LH(),t=Ce(),n=WH(),r=he(KH),s=w.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var v,y;const{nodeLookup:h,nodeOrigin:p}=t.getState(),g=Nw(f)?f:h.get(f.id),x=g.parentId?mC(g.position,g.measured,g.parentId,h,p):g.position,_={...g,position:x,width:((v=g.measured)==null?void 0:v.width)??g.width,height:((y=g.measured)==null?void 0:y.height)??g.height};return Ha(_)},u=(f,h,p={replace:!1})=>{o(g=>g.map(x=>{if(x.id===f){const _=typeof h=="function"?h(x):h;return p.replace&&Nw(_)?_:{...x,..._}}return x}))},d=(f,h,p={replace:!1})=>{l(g=>g.map(x=>{if(x.id===f){const _=typeof h=="function"?h(x):h;return p.replace&&BH(_)?_:{...x,..._}}return x}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=i(f))==null?void 0:h.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[g,x,_]=p;return{nodes:f.map(v=>({...v})),edges:h.map(v=>({...v})),viewport:{x:g,y:x,zoom:_}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:g,onNodesDelete:x,onEdgesDelete:_,triggerNodeChanges:v,triggerEdgeChanges:y,onDelete:m,onBeforeDelete:b}=t.getState(),{nodes:j,edges:k}=await uU({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:g,onBeforeDelete:b}),S=k.length>0,N=j.length>0;if(S){const R=k.map(kw);_==null||_(k),y(R)}if(N){const R=j.map(kw);x==null||x(j),v(R)}return(N||S)&&(m==null||m({nodes:j,edges:k})),{deletedNodes:j,deletedEdges:k}},getIntersectingNodes:(f,h=!0,p)=>{const g=tw(f),x=g?f:c(f),_=p!==void 0;return x?(p||t.getState().nodes).filter(v=>{const y=t.getState().nodeLookup.get(v.id);if(y&&!g&&(v.id===f.id||!y.internals.positionAbsolute))return!1;const m=Ha(_?v:y),b=Uu(m,x);return h&&b>0||b>=m.width*m.height||b>=x.width*x.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const x=tw(f)?f:c(f);if(!x)return!1;const _=Uu(x,h);return p&&_>0||_>=h.width*h.height||_>=x.width*x.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,g=>{const x=typeof h=="function"?h(g):h;return p.replace?{...g,data:x}:{...g,data:{...g.data,...x}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,g=>{const x=typeof h=="function"?h(g):h;return p.replace?{...g,data:x}:{...g,data:{...g.data,...x}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return oU(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??hU();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return w.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const Cw=e=>e.selected,GH=typeof window<"u"?window:void 0;function qH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ce(),{deleteElements:r}=Jv(),s=Ka(e,{actInsideInputWithModifier:!1}),i=Ka(t,{target:GH});w.useEffect(()=>{if(s){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(Cw),edges:o.filter(Cw)}),n.setState({nodesSelectionActive:!1})}},[s]),w.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function YH(e){const t=Ce();w.useEffect(()=>{const n=()=>{var s,i,o,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Gv(e.current);(r.height===0||r.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",jn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Hd={position:"absolute",width:"100%",height:"100%",top:0,left:0},XH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function QH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Ns.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:g,noWheelClassName:x,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:m,selectionOnDrag:b}){const j=Ce(),k=w.useRef(null),{userSelectionActive:S,lib:N,connectionInProgress:R}=he(XH,Oe),O=Ka(h),D=w.useRef();YH(k);const M=w.useCallback(z=>{v==null||v({x:z[0],y:z[1],zoom:z[2]}),y||j.setState({transform:z})},[v,y]);return w.useEffect(()=>{if(k.current){D.current=XU({domNode:k.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:A=>j.setState(P=>P.paneDragging===A?P:{paneDragging:A}),onPanZoomStart:(A,P)=>{const{onViewportChangeStart:I,onMoveStart:C}=j.getState();C==null||C(A,P),I==null||I(P)},onPanZoom:(A,P)=>{const{onViewportChange:I,onMove:C}=j.getState();C==null||C(A,P),I==null||I(P)},onPanZoomEnd:(A,P)=>{const{onViewportChangeEnd:I,onMoveEnd:C}=j.getState();C==null||C(A,P),I==null||I(P)}});const{x:z,y:T,zoom:E}=D.current.getViewport();return j.setState({panZoom:D.current,transform:[z,T,E],domNode:k.current.closest(".react-flow")}),()=>{var A;(A=D.current)==null||A.destroy()}}},[]),w.useEffect(()=>{var z;(z=D.current)==null||z.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:O,preventScrolling:p,noPanClassName:_,userSelectionActive:S,noWheelClassName:x,lib:N,onTransformChange:M,connectionInProgress:R,selectionOnDrag:b,paneClickDistance:m})},[e,t,n,r,s,i,o,l,O,p,_,S,x,N,M,R,b,m]),a.jsx("div",{className:"react-flow__renderer",ref:k,style:Hd,children:g})}const ZH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function JH(){const{userSelectionActive:e,userSelectionRect:t}=he(ZH,Oe);return e&&t?a.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const ih=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},eW=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function tW({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ua.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:o,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:g,children:x}){const _=w.useRef(0),v=Ce(),{userSelectionActive:y,elementsSelectable:m,dragging:b,panBy:j,autoPanSpeed:k}=he(eW,Oe),S=m&&(e||y),N=w.useRef(null),R=w.useRef(),O=w.useRef(new Set),D=w.useRef(new Set),M=w.useRef(!1),z=w.useRef(!1),T=w.useRef({x:0,y:0}),E=w.useRef(!1),A=K=>{if(z.current||M.current||v.getState().connection.inProgress){z.current=!1,M.current=!1;return}u==null||u(K),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},P=K=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){K.preventDefault();return}d==null||d(K)},I=f?K=>f(K):void 0,C=K=>{z.current&&(K.stopPropagation(),z.current=!1)},L=K=>{var Le,Ft;const{domNode:X,transform:re}=v.getState();if(R.current=X==null?void 0:X.getBoundingClientRect(),!R.current)return;const te=K.target===N.current;if(!te&&!!K.target.closest(".nokey")||!e||!(o&&te||t)||K.button!==0||!K.isPrimary)return;(Ft=(Le=K.target)==null?void 0:Le.setPointerCapture)==null||Ft.call(Le,K.pointerId),z.current=!1;const{x:se,y:pe}=mn(K.nativeEvent,R.current),ve=yl({x:se,y:pe},re);v.setState({userSelectionRect:{width:0,height:0,startX:ve.x,startY:ve.y,x:se,y:pe}}),te||(K.stopPropagation(),K.preventDefault())};function F(K,X){const{userSelectionRect:re}=v.getState();if(!re)return;const{transform:te,nodeLookup:Z,edgeLookup:ee,connectionLookup:se,triggerNodeChanges:pe,triggerEdgeChanges:ve,defaultEdgeOptions:Le}=v.getState(),Ft={x:re.startX,y:re.startY},{x:Nn,y:En}=Ji(Ft,te),Kn={startX:Ft.x,startY:Ft.y,x:K<Nn?K:Nn,y:X<En?X:En,width:Math.abs(K-Nn),height:Math.abs(X-En)},go=O.current,rs=D.current;O.current=new Set(Hv(Z,Kn,te,n===Ua.Partial,!0).map(sn=>sn.id)),D.current=new Set;const ss=(Le==null?void 0:Le.selectable)??!0;for(const sn of O.current){const Gn=se.get(sn);if(Gn)for(const{edgeId:qn}of Gn.values()){const is=ee.get(qn);is&&(is.selectable??ss)&&D.current.add(qn)}}if(!nw(go,O.current)){const sn=bi(Z,O.current,!0);pe(sn)}if(!nw(rs,D.current)){const sn=bi(ee,D.current);ve(sn)}v.setState({userSelectionRect:Kn,userSelectionActive:!0,nodesSelectionActive:!1})}function V(){if(!s||!R.current)return;const[K,X]=Wv(T.current,R.current,k);j({x:K,y:X}).then(re=>{if(!z.current||!re){_.current=requestAnimationFrame(V);return}const{x:te,y:Z}=T.current;F(te,Z),_.current=requestAnimationFrame(V)})}const H=()=>{cancelAnimationFrame(_.current),_.current=0,E.current=!1};w.useEffect(()=>()=>H(),[]);const U=K=>{const{userSelectionRect:X,transform:re,resetSelectedElements:te}=v.getState();if(!R.current||!X)return;const{x:Z,y:ee}=mn(K.nativeEvent,R.current);T.current={x:Z,y:ee};const se=Ji({x:X.startX,y:X.startY},re);if(!z.current){const pe=t?0:i;if(Math.hypot(Z-se.x,ee-se.y)<=pe)return;te(),l==null||l(K)}z.current=!0,E.current||(V(),E.current=!0),F(Z,ee)},W=K=>{var X,re;if(!S){K.target===N.current&&v.getState().connection.inProgress&&(M.current=!0);return}K.button===0&&((re=(X=K.target)==null?void 0:X.releasePointerCapture)==null||re.call(X,K.pointerId),!y&&K.target===N.current&&v.getState().userSelectionRect&&(A==null||A(K)),v.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(c==null||c(K),v.setState({nodesSelectionActive:O.current.size>0})),H())},G=K=>{var X,re;(re=(X=K.target)==null?void 0:X.releasePointerCapture)==null||re.call(X,K.pointerId),H()},Y=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:He(["react-flow__pane",{draggable:Y,dragging:b,selection:e}]),onClick:S?void 0:ih(A,N),onContextMenu:ih(P,N),onWheel:ih(I,N),onPointerEnter:S?void 0:h,onPointerMove:S?U:p,onPointerUp:W,onPointerCancel:S?G:void 0,onPointerDownCapture:S?L:void 0,onClickCapture:S?C:void 0,onPointerLeave:g,ref:N,style:Hd,children:[x,a.jsx(JH,{})]})}function xm({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",jn.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function WC({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const l=Ce(),[c,u]=w.useState(!1),d=w.useRef();return w.useEffect(()=>{if(!t)return d.current=LU({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{xm({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}}),()=>{var f;(f=d.current)==null||f.destroy(),d.current=void 0}},[t,l,e]),w.useEffect(()=>{t||!e.current||!d.current||d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:o})},[n,r,t,i,e,s,o]),c}const nW=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function KC(){const e=Ce();return w.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=nW(o),p=s?i[0]:5,g=s?i[1]:5,x=n.direction.x*p*n.factor,_=n.direction.y*g*n.factor;for(const[,v]of u){if(!h(v))continue;let y={x:v.internals.positionAbsolute.x+x,y:v.internals.positionAbsolute.y+_};s&&(y=vl(y,i));const{position:m,positionAbsolute:b}=cC({nodeId:v.id,nextPosition:y,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});v.position=m,v.internals.positionAbsolute=b,f.set(v.id,v)}c(f)},[])}const ey=w.createContext(null),rW=ey.Provider;ey.Consumer;const GC=()=>w.useContext(ey),sW=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),qC=w.createContext(null);function iW({children:e}){const t=he(sW,Oe);return a.jsx(qC.Provider,{value:t,children:e})}function oW(){const e=w.useContext(qC);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const aW={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},lW=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:l,toHandle:c,isValid:u}=o;if(!l&&!s)return aW;const d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Qi.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:d&&u}};function cW({type:e="source",position:t=ne.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var E,A;const g=o||null,x=e==="target",_=Ce(),v=GC(),{connectOnClick:y,noPanClassName:m,rfId:b}=oW(),{connectingFrom:j,connectingTo:k,clickConnecting:S,isPossibleEndHandle:N,connectionInProcess:R,clickConnectionInProcess:O,valid:D}=he(lW(v,g,e),Oe);v||(A=(E=_.getState()).onError)==null||A.call(E,"010",jn.error010());const M=P=>{const{defaultEdgeOptions:I,onConnect:C,hasDefaultEdges:L}=_.getState(),F={...I,...P};if(L){const{edges:V,setEdges:H,onError:U}=_.getState();H(VH(F,V,{onError:U}))}C==null||C(F),l==null||l(F)},z=P=>{if(!v)return;const I=yC(P.nativeEvent);if(s&&(I&&P.button===0||!I)){const C=_.getState();ym.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:C.autoPanOnConnect,connectionMode:C.connectionMode,connectionRadius:C.connectionRadius,domNode:C.domNode,nodeLookup:C.nodeLookup,lib:C.lib,isTarget:x,handleId:g,nodeId:v,flowId:C.rfId,panBy:C.panBy,cancelConnection:C.cancelConnection,onConnectStart:C.onConnectStart,onConnectEnd:(...L)=>{var F,V;return(V=(F=_.getState()).onConnectEnd)==null?void 0:V.call(F,...L)},updateConnection:C.updateConnection,onConnect:M,isValidConnection:n||((...L)=>{var F,V;return((V=(F=_.getState()).isValidConnection)==null?void 0:V.call(F,...L))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:C.autoPanSpeed,dragThreshold:C.connectionDragThreshold})}I?d==null||d(P):f==null||f(P)},T=P=>{const{onClickConnectStart:I,onClickConnectEnd:C,connectionClickStartHandle:L,connectionMode:F,isValidConnection:V,lib:H,rfId:U,nodeLookup:W,connection:G}=_.getState();if(!v||!L&&!s)return;if(!L){I==null||I(P.nativeEvent,{nodeId:v,handleId:g,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:v,type:e,id:g}});return}const Y=gC(P.target),K=n||V,{connection:X,isValid:re}=ym.isValid(P.nativeEvent,{handle:{nodeId:v,id:g,type:e},connectionMode:F,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:K,flowId:U,doc:Y,lib:H,nodeLookup:W});re&&X&&M(X);const te=structuredClone(G);delete te.inProgress,te.toPosition=te.toHandle?te.toHandle.position:null,C==null||C(P,te),_.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":g,"data-nodeid":v,"data-handlepos":t,"data-id":`${b}-${v}-${g}-${e}`,className:He(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,u,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:i,clickconnecting:S,connectingfrom:j,connectingto:k,valid:D,connectionindicator:r&&(!R||N)&&(R||O?i:s)}]),onMouseDown:z,onTouchStart:z,onClick:y?T:void 0,ref:p,...h,children:c})}const to=w.memo(BC(cW));function uW({data:e,isConnectable:t,sourcePosition:n=ne.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(to,{type:"source",position:n,isConnectable:t})]})}function dW({data:e,isConnectable:t,targetPosition:n=ne.Top,sourcePosition:r=ne.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(to,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(to,{type:"source",position:r,isConnectable:t})]})}function fW(){return null}function hW({data:e,isConnectable:t,targetPosition:n=ne.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(to,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Hu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Tw={input:uW,default:dW,output:hW,group:fW};function pW(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const mW=e=>{const{width:t,height:n,x:r,y:s}=gl(e.nodeLookup,{filter:i=>!!i.selected});return{width:pn(t)?t:null,height:pn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function gW({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ce(),{width:s,height:i,transformString:o,userSelectionActive:l}=he(mW,Oe),c=KC(),u=w.useRef(null);w.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&s!==null&&i!==null;if(WC({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const g=r.getState().nodes.filter(x=>x.selected);e(p,g)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Hu,p.key)&&(p.preventDefault(),c({direction:Hu[p.key],factor:p.shiftKey?4:1}))};return a.jsx("div",{className:He(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const Pw=typeof window<"u"?window:void 0,vW=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function YC({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:g,panActivationKeyCode:x,zoomActivationKeyCode:_,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:b,panOnScrollSpeed:j,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:N,autoPanOnSelection:R,defaultViewport:O,translateExtent:D,minZoom:M,maxZoom:z,preventScrolling:T,onSelectionContextMenu:E,noWheelClassName:A,noPanClassName:P,disableKeyboardA11y:I,onViewportChange:C,isControlledViewport:L}){const{nodesSelectionActive:F,userSelectionActive:V}=he(vW,Oe),H=Ka(u,{target:Pw}),U=Ka(x,{target:Pw}),W=U||N,G=U||b,Y=d&&W!==!0,K=H||V||Y;return qH({deleteKeyCode:c,multiSelectionKeyCode:g}),a.jsx(QH,{onPaneContextMenu:i,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:G,panOnScrollSpeed:j,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:!H&&W,defaultViewport:O,translateExtent:D,minZoom:M,maxZoom:z,zoomActivationKeyCode:_,preventScrolling:T,noWheelClassName:A,noPanClassName:P,onViewportChange:C,isControlledViewport:L,paneClickDistance:l,selectionOnDrag:Y,children:a.jsxs(tW,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:W,autoPanOnSelection:R,isSelecting:!!K,selectionMode:f,selectionKeyPressed:H,paneClickDistance:l,selectionOnDrag:Y,children:[e,F&&a.jsx(gW,{onSelectionContextMenu:E,noPanClassName:P,disableKeyboardA11y:I})]})})}YC.displayName="FlowRenderer";const yW=w.memo(YC),xW=e=>t=>e?Hv(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function _W(e){return he(w.useCallback(xW(e),[e]),Oe)}const wW=e=>e.updateNodeInternals;function bW(){const e=he(wW),[t]=w.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return w.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function jW({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Ce(),i=w.useRef(null),o=w.useRef(null),l=w.useRef(e.sourcePosition),c=w.useRef(e.targetPosition),u=w.useRef(t),d=n&&!!e.internals.handleBounds;return w.useEffect(()=>{i.current&&!e.hidden&&(!d||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[d,e.hidden]),w.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),w.useEffect(()=>{if(i.current){const f=u.current!==t,h=l.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function SW({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:g,rfId:x,nodeTypes:_,nodeClickDistance:v,onError:y}){const{node:m,internals:b,isParent:j}=he(K=>{const X=K.nodeLookup.get(e),re=K.parentLookup.has(e);return{node:X,internals:X.internals,isParent:re}},Oe);let k=m.type||"default",S=(_==null?void 0:_[k])||Tw[k];S===void 0&&(y==null||y("003",jn.error003(k)),k="default",S=(_==null?void 0:_.default)||Tw.default);const N=!!(m.draggable||l&&typeof m.draggable>"u"),R=!!(m.selectable||c&&typeof m.selectable>"u"),O=!!(m.connectable||u&&typeof m.connectable>"u"),D=!!(m.focusable||d&&typeof m.focusable>"u"),M=Ce(),z=pC(m),T=jW({node:m,nodeType:k,hasDimensions:z,resizeObserver:f}),E=WC({nodeRef:T,disabled:m.hidden||!N,noDragClassName:h,handleSelector:m.dragHandle,nodeId:e,isSelectable:R,nodeClickDistance:v}),A=KC();if(m.hidden)return null;const P=Wn(m),I=pW(m),C=R||N||t||n||r||s,L=n?K=>n(K,{...b.userNode}):void 0,F=r?K=>r(K,{...b.userNode}):void 0,V=s?K=>s(K,{...b.userNode}):void 0,H=i?K=>i(K,{...b.userNode}):void 0,U=o?K=>o(K,{...b.userNode}):void 0,W=K=>{const{selectNodesOnDrag:X,nodeDragThreshold:re}=M.getState();R&&(!X||!N||re>0)&&xm({id:e,store:M,nodeRef:T}),t&&t(K,{...b.userNode})},G=K=>{if(!(vC(K.nativeEvent)||g)){if(sC.includes(K.key)&&R){const X=K.key==="Escape";xm({id:e,store:M,unselect:X,nodeRef:T})}else if(N&&m.selected&&Object.prototype.hasOwnProperty.call(Hu,K.key)){K.preventDefault();const{ariaLabelConfig:X}=M.getState();M.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:K.key.replace("Arrow","").toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),A({direction:Hu[K.key],factor:K.shiftKey?4:1})}}},Y=()=>{var se;if(g||!((se=T.current)!=null&&se.matches(":focus-visible")))return;const{transform:K,width:X,height:re,autoPanOnNodeFocus:te,setCenter:Z}=M.getState();if(!te)return;Hv(new Map([[e,m]]),{x:0,y:0,width:X,height:re},K,!0).length>0||Z(m.position.x+P.width/2,m.position.y+P.height/2,{zoom:K[2]})};return a.jsx("div",{className:He(["react-flow__node",`react-flow__node-${k}`,{[p]:N},m.className,{selected:m.selected,selectable:R,parent:j,draggable:N,dragging:E}]),ref:T,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:C?"all":"none",visibility:z?"visible":"hidden",...m.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:F,onMouseLeave:V,onContextMenu:H,onClick:W,onDoubleClick:U,onKeyDown:D?G:void 0,tabIndex:D?0:void 0,onFocus:D?Y:void 0,role:m.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${DC}-${x}`,"aria-label":m.ariaLabel,...m.domAttributes,children:a.jsx(rW,{value:e,children:a.jsx(S,{id:e,data:m.data,type:k,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:m.selected??!1,selectable:R,draggable:N,deletable:m.deletable??!0,isConnectable:O,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:E,dragHandle:m.dragHandle,zIndex:b.z,parentId:m.parentId,...P})})})}var kW=w.memo(SW);const NW=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function XC(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:s}=he(NW,Oe),i=_W(e.onlyRenderVisibleElements),o=bW();return a.jsx("div",{className:"react-flow__nodes",style:Hd,children:i.map(l=>a.jsx(kW,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}XC.displayName="NodeRenderer";const EW=w.memo(XC);function CW(e){return he(w.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&vU({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),Oe)}const TW=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},PW=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Aw={[Vu.Arrow]:TW,[Vu.ArrowClosed]:PW};function AW(e){const t=Ce();return w.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(Aw,e)?Aw[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",jn.error009(e)),null)},[e])}const RW=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=AW(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},QC=({defaultColor:e,rfId:t})=>{const n=he(i=>i.edges),r=he(i=>i.defaultEdgeOptions),s=w.useMemo(()=>kU(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:s.map(i=>a.jsx(RW,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};QC.displayName="MarkerDefinitions";var IW=w.memo(QC);function ZC({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=w.useState({x:1,y:0,width:0,height:0}),p=He(["react-flow__edge-textwrapper",u]),g=w.useRef(null);return w.useEffect(()=>{if(g.current){const x=g.current.getBBox();h({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&a.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}ZC.displayName="EdgeText";const MW=w.memo(ZC);function Wd({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...d,d:e,fill:"none",className:He(["react-flow__edge-path",d.className])}),u?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&pn(t)&&pn(n)?a.jsx(MW,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function Rw({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===ne.Left||e===ne.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function JC({sourceX:e,sourceY:t,sourcePosition:n=ne.Bottom,targetX:r,targetY:s,targetPosition:i=ne.Top}){const[o,l]=Rw({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=Rw({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=xC({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${l} ${c},${u} ${r},${s}`,d,f,h,p]}function eT(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:_,interactionWidth:v})=>{const[y,m,b]=JC({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l}),j=e.isInternal?void 0:t;return a.jsx(Wd,{id:j,path:y,labelX:m,labelY:b,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:_,interactionWidth:v})})}const OW=eT({isInternal:!1}),tT=eT({isInternal:!0});OW.displayName="SimpleBezierEdge";tT.displayName="SimpleBezierEdgeInternal";function nT(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=ne.Bottom,targetPosition:g=ne.Top,markerEnd:x,markerStart:_,pathOptions:v,interactionWidth:y})=>{const[m,b,j]=mm({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:g,borderRadius:v==null?void 0:v.borderRadius,offset:v==null?void 0:v.offset,stepPosition:v==null?void 0:v.stepPosition}),k=e.isInternal?void 0:t;return a.jsx(Wd,{id:k,path:m,labelX:b,labelY:j,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:x,markerStart:_,interactionWidth:y})})}const rT=nT({isInternal:!1}),sT=nT({isInternal:!0});rT.displayName="SmoothStepEdge";sT.displayName="SmoothStepEdgeInternal";function iT(e){return w.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return a.jsx(rT,{...n,id:r,pathOptions:w.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const LW=iT({isInternal:!1}),oT=iT({isInternal:!0});LW.displayName="StepEdge";oT.displayName="StepEdgeInternal";function aT(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:x})=>{const[_,v,y]=bC({sourceX:n,sourceY:r,targetX:s,targetY:i}),m=e.isInternal?void 0:t;return a.jsx(Wd,{id:m,path:_,labelX:v,labelY:y,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:x})})}const $W=aT({isInternal:!1}),lT=aT({isInternal:!0});$W.displayName="StraightEdge";lT.displayName="StraightEdgeInternal";function cT(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=ne.Bottom,targetPosition:l=ne.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:_,pathOptions:v,interactionWidth:y})=>{const[m,b,j]=_C({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l,curvature:v==null?void 0:v.curvature}),k=e.isInternal?void 0:t;return a.jsx(Wd,{id:k,path:m,labelX:b,labelY:j,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:_,interactionWidth:y})})}const DW=cT({isInternal:!1}),uT=cT({isInternal:!0});DW.displayName="BezierEdge";uT.displayName="BezierEdgeInternal";const Iw={default:uT,straight:lT,step:oT,smoothstep:sT,simplebezier:tT},Mw={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},zW=(e,t,n)=>n===ne.Left?e-t:n===ne.Right?e+t:e,FW=(e,t,n)=>n===ne.Top?e-t:n===ne.Bottom?e+t:e,Ow="react-flow__edgeupdater";function Lw({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:He([Ow,`${Ow}-${l}`]),cx:zW(t,r,e),cy:FW(n,r,e),r,stroke:"transparent",fill:"transparent"})}function VW({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=Ce(),x=(b,j)=>{if(b.button!==0)return;const{autoPanOnConnect:k,domNode:S,connectionMode:N,connectionRadius:R,lib:O,onConnectStart:D,cancelConnection:M,nodeLookup:z,rfId:T,panBy:E,updateConnection:A}=g.getState(),P=j.type==="target",I=(F,V)=>{h(!1),f==null||f(F,n,j.type,V)},C=F=>u==null?void 0:u(n,F),L=(F,V)=>{h(!0),d==null||d(b,n,j.type),D==null||D(F,V)};ym.onPointerDown(b.nativeEvent,{autoPanOnConnect:k,connectionMode:N,connectionRadius:R,domNode:S,handleId:j.id,nodeId:j.nodeId,nodeLookup:z,isTarget:P,edgeUpdaterType:j.type,lib:O,flowId:T,cancelConnection:M,panBy:E,isValidConnection:(...F)=>{var V,H;return((H=(V=g.getState()).isValidConnection)==null?void 0:H.call(V,...F))??!0},onConnect:C,onConnectStart:L,onConnectEnd:(...F)=>{var V,H;return(H=(V=g.getState()).onConnectEnd)==null?void 0:H.call(V,...F)},onReconnectEnd:I,updateConnection:A,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:b.currentTarget})},_=b=>x(b,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),v=b=>x(b,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),y=()=>p(!0),m=()=>p(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(Lw,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:_,onMouseEnter:y,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&a.jsx(Lw,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:v,onMouseEnter:y,onMouseOut:m,type:"target"})]})}function BW({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:g,edgeTypes:x,noPanClassName:_,onError:v,disableKeyboardA11y:y}){let m=he(Z=>Z.edgeLookup.get(e));const b=he(Z=>Z.defaultEdgeOptions);m=b?{...b,...m}:m;let j=m.type||"default",k=(x==null?void 0:x[j])||Iw[j];k===void 0&&(v==null||v("011",jn.error011(j)),j="default",k=(x==null?void 0:x.default)||Iw.default);const S=!!(m.focusable||t&&typeof m.focusable>"u"),N=typeof f<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),R=!!(m.selectable||r&&typeof m.selectable>"u"),O=w.useRef(null),[D,M]=w.useState(!1),[z,T]=w.useState(!1),E=Ce(),{zIndex:A=m.zIndex,sourceX:P,sourceY:I,targetX:C,targetY:L,sourcePosition:F,targetPosition:V}=he(w.useCallback(Z=>{const ee=Z.nodeLookup.get(m.source),se=Z.nodeLookup.get(m.target);if(!ee||!se)return Mw;const pe=SU({id:e,sourceNode:ee,targetNode:se,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:Z.connectionMode,onError:v}),ve=gU({selected:m.selected,zIndex:m.zIndex,sourceNode:ee,targetNode:se,elevateOnSelect:Z.elevateEdgesOnSelect,zIndexMode:Z.zIndexMode});return{...pe||Mw,zIndex:ve}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),Oe),H=w.useMemo(()=>m.markerStart?`url('#${gm(m.markerStart,g)}')`:void 0,[m.markerStart,g]),U=w.useMemo(()=>m.markerEnd?`url('#${gm(m.markerEnd,g)}')`:void 0,[m.markerEnd,g]);if(m.hidden||P===null||I===null||C===null||L===null)return null;const W=Z=>{var ve;const{addSelectedEdges:ee,unselectNodesAndEdges:se,multiSelectionActive:pe}=E.getState();R&&(E.setState({nodesSelectionActive:!1}),m.selected&&pe?(se({nodes:[],edges:[m]}),(ve=O.current)==null||ve.blur()):ee([e])),s&&s(Z,m)},G=i?Z=>{i(Z,{...m})}:void 0,Y=o?Z=>{o(Z,{...m})}:void 0,K=l?Z=>{l(Z,{...m})}:void 0,X=c?Z=>{c(Z,{...m})}:void 0,re=u?Z=>{u(Z,{...m})}:void 0,te=Z=>{var ee;if(!y&&sC.includes(Z.key)&&R){const{unselectNodesAndEdges:se,addSelectedEdges:pe}=E.getState();Z.key==="Escape"?((ee=O.current)==null||ee.blur(),se({edges:[m]})):pe([e])}};return a.jsx("svg",{style:{zIndex:A},children:a.jsxs("g",{className:He(["react-flow__edge",`react-flow__edge-${j}`,m.className,_,{selected:m.selected,animated:m.animated,inactive:!R&&!s,updating:D,selectable:R}]),onClick:W,onDoubleClick:G,onContextMenu:Y,onMouseEnter:K,onMouseMove:X,onMouseLeave:re,onKeyDown:S?te:void 0,tabIndex:S?0:void 0,role:m.ariaRole??(S?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":m.ariaLabel===null?void 0:m.ariaLabel||`Edge from ${m.source} to ${m.target}`,"aria-describedby":S?`${zC}-${g}`:void 0,ref:O,...m.domAttributes,children:[!z&&a.jsx(k,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:R,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:P,sourceY:I,targetX:C,targetY:L,sourcePosition:F,targetPosition:V,data:m.data,style:m.style,sourceHandleId:m.sourceHandle,targetHandleId:m.targetHandle,markerStart:H,markerEnd:U,pathOptions:"pathOptions"in m?m.pathOptions:void 0,interactionWidth:m.interactionWidth}),N&&a.jsx(VW,{edge:m,isReconnectable:N,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:P,sourceY:I,targetX:C,targetY:L,sourcePosition:F,targetPosition:V,setUpdateHover:M,setReconnecting:T})]})})}var UW=w.memo(BW);const HW=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function dT({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:g,disableKeyboardA11y:x}){const{edgesFocusable:_,edgesReconnectable:v,elementsSelectable:y,onError:m}=he(HW,Oe),b=CW(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(IW,{defaultColor:e,rfId:n}),b.map(j=>a.jsx(UW,{id:j,edgesFocusable:_,edgesReconnectable:v,elementsSelectable:y,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:g,rfId:n,onError:m,edgeTypes:r,disableKeyboardA11y:x},j))]})}dT.displayName="EdgeRenderer";const WW=w.memo(dT),$w=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function KW({children:e}){const t=Ce(),n=w.useRef(null),[r]=w.useState(()=>t.getState().transform);return UC(()=>{let s=null;const i=()=>{const o=t.getState().transform;s&&o[0]===s[0]&&o[1]===s[1]&&o[2]===s[2]||(s=o,n.current&&(n.current.style.transform=$w(o)))};return i(),t.subscribe(i)},[t]),a.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:$w(r)},children:e})}function GW(e){const t=Jv(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const qW=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function YW(e){const t=he(qW),n=Ce();return w.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function XW(e){return e.connection.inProgress?{...e.connection,to:yl(e.connection.to,e.transform)}:{...e.connection}}function QW(e){return XW}function ZW(e){const t=QW();return he(t,Oe)}const JW=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function e7({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:l,inProgress:c}=he(JW,Oe);return!(i&&s&&c)?null:a.jsx("svg",{style:e,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:He(["react-flow__connection",aC(l)]),children:a.jsx(fT,{style:t,type:n,CustomComponent:r,isValid:l})})})}const fT=({style:e,type:t=Mr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=ZW();if(!s)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:aC(r),toNode:d,toHandle:f,pointer:p});let g="";const x={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Mr.Bezier:[g]=_C(x);break;case Mr.SimpleBezier:[g]=JC(x);break;case Mr.Step:[g]=mm({...x,borderRadius:0});break;case Mr.SmoothStep:[g]=mm(x);break;default:[g]=bC(x)}return a.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};fT.displayName="ConnectionLine";const t7={};function Dw(e=t7){w.useRef(e),Ce(),w.useEffect(()=>{},[e])}function n7(){Ce(),w.useRef(!1),w.useEffect(()=>{},[])}function hT({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:g,connectionLineStyle:x,connectionLineComponent:_,connectionLineContainerStyle:v,selectionKeyCode:y,selectionOnDrag:m,selectionMode:b,multiSelectionKeyCode:j,panActivationKeyCode:k,zoomActivationKeyCode:S,deleteKeyCode:N,onlyRenderVisibleElements:R,elementsSelectable:O,defaultViewport:D,translateExtent:M,minZoom:z,maxZoom:T,preventScrolling:E,defaultMarkerColor:A,zoomOnScroll:P,zoomOnPinch:I,panOnScroll:C,panOnScrollSpeed:L,panOnScrollMode:F,zoomOnDoubleClick:V,panOnDrag:H,autoPanOnSelection:U,onPaneClick:W,onPaneMouseEnter:G,onPaneMouseMove:Y,onPaneMouseLeave:K,onPaneScroll:X,onPaneContextMenu:re,paneClickDistance:te,nodeClickDistance:Z,onEdgeContextMenu:ee,onEdgeMouseEnter:se,onEdgeMouseMove:pe,onEdgeMouseLeave:ve,reconnectRadius:Le,onReconnect:Ft,onReconnectStart:Nn,onReconnectEnd:En,noDragClassName:Kn,noWheelClassName:go,noPanClassName:rs,disableKeyboardA11y:ss,nodeExtent:sn,rfId:Gn,viewport:qn,onViewportChange:is,nodesDraggable:qd}){return Dw(e),Dw(t),n7(),GW(n),YW(qn),a.jsx(yW,{onPaneClick:W,onPaneMouseEnter:G,onPaneMouseMove:Y,onPaneMouseLeave:K,onPaneContextMenu:re,onPaneScroll:X,paneClickDistance:te,deleteKeyCode:N,selectionKeyCode:y,selectionOnDrag:m,selectionMode:b,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:O,zoomOnScroll:P,zoomOnPinch:I,zoomOnDoubleClick:V,panOnScroll:C,panOnScrollSpeed:L,panOnScrollMode:F,panOnDrag:H,autoPanOnSelection:U,defaultViewport:D,translateExtent:M,minZoom:z,maxZoom:T,onSelectionContextMenu:f,preventScrolling:E,noDragClassName:Kn,noWheelClassName:go,noPanClassName:rs,disableKeyboardA11y:ss,onViewportChange:is,isControlledViewport:!!qn,children:a.jsxs(KW,{children:[a.jsx(WW,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:Ft,onReconnectStart:Nn,onReconnectEnd:En,onlyRenderVisibleElements:R,onEdgeContextMenu:ee,onEdgeMouseEnter:se,onEdgeMouseMove:pe,onEdgeMouseLeave:ve,reconnectRadius:Le,defaultMarkerColor:A,noPanClassName:rs,disableKeyboardA11y:ss,rfId:Gn}),a.jsx(e7,{style:x,type:g,component:_,containerStyle:v}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(EW,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Z,onlyRenderVisibleElements:R,noPanClassName:rs,noDragClassName:Kn,disableKeyboardA11y:ss,nodeExtent:sn,rfId:Gn,nodesDraggable:qd}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}hT.displayName="GraphView";const r7=w.memo(hT),s7=hC(),zw=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,g=new Map,x=new Map,_=new Map,v=r??t??[],y=n??e??[],m=d??[0,0],b=f??Ba;kC(x,_,v);const{nodesInitialized:j}=vm(y,p,g,{nodeOrigin:m,nodeExtent:b,zIndexMode:h});let k=[0,0,1];if(o&&s&&i){const S=gl(p,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:N,y:R,zoom:O}=Kv(S,s,i,c,u,(l==null?void 0:l.padding)??.1);k=[N,R,O]}return{rfId:"1",width:s??0,height:i??0,transform:k,nodes:y,nodesInitialized:j,nodeLookup:p,parentLookup:g,edges:v,edgeLookup:_,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Ba,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Qi.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:m,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...oC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:s7,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:iC,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},i7=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>vH((p,g)=>{async function x(){const{nodeLookup:_,panZoom:v,fitViewOptions:y,fitViewResolver:m,width:b,height:j,minZoom:k,maxZoom:S}=g();v&&(await cU({nodes:_,width:b,height:j,panZoom:v,minZoom:k,maxZoom:S},y),m==null||m.resolve(!0),p({fitViewResolver:null}))}return{...zw({nodes:e,edges:t,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:_=>{const{nodeLookup:v,parentLookup:y,nodeOrigin:m,elevateNodesOnSelect:b,fitViewQueued:j,zIndexMode:k,nodesSelectionActive:S}=g(),{nodesInitialized:N,hasSelectedNodes:R}=vm(_,v,y,{nodeOrigin:m,nodeExtent:f,elevateNodesOnSelect:b,checkEquality:!0,zIndexMode:k}),O=S&&R;j&&N?(x(),p({nodes:_,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:O})):p({nodes:_,nodesInitialized:N,nodesSelectionActive:O})},setEdges:_=>{const{connectionLookup:v,edgeLookup:y}=g();kC(v,y,_),p({edges:_})},setDefaultNodesAndEdges:(_,v)=>{if(_){const{setNodes:y}=g();y(_),p({hasDefaultNodes:!0})}if(v){const{setEdges:y}=g();y(v),p({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:v,nodeLookup:y,parentLookup:m,domNode:b,nodeOrigin:j,nodeExtent:k,debug:S,fitViewQueued:N,zIndexMode:R}=g(),{changes:O,updatedInternals:D}=RU(_,y,m,b,j,k,R);D&&(CU(y,m,{nodeOrigin:j,nodeExtent:k,zIndexMode:R}),N?(x(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(O==null?void 0:O.length)>0&&(S&&console.log("React Flow: trigger node changes",O),v==null||v(O)))},updateNodePositions:(_,v=!1)=>{const y=[];let m=[];const{nodeLookup:b,triggerNodeChanges:j,connection:k,updateConnection:S,onNodesChangeMiddlewareMap:N}=g();for(const[R,O]of _){const D=b.get(R),M=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(O!=null&&O.position)),z={id:R,type:"position",position:M?{x:Math.max(0,O.position.x),y:Math.max(0,O.position.y)}:O.position,dragging:v};if(D&&k.inProgress&&k.fromNode.id===D.id){const T=Vs(D,k.fromHandle,ne.Left,!0);S({...k,from:T})}M&&D.parentId&&y.push({id:R,parentId:D.parentId,rect:{...O.internals.positionAbsolute,width:O.measured.width??0,height:O.measured.height??0}}),m.push(z)}if(y.length>0){const{parentLookup:R,nodeOrigin:O}=g(),D=Zv(y,b,R,O);m.push(...D)}for(const R of N.values())m=R(m);j(m)},triggerNodeChanges:_=>{const{onNodesChange:v,setNodes:y,nodes:m,hasDefaultNodes:b,debug:j}=g();if(_!=null&&_.length){if(b){const k=DH(_,m);y(k)}j&&console.log("React Flow: trigger node changes",_),v==null||v(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:v,setEdges:y,edges:m,hasDefaultEdges:b,debug:j}=g();if(_!=null&&_.length){if(b){const k=zH(_,m);y(k)}j&&console.log("React Flow: trigger edge changes",_),v==null||v(_)}},addSelectedNodes:_=>{const{multiSelectionActive:v,edgeLookup:y,nodeLookup:m,triggerNodeChanges:b,triggerEdgeChanges:j}=g();if(v){const k=_.map(S=>ps(S,!0));b(k);return}b(bi(m,new Set([..._]),!0)),j(bi(y))},addSelectedEdges:_=>{const{multiSelectionActive:v,edgeLookup:y,nodeLookup:m,triggerNodeChanges:b,triggerEdgeChanges:j}=g();if(v){const k=_.map(S=>ps(S,!0));j(k);return}j(bi(y,new Set([..._]))),b(bi(m,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:v}={})=>{const{edges:y,nodes:m,nodeLookup:b,triggerNodeChanges:j,triggerEdgeChanges:k}=g(),S=_||m,N=v||y,R=[];for(const D of S){if(!D.selected)continue;const M=b.get(D.id);M&&(M.selected=!1),R.push(ps(D.id,!1))}const O=[];for(const D of N)D.selected&&O.push(ps(D.id,!1));j(R),k(O)},setMinZoom:_=>{const{panZoom:v,maxZoom:y}=g();v==null||v.setScaleExtent([_,y]),p({minZoom:_})},setMaxZoom:_=>{const{panZoom:v,minZoom:y}=g();v==null||v.setScaleExtent([y,_]),p({maxZoom:_})},setTranslateExtent:_=>{var v;(v=g().panZoom)==null||v.setTranslateExtent(_),p({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:v,triggerNodeChanges:y,triggerEdgeChanges:m,elementsSelectable:b}=g();if(!b)return;const j=v.reduce((S,N)=>N.selected?[...S,ps(N.id,!1)]:S,[]),k=_.reduce((S,N)=>N.selected?[...S,ps(N.id,!1)]:S,[]);y(j),m(k)},setNodeExtent:_=>{const{nodes:v,nodeLookup:y,parentLookup:m,nodeOrigin:b,elevateNodesOnSelect:j,nodeExtent:k,zIndexMode:S}=g();_[0][0]===k[0][0]&&_[0][1]===k[0][1]&&_[1][0]===k[1][0]&&_[1][1]===k[1][1]||(vm(v,y,m,{nodeOrigin:b,nodeExtent:_,elevateNodesOnSelect:j,checkEquality:!1,zIndexMode:S}),p({nodeExtent:_}))},panBy:_=>{const{transform:v,width:y,height:m,panZoom:b,translateExtent:j}=g();return IU({delta:_,panZoom:b,transform:v,translateExtent:j,width:y,height:m})},setCenter:async(_,v,y)=>{const{width:m,height:b,maxZoom:j,panZoom:k}=g();if(!k)return!1;const S=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:j;return await k.setViewport({x:m/2-_*S,y:b/2-v*S,zoom:S},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),!0},cancelConnection:()=>{p({connection:{...oC}})},updateConnection:_=>{p({connection:_})},reset:()=>p({...zw()})}},Object.is);function o7({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[g]=w.useState(()=>i7({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return a.jsx(yH,{value:g,children:a.jsx(HH,{children:a.jsx(iW,{children:p})})})}function a7({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return w.useContext(Bd)?a.jsx(a.Fragment,{children:e}):a.jsx(o7,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const l7={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function c7({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:g,onConnectEnd:x,onClickConnectStart:_,onClickConnectEnd:v,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:b,onNodeContextMenu:j,onNodeDoubleClick:k,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:R,onNodesDelete:O,onEdgesDelete:D,onDelete:M,onSelectionChange:z,onSelectionDragStart:T,onSelectionDrag:E,onSelectionDragStop:A,onSelectionContextMenu:P,onSelectionStart:I,onSelectionEnd:C,onBeforeDelete:L,connectionMode:F,connectionLineType:V=Mr.Bezier,connectionLineStyle:H,connectionLineComponent:U,connectionLineContainerStyle:W,deleteKeyCode:G="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:K=!1,selectionMode:X=Ua.Full,panActivationKeyCode:re="Space",multiSelectionKeyCode:te=Wa()?"Meta":"Control",zoomActivationKeyCode:Z=Wa()?"Meta":"Control",snapToGrid:ee,snapGrid:se,onlyRenderVisibleElements:pe=!1,selectNodesOnDrag:ve,nodesDraggable:Le,autoPanOnNodeFocus:Ft,nodesConnectable:Nn,nodesFocusable:En,nodeOrigin:Kn=FC,edgesFocusable:go,edgesReconnectable:rs,elementsSelectable:ss=!0,defaultViewport:sn=AH,minZoom:Gn=.5,maxZoom:qn=2,translateExtent:is=Ba,preventScrolling:qd=!0,nodeExtent:Yd,defaultMarkerColor:XT="#b1b1b7",zoomOnScroll:QT=!0,zoomOnPinch:ZT=!0,panOnScroll:JT=!1,panOnScrollSpeed:eP=.5,panOnScrollMode:tP=Ns.Free,zoomOnDoubleClick:nP=!0,panOnDrag:rP=!0,onPaneClick:sP,onPaneMouseEnter:iP,onPaneMouseMove:oP,onPaneMouseLeave:aP,onPaneScroll:lP,onPaneContextMenu:cP,paneClickDistance:uP=1,nodeClickDistance:dP=0,children:fP,onReconnect:hP,onReconnectStart:pP,onReconnectEnd:mP,onEdgeContextMenu:gP,onEdgeDoubleClick:vP,onEdgeMouseEnter:yP,onEdgeMouseMove:xP,onEdgeMouseLeave:_P,reconnectRadius:wP=10,onNodesChange:bP,onEdgesChange:jP,noDragClassName:SP="nodrag",noWheelClassName:kP="nowheel",noPanClassName:cy="nopan",fitView:uy,fitViewOptions:dy,connectOnClick:NP,attributionPosition:EP,proOptions:CP,defaultEdgeOptions:TP,elevateNodesOnSelect:PP=!0,elevateEdgesOnSelect:AP=!1,disableKeyboardA11y:fy=!1,autoPanOnConnect:RP,autoPanOnNodeDrag:IP,autoPanOnSelection:MP=!0,autoPanSpeed:OP,connectionRadius:LP,isValidConnection:$P,onError:DP,style:zP,id:hy,nodeDragThreshold:FP,connectionDragThreshold:VP,viewport:BP,onViewportChange:UP,width:HP,height:WP,colorMode:KP="light",debug:GP,onScroll:_l,ariaLabelConfig:qP,zIndexMode:py="basic",...YP},XP){const Xd=hy||"1",QP=OH(KP),ZP=w.useCallback(my=>{my.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),_l==null||_l(my)},[_l]);return a.jsx("div",{"data-testid":"rf__wrapper",...YP,onScroll:ZP,style:{...zP,...l7},ref:XP,className:He(["react-flow",s,QP]),id:hy,role:"application",children:a.jsxs(a7,{nodes:e,edges:t,width:HP,height:WP,fitView:uy,fitViewOptions:dy,minZoom:Gn,maxZoom:qn,nodeOrigin:Kn,nodeExtent:Yd,zIndexMode:py,children:[a.jsx(MH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:g,onConnectEnd:x,onClickConnectStart:_,onClickConnectEnd:v,nodesDraggable:Le,autoPanOnNodeFocus:Ft,nodesConnectable:Nn,nodesFocusable:En,edgesFocusable:go,edgesReconnectable:rs,elementsSelectable:ss,elevateNodesOnSelect:PP,elevateEdgesOnSelect:AP,minZoom:Gn,maxZoom:qn,nodeExtent:Yd,onNodesChange:bP,onEdgesChange:jP,snapToGrid:ee,snapGrid:se,connectionMode:F,translateExtent:is,connectOnClick:NP,defaultEdgeOptions:TP,fitView:uy,fitViewOptions:dy,onNodesDelete:O,onEdgesDelete:D,onDelete:M,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:R,onSelectionDrag:E,onSelectionDragStart:T,onSelectionDragStop:A,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:cy,nodeOrigin:Kn,rfId:Xd,autoPanOnConnect:RP,autoPanOnNodeDrag:IP,autoPanSpeed:OP,onError:DP,connectionRadius:LP,isValidConnection:$P,selectNodesOnDrag:ve,nodeDragThreshold:FP,connectionDragThreshold:VP,onBeforeDelete:L,debug:GP,ariaLabelConfig:qP,zIndexMode:py}),a.jsx(r7,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:b,onNodeContextMenu:j,onNodeDoubleClick:k,nodeTypes:i,edgeTypes:o,connectionLineType:V,connectionLineStyle:H,connectionLineComponent:U,connectionLineContainerStyle:W,selectionKeyCode:Y,selectionOnDrag:K,selectionMode:X,deleteKeyCode:G,multiSelectionKeyCode:te,panActivationKeyCode:re,zoomActivationKeyCode:Z,onlyRenderVisibleElements:pe,defaultViewport:sn,translateExtent:is,minZoom:Gn,maxZoom:qn,preventScrolling:qd,zoomOnScroll:QT,zoomOnPinch:ZT,zoomOnDoubleClick:nP,panOnScroll:JT,panOnScrollSpeed:eP,panOnScrollMode:tP,panOnDrag:rP,autoPanOnSelection:MP,onPaneClick:sP,onPaneMouseEnter:iP,onPaneMouseMove:oP,onPaneMouseLeave:aP,onPaneScroll:lP,onPaneContextMenu:cP,paneClickDistance:uP,nodeClickDistance:dP,onSelectionContextMenu:P,onSelectionStart:I,onSelectionEnd:C,onReconnect:hP,onReconnectStart:pP,onReconnectEnd:mP,onEdgeContextMenu:gP,onEdgeDoubleClick:vP,onEdgeMouseEnter:yP,onEdgeMouseMove:xP,onEdgeMouseLeave:_P,reconnectRadius:wP,defaultMarkerColor:XT,noDragClassName:SP,noWheelClassName:kP,noPanClassName:cy,rfId:Xd,disableKeyboardA11y:fy,nodeExtent:Yd,viewport:BP,onViewportChange:UP,nodesDraggable:Le}),a.jsx(PH,{onSelectionChange:z}),fP,a.jsx(kH,{proOptions:CP,position:EP}),a.jsx(SH,{rfId:Xd,disableKeyboardA11y:fy})]})})}var u7=BC(c7);function d7({dimensions:e,lineWidth:t,variant:n,className:r}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:He(["react-flow__background-pattern",n,r])})}function f7({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:He(["react-flow__background-pattern","dots",t])})}var fr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(fr||(fr={}));const h7={[fr.Dots]:1,[fr.Lines]:1,[fr.Cross]:6},p7=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function pT({id:e,variant:t=fr.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:l,style:c,className:u,patternClassName:d}){const f=w.useRef(null),{transform:h,patternId:p}=he(p7,Oe),g=r||h7[t],x=t===fr.Dots,_=t===fr.Cross,v=Array.isArray(n)?n:[n,n],y=[v[0]*h[2]||1,v[1]*h[2]||1],m=g*h[2],b=Array.isArray(i)?i:[i,i],j=_?[m,m]:y,k=[b[0]*h[2]||1+j[0]/2,b[1]*h[2]||1+j[1]/2],S=`${p}${e||""}`;return a.jsxs("svg",{className:He(["react-flow__background",u]),style:{...c,...Hd,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[a.jsx("pattern",{id:S,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:x?a.jsx(f7,{radius:m/2,className:d}):a.jsx(d7,{dimensions:j,lineWidth:s,variant:t,className:d})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${S})`})]})}pT.displayName="Background";const m7=w.memo(pT);function g7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function v7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function y7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function x7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function _7(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function nc({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:He(["react-flow__controls-button",t]),...n,children:e})}const w7=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function mT({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const g=Ce(),{isInteractive:x,minZoomReached:_,maxZoomReached:v,ariaLabelConfig:y}=he(w7,Oe),{zoomIn:m,zoomOut:b,fitView:j}=Jv(),k=()=>{m(),i==null||i()},S=()=>{b(),o==null||o()},N=()=>{j(s),l==null||l()},R=()=>{g.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),c==null||c(!x)},O=h==="horizontal"?"horizontal":"vertical";return a.jsxs(Ud,{className:He(["react-flow__controls",O,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??y["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(nc,{onClick:k,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:v,children:a.jsx(g7,{})}),a.jsx(nc,{onClick:S,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:_,children:a.jsx(v7,{})})]}),n&&a.jsx(nc,{className:"react-flow__controls-fitview",onClick:N,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:a.jsx(y7,{})}),r&&a.jsx(nc,{className:"react-flow__controls-interactive",onClick:R,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:x?a.jsx(_7,{}):a.jsx(x7,{})}),d]})}mT.displayName="Controls";const b7=w.memo(mT);function j7({id:e,x:t,y:n,width:r,height:s,style:i,color:o,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:g,backgroundColor:x}=i||{},_=o||g||x;return a.jsx("rect",{className:He(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:_,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?v=>p(v,e):void 0})}const S7=w.memo(j7),k7=e=>e.nodes.map(t=>t.id),oh=e=>e instanceof Function?e:()=>e;function N7({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=S7,onClick:o}){const l=he(k7,Oe),c=oh(t),u=oh(e),d=oh(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(h=>a.jsx(C7,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:f},h))})}function E7({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=he(g=>{const x=g.nodeLookup.get(e);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const _=x.internals.userNode,{x:v,y}=x.internals.positionAbsolute,{width:m,height:b}=Wn(_);return{node:_,x:v,y,width:m,height:b}},Oe);return!u||u.hidden||!pC(u)?null:a.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:o,onClick:c,id:u.id})}const C7=w.memo(E7);var T7=w.memo(N7);const P7=200,A7=150,R7=e=>!e.hidden,I7=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?dC(gl(e.nodeLookup,{filter:R7}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Fw=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,M7=(e,t)=>Fw(e.viewBB,t.viewBB)&&Fw(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,O7="react-flow__minimap-desc";function gT({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:g,pannable:x=!1,zoomable:_=!1,ariaLabel:v,inversePan:y,zoomStep:m=1,offsetScale:b=5}){const j=Ce(),k=w.useRef(null),{boundingRect:S,viewBB:N,rfId:R,panZoom:O,translateExtent:D,flowWidth:M,flowHeight:z,ariaLabelConfig:T}=he(I7,M7),E=(e==null?void 0:e.width)??P7,A=(e==null?void 0:e.height)??A7,P=S.width/E,I=S.height/A,C=Math.max(P,I),L=C*E,F=C*A,V=b*C,H=S.x-(L-S.width)/2-V,U=S.y-(F-S.height)/2-V,W=L+V*2,G=F+V*2,Y=`${O7}-${R}`,K=w.useRef(0),X=w.useRef();K.current=C,w.useEffect(()=>{if(k.current&&O)return X.current=BU({domNode:k.current,panZoom:O,getTransform:()=>j.getState().transform,getViewScale:()=>K.current}),()=>{var ee;(ee=X.current)==null||ee.destroy()}},[O]),w.useEffect(()=>{var ee;(ee=X.current)==null||ee.update({translateExtent:D,width:M,height:z,inversePan:y,pannable:x,zoomStep:m,zoomable:_})},[x,_,y,m,D,M,z]);const re=p?ee=>{var ve;const[se,pe]=((ve=X.current)==null?void 0:ve.pointer(ee))||[0,0];p(ee,{x:se,y:pe})}:void 0,te=g?w.useCallback((ee,se)=>{const pe=j.getState().nodeLookup.get(se).internals.userNode;g(ee,pe)},[]):void 0,Z=v??T["minimap.ariaLabel"];return a.jsx(Ud,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*C:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:He(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:E,height:A,viewBox:`${H} ${U} ${W} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Y,ref:k,onClick:re,children:[Z&&a.jsx("title",{id:Y,children:Z}),a.jsx(T7,{onClick:te,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-V},${U-V}h${W+V*2}v${G+V*2}h${-W-V*2}z
92
+ M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}gT.displayName="MiniMap";w.memo(gT);const L7=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,$7={[eo.Line]:"right",[eo.Handle]:"bottom-right"};function D7({nodeId:e,position:t,variant:n=eo.Handle,className:r,style:s=void 0,children:i,color:o,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:g,onResizeStart:x,onResize:_,onResizeEnd:v}){const y=GC(),m=typeof e=="string"?e:y,b=Ce(),j=w.useRef(null),k=n===eo.Handle,S=he(w.useCallback(L7(k&&p),[k,p]),Oe),N=w.useRef(null),R=t??$7[n];w.useEffect(()=>{if(!(!j.current||!m))return N.current||(N.current=tH({domNode:j.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:D,transform:M,snapGrid:z,snapToGrid:T,nodeOrigin:E,domNode:A}=b.getState();return{nodeLookup:D,transform:M,snapGrid:z,snapToGrid:T,nodeOrigin:E,paneDomNode:A}},onChange:(D,M)=>{const{triggerNodeChanges:z,nodeLookup:T,parentLookup:E,nodeOrigin:A}=b.getState(),P=[],I={x:D.x,y:D.y},C=T.get(m);if(C&&C.expandParent&&C.parentId){const L=C.origin??A,F=D.width??C.measured.width??0,V=D.height??C.measured.height??0,H={id:C.id,parentId:C.parentId,rect:{width:F,height:V,...mC({x:D.x??C.position.x,y:D.y??C.position.y},{width:F,height:V},C.parentId,T,L)}},U=Zv([H],T,E,A);P.push(...U),I.x=D.x?Math.max(L[0]*F,D.x):void 0,I.y=D.y?Math.max(L[1]*V,D.y):void 0}if(I.x!==void 0&&I.y!==void 0){const L={id:m,type:"position",position:{...I}};P.push(L)}if(D.width!==void 0&&D.height!==void 0){const F={id:m,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};P.push(F)}for(const L of M){const F={...L,type:"position"};P.push(F)}z(P)},onEnd:({width:D,height:M})=>{const z={id:m,type:"dimensions",resizing:!1,dimensions:{width:D,height:M}};b.getState().triggerNodeChanges([z])}})),N.current.update({controlPosition:R,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:x,onResize:_,onResizeEnd:v,shouldResize:g}),()=>{var D;(D=N.current)==null||D.destroy()}},[R,l,c,u,d,f,x,_,v,g]);const O=R.split("-");return a.jsx("div",{className:He(["react-flow__resize-control","nodrag",...O,n,r]),ref:j,style:{...s,scale:S,...o&&{[k?"backgroundColor":"borderColor"]:o}},children:i})}w.memo(D7);const z7={llm_only:"AI",claude:"Claude",codex:"Codex",qoder:"Qoder",qwenwork:"千问办公"};function F7(e){return e.requiresAgent?{key:e.engine==="llm_only"?"llm":e.engine,label:z7[e.engine]}:null}function V7({data:e,selected:t}){var l;const n=e.step,r=F7(n),s=n.status??"idle",i=n.configStatus==="missing",o=((l=n.missingConfigKeys)==null?void 0:l.length)??0;return a.jsxs(Ze.div,{variants:ZV,initial:"hidden",animate:"visible",className:`wf-node is-${s}${t?" is-selected":""}`+(i?" is-config-missing":""),style:{"--engine":r?`var(--agent-${r.key})`:"var(--border-strong)"},children:[a.jsx(to,{type:"target",position:ne.Top,className:"wf-node__handle"}),a.jsx("div",{className:"wf-node__bar"}),a.jsxs("div",{className:"wf-node__body",children:[a.jsxs("div",{className:"wf-node__top",children:[r?a.jsx("span",{className:"wf-node__engine",children:r.label}):a.jsx("span",{}),a.jsxs("div",{className:"wf-node__top-right",children:[i&&a.jsxs("span",{className:"wf-node__config-badge",title:`缺 ${o} 项配置`,children:["⚠ ",o]}),n.needsHuman?a.jsx("span",{className:"wf-node__flag wf-node__flag--human",title:"人工审批",children:a.jsx($,{name:"user",size:11})}):a.jsx("span",{className:"wf-node__flag",title:"自动",children:a.jsx($,{name:"bolt",size:11})})]})]}),a.jsx("div",{className:"wf-node__name",children:n.name}),a.jsx("div",{className:"wf-node__recipe",children:n.recipe}),i&&a.jsx("div",{className:"wf-node__config-warn",children:"⚠ 缺少参数 · 点击补齐"})]}),a.jsx(to,{type:"source",position:ne.Bottom,className:"wf-node__handle"})]})}const B7={step:V7};function vT({steps:e,edges:t,selectedId:n,onSelect:r}){const s=w.useMemo(()=>e.map((o,l)=>({id:o.id,type:"step",position:{x:60,y:l*128},data:{step:o},selected:o.id===n,draggable:!0})),[e,n]),i=w.useMemo(()=>t.map(o=>{const l=o.from===n||o.to===n;return{id:`${o.from}-${o.to}`,source:o.from,target:o.to,type:"smoothstep",animated:l,style:{stroke:l?"var(--accent)":"var(--border-strong)",strokeWidth:l?2:1.5}}}),[t,n]);return a.jsx("div",{className:"wf-canvas",children:a.jsxs(u7,{nodes:s,edges:i,nodeTypes:B7,fitView:!0,fitViewOptions:{padding:.25},minZoom:.4,maxZoom:1.5,proOptions:{hideAttribution:!0},onNodeClick:(o,l)=>r(l.id),onPaneClick:()=>r(null),children:[a.jsx(m7,{variant:fr.Dots,gap:16,size:1}),a.jsx(b7,{showInteractive:!1})]})})}function zc(e){const t=e.slice(e.lastIndexOf(".")+1);return t==="base_id"||t==="baseId"}function U7({config:e,workflowTopology:t,onSave:n}){const r=e.modules.find(u=>u.id==="workflow"),s=e.modules.find(u=>u.id==="env"),[i,o]=w.useState(null),l=(r==null?void 0:r.workflows)??[],c=w.useMemo(()=>{for(const u of l)for(const d of u.items)if(zc(d.key)&&typeof d.value=="string"&&d.value.trim())return d.value.trim()},[l]);return l.length===0?a.jsx("div",{className:"adjust__tab-inner",children:a.jsxs("div",{className:"adjust__empty",children:[a.jsx($,{name:"flow",size:20,color:"var(--text-muted)"}),a.jsx("span",{children:"暂无工作流"})]})}):a.jsx("div",{className:"adjust__tab-inner",children:l.map(u=>a.jsx(H7,{workflow:u,topology:t[u.id],envItems:(s==null?void 0:s.items)??[],suggestedBaseId:c,isOpen:i===u.id,onToggle:()=>o(d=>d===u.id?null:u.id),onSave:n},u.id))})}function H7({workflow:e,topology:t,envItems:n,suggestedBaseId:r,isOpen:s,onToggle:i,onSave:o}){const[l,c]=w.useState(null),u=e.items.filter(S=>S.key==="tracker.base_id"||S.key==="tracker.table_id"),d=e.items.filter(S=>S.key.startsWith("event_source.")&&S.writeTarget),f=w.useMemo(()=>{const S=new Set((t==null?void 0:t.envRefs)??[]);for(const N of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const R of N){const O=n.find(D=>D.key===R);O&&O.status==="error"&&S.add(R)}return[...S].map(N=>n.find(R=>R.key===N)).filter(N=>!!N&&!!N.writeTarget)},[t,n]),h=w.useMemo(()=>{const S=new Set((t==null?void 0:t.envRefs)??[]);for(const N of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const R of N)S.add(R);return n.filter(N=>S.has(N.key)&&N.status==="error")},[t,n]),p=e.ok&&h.length===0,g=e.items.filter(S=>S.writeTarget&&S.status==="error").length+h.filter(S=>S.writeTarget).length,x=e.items.filter(S=>!S.writeTarget&&S.status==="error").length+h.filter(S=>!S.writeTarget).length,_=w.useMemo(()=>{const S=new Set((t==null?void 0:t.envRefs)??[]);for(const N of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const R of N)S.add(R);return[...e.items.filter(N=>!N.writeTarget&&(N.status==="error"||N.status==="warn")),...n.filter(N=>S.has(N.key)&&!N.writeTarget&&(N.status==="error"||N.status==="warn"))]},[t,n,e.items]),v=w.useMemo(()=>t?t.steps.map(S=>{const N=e.items.filter(R=>R.key.startsWith(`step.${S.id}.config.`)&&R.status==="error");return{id:S.id,name:S.name,recipe:S.recipe??"",engine:S.engine??"llm_only",auto:S.auto,inputs:[],outputs:[],configStatus:N.length>0?"missing":"ok",missingConfigKeys:N.map(R=>R.key)}}):[],[t,e.items]),y=w.useMemo(()=>t?t.edges:[],[t]),m=w.useMemo(()=>l?e.items.filter(S=>S.key.startsWith(`step.${l}.config.`)&&S.writeTarget):[],[l,e.items]),b=w.useMemo(()=>!l||!t?[]:(t.stepEnvRefs[l]??[]).map(N=>n.find(R=>R.key===N)).filter(N=>!!N&&N.status!=="ok"),[l,t,n]),j=t==null?void 0:t.steps.find(S=>S.id===l),k=l&&(m.length>0||b.length>0);return a.jsxs("div",{className:`wf-card${p?" is-done":""}`,children:[a.jsxs("button",{type:"button",className:"wf-card__head",onClick:i,children:[a.jsx("span",{className:"wf-card__icon",children:a.jsx($,{name:"flow",size:15})}),a.jsx("span",{className:"wf-card__name",children:e.name}),g>0&&a.jsxs("span",{className:"wf-card__badge",children:[g," 项需配置"]}),x>0&&a.jsxs("span",{className:"wf-card__badge wf-card__badge--process",children:[x," 项过程错误"]}),a.jsx("span",{className:`wf-card__status${p?" is-ok":""}`,children:p?a.jsxs(a.Fragment,{children:[a.jsx($,{name:"check",size:12})," 通过"]}):g>0?"需配置":"有异常"}),a.jsx("span",{className:`wf-card__chevron${s?" is-open":""}`,children:a.jsx($,{name:"chevron-right",size:12})})]}),s&&a.jsxs("div",{className:"wf-card__body",children:[u.length>0&&a.jsx("div",{className:"wf-card__tracker",children:u.map(S=>a.jsx(fn,{item:S,onSave:o,suggestedDefault:zc(S.key)?r:void 0},S.key))}),t&&v.length>0&&a.jsxs("div",{className:`wf-card__canvas-row${k?" has-panel":""}`,children:[a.jsx("div",{className:"wf-card__canvas",children:a.jsx(vT,{steps:v,edges:y,selectedId:l,onSelect:c})}),k&&j&&a.jsxs("div",{className:"wf-card__panel",children:[a.jsxs("div",{className:"wf-card__panel-head",children:[a.jsx($,{name:"bolt",size:14}),a.jsxs("span",{children:["步骤配置 · ",j.name]}),a.jsx("button",{type:"button",className:"wf-card__panel-close",onClick:()=>c(null),children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"wf-card__panel-body",children:[m.map(S=>a.jsx(fn,{item:S,onSave:o,suggestedDefault:zc(S.key)?r:void 0},S.key)),b.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"wf-card__panel-divider",children:"参数与凭据"}),b.map(S=>a.jsx(fn,{item:S,onSave:o},S.key))]})]})]}),l&&!k&&j&&a.jsxs("div",{className:"wf-card__panel",children:[a.jsxs("div",{className:"wf-card__panel-head",children:[a.jsx($,{name:"bolt",size:14}),a.jsxs("span",{children:["步骤配置 · ",j.name]}),a.jsx("button",{type:"button",className:"wf-card__panel-close",onClick:()=>c(null),children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"wf-card__panel-body",children:a.jsxs("div",{className:"adjust__empty",style:{padding:"24px 16px"},children:[a.jsx($,{name:"check",size:16,color:"var(--green)"}),a.jsx("span",{children:"此步骤配置完整"})]})})]})]}),d.length>0&&a.jsxs("div",{className:"wf-card__events",children:[a.jsxs("div",{className:"wf-card__events-title",children:[a.jsx($,{name:"bolt",size:13,color:"var(--text-muted)"}),"事件源配置"]}),d.map(S=>a.jsx(fn,{item:S,onSave:o,suggestedDefault:zc(S.key)?r:void 0},S.key))]}),f.length>0&&a.jsxs("div",{className:"wf-card__events",children:[a.jsxs("div",{className:"wf-card__events-title",children:[a.jsx($,{name:"lock",size:13,color:"var(--text-muted)"}),"参数与凭据"]}),f.map(S=>a.jsx(fn,{item:S,onSave:o},S.key))]}),a.jsx(Iu,{items:_})]})]})}const W7=[{id:"project",label:"项目配置",icon:"folder"},{id:"roles",label:"角色配置",icon:"user"},{id:"workflows",label:"工作流配置",icon:"flow"}];function K7(){const[e,t]=w.useState(null),[n,r]=w.useState(!0),[s,i]=w.useState(null),[o,l]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState("project"),[h,p]=w.useState(!1),g=w.useRef(!1),x=w.useCallback(async()=>{var j,k,S;r(!0),i(null);try{const N=await jk();if(t(N),!N.config.ok){const R=((j=N.config.modules.find(M=>M.id==="project"))==null?void 0:j.ok)??!0,O=((k=N.config.modules.find(M=>M.id==="coding_agent"))==null?void 0:k.ok)??!0,D=((S=N.config.modules.find(M=>M.id==="roles"))==null?void 0:S.ok)??!0;f(!R||!O?"project":D?"workflows":"roles")}}catch(N){i(N instanceof Error?N.message:String(N))}finally{r(!1)}},[]);w.useEffect(()=>{x()},[x]),w.useEffect(()=>{if(e&&!c){const j=k=>{k.preventDefault()};return window.addEventListener("beforeunload",j),()=>window.removeEventListener("beforeunload",j)}},[e,c]);const _=w.useCallback(async()=>{if(!(g.current||c)){g.current=!0,l(!0);try{await bk(),u(!0)}catch(j){i(j instanceof Error?j.message:String(j))}finally{l(!1),g.current=!1}}},[c]),v=w.useCallback(async(j,k)=>{const S=await Ip([{writeTarget:j,value:k}]);t(N=>N&&{...N,config:S.recheck})},[]),y=w.useCallback(async j=>{const k=await Ip(j);t(S=>S&&{...S,config:k.recheck})},[]),m=w.useCallback(async(j,k)=>{try{const S=await _D(j,k);return t(N=>N&&{...N,config:S.recheck}),{ok:S.ok,message:S.message}}catch(S){const N=S instanceof Error?S.message:"知识库导入失败";return i(N),{ok:!1,message:N}}},[]),b=w.useCallback(async(j,k)=>{try{const S=await xD(j,k);return t(N=>N&&{...N,config:S.recheck}),{ok:S.ok,message:S.message}}catch(S){const N=S instanceof Error?S.message:"文件上传失败";return i(N),{ok:!1,message:N}}},[]);return c?a.jsx("div",{className:"adjust",children:a.jsxs("div",{className:"adjust__done",children:[a.jsx("span",{className:"adjust__done-icon",children:a.jsx($,{name:"check",size:32,color:"var(--green)"})}),a.jsx("h2",{className:"adjust__done-title",children:"配置完成"}),a.jsx("p",{className:"adjust__done-text",children:"所有配置项已保存到本地文件,CLI 将继续 setup 流程。"}),a.jsx("p",{className:"adjust__done-hint",children:"可以关闭此页面。"})]})}):a.jsxs("div",{className:"adjust",children:[a.jsxs("div",{className:"adjust__head",children:[a.jsx("h1",{className:"adjust__title",children:"参数调整"}),a.jsx("p",{className:"adjust__sub",children:"配置项目参数、角色和工作流"})]}),n&&a.jsx("div",{className:"adjust__loading",children:"正在加载配置状态…"}),s&&a.jsxs("div",{className:"adjust__error",children:[a.jsx($,{name:"warn",size:16,color:"var(--red)"}),a.jsx("span",{children:s}),a.jsx("button",{type:"button",className:"adjust__retry",onClick:()=>void x(),children:"重试"})]}),e&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"adjust__hint",children:[a.jsx($,{name:"folder",size:14,color:"var(--text-muted)"}),a.jsx("code",{children:e.config.projectPath})]}),a.jsxs("div",{className:"adjust__tab-area",children:[a.jsx("div",{className:"adjust__tabs",children:W7.map(j=>{var D,M,z,T,E;const k=((D=e.config.modules.find(A=>A.id==="env"))==null?void 0:D.items)??[],S=new Set(e.projectEnvRefs??k.map(A=>A.key)),N=new Set;for(const A of Object.values(e.workflowTopology)){for(const P of A.envRefs??[])N.add(P);for(const P of Object.values(A.stepEnvRefs??{}))for(const I of P)N.add(I)}const R=A=>k.some(P=>P.status==="error"&&A.has(P.key)),O=j.id==="project"?(((M=e.config.modules.find(A=>A.id==="project"))==null?void 0:M.ok)??!0)&&(((z=e.config.modules.find(A=>A.id==="coding_agent"))==null?void 0:z.ok)??!0)&&!R(S):j.id==="roles"?((T=e.config.modules.find(A=>A.id==="roles"))==null?void 0:T.ok)??!0:(((E=e.config.modules.find(A=>A.id==="workflow"))==null?void 0:E.ok)??!0)&&!R(N);return a.jsxs("button",{type:"button",className:`adjust__tab${d===j.id?" is-active":""}${O?"":" has-error"}`,onClick:()=>f(j.id),children:[a.jsx($,{name:j.icon,size:13}),j.label,!O&&a.jsx("span",{className:"adjust__tab-dot"})]},j.id)})}),a.jsxs("div",{className:"adjust__tab-content",children:[d==="project"&&a.jsx(b5,{config:e.config,engines:e.engines,projectEnvRefs:e.projectEnvRefs,onSave:v,onBatchSave:y}),d==="roles"&&a.jsx(S5,{config:e.config,onSave:v,onKbIngest:m,onKbUpload:b}),d==="workflows"&&a.jsx(U7,{config:e.config,workflowTopology:e.workflowTopology,onSave:v})]})]}),a.jsx(l5,{summary:e.config.summary,allPassed:e.config.ok,saving:o,onComplete:()=>p(!0)}),h&&a.jsx("div",{className:"modal-overlay",onClick:()=>p(!1),children:a.jsxs("div",{className:"modal-card",onClick:j=>j.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__icon",style:{background:"var(--accent-tint)",color:"var(--accent)"},children:a.jsx($,{name:"check",size:16})}),a.jsx("span",{className:"modal-card__title",children:"确认进入搭建"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:()=>p(!1),children:a.jsx($,{name:"close",size:14})})]}),a.jsx("div",{className:"modal-card__body",children:a.jsx("p",{style:{margin:0,fontSize:14,color:"var(--text)"},children:"确认不再修改配置,进入下一步搭建流程?"})}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>p(!1),children:"继续修改"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:o,onClick:()=>{p(!1),_()},children:o?"完成中…":"确认,继续搭建"})]})]})})]})]})}function G7(){return a.jsx(Rd,{children:a.jsx(K7,{})})}function yT({onCancel:e,onConfirm:t}){const[n,r]=w.useState([]),[s,i]=w.useState(!0),[o,l]=w.useState(null),[c,u]=w.useState(""),[d,f]=w.useState(new Set);async function h(){i(!0),l(null);try{const _=await ED();_.ok?r(_.groups):l(_.message)}catch(_){l(_ instanceof Error?_.message:String(_))}finally{i(!1)}}w.useEffect(()=>{h()},[]);const p=w.useMemo(()=>{const _=c.trim().toLowerCase();return _?n.filter(v=>v.title.toLowerCase().includes(_)):n},[n,c]);function g(_){f(v=>{const y=new Set(v);return y.has(_)?y.delete(_):y.add(_),y})}function x(){const _=n.filter(v=>d.has(v.conversationId));t(_)}return a.jsxs("div",{className:"console-sub",children:[a.jsxs("div",{className:"console-sub__head",children:[a.jsxs("button",{type:"button",className:"console-sub__back",onClick:e,children:[a.jsx($,{name:"chevron-left",size:14}),"返回首页"]}),a.jsx("h2",{className:"console-sub__title",children:"选择要绑定的群聊"}),a.jsx("p",{className:"console-sub__desc",children:"从你作为群主/管理员的钉钉群中多选,确认后为每个群绑定机器人"})]}),a.jsx("div",{className:"group-select__search",children:a.jsx("input",{className:"qf-input",placeholder:"搜索群名…",value:c,onChange:_=>u(_.target.value)})}),s?a.jsx("div",{className:"console-sub__saving",children:"正在拉取你管理的群…"}):o?a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),o,a.jsx("button",{type:"button",className:"console-retry",onClick:()=>void h(),children:"重试"})]}):a.jsx("div",{className:"group-select__list",children:p.length===0?a.jsx("div",{className:"console-sub__saving",children:"没有匹配的群"}):p.map(_=>a.jsxs("label",{className:"group-select__item",children:[a.jsx("input",{type:"checkbox",checked:d.has(_.conversationId),onChange:()=>g(_.conversationId)}),a.jsx("span",{className:"group-select__name",children:_.title||_.conversationId}),a.jsx("span",{className:"group-select__type",children:xT(_.groupType)})]},_.conversationId))}),a.jsxs("div",{className:"console-sub__foot",children:[a.jsxs("span",{className:"group-select__count",children:["已选 ",d.size," 个群"]}),a.jsxs("div",{className:"group-select__foot-actions",children:[a.jsx("button",{type:"button",className:"ghost",onClick:e,children:"取消"}),a.jsx("button",{type:"button",className:"primary",onClick:x,disabled:d.size===0,children:"确认选择"})]})]})]})}function xT(e){return e==="internal"?"内部群":e==="external"?"外部群":"未知"}function _T({rows:e,mode:t,onBack:n,onAddBot:r,onEditBot:s,onToggleEnabled:i,footer:o}){return a.jsxs("div",{className:"console-sub",children:[a.jsxs("div",{className:"console-sub__head",children:[a.jsxs("button",{type:"button",className:"console-sub__back",onClick:n,children:[a.jsx($,{name:"chevron-left",size:14}),"返回首页"]}),a.jsx("h2",{className:"console-sub__title",children:"群聊-机器人配置"}),a.jsx("p",{className:"console-sub__desc",children:t==="view"?"当前群配置表内容,可编辑机器人或启停群":"为每个群绑定机器人后即可开始搭建"})]}),a.jsxs("div",{className:"group-bot-table",children:[a.jsxs("div",{className:"group-bot-table__head",children:[a.jsx("span",{className:"group-bot-table__col group-bot-table__col--name",children:"群名"}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--type",children:"类型"}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--bot",children:"机器人"}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--enabled",children:"是否启用"})]}),e.length===0?a.jsx("div",{className:"console-sub__saving",children:"还没有群配置"}):e.map(l=>a.jsxs("div",{className:"group-bot-table__row",children:[a.jsx("span",{className:"group-bot-table__col group-bot-table__col--name",title:l.title,children:l.title||l.conversationId}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--type",children:xT(l.groupType)}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--bot",children:l.botLabel?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"group-bot-table__bot-name",children:[a.jsx($,{name:"robot",size:13,color:"var(--accent)"}),l.botLabel]}),a.jsxs("button",{type:"button",className:"group-bot-table__edit",onClick:()=>s(l),children:[a.jsx($,{name:"bolt",size:12}),"编辑"]})]}):a.jsxs("button",{type:"button",className:"ghost group-bot-table__add",onClick:()=>r(l),children:[a.jsx($,{name:"plus",size:12}),"添加机器人"]})}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--enabled",children:a.jsxs("label",{className:"group-bot-table__switch",children:[a.jsx("input",{type:"checkbox",checked:l.enabled,onChange:c=>i(l,c.target.checked)}),a.jsx("span",{children:l.enabled?"已启用":"已停用"})]})})]},l.conversationId))]}),o&&a.jsx("div",{className:"console-sub__foot",children:o})]})}function wT({conversationId:e,groupTitle:t,groupType:n,onCancel:r,onEnterpriseDone:s,onPickCustom:i}){const o=n==="external",[l,c]=w.useState(null),[u,d]=w.useState(!1),[f,h]=w.useState(null),p=l==="custom"||l==="enterprise"&&!o&&!u;async function g(){if(l==="custom"){i();return}if(!(l!=="enterprise"||o)){d(!0),h(null);try{const x=await CD({conversationId:e,title:t,...n?{groupType:n}:{}});x.ok?s():h(x.message)}catch(x){h(x instanceof Error?x.message:String(x))}finally{d(!1)}}}return a.jsx("div",{className:"modal-overlay",onClick:r,children:a.jsxs("div",{className:"modal-card",onClick:x=>x.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsxs("span",{className:"modal-card__title",children:["为「",t,"」添加机器人"]}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:r,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsxs("label",{className:`addbot__option${l==="enterprise"?" is-active":""}${o?" is-disabled":""}`,children:[a.jsx("input",{type:"radio",name:"botChoice",disabled:o,checked:l==="enterprise",onChange:()=>c("enterprise")}),a.jsxs("div",{children:[a.jsx("div",{className:"addbot__option-title",children:"一键添加「企业机器人」"}),a.jsx("div",{className:"addbot__option-desc",children:o?"外部群仅支持自定义机器人 webhook":"仅内部群可用,自动创建/复用「ai表格群答疑助手」并入群"})]})]}),l==="enterprise"&&!o&&a.jsx("div",{className:"addbot__creds",children:a.jsxs("div",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"企业机器人"}),a.jsx("div",{className:"addbot__enterprise-hint",children:"ai表格群答疑助手(按当前 dws 组织自动创建/复用)"})]})}),a.jsxs("label",{className:`addbot__option${l==="custom"?" is-active":""}`,children:[a.jsx("input",{type:"radio",name:"botChoice",checked:l==="custom",onChange:()=>c("custom")}),a.jsxs("div",{children:[a.jsx("div",{className:"addbot__option-title",children:"配置「自定义机器人」"}),a.jsx("div",{className:"addbot__option-desc",children:"所有群都可用,需手动在群设置里添加 Webhook"})]})]}),f&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"qf-btn qf-btn--secondary",onClick:r,children:"取消"}),a.jsx("button",{type:"button",className:"qf-btn qf-btn--primary",disabled:!p,onClick:g,children:u?"添加中…":l==="custom"?"去配置":"去添加"})]})]})})}function bT({groupTitle:e,onCancel:t,onSave:n}){const[r,s]=w.useState(""),[i,o]=w.useState(""),[l,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(null),p=/^https?:\/\//.test(i.trim()),g=r.trim().length>0&&p&&l.trim().length>0&&!u;async function x(){d(!0),h(null);try{await n({name:r.trim(),webhook:i.trim(),secret:l.trim()})}catch(_){h(_ instanceof Error?_.message:String(_)),d(!1)}}return a.jsx("div",{className:"modal-overlay",onClick:t,children:a.jsxs("div",{className:"modal-card",onClick:_=>_.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsxs("span",{className:"modal-card__title",children:["为「",e,"」配置自定义机器人"]}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:t,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsxs("div",{className:"console-note",children:[a.jsx($,{name:"bolt",size:13,color:"var(--blue)"}),a.jsxs("div",{children:["请按以下步骤在钉钉群里添加自定义机器人:",a.jsx("br",{}),"1. 打开群设置 → 2. 选择「机器人」→ 3. 选择「自定义机器人」→ 4. 输入机器人名字",a.jsx("br",{}),"完成后把 Webhook 地址与加签密钥填入下方。"]})]}),a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"机器人名字"}),a.jsx("input",{className:"qf-input",value:r,placeholder:"如:群答疑助手",onChange:_=>s(_.target.value)})]}),a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"Webhook URL"}),a.jsx("input",{className:"qf-input",value:i,placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",onChange:_=>o(_.target.value)})]}),i.trim()&&!p&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),"Webhook 需以 http(s):// 开头"]}),a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"Secret"}),a.jsx("input",{className:"qf-input",type:"password",value:l,placeholder:"加签密钥",onChange:_=>c(_.target.value)})]}),f&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:t,children:"取消"}),a.jsx("button",{type:"button",className:"modal-card__btn primary",onClick:()=>void x(),disabled:!g,children:u?"保存中…":"保存"})]})]})})}function q7(e){return e?e.type==="enterprise"?e.name?`企业机器人-「${e.name}」`:"企业机器人":`自定义机器人-「${e.name}」`:null}function Y7(e){return e.appKey?e.botNick?`企业机器人-「${e.botNick}」`:"企业机器人":e.webhookUrl?`自定义机器人-「${e.botNick||"自定义"}」`:null}function X7({mode:e,state:t,onBack:n,onReload:r}){return e==="view"?a.jsx(Z7,{onBack:n}):a.jsx(Q7,{state:t,onBack:n,onReload:r})}function Q7({state:e,onBack:t,onReload:n}){const r=e.groupBotsStaging??[],[s,i]=w.useState(null),[o,l]=w.useState(r.length===0),[c,u]=w.useState(null);if(o)return a.jsx(yT,{onCancel:()=>{r.length>0||(s??[]).length>0?l(!1):t()},onConfirm:g=>{i(x=>{const _=new Map((x??[]).map(v=>[v.conversationId,v]));for(const v of g)_.set(v.conversationId,v);return Array.from(_.values())}),l(!1)}});const d=new Map(r.map(g=>[g.conversationId,g])),f=new Map;for(const g of s??[])f.set(g.conversationId,g);for(const g of r)f.has(g.conversationId)||f.set(g.conversationId,{conversationId:g.conversationId,title:g.title,groupType:g.groupType});const h=Array.from(f.values()).map(g=>{const x=d.get(g.conversationId);return{conversationId:g.conversationId,title:g.title,...g.groupType?{groupType:g.groupType}:{},botLabel:x?q7(x.bot):null,enabled:(x==null?void 0:x.enabled)??!0}}),p=()=>{u(null),n()};return a.jsxs(a.Fragment,{children:[a.jsx(_T,{rows:h,mode:"setup",onBack:t,onAddBot:g=>u({kind:"add",row:g}),onEditBot:g=>u({kind:"add",row:g}),onToggleEnabled:()=>{},footer:a.jsxs("div",{className:"console-sub__foot",style:{display:"flex",gap:12},children:[a.jsx("button",{type:"button",className:"ghost",onClick:()=>l(!0),children:"添加更多群"}),a.jsx("button",{type:"button",className:"primary",onClick:t,children:"完成,返回首页"})]})}),(c==null?void 0:c.kind)==="add"&&a.jsx(wT,{conversationId:c.row.conversationId,groupTitle:c.row.title,...c.row.groupType?{groupType:c.row.groupType}:{},onCancel:()=>u(null),onEnterpriseDone:p,onPickCustom:()=>u({kind:"custom",row:c.row})}),(c==null?void 0:c.kind)==="custom"&&a.jsx(bT,{groupTitle:c.row.title,onCancel:()=>u(null),onSave:async({name:g,webhook:x,secret:_})=>{await Sk({conversationId:c.row.conversationId,title:c.row.title,...c.row.groupType?{groupType:c.row.groupType}:{},name:g,webhook:x,secret:_}),p()}})]})}function Z7({onBack:e}){const[t,n]=w.useState([]),[r,s]=w.useState(!1),[i,o]=w.useState(!0),[l,c]=w.useState(null),[u,d]=w.useState(null),[f,h]=w.useState([]),[p,g]=w.useState(!1),x=w.useCallback(async()=>{o(!0),c(null);try{const j=await kk();j.ok?n(j.groups):c("群配置表尚未就绪")}catch(j){c(j instanceof Error?j.message:String(j))}finally{s(!0),o(!1)}},[]);w.useEffect(()=>{x()},[x]);const _=w.useCallback(async()=>{const j=await TD().catch(()=>null);j!=null&&j.ok&&h([]),await x()},[x]);if(r&&!i&&!l&&t.length===0&&f.length===0||p)return a.jsx(yT,{onCancel:()=>{t.length>0||f.length>0?g(!1):e()},onConfirm:j=>{h(k=>{const S=new Map(k.map(N=>[N.conversationId,N]));for(const N of j)S.set(N.conversationId,N);return Array.from(S.values())}),g(!1)}});if(i)return a.jsx("div",{className:"console-sub",children:a.jsx("div",{className:"console-sub__saving",children:"正在读取群配置表…"})});const y=t.map(j=>({conversationId:j.groupId,title:j.groupName,...j.groupType?{groupType:j.groupType}:{},botLabel:Y7(j),enabled:j.enabled,recordId:j.recordId})),m=new Set(t.map(j=>j.groupId)),b=f.filter(j=>!m.has(j.conversationId)).map(j=>({conversationId:j.conversationId,title:j.title,...j.groupType?{groupType:j.groupType}:{},botLabel:null,enabled:!0}));return a.jsxs(a.Fragment,{children:[a.jsx(_T,{rows:[...y,...b],mode:"view",onBack:e,onAddBot:j=>d({kind:"add",row:j}),onEditBot:j=>d({kind:"add",row:j}),onToggleEnabled:async(j,k)=>{j.recordId&&(await l_(j.recordId,{enabled:k}),await x())},footer:l?a.jsx("span",{className:"console-sub__err",children:l}):a.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[a.jsx("button",{type:"button",className:"ghost",onClick:()=>g(!0),children:"添加群聊"}),a.jsx("span",{className:"console-build__hint",children:"修改后将在下一次配置同步(约 5 分钟)后生效"})]})}),(u==null?void 0:u.kind)==="add"&&a.jsx(wT,{conversationId:u.row.conversationId,groupTitle:u.row.title,...u.row.groupType?{groupType:u.row.groupType}:{},onCancel:()=>d(null),onEnterpriseDone:()=>{d(null),u.row.recordId?x():_()},onPickCustom:()=>d({kind:"custom",row:u.row})}),(u==null?void 0:u.kind)==="custom"&&a.jsx(bT,{groupTitle:u.row.title,onCancel:()=>d(null),onSave:async({name:j,webhook:k,secret:S})=>{u.row.recordId?(await l_(u.row.recordId,{inbound:"dws",outbound:"webhook",botNick:j,webhookUrl:k,...S?{webhookSecret:S}:{}}),d(null),await x()):(await Sk({conversationId:u.row.conversationId,title:u.row.title,...u.row.groupType?{groupType:u.row.groupType}:{},name:j,webhook:k,secret:S}),d(null),await _())}})]})}const Vw=[{id:"home",label:"首页",icon:"folder"},{id:"kb",label:"知识库",icon:"file"},{id:"records",label:"答疑记录",icon:"table"},{id:"experts",label:"专家配置",icon:"user"}];function Ga(e,t){if(!(e!=null&&e.baseId)||!e.tableId)return null;const n=`https://docs.dingtalk.com/i/nodes/${e.baseId}?iframeQuery=sheetId%3D${encodeURIComponent(e.tableId)}`;if(!(t!=null&&t.embed))return n;const r=`sheetId=${encodeURIComponent(e.tableId)}&side_bar=false&top_bar=false&foot_bar=false&disable_guide=true&ntCatalogCollapsed=true&ntDisableGuide=true`;return`https://docs.dingtalk.com/i/nodes/${e.baseId}?iframeQuery=${encodeURIComponent(r)}&sideCollapsed=true&ntCatalogCollapsed=true&ntDisableGuide=true`}function J7(e,t,n,r={}){var d;const i=(n??[]).filter(f=>f.enabled&&f.bot),o=i.length>0,l=r.groupsLoading===!0,c=(d=t==null?void 0:t.modules.find(f=>f.id==="coding_agent"))==null?void 0:d.items.find(f=>f.key==="coding_agent.engine"),u=(c==null?void 0:c.status)==="ok";return[{id:"groups",title:"一键添加群聊并绑定机器人",desc:"拉取你管理的钉钉群,多选后为每个群绑定企业机器人或自定义机器人",done:o,loading:l,hint:l?"正在读取群配置…":o?`已配置 ${i.length} 个群`:"还没添加群聊或有群未配置机器人"},{id:"other",title:"其他配置",desc:"选择本机用于作答的 Coding Agent 引擎",done:!0,hint:u?`引擎:${String((c==null?void 0:c.value)??"")}`:"默认使用 qoder,可点击修改"}]}function e9(e){return e.map(t=>({conversationId:t.groupId,title:t.groupName,...t.groupType?{groupType:t.groupType}:{},enabled:t.enabled,bot:t.appKey?{type:"enterprise",appKey:t.appKey,...t.botNick?{name:t.botNick}:{}}:t.webhookUrl?{type:"custom",name:t.botNick||"自定义",webhookUrl:t.webhookUrl}:null}))}function Bw(e){return e.length>0&&e.every(t=>t.done)}function t9(e){return e!=null&&e.tableId?"view":"setup"}function Uw(e){const t=(e==null?void 0:e.pending)??null;return t?{label:{start:"正在启动…",stop:"正在停止…"}[t.action],action:t.action,tone:"primary",disabled:!0,statusLabel:"等待本机执行"}:(e==null?void 0:e.status)==="starting"?{label:"正在启动…",action:"start",tone:"primary",disabled:!0,statusLabel:"启动中"}:(e==null?void 0:e.status)==="stopping"?{label:"正在停止…",action:"stop",tone:"danger",disabled:!0,statusLabel:"停止中"}:(e==null?void 0:e.status)==="running"?{label:"停止",action:"stop",tone:"danger",disabled:!1,statusLabel:"运行中"}:(e==null?void 0:e.status)==="stopped"?{label:"重启运行",action:"start",tone:"primary",disabled:!1,statusLabel:"已停止"}:(e==null?void 0:e.status)==="error"?{label:"重启运行",action:"start",tone:"primary",disabled:!1,statusLabel:"运行异常"}:{label:"启动运行",action:"start",tone:"primary",disabled:!1,statusLabel:(e==null?void 0:e.status)==="idle"?"未运行":"状态未知"}}function n9(e,t){const n=r=>{if(r)return r.baseId?r:{...r,baseId:t}};return[{field:"admin_table",label:"管理员配置表",purpose:"指定哪些人是管理员。管理员可以在「知识收件箱」里补充答案,补充后会自动沉淀进知识库。",howTo:"在表格中每行填一位管理员的钉钉 userId(或按表内列说明填写)。改完点下方「同步配置」,助手会立刻重新读取名单。",ref:n(e==null?void 0:e.admin_table)},{field:"owner_table",label:"模块负责人配置表",purpose:"按功能模块指定专家。助手判定问题属于某模块且需要升级时,会在群里 @ 对应负责人。",howTo:"每行填「模块名 + 负责人 userId」。模块名要和助手回答里出现的模块口径一致。改完点下方「同步配置」,助手会立刻重新读取名单。",ref:n(e==null?void 0:e.owner_table)}]}function ty(e,t){var n;if(e)return t&&((n=e[t])!=null&&n.tableId)?e[t]:Object.values(e).find(r=>r.baseId&&r.tableId)}function r9({mode:e,state:t,config:n,engines:r,artifacts:s,buildDone:i,buildBaseUrl:o,onSave:l,onReload:c,onStartBuild:u,building:d}){const[f,h]=w.useState(null),p=t9(t==null?void 0:t.groupTableRef),[g,x]=w.useState(null),[_,v]=w.useState(!1),[y,m]=w.useState("idle"),[b,j]=w.useState(null),[k,S]=w.useState(null),N=w.useRef([]),R=P=>(N.current.push(P),P);w.useEffect(()=>()=>N.current.forEach(P=>clearInterval(P)),[]),w.useEffect(()=>{let P=!1;return a_().then(I=>{P||v(!I.loggedIn)}).catch(()=>{}),()=>{P=!0}},[]);async function O(){S(null),m("starting");const P=await kD().catch(L=>({ok:!1,message:String(L)}));if(!P.ok){S(P.message??"登录发起失败"),m("idle");return}m("waiting-link");const I=Date.now()+6e4,C=R(window.setInterval(async()=>{const L=await ND().catch(()=>({verifyUrl:null}));if(L.verifyUrl){clearInterval(C),j(L.verifyUrl),m("waiting-auth");const F=R(window.setInterval(async()=>{const V=await a_().catch(()=>null);V!=null&&V.loggedIn&&(clearInterval(F),v(!1),m("idle"),j(null),c())},5e3))}else Date.now()>I&&(clearInterval(C),S("等待授权链接超时,请重试或在终端手动执行 dws auth login"),m("idle"))},2e3))}w.useEffect(()=>{if(p!=="view"){x(null);return}let P=!1;return kk().then(I=>{P||x(I.ok?I.groups:[])}).catch(()=>{P||x([])}),()=>{P=!0}},[p]);const D=p==="view"&&g?e9(g):t==null?void 0:t.groupBotsStaging,z=J7(t,n,D,{groupsLoading:p==="view"&&g===null}),T=ty(s==null?void 0:s.trackers,(t==null?void 0:t.workflowId)??null),E=o??Ga(T),A=w.useRef(!1);return w.useEffect(()=>{var F,V;if(A.current)return;const P=n==null?void 0:n.modules.find(H=>H.id==="coding_agent"),I=P==null?void 0:P.items.find(H=>H.key==="coding_agent.engine");if(!(I!=null&&I.writeTarget)||I.status!=="error")return;const C=((F=r.find(H=>H.engine==="qoder"))==null?void 0:F.engine)??((V=r[0])==null?void 0:V.engine);if(!C)return;A.current=!0;const L=P==null?void 0:P.items.find(H=>H.key==="coding_agent.config.enabled");(async()=>(await l(I.writeTarget,C),(L==null?void 0:L.status)==="error"&&L.writeTarget&&await l(L.writeTarget,"true")))()},[n,r,l]),f==="groups"&&t?a.jsx(X7,{mode:p,state:t,onBack:()=>h(null),onReload:c}):f==="other"?a.jsx(s9,{config:n,engines:r,onSave:l,onBack:()=>h(null)}):a.jsxs("div",{className:"console-page",children:[_&&a.jsxs("div",{className:"console-auth-banner",children:[a.jsx($,{name:"warn",size:14,color:"var(--red)"}),a.jsxs("span",{className:"console-auth-banner__text",children:["钉钉(dws)登录已失效:引擎无法装配、群配置与表格读写都会失败。",y==="waiting-auth"&&b?" 请在浏览器完成授权,本页会自动恢复。":" 请重新登录。"]}),y==="idle"&&a.jsx("button",{type:"button",className:"primary console-auth-banner__btn",onClick:()=>void O(),children:"重新登录"}),(y==="starting"||y==="waiting-link")&&a.jsx("span",{className:"console-auth-banner__wait",children:"正在启动登录…"}),y==="waiting-auth"&&b&&a.jsx("a",{className:"primary console-auth-banner__btn",href:b,target:"_blank",rel:"noreferrer",children:"打开授权页面"}),k&&a.jsx("span",{className:"console-auth-banner__err",children:k})]}),a.jsxs("section",{className:"console-section",children:[a.jsx("h2",{className:"console-section__title",children:"答疑助手能做什么"}),a.jsxs("div",{className:"console-intro",children:[a.jsxs("div",{className:"console-intro__item",children:[a.jsx("span",{className:"console-intro__icon",children:a.jsx($,{name:"robot",size:16,color:"var(--accent)"})}),a.jsxs("div",{children:[a.jsx("div",{className:"console-intro__head",children:"自动回答群里的常见问题"}),a.jsx("div",{className:"console-intro__body",children:"监听你指定的钉钉群,识别出真正的提问后,基于知识库给出有依据的回答; 没有依据时保持静默,不编造答案。"})]})]}),a.jsxs("div",{className:"console-intro__item",children:[a.jsx("span",{className:"console-intro__icon",children:a.jsx($,{name:"user",size:16,color:"var(--accent)"})}),a.jsxs("div",{children:[a.jsx("div",{className:"console-intro__head",children:"该找人的时候自动找人"}),a.jsx("div",{className:"console-intro__body",children:"判定为缺陷、需求或知识库缺口时,按「模块负责人配置表」在群里 @ 对应专家, 并把待处理事项留痕到 AI 表格。"})]})]})]})]}),a.jsxs("section",{className:"console-section",children:[a.jsx("h2",{className:"console-section__title",children:"快速配置"}),a.jsx("p",{className:"console-section__sub",children:"下面两项配齐后就能开始搭建 AI 表格"}),a.jsx("div",{className:"console-quick",children:z.map(P=>{const I=P.id==="groups"&&p==="view"?"查看配置":P.done?"查看 / 修改":"去配置";return a.jsxs("div",{className:`console-quick__card${P.done?" is-done":""}`,children:[a.jsx("span",{className:`console-quick__badge${P.loading?" is-loading":""}`,children:a.jsx($,{name:P.loading?"refresh":P.done?"check":"dot",size:13,color:P.loading?"var(--text-faint)":P.done?"var(--green)":"var(--amber)"})}),a.jsx("div",{className:"console-quick__title",children:P.title}),a.jsx("div",{className:"console-quick__desc",children:P.desc}),a.jsx("div",{className:`console-quick__hint${P.done?" is-done":""}${P.loading?" is-loading":""}`,children:P.hint}),a.jsxs("button",{type:"button",className:P.done?"ghost console-quick__cta":"primary console-quick__cta",onClick:()=>h(P.id),children:[I,a.jsx($,{name:"chevron-right",size:13})]})]},P.id)})}),a.jsx("div",{className:"console-build",children:i?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"console-build__icon",children:a.jsx($,{name:"check",size:18,color:"var(--green)"})}),a.jsx("span",{className:"console-build__hint",children:e==="runtime"?"已搭建。点右上角「启动运行」开始服务;群配置修改在下一次配置同步(约 5 分钟)后生效。点击「重新搭建」自动补齐。":"已搭建。如需启动运行请使用 aitable-workflow start 命令。点击「重新搭建」自动补齐。"}),E&&a.jsx("a",{href:E,target:"_blank",rel:"noreferrer",className:"console-build__link",children:"查看 AI 表格"}),a.jsxs("button",{type:"button",className:"ghost console-build__rebuild",onClick:u,disabled:d,title:"自动检查并补齐缺失的表、字段与视图,已有数据不受影响",children:[a.jsx($,{name:"refresh",size:13}),d?"搭建中…":"重新搭建"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"primary console-build__btn",onClick:u,disabled:!Bw(z)||d,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),d?"搭建中…":"开始搭建"]}),a.jsx("span",{className:"console-build__hint",children:Bw(z)?"将自动创建「群问答记录表」「群配置表」及其字段与视图":"两项配置全部完成后可开始搭建"})]})})]})]})}function s9({config:e,engines:t,onSave:n,onBack:r}){const s=e==null?void 0:e.modules.find(f=>f.id==="coding_agent"),i=s==null?void 0:s.items.find(f=>f.key==="coding_agent.engine"),o=s==null?void 0:s.items.find(f=>f.key==="coding_agent.config.enabled"),[l,c]=w.useState(!1);async function u(f){if(!(!(i!=null&&i.writeTarget)||!f)){c(!0);try{await n(i.writeTarget,f),(o==null?void 0:o.status)==="error"&&o.writeTarget&&await n(o.writeTarget,"true")}finally{c(!1)}}}const d=((s==null?void 0:s.items)??[]).filter(f=>f.key!=="coding_agent.engine"&&f.writeTarget&&f.status==="error");return a.jsxs("div",{className:"console-sub",children:[a.jsxs("div",{className:"console-sub__head",children:[a.jsxs("button",{type:"button",className:"console-sub__back",onClick:r,children:[a.jsx($,{name:"chevron-left",size:14}),"返回首页"]}),a.jsx("h2",{className:"console-sub__title",children:"配置其他"}),a.jsx("p",{className:"console-sub__desc",children:"选择本机用于作答的 Coding Agent 引擎"})]}),a.jsxs("div",{className:"console-card",children:[a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"执行引擎"}),a.jsxs("select",{className:"qf-select",value:(i==null?void 0:i.value)??"",disabled:l,onChange:f=>void u(f.target.value),children:[a.jsx("option",{value:"",children:"请选择…"}),t.map(f=>a.jsxs("option",{value:f.engine,children:[f.engine,"(",f.cmd,f.version?` v${f.version}`:"",")"]},f.engine)),!t.some(f=>f.engine==="llm_only")&&a.jsx("option",{value:"llm_only",children:"llm_only(无需本地 CLI)"})]})]}),(i==null?void 0:i.status)==="error"&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),i.message]}),l&&a.jsx("div",{className:"console-sub__saving",children:"保存中…"})]}),d.length>0&&a.jsxs("div",{className:"console-card",children:[a.jsx("div",{className:"console-card__head",children:a.jsx("span",{className:"console-card__title",children:"引擎补充配置"})}),d.map(f=>a.jsx(fn,{item:f,onSave:n},f.key))]})]})}function ny({ref_:e,placeholder:t}){const n=Ga(e,{embed:!0}),r=Ga(e),[s,i]=w.useState(!1);return w.useEffect(()=>{i(!1)},[n]),!n||!r?a.jsxs("div",{className:"console-frame__empty",children:[a.jsx($,{name:"table",size:26,color:"var(--text-faint)"}),a.jsx("p",{className:"console-frame__empty-text",children:t})]}):a.jsxs("div",{className:"console-frame",children:[a.jsxs("div",{className:"console-frame__stage",children:[!s&&a.jsxs("div",{className:"console-frame__loading",children:[a.jsx("span",{className:"console-frame__spinner"}),"正在加载表格…"]}),a.jsx("iframe",{className:"console-frame__iframe",src:n,title:(e==null?void 0:e.label)??"AI 表格",allow:"clipboard-read; clipboard-write",onLoad:()=>i(!0)})]}),a.jsxs("div",{className:"console-frame__foot",children:[a.jsx($,{name:"link",size:11,color:"var(--text-muted)"}),a.jsx("span",{children:"若显示登录页,请先在浏览器登录钉钉"}),a.jsx("a",{className:"console-frame__link",href:r,target:"_blank",rel:"noreferrer",children:"在新标签页打开"})]})]})}const i9="wiki/official-aitable-faq",o9="knowledge-ingest";function a9({state:e,artifacts:t,onReload:n}){var y;const[r,s]=w.useState(null),[i,o]=w.useState(null),l=(e==null?void 0:e.kbRoleId)??null,c=(e==null?void 0:e.kb.userCollection)??null,u=(e==null?void 0:e.kb.officialOn)??!1,d=(e==null?void 0:e.kb.stats)??{},f=c?d[c]:void 0,h=d[i9],p=(y=t==null?void 0:t.trackers)==null?void 0:y[o9],g=(c?1:0)+(u?1:0),x=Object.values(d).some(m=>m.status==="compiling"),_=w.useRef(n);_.current=n,w.useEffect(()=>{if(!x)return;const m=setInterval(()=>_.current(),4e3);return()=>clearInterval(m)},[x]);async function v(m){if(l){s("official"),o(null);try{const b=await PD(l,m);if(!b.ok){o(b.message);return}n()}catch(b){o(b instanceof Error?b.message:String(b))}finally{s(null)}}}return a.jsx("div",{className:"console-page console-page--frame",children:a.jsxs("section",{className:"console-section console-section--frame",children:[a.jsxs("div",{className:"console-kb__title-row",children:[a.jsx("h2",{className:"console-section__title",children:"知识库"}),a.jsxs("span",{className:"console-kb__count",children:["已启用 ",g," 个"]})]}),a.jsx("p",{className:"console-section__sub",children:"助手可同时使用多个知识库作答:在「我的知识库」上传你自己的知识,添加后助手会自动学习; 官方知识库是内置的 AI 表格官方答疑知识库,只读,可随时启用作为补充。"}),!l&&a.jsxs("div",{className:"console-note console-note--warn",children:[a.jsx($,{name:"warn",size:13,color:"var(--amber)"}),a.jsx("div",{children:"未在 profile 中找到带知识库的角色,知识库功能不可用。"})]}),a.jsxs("div",{className:"console-kb",children:[a.jsxs("div",{className:"console-kb__card console-kb__card--official",children:[a.jsxs("div",{className:"console-kb__head",children:[a.jsx($,{name:"file",size:16,color:"var(--accent)"}),a.jsx("span",{className:"console-kb__title",children:"官方知识库 · 钉钉 AI 表格 FAQ"}),a.jsx("span",{className:"console-kb__badge",children:"只读"}),a.jsxs("label",{className:"console-kb__switch",children:[a.jsx("input",{type:"checkbox",checked:u,disabled:r!==null||!l,onChange:m=>void v(m.target.checked)}),r==="official"?"切换中…":u?"已启用":"未启用"]})]}),a.jsx("p",{className:"console-kb__desc",children:"内置的 AI 表格官方答疑知识库,覆盖快速入门、字段与视图、自动化、仪表盘等常见问题。 只读,不可查看或修改;启用后助手会把它和你的知识库一起作为作答参考。"}),a.jsx("div",{className:"console-kb__stats",children:u?Hw(h):"未启用,不参与作答"})]}),a.jsxs("div",{className:"console-kb__card",children:[a.jsxs("div",{className:"console-kb__head",children:[a.jsx($,{name:"table",size:16,color:"var(--accent)"}),a.jsx("span",{className:"console-kb__title",children:"我的知识库"}),a.jsx("span",{className:"console-kb__stats",children:Hw(f)})]}),a.jsx("p",{className:"console-kb__desc",children:"在这里上传和管理你自己的知识。在下方表格新增一行就是一条知识:填写「标题」和「内容」, 或提供「来源附件」/「来源链接」;然后把「状态」拨为「待处理」, 助手运行期间会自动学习并编译,完成后状态变为「就绪」。"}),a.jsx(ny,{ref_:p,placeholder:"还没有「我的知识库」表。请先在首页完成配置并点「开始搭建」,系统会自动创建这张录入表。"})]})]}),i&&a.jsxs("div",{className:"console-note console-note--err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),a.jsx("div",{children:i})]})]})})}function Hw(e){if(!e||e.status==="unknown")return"尚未编译";if(e.status==="compiling")return"正在编译…";const t=[];return typeof e.sourceCount=="number"&&t.push(`${e.sourceCount} 个来源`),typeof e.articleCount=="number"&&t.push(`${e.articleCount} 篇知识文章`),e.finishedAt&&t.push(`更新于 ${l9(e.finishedAt)}`),t.length===0?e.status==="failed"?"上次编译失败":"尚未编译":e.status==="failed"?`${t.join(" · ")}(上次编译失败)`:t.join(" · ")}function l9(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function c9({artifacts:e,workflowId:t}){const n=ty(e==null?void 0:e.trackers,t),r=Ga(n);return a.jsx("div",{className:"console-page console-page--frame",children:a.jsxs("section",{className:"console-section console-section--frame",children:[a.jsx("h2",{className:"console-section__title",children:"答疑记录"}),a.jsx("p",{className:"console-section__sub",children:"助手处理过的每条群消息都会留痕在这里:原始提问、处置动作、回答内容与知识沉淀状态。 管理员在「★ 知识收件箱」视图里补充答案,即可把缺口沉淀进知识库。"}),r&&a.jsxs("p",{className:"console-section__tablelink",children:["详情可见 AI 表格 ——"," ",a.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",children:["「",(n==null?void 0:n.label)??"群问答记录表","」"]})]}),a.jsx(ny,{ref_:n,placeholder:"还没有「群问答记录表」。请先在首页完成配置并点「开始搭建」,系统会自动创建这张表。"})]})})}function u9({artifacts:e,workflowId:t}){const n=ty(e==null?void 0:e.trackers,t),r=n9(e==null?void 0:e.configTables,(n==null?void 0:n.baseId)??""),[s,i]=w.useState(0),[o,l]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState(null),h=r[s]??r[0],p=Ga(h.ref);async function g(){l(!0),f(null),u(null);try{const x=await MD(d9);u(x.actions>0?{tone:"ok",text:`同步完成:处理了 ${x.actions} 条配置动作,新的管理员与负责人名单已生效。`}:{tone:"warn",text:"配置同步已执行,但没有产出任何动作。请检查表格里是否有可用行(空表、必填列没填都会这样)。"})}catch(x){f(x instanceof Error?x.message:String(x))}finally{l(!1)}}return a.jsx("div",{className:"console-page console-page--frame",children:a.jsxs("section",{className:"console-section console-section--frame",children:[a.jsx("h2",{className:"console-section__title",children:"专家配置"}),a.jsx("div",{className:"console-tabs",children:r.map((x,_)=>a.jsxs("button",{type:"button",className:`console-tabs__tab${_===s?" is-active":""}`,onClick:()=>i(_),children:[x.label,!f9(x.ref)&&a.jsx("span",{className:"console-tabs__dot"})]},x.field))}),a.jsxs("div",{className:"console-note",children:[a.jsx($,{name:"user",size:13,color:"var(--blue)"}),a.jsxs("div",{children:[a.jsxs("div",{className:"console-note__title",children:[h.label,"有什么用"]}),a.jsx("div",{children:h.purpose}),a.jsxs("div",{className:"console-note__howto",children:[a.jsx("strong",{children:"怎么配:"}),h.howTo]})]})]}),p&&a.jsxs("p",{className:"console-section__tablelink",children:["详情可见 AI 表格 ——"," ",a.jsxs("a",{href:p,target:"_blank",rel:"noreferrer",children:["「",h.label,"」"]})]}),a.jsx(ny,{ref_:h.ref,placeholder:`还没有「${h.label}」。请先在首页完成搭建,系统会在同一个 AI 表格里创建这张配置表。`}),a.jsxs("div",{className:"console-sync",children:[a.jsxs("button",{type:"button",className:"primary",onClick:()=>void g(),disabled:o,children:[a.jsx($,{name:"refresh",size:14,color:"#fff"}),o?"同步中…":"同步配置"]}),a.jsx("span",{className:"console-sync__hint",children:"在表格里改完管理员或模块负责人后,点这里让助手立刻重新读取名单"}),(c==null?void 0:c.tone)==="ok"&&a.jsxs("span",{className:"console-sub__ok",children:[a.jsx($,{name:"check",size:13,color:"var(--green)"}),c.text]}),(c==null?void 0:c.tone)==="warn"&&a.jsxs("span",{className:"console-sub__warn",children:[a.jsx($,{name:"warn",size:13,color:"var(--amber)"}),c.text]}),d&&a.jsxs("span",{className:"console-sub__err",children:[a.jsx($,{name:"warn",size:13,color:"var(--red)"}),d]})]})]})})}const d9="config-sync";function f9(e){return!!(e!=null&&e.baseId)&&!!e.tableId}const Ww=8e3,h9=2e3;function p9({mode:e,onFallback:t}){var V;const[n,r]=w.useState(e),[s,i]=w.useState("home"),[o,l]=w.useState(null),[c,u]=w.useState(null),[d,f]=w.useState(null),[h,p]=w.useState(null),[g,x]=w.useState(!0),[_,v]=w.useState(null),[y,m]=w.useState(!1),[b,j]=w.useState(!1),[k,S]=w.useState(null),[N,R]=w.useState(null),[O,D]=w.useState(!1),[M,z]=w.useState(null),T=w.useRef(!1),E=w.useCallback(async(H=!1)=>{v(null);try{const[U,W,G]=await Promise.all([H?Promise.resolve(null):jk(),jD(),o_().catch(()=>null)]);U&&l(U),u(W),f(G),G!=null&&G.ready&&j(!0)}catch(U){v(U instanceof Error?U.message:String(U))}finally{x(!1)}},[]);w.useEffect(()=>{E()},[E]),w.useEffect(()=>{if(n){Mp().then(U=>D(!!U.promotable)).catch(()=>{});return}let H=!1;return Mp().then(U=>{H||(r(U.mode),D(!!U.promotable))}).catch(()=>{H||r("setup")}),()=>{H=!0}},[n]),w.useEffect(()=>{if(n!=="runtime")return;let H=!1,U;const W=async()=>{try{const G=await AD();if(H)return;p(G);const Y=G.pending||G.status==="starting"||G.status==="stopping";U=setTimeout(()=>void W(),Y?h9:Ww)}catch{H||(U=setTimeout(()=>void W(),Ww))}};return W(),()=>{H=!0,U&&clearTimeout(U)}},[n]);const A=w.useCallback(async(H,U)=>{const W=await Ip([{writeTarget:H,value:U}]);l(G=>G&&{...G,config:W.recheck})},[]);async function P(){m(!0),S({phase:"running",logs:[]});try{await bk()}catch(U){const W=U instanceof Error?U.message:String(U);v(W),m(!1),S({phase:"error",message:W});return}const H=async()=>{try{const U=await i_();if(S(U),U.phase==="done"){j(!0),R(U.baseUrl),m(!1),z(U.promotionError??null),U.mode&&U.mode!==n&&r(U.mode);const W=await o_().catch(()=>null);W&&f(W)}else U.phase==="error"?(v(U.message),m(!1)):setTimeout(()=>void H(),2e3)}catch(U){const W=U instanceof Error?U.message:String(U);v(W),m(!1),S({phase:"error",message:W})}};H()}async function I(){if(T.current)return;const H=Uw(h);if(!H.disabled){T.current=!0;try{const U=await ID(H.action);p(U.status)}catch(U){v(U instanceof Error?U.message:String(U))}finally{T.current=!1}}}async function C(){try{await SD(),r("runtime"),z(null);const H=await i_().catch(()=>null);(H==null?void 0:H.phase)==="done"&&S(H)}catch(H){z(H instanceof Error?H.message:String(H))}}const L=n==="runtime"?Uw(h):null,F=((L==null?void 0:L.disabled)??!0)||!b;return a.jsxs("div",{className:"console",children:[a.jsxs("aside",{className:"console__rail",children:[a.jsxs("div",{className:"console__brand",children:[a.jsx("span",{className:"console__brand-mark",children:a.jsx($,{name:"sparkle",size:14,color:"#fff"})}),a.jsx("span",{className:"console__brand-text",children:"群答疑助手"})]}),a.jsx("nav",{className:"console__nav",children:Vw.map(H=>a.jsxs("button",{type:"button",className:`console__nav-item${s===H.id?" is-active":""}`,onClick:()=>i(H.id),children:[a.jsx($,{name:H.icon,size:15}),H.label]},H.id))}),a.jsxs("button",{type:"button",className:"console__fallback",onClick:t,children:[a.jsx($,{name:"bolt",size:13}),"切换到通用配置"]})]}),a.jsxs("div",{className:"console__main",children:[a.jsxs("header",{className:"console__topbar",children:[a.jsx("div",{className:"console__topbar-title",children:(V=Vw.find(H=>H.id===s))==null?void 0:V.label}),a.jsx("div",{className:"console__spacer"}),n==="runtime"&&L&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:`console__status console__status--${(h==null?void 0:h.status)??"unknown"}`,children:[a.jsx($,{name:"dot",size:11}),L.statusLabel]}),a.jsxs("button",{type:"button",className:L.tone==="danger"?"ghost console__run console__run--danger":"primary console__run",onClick:()=>void I(),disabled:F,title:b?void 0:"请先完成搭建",children:[a.jsx($,{name:L.action==="stop"?"pause":"play",size:13,color:L.tone==="danger"?void 0:"#fff"}),L.label]})]}),n==="setup"&&O&&a.jsxs("button",{type:"button",className:"primary console__run",disabled:!0,title:"完成搭建后可启动运行",children:[a.jsx($,{name:"play",size:13,color:"#fff"}),"启动运行"]})]}),_&&a.jsxs("div",{className:"console__error",children:[a.jsx($,{name:"warn",size:14,color:"var(--red)"}),a.jsx("span",{children:_}),a.jsx("button",{type:"button",className:"console__retry",onClick:()=>void E(),children:"重试"})]}),n==="setup"&&M&&a.jsxs("div",{className:"console__error",children:[a.jsx($,{name:"warn",size:14,color:"var(--red)"}),a.jsxs("span",{children:["进入运行模式失败:",M]}),a.jsx("button",{type:"button",className:"console__retry",onClick:()=>void C(),children:"重试进入运行模式"})]}),(h==null?void 0:h.lastError)&&a.jsxs("div",{className:"console__error",children:[a.jsx($,{name:"warn",size:14,color:"var(--amber)"}),a.jsxs("span",{children:["上次运行报错:",h.lastError]})]}),g||!n?a.jsx("div",{className:"console__loading",children:"正在读取配置…"}):y?a.jsx(m9,{progress:k}):s==="home"?a.jsx(r9,{mode:n,state:c,config:(o==null?void 0:o.config)??null,engines:(o==null?void 0:o.engines.available)??[],artifacts:d,buildDone:b,buildBaseUrl:N,onSave:A,onReload:()=>void E(),onStartBuild:()=>void P(),building:y}):s==="kb"?a.jsx(a9,{state:c,artifacts:d,onReload:()=>void E(!0)}):s==="records"?a.jsx(c9,{artifacts:d,workflowId:(c==null?void 0:c.workflowId)??null}):a.jsx(u9,{artifacts:d,workflowId:(c==null?void 0:c.workflowId)??null})]}),a.jsxs("a",{className:"console-joingroup",href:"https://qr.dingtalk.com/action/joingroup?code=v1,k1,/xIPTTGROCslSemXwkUCiBNuwoP52KHYqXWhiIoOFnWdR7ksupjDEA==&_dt_no_comment=1&origin=1",target:"_blank",rel:"noopener noreferrer",children:[a.jsx($,{name:"user",size:14,color:"#fff"}),"加入交流群"]})]})}function m9({progress:e}){return a.jsx("div",{className:"console-page",children:a.jsxs("div",{className:"console-build console-build--center",children:[a.jsx("span",{className:"console-build__spinner"}),a.jsx("h2",{className:"console-build__title",children:"正在搭建 AI 表格"}),a.jsx("p",{className:"console-build__hint",children:(e==null?void 0:e.phase)==="running"?"正在创建数据表、字段、视图与自动化…":"正在启动搭建任务…"})]})})}function g9(){const e=Sr(),[t]=w.useState(()=>(wk(),Mp().then(s=>r(s.mode)).catch(()=>r("setup")),null)),[n,r]=w.useState(t);return a.jsx(p9,{mode:n,onFallback:()=>e("/setup")})}async function v9(){return(await(await ue("/api/account/profile")).json()).user}async function ry(){return(await(await ue("/api/account/machines")).json()).machines}async function y9(e){await ue(`/api/account/machines/${e}`,{method:"DELETE"})}async function x9(e,t){await ue(`/api/account/machines/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}async function _9(e){return(await(await ue(`/api/account/machines/${e}/regenerate-key`,{method:"POST"})).json()).key}async function jT(){return(await(await ue("/api/account/owner-token")).json()).token}let _m;async function w9(){try{const e=await fetch(`${nk}/api/public-config`);if(e.ok){const t=await e.json();t.relayGatewayUrl&&(_m=t.relayGatewayUrl)}}catch{}}function ST(){return _m||(typeof window<"u"?window.location.origin.replace(/^http/,"ws"):"ws://your-server:8787")}const Kw="@ali/aitable-workflow@latest",b9="";function j9(e){return e?`npm i -g --registry=${e} ${Kw}`:`npm i -g ${Kw}`}function S9(e=b9){return j9(e)}function k9(e,t=ST()){return["aitable-workflow connect",` --server-url ${t}`,` --key ${e}`," --name <此机器名>"].join(` \\
93
+ `)}function N9(e,t="<此机器名>",n=ST()){return["aitable-workflow connect",` --server-url ${n}`,` --token ${e}`,` --name ${t}`].join(` \\
94
+ `)}function wm({machineKey:e,ownerToken:t,machineName:n,title:r,persistent:s,onClose:i}){const[o,l]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState(!1),h=!!t,p=t??e??"",g=h?"Owner Token":"Machine Key",x=S9(),_=h?N9(t,n||void 0):k9(e??"");function v(y,m){navigator.clipboard.writeText(y).then(()=>{m(!0),setTimeout(()=>m(!1),2e3)})}return a.jsxs("div",{className:"daemon-connect-card",children:[a.jsxs("div",{className:"daemon-connect-card__header",children:[a.jsx($,{name:"check",size:16,color:"var(--green)"}),a.jsx("span",{className:"daemon-connect-card__title",children:r??(h?"添加执行引擎":`机器「${n??""}」创建成功`)})]}),a.jsxs("div",{className:"daemon-connect-card__warn",children:[a.jsx($,{name:"warn",size:14}),h?"该 owner-token 是账号级长期凭证,请妥善保管勿外泄(可在账号中心轮换)":s?"该命令含接入密钥,请妥善保管勿外泄":"密钥仅此一次展示,请立即复制保管"]}),a.jsxs("div",{className:"daemon-connect-card__section",children:[a.jsx("div",{className:"daemon-connect-card__label",children:g}),a.jsxs("div",{className:"daemon-connect-card__copyable",children:[a.jsx("code",{className:"daemon-connect-card__code",children:p}),a.jsxs("button",{type:"button",className:"daemon-connect-card__copy-btn",onClick:()=>v(p,l),title:"复制凭证",children:[o?a.jsx($,{name:"check",size:12}):a.jsx($,{name:"link",size:12}),o?"已复制":"复制"]})]})]}),a.jsxs("div",{className:"daemon-connect-card__section",children:[a.jsx("div",{className:"daemon-connect-card__label",children:"首次安装(一次性)"}),a.jsxs("div",{className:"daemon-connect-card__copyable daemon-connect-card__copyable--cmd",children:[a.jsx("pre",{className:"daemon-connect-card__pre",children:x}),a.jsxs("button",{type:"button",className:"daemon-connect-card__copy-btn",onClick:()=>v(x,f),title:"复制安装命令",children:[d?a.jsx($,{name:"check",size:12}):a.jsx($,{name:"link",size:12}),d?"已复制":"复制"]})]}),a.jsx("div",{className:"daemon-connect-card__hint",children:"仅首次安装或升级 CLI 时执行一次,之后无需重复。"})]}),a.jsxs("div",{className:"daemon-connect-card__section",children:[a.jsx("div",{className:"daemon-connect-card__label",children:"Daemon 接入命令(后台运行)"}),a.jsxs("div",{className:"daemon-connect-card__copyable daemon-connect-card__copyable--cmd",children:[a.jsx("pre",{className:"daemon-connect-card__pre",children:_}),a.jsxs("button",{type:"button",className:"daemon-connect-card__copy-btn",onClick:()=>v(_,u),title:"复制命令",children:[c?a.jsx($,{name:"check",size:12}):a.jsx($,{name:"link",size:12}),c?"已复制":"复制"]})]}),a.jsx("div",{className:"daemon-connect-card__hint",children:h?a.jsxs(a.Fragment,{children:["将 ",a.jsx("code",{children:"<此机器名>"})," 改为该机器的稳定名称(相同名字复用同一台,不同名字新增一台), 在目标机器上执行即可:保存凭证 → ",a.jsx("strong",{children:"后台启动 daemon"}),", 终端随后打印 status / logs / stop 等常用命令指引。工作区默认为"," ",a.jsx("code",{children:"~/.aitable-workflow/workspaces/<机器名>"}),",如需自定义可加"," ",a.jsx("code",{children:"--workspace-root <目录>"}),"。",a.jsx("br",{}),"多网关 / 多台机器请为每台使用",a.jsxs("strong",{children:["不同的 ",a.jsx("code",{children:"--name"})]}),"(相同 name 连不同 gateway 会覆盖本机凭证)。"]}):a.jsxs(a.Fragment,{children:["在目标机器上执行即可:保存凭证 → ",a.jsx("strong",{children:"后台启动 daemon"}),", 终端随后打印 status / logs / stop 等常用命令指引。工作区默认为"," ",a.jsx("code",{children:"~/.aitable-workflow/workspaces/<机器名>"}),",如需自定义可加"," ",a.jsx("code",{children:"--workspace-root <目录>"}),"。",a.jsx("br",{}),"多网关 / 多台机器请为每台使用",a.jsxs("strong",{children:["不同的 ",a.jsx("code",{children:"--name"})]}),"(相同 name 连不同 gateway 会覆盖本机凭证)。"]})})]}),a.jsx("div",{className:"daemon-connect-card__actions",children:a.jsx("button",{type:"button",className:"daemon-connect-card__close",onClick:i,children:"我已复制,关闭"})})]})}function E9(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(Number.isNaN(r))return e;const s=Math.floor(r/1e3);if(s<60)return"刚刚";const i=Math.floor(s/60);if(i<60)return`${i}分钟前`;const o=Math.floor(i/60);if(o<24)return`${o}小时前`;const l=Math.floor(o/24);if(l<30)return`${l}天前`;const c=Math.floor(l/30);return c<12?`${c}个月前`:`${Math.floor(c/12)}年前`}function C9(e){return e.length<=12?e:e.slice(0,6)+"..."+e.slice(-4)}const T9={claudecode:"Claude",codex:"Codex",qoder:"Qoder",codebuddy:"Codebuddy",opencode:"OpenCode",qwen:"Qwen",deepseek:"DeepSeek",trae:"Trae",qwenwork:"千问办公"};function P9({machine:e,onRevoke:t,onUpdated:n}){const[r,s]=w.useState(!1),[i,o]=w.useState(!1),[l,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(null),[p,g]=w.useState(null);function x(){navigator.clipboard.writeText(e.machineId).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})}async function _(){d(!0);try{const N=await jT();h(N)}catch(N){window.alert("获取接入指令失败:"+(N instanceof Error?N.message:String(N)))}finally{d(!1)}}async function v(){if(window.confirm(`确定要为「${e.displayName||e.name}」重新生成密钥吗?旧密钥将立即失效,需用新密钥重新接入。`)){d(!0);try{const R=await _9(e.machineId);g(R)}catch(R){window.alert("重新生成失败:"+(R instanceof Error?R.message:String(R)))}finally{d(!1)}}}function y(){window.confirm(`确定要撤销执行引擎「${e.displayName||e.name}」吗?撤销后该机器将无法连接。`)&&t(e.machineId)}function m(){c(e.displayName||e.name),o(!0)}async function b(){const N=l.trim();if(N){try{await x9(e.machineId,{displayName:N}),n==null||n(e.machineId,{displayName:N})}catch(R){window.alert("修改失败:"+(R instanceof Error?R.message:String(R)))}o(!1)}}const j=e.displayName||e.name,k=e.status==="online",S=e.runtimes??[];return a.jsxs("div",{className:"machine-card",children:[a.jsxs("div",{className:"machine-card__header",children:[a.jsx("span",{className:`machine-status ${k?"machine-status--online":"machine-status--offline"}`}),i?a.jsxs("span",{className:"machine-card__edit-row",children:[a.jsx("input",{className:"machine-card__edit-input",type:"text",value:l,onChange:N=>c(N.target.value),onKeyDown:N=>{N.key==="Enter"&&b(),N.key==="Escape"&&o(!1)},autoFocus:!0}),a.jsx("button",{type:"button",className:"machine-card__edit-save",onClick:()=>void b(),title:"保存",children:a.jsx($,{name:"check",size:12})}),a.jsx("button",{type:"button",className:"machine-card__edit-cancel",onClick:()=>o(!1),title:"取消",children:a.jsx($,{name:"close",size:12})})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"machine-card__name",onDoubleClick:m,title:"双击编辑名称",children:j}),e.displayName&&e.name!==e.displayName&&a.jsx("span",{className:"machine-card__slug",children:e.name})]})]}),e.description&&a.jsx("div",{className:"machine-card__desc",children:e.description}),S.length>0?a.jsxs("div",{className:`machine-card__runtimes${k?"":" machine-card__runtimes--offline"}`,children:[S.map(N=>a.jsx("span",{className:"machine-card__runtime-tag",children:T9[N]??N},N)),e.hasDws&&a.jsx("span",{className:"machine-card__runtime-tag machine-card__runtime-tag--dws",children:"dws"})]}):a.jsx("div",{className:"machine-card__runtimes machine-card__runtimes--offline",children:a.jsx("span",{className:"machine-card__runtime-hint",children:"未探测到引擎"})}),a.jsxs("div",{className:"machine-card__meta",children:[a.jsxs("span",{className:"machine-card__id",title:e.machineId,children:["ID: ",C9(e.machineId),a.jsx("button",{type:"button",className:"machine-card__copy",onClick:x,title:"复制 Machine ID",children:r?a.jsx($,{name:"check",size:12}):a.jsx($,{name:"link",size:12})})]}),a.jsx("span",{className:"machine-card__seen",children:k?"在线":e.lastSeen?`最后在线 ${E9(e.lastSeen)}`:"从未连接"})]}),a.jsxs("div",{className:"machine-card__actions",children:[a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:m,title:"编辑名称",children:[a.jsx($,{name:"file",size:12})," 编辑"]}),a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:()=>void _(),disabled:u,title:"查看该机器的接入指令(Key + 启动命令)",children:[a.jsx($,{name:"link",size:12})," 查看指令"]}),a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:()=>void v(),disabled:u,title:"重新生成密钥(旧密钥失效)",children:[a.jsx($,{name:"refresh",size:12})," 重生成密钥"]}),a.jsx("button",{type:"button",className:"machine-card__revoke",onClick:y,children:"撤销"})]}),f&&a.jsx(wm,{ownerToken:f,machineName:e.name,title:`「${j}」接入指令`,onClose:()=>h(null)}),p&&a.jsx(wm,{machineKey:p,machineName:j,title:`「${j}」新密钥已生成`,onClose:()=>g(null)})]})}function kT(){const[e,t]=w.useState([]),[n,r]=w.useState(!0),[s,i]=w.useState(""),[o,l]=w.useState(!1),[c,u]=w.useState(null);async function d(){r(!0),i("");try{const _=await ry();t(_)}catch(_){i(_ instanceof Error?_.message:String(_))}finally{r(!1)}}w.useEffect(()=>{d()},[]);async function f(){l(!0);try{const _=await jT();u(_)}catch(_){window.alert("获取接入指令失败:"+(_ instanceof Error?_.message:String(_)))}finally{l(!1)}}async function h(_){try{await y9(_),t(v=>v.filter(y=>y.machineId!==_))}catch(v){window.alert("撤销失败:"+(v instanceof Error?v.message:String(v)))}}function p(_,v){t(y=>y.map(m=>m.machineId===_?{...m,...v}:m))}if(n)return a.jsx("div",{className:"machine-list__loading",children:"加载中..."});if(s)return a.jsxs("div",{className:"machine-list__error",children:[a.jsx("span",{children:s}),a.jsx("button",{type:"button",className:"machine-list__retry",onClick:()=>void d(),children:"重试"})]});const g=e.filter(_=>_.status==="online"||_.lastSeen),x=g.filter(_=>_.status==="online").length;return a.jsxs("div",{className:"machine-list",children:[a.jsxs("div",{className:"machine-list__header",children:[a.jsxs("span",{className:"machine-list__count",children:["已接入 ",g.length," 台 · 在线 ",x," 台"]}),a.jsxs("div",{className:"machine-list__header-actions",children:[a.jsxs("button",{type:"button",className:"machine-list__refresh",onClick:()=>void d(),title:"刷新(daemon 接入后点此更新列表)",children:[a.jsx($,{name:"refresh",size:14}),"刷新"]}),a.jsxs("button",{type:"button",className:"primary machine-list__add",onClick:()=>void f(),disabled:o,children:[a.jsx($,{name:"plus",size:14}),o?"获取中...":"添加引擎"]})]})]}),c&&a.jsx(wm,{ownerToken:c,title:"添加执行引擎",onClose:()=>u(null)}),g.length===0&&!c?a.jsx("div",{className:"machine-list__empty",children:"暂无已接入的执行引擎。点击「添加引擎」获取自注册接入指令,在目标机器上执行 daemon 启动命令(填入机器名);接入成功后点「刷新」即可看到。"}):a.jsx("div",{className:"machine-list__grid",children:g.map(_=>a.jsx(P9,{machine:_,onRevoke:h,onUpdated:p},_.machineId))})]})}const A9={admin:"管理员",user:"普通用户"};function R9(e){try{return new Date(e).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"})}catch{return e}}function I9(){var u,d,f;const e=xk(),[t,n]=w.useState(null),[r,s]=w.useState(!0);w.useEffect(()=>{(async()=>{try{const h=await v9();n(h)}catch{}finally{s(!1)}})()},[]);const i=(t==null?void 0:t.username)??((u=e.user)==null?void 0:u.username)??"---",o=(t==null?void 0:t.role)??((d=e.user)==null?void 0:d.role)??"user",l=(t==null?void 0:t.createdAt)??null,c=(t==null?void 0:t.avatarUrl)||((f=e.user)==null?void 0:f.avatarUrl)||"";return a.jsx(Rd,{children:a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{className:"work-head__left",children:[a.jsxs(Ue,{className:"account-back-btn",to:"/",title:"返回首页",children:[a.jsx($,{name:"chevron-left",size:16}),"返回"]}),a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:"用户中心"}),a.jsx("div",{className:"work-head__sub",children:"管理账号信息与执行引擎"})]})]})}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"account-page",children:[a.jsxs("section",{className:"account-section",children:[a.jsx("h3",{className:"account-section__title",children:"账号信息"}),a.jsx("div",{className:"account-card",children:r?a.jsx("div",{className:"account-card__loading",children:"加载中..."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"account-card__row",children:[a.jsx("span",{className:"account-card__avatar",children:c?a.jsx("img",{className:"account-card__avatar-img",src:c,alt:""}):a.jsx($,{name:"user",size:24})}),a.jsxs("div",{className:"account-card__info",children:[a.jsx("span",{className:"account-card__username",children:i}),a.jsx("span",{className:`account-card__role account-card__role--${o}`,children:A9[o]??o})]})]}),l&&a.jsxs("div",{className:"account-card__detail",children:[a.jsx("span",{className:"account-card__label",children:"注册时间"}),a.jsx("span",{className:"account-card__value",children:R9(l)})]})]})})]}),a.jsxs("section",{className:"account-section",children:[a.jsx("h3",{className:"account-section__title",children:"执行引擎管理"}),a.jsx(kT,{})]})]})})]})})})}function M9(){return a.jsx(Rd,{children:a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsx("div",{className:"work-head",children:a.jsxs("div",{className:"work-head__left",children:[a.jsxs(Ue,{className:"account-back-btn",to:"/",title:"返回首页",children:[a.jsx($,{name:"chevron-left",size:16}),"返回"]}),a.jsxs("div",{children:[a.jsx("div",{className:"work-head__title",children:"执行引擎"}),a.jsx("div",{className:"work-head__sub",children:"生成接入密钥、查看启动命令,管理已接入的引擎"})]})]})}),a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"account-page",children:a.jsx("section",{className:"account-section",children:a.jsx(kT,{})})})})]})})})}function O9(e,t){return lk(e,t)}function bm(e,t){return e.questions.filter(n=>O9(n,t))}const ah={required:()=>"此项必填",max_selections:e=>`最多选 ${e.maxSelections} 项`};function L9(e,t){var s;const n=new Map(e.questions.map(i=>[i.id,i])),r={};for(const i of _$(e,t)){const o=n.get(i.questionId);r[i.questionId]=o?((s=ah[i.code])==null?void 0:s.call(ah,o))??i.message:i.message}return r}function $9(e){if(!e)return;const t=e.map(n=>typeof n=="string"?{label:n,value:n}:n);return t.length>0?t:void 0}function sy(e){return{id:e.id,title:e.title,...e.description?{description:e.description}:{},...e.submitLabel?{submitLabel:e.submitLabel}:{},questions:e.questions.map(t=>({...t,options:$9(t.options)}))}}function D9(e,t){var r;const n=(r=e.options)==null?void 0:r.find(s=>s.value===t||s.label===t);return(n==null?void 0:n.label)??t}function Gw(e,t){var r;const n=(r=e.options)==null?void 0:r.find(s=>s.value===t||s.label===t);return(n==null?void 0:n.value)??t}function qw(e,t){return D9(e,t)}function jm(e,t){const n=[`[表单答复 · ${e.title}]`];for(const r of bm(e,t)){const s=t[r.id];let i;Array.isArray(s)?i=s.length>0?s.map(o=>qw(r,o)).join("、"):"(跳过)":typeof s=="string"&&s.trim().length>0?i=qw(r,s.trim()):typeof s=="boolean"?i=s?"是":"否":i="(跳过)",n.push(`· ${r.label}:${i}`)}return n.join(`
95
+ `)}let z9=0;const wt=e=>`${e}_${(z9++).toString(36)}`,as=e=>new Promise(t=>setTimeout(t,e));class iy{constructor(){le(this,"state",{messages:[],busy:!1,pendingForm:null,formTransitioning:!1});le(this,"listeners",new Set);le(this,"formResolver",null);le(this,"currentAssistantId",null);le(this,"currentTextId",null);le(this,"agentTextMsgId",null);le(this,"agentTextSegId",null);le(this,"agentThinkingMsgId",null);le(this,"agentThinkingSegId",null);le(this,"animQueue",[]);le(this,"consuming",!1);le(this,"activeTasks",0);le(this,"onFormSubmit",null);le(this,"subscribe",t=>(this.listeners.add(t),()=>this.listeners.delete(t)));le(this,"getState",()=>this.state)}emit(){this.listeners.forEach(t=>t())}set(t){this.state={...this.state,...t},this.emit()}pushMessage(t){this.set({messages:[...this.state.messages,t]})}patchMessage(t,n){this.set({messages:this.state.messages.map(r=>r.id===t?n(r):r)})}ensureAssistant(){if(this.currentAssistantId)return this.currentAssistantId;const t=wt("a");return this.currentAssistantId=t,this.currentTextId=null,this.pushMessage({id:t,role:"assistant",segments:[]}),t}addSegment(t){const n=this.ensureAssistant();this.patchMessage(n,r=>({...r,segments:[...r.segments,t]}))}patchSegment(t,n,r){this.patchMessage(t,s=>({...s,segments:s.segments.map(i=>i.id===n?r(i):i)}))}addUserMessage(t){this.pushMessage({id:wt("u"),role:"user",segments:[{kind:"text",id:wt("t"),text:t}]})}run(t){return new Promise(n=>{this.animQueue.push({script:t,resolve:n}),this.ensureConsumer()})}enqueue(t){this.animQueue.push({script:t}),this.ensureConsumer()}beginTask(t,n){const r=this.ensureAssistant(),s=wt("tool");this.resetAgentStream(),this.addSegment({kind:"tool",id:s,tool:{id:wt("tr"),label:t,detail:n,status:"running"}}),this.activeTasks+=1,this.state.busy||this.set({busy:!0});let i=!1;return(o="done")=>{i||(i=!0,this.patchSegment(r,s,l=>l.kind==="tool"?{...l,tool:{...l.tool,status:o}}:l),this.activeTasks=Math.max(0,this.activeTasks-1),this.currentAssistantId=null,this.currentTextId=null,this.activeTasks===0&&!this.consuming&&this.set({busy:!1}))}}ensureConsumer(){this.consuming||(this.consuming=!0,this.state.busy||this.set({busy:!0}),this.consume())}async consume(){var t;for(;this.animQueue.length>0;){const n=this.animQueue.shift();for(const r of n.script)await this.step(r);this.currentAssistantId=null,this.currentTextId=null,(t=n.resolve)==null||t.call(n)}this.consuming=!1,this.set({busy:this.activeTasks>0,formTransitioning:!1})}pendingBeats(){let t=0;for(const n of this.animQueue)t+=n.script.length;return t}async pace(t){const n=this.pendingBeats();if(!(n>=24)){if(n>=8){await as(Math.min(t,6));return}await as(t)}}async step(t){var n;switch(t.kind){case"wait":await as(t.ms);return;case"do":t.run();return;case"say":this.resetAgentStream(),await this.streamText(t.text);return;case"agent-text":this.appendAgentText(t.content),await this.pace(24);return;case"agent-thinking":this.appendAgentThinking(t.content),await this.pace(24);return;case"todo":{const r=t.items.map((s,i)=>({id:wt("td"),text:s,status:i===0?"active":"pending"}));this.addSegment({kind:"todo",id:wt("todo"),items:r}),await as(240);return}case"todo-advance":this.advanceTodo(),await as(300);return;case"tool":{this.resetAgentStream();const r=this.ensureAssistant(),s=wt("tool"),i={id:wt("tr"),label:t.label,detail:t.detail,status:"running"};this.addSegment({kind:"tool",id:s,tool:i}),await this.pace(t.ms??700),this.patchSegment(r,s,o=>o.kind==="tool"?{...o,tool:{...o.tool,status:"done"}}:o),this.currentTextId=null,await this.pace(160);return}case"form":{if(((n=this.state.pendingForm)==null?void 0:n.form.id)===t.form.id)return;const r=this.ensureAssistant(),s=wt("form");this.addSegment({kind:"form",id:s,form:t.form}),this.set({pendingForm:{messageId:r,segmentId:s,form:t.form},formTransitioning:!1}),await new Promise(i=>{this.formResolver=i}),this.currentAssistantId=null,this.currentTextId=null;return}}}advanceTodo(){const t=this.state.messages.map(n=>{let r=!1;const s=n.segments.map(i=>{if(r||i.kind!=="todo")return i;const o=i.items.findIndex(c=>c.status==="active");if(o===-1)return i;r=!0;const l=i.items.map((c,u)=>u===o?{...c,status:"done"}:u===o+1?{...c,status:"active"}:c);return{...i,items:l}});return r?{...n,segments:s}:n});this.set({messages:t})}resetAgentStream(){this.agentTextMsgId=null,this.agentTextSegId=null,this.agentThinkingMsgId=null,this.agentThinkingSegId=null}appendAgentText(t){if(this.agentTextMsgId&&this.agentTextSegId){this.patchSegment(this.agentTextMsgId,this.agentTextSegId,s=>s.kind==="agent-text"?{...s,text:s.text+t}:s);return}this.currentTextId=null;const n=this.ensureAssistant(),r=wt("atext");this.agentTextMsgId=n,this.agentTextSegId=r,this.addSegment({kind:"agent-text",id:r,text:t})}appendAgentThinking(t){if(this.agentThinkingMsgId&&this.agentThinkingSegId){this.patchSegment(this.agentThinkingMsgId,this.agentThinkingSegId,s=>s.kind==="agent-thinking"?{...s,text:s.text+t}:s);return}this.currentTextId=null;const n=this.ensureAssistant(),r=wt("athink");this.agentThinkingMsgId=n,this.agentThinkingSegId=r,this.addSegment({kind:"agent-thinking",id:r,text:t})}async streamText(t){const n=this.ensureAssistant(),r=wt("t");this.currentTextId=r,this.addSegment({kind:"text",id:r,text:""});const s=2;for(let i=0;i<t.length;i+=s){const o=t.slice(0,i+s);this.patchSegment(n,r,l=>l.kind==="text"?{...l,text:o}:l),await as(12)}this.patchSegment(n,r,i=>i.kind==="text"?{...i,text:t}:i),await as(80)}submitForm(t){var s;const n=this.state.pendingForm;if(!n)return;this.patchSegment(n.messageId,n.segmentId,i=>i.kind==="form"?{...i,answers:t}:i),this.addUserMessage(jm(n.form,t)),(s=this.onFormSubmit)==null||s.call(this,n.form.id,t),this.set({pendingForm:null,formTransitioning:!0});const r=this.formResolver;this.formResolver=null,r==null||r()}reset(){var t;for(const n of this.animQueue)(t=n.resolve)==null||t.call(n);this.animQueue=[],this.consuming=!1,this.activeTasks=0,this.currentAssistantId=null,this.currentTextId=null,this.resetAgentStream(),this.formResolver=null,this.set({messages:[],busy:!1,pendingForm:null,formTransitioning:!1})}}function NT(e){return w.useSyncExternalStore(e.subscribe,e.getState,e.getState)}function ET({items:e}){const t=e.filter(n=>n.status==="done").length;return a.jsxs("div",{className:"todo-card",children:[a.jsxs("div",{className:"todo-card__head",children:[a.jsx($,{name:"check",size:14}),a.jsx("span",{children:"执行清单"}),a.jsxs("span",{className:"todo-card__count",children:[t,"/",e.length]})]}),a.jsx(Ze.ul,{className:"todo-card__list",variants:SE,initial:"hidden",animate:"visible",children:e.map(n=>a.jsxs(Ze.li,{className:`todo-item is-${n.status}`,variants:Ct,children:[a.jsx("span",{className:"todo-item__mark",children:n.status==="done"?a.jsx($,{name:"check",size:12}):n.status==="active"?a.jsx("span",{className:"todo-item__spinner"}):a.jsx("span",{className:"todo-item__dot"})}),a.jsx("span",{className:"todo-item__text",children:n.text})]},n.id))})]})}function F9({tool:e}){return a.jsxs("div",{className:`tool-card is-${e.status}`,children:[a.jsx("span",{className:"tool-card__icon",children:e.status==="running"?a.jsx("span",{className:"tool-card__spinner"}):e.status==="error"?a.jsx($,{name:"warn",size:14}):a.jsx($,{name:"check",size:14})}),a.jsx("span",{className:"tool-card__label",children:e.label}),e.detail?a.jsx("span",{className:"tool-card__detail",children:e.detail}):null]})}const CT=w.forwardRef(function({form:t,interactive:n,submittedAnswers:r,hideInternalSubmit:s=!1,onReadyChange:i,onSubmit:o},l){const c=w.useMemo(()=>U9(t,r),[t,r]),[u,d]=w.useState(c),[f,h]=w.useState({}),[p,g]=w.useState({}),x=!n||!o||r!==void 0,_=r??u;w.useEffect(()=>{d(M=>{let z=!1;const T={...M};for(const E of t.questions)T[E.id]===void 0&&(z=!0,T[E.id]=E.defaultValue!==void 0?Sm(E,E.defaultValue):TT(E));return z?T:M})},[t]);function v(M,z){x||(h(T=>T[M]?T:{...T,[M]:!0}),d(T=>({...T,[M]:z})))}function y(M,z,T){x||(h(E=>E[M]?E:{...E,[M]:!0}),d(E=>{const A=Array.isArray(E[M])?E[M]:[],P=A.includes(z);if(!P&&T!==void 0&&A.length>=T)return E;const I=P?A.filter(C=>C!==z):[...A,z];return{...E,[M]:I}}))}function m(M){x||(g(z=>({...z,[M]:!0})),h(z=>z[M]?z:{...z,[M]:!0}),d(z=>({...z,[M]:""})))}function b(M,z){x||(g(T=>T[M]?{...T,[M]:!1}:T),v(M,z))}function j(M,z){if(x)return;h(A=>A[M.id]?A:{...A,[M.id]:!0});const T=new Set((M.options??[]).map(A=>A.value)),E=z.split(/[,,]/).map(A=>A.trim()).filter(Boolean);d(A=>{const P=Array.isArray(A[M.id])?A[M.id]:[];return{...A,[M.id]:[...P.filter(I=>T.has(I)),...E]}})}const k=bm(t,_),S=L9(t,_),N=Object.keys(S).length===0;function R(M){const z={};for(const T of bm(t,M)){const E=M[T.id];E!==void 0&&(z[T.id]=E)}return z}function O(){if(x||!o||!N)return;const M=R(u);o(jm(t,M),M)}function D(){x||!o||o(jm(t,{}),{})}return w.useImperativeHandle(l,()=>({submit:O,skipAll:D})),w.useEffect(()=>{i==null||i(!x&&N)},[i,x,N]),a.jsxs("div",{className:`question-form${x?" question-form-locked":""}`,"data-form-id":t.id,children:[a.jsxs("div",{className:"question-form-head",children:[a.jsx("span",{className:"question-form-icon","aria-hidden":!0,children:"?"}),a.jsxs("div",{className:"question-form-titles",children:[a.jsx("div",{className:"question-form-title",children:t.title}),t.description?a.jsx("div",{className:"question-form-desc",children:t.description}):null]}),x?a.jsx("span",{className:"question-form-pill",children:"已回答"}):null]}),a.jsx("div",{className:"question-form-body",children:k.map(M=>{const z=_[M.id],T=f[M.id]?S[M.id]:void 0;return a.jsxs("div",{className:`qf-field${T?" qf-field-error":""}`,children:[a.jsxs("label",{className:"qf-label",children:[a.jsx("span",{children:M.label}),M.required?a.jsx("span",{className:"qf-required",children:"*"}):null]}),M.help?a.jsx("div",{className:"qf-help",children:M.help}):null,T?a.jsx("div",{className:"qf-error",children:T}):null,M.type==="radio"&&M.options?a.jsxs("div",{className:"qf-choices",role:"radiogroup",children:[M.options.map(E=>a.jsxs("label",{className:`qf-choice${z===E.value?" is-on":""}${x?" is-disabled":""}`,title:E.description,children:[a.jsx("input",{type:"radio",name:`${t.id}-${M.id}`,checked:!rc(M,z,p)&&z===E.value,disabled:x,onChange:()=>b(M.id,E.value)}),a.jsx(lh,{option:E})]},E.value)),Fc(M)?a.jsxs("label",{className:`qf-choice${rc(M,z,p)?" is-on":""}${x?" is-disabled":""}`,children:[a.jsx("input",{type:"radio",name:`${t.id}-${M.id}`,checked:rc(M,z,p),disabled:x,onChange:()=>m(M.id)}),a.jsx(lh,{option:{label:"其他 — 我自己说",value:V9}})]}):null,Fc(M)&&rc(M,z,p)?a.jsx("input",{type:"text",className:"qf-input",value:typeof z=="string"?z:"",placeholder:M.placeholder??"按你的想法写,不用挑上面的选项",disabled:x,onChange:E=>v(M.id,E.target.value)}):null]}):null,M.type==="checkbox"&&M.options?a.jsxs("div",{className:"qf-choices",children:[M.options.map(E=>{const A=Array.isArray(z)?z:[],P=A.includes(E.value),I=M.maxSelections!==void 0&&!P&&A.length>=M.maxSelections;return a.jsxs("label",{title:E.description,className:`qf-choice${P?" is-on":""}${I||x?" is-disabled":""}`,children:[a.jsx("input",{type:"checkbox",checked:P,disabled:x||I,onChange:()=>y(M.id,E.value,M.maxSelections)}),a.jsx(lh,{option:E})]},E.value)}),Fc(M)?a.jsx("input",{type:"text",className:"qf-input",value:B9(M,z).join(","),placeholder:"其他(多个用逗号分隔)",disabled:x,onChange:E=>j(M,E.target.value)}):null]}):null,M.type==="select"&&M.options?a.jsxs("select",{className:"qf-select",value:typeof z=="string"?z:"",disabled:x,onChange:E=>v(M.id,E.target.value),children:[a.jsx("option",{value:"",disabled:!0,children:M.placeholder??"请选择…"}),M.options.map(E=>a.jsx("option",{value:E.value,children:E.label},E.value))]}):null,M.type==="text"?a.jsx("input",{type:"text",className:"qf-input",value:typeof z=="string"?z:"",placeholder:M.placeholder,disabled:x,onChange:E=>v(M.id,E.target.value)}):null,M.type==="number"?a.jsx("input",{type:"number",className:"qf-input",value:typeof z=="string"?z:"",placeholder:M.placeholder,min:M.min,max:M.max,step:M.step,disabled:x,onChange:E=>v(M.id,E.target.value)}):null,M.type==="textarea"?a.jsx("textarea",{className:"qf-textarea",value:typeof z=="string"?z:"",placeholder:M.placeholder,rows:3,disabled:x,onChange:E=>v(M.id,E.target.value)}):null,M.type==="range"?a.jsxs("div",{className:"qf-range-wrap",children:[a.jsx("input",{type:"range",className:"qf-range",value:typeof z=="string"&&z.trim()?z:String(M.min??0),min:M.min,max:M.max,step:M.step,disabled:x,onChange:E=>v(M.id,E.target.value)}),a.jsx("output",{className:"qf-range-value",children:typeof z=="string"&&z.trim()?z:String(M.min??0)})]}):null,M.type==="color"?a.jsx("input",{type:"color",className:"qf-color",value:H9(z),disabled:x,onChange:E=>v(M.id,E.target.value)}):null,M.type==="switch"?a.jsxs("label",{className:"qf-switch",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:z===!0||z==="true",disabled:x,onChange:E=>v(M.id,E.target.checked?"true":"false")}),a.jsx("span",{"aria-hidden":!0})]}):null]},M.id)})}),s?null:a.jsxs("div",{className:"question-form-foot",children:[x?a.jsx("span",{className:"qf-locked-note",children:"已提交答复"}):a.jsx("span",{className:"qf-hint",children:"选择或填写后提交,未答项将记为跳过"}),x?null:a.jsx("button",{type:"button",className:"primary",onClick:O,disabled:!N,children:t.submitLabel??"提交"})]})]})}),V9="__custom__";function Fc(e){return e.type!=="radio"&&e.type!=="checkbox"?!1:e.allowCustom!==!1}function rc(e,t,n){return!Fc(e)||e.type!=="radio"?!1:n[e.id]?!0:typeof t!="string"||t===""?!1:!(e.options??[]).some(r=>r.value===t)}function B9(e,t){if(!Array.isArray(t))return[];const n=new Set((e.options??[]).map(r=>r.value));return t.filter(r=>!n.has(r))}function lh({option:e}){return a.jsxs("span",{className:"qf-chip-copy",children:[a.jsx("span",{children:e.label}),e.description?a.jsx("span",{className:"qf-chip-desc",children:e.description}):null]})}function U9(e,t){const n={};for(const r of e.questions)t&&t[r.id]!==void 0?n[r.id]=Sm(r,t[r.id]):r.defaultValue!==void 0?n[r.id]=Sm(r,r.defaultValue):n[r.id]=TT(r);return n}function TT(e){return e.type==="checkbox"?[]:e.type==="switch"?!1:e.type==="range"?String(e.min??0):e.type==="color"?"#000000":""}function Sm(e,t){return typeof t=="boolean"?t:Array.isArray(t)?t.map(n=>Gw(e,n)):Gw(e,t)}function H9(e){return typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e)?e:"#000000"}function W9({msg:e}){if(e.role==="user"){const t=e.segments.map(n=>n.kind==="text"?n.text:"").join("");return a.jsx(Ze.div,{className:"msg msg--user",variants:Ct,initial:"hidden",animate:"visible",children:a.jsx("div",{className:"msg__bubble",children:t})})}return a.jsxs(Ze.div,{className:"msg msg--assistant",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("div",{className:"msg__avatar","aria-hidden":!0,children:a.jsx($,{name:"sparkle",size:13,color:"#fff"})}),a.jsx("div",{className:"msg__content",children:e.segments.map(t=>{switch(t.kind){case"text":return a.jsx("p",{className:"msg__text",children:t.text},t.id);case"agent-text":return a.jsx("p",{className:"msg__text msg__text--agent",children:t.text},t.id);case"agent-thinking":return a.jsx(K9,{text:t.text},t.id);case"todo":return a.jsx(ET,{items:t.items},t.id);case"tool":return a.jsx(F9,{tool:t.tool},t.id);case"form":return t.answers?a.jsx(CT,{form:t.form,interactive:!1,submittedAnswers:t.answers},t.id):a.jsxs("div",{className:"msg__form-hint",children:[a.jsx($,{name:"chevron-right",size:14}),"请在右侧「问题」面板作答"]},t.id)}})})]})}function K9({text:e}){return a.jsxs("details",{className:"think-block",children:[a.jsxs("summary",{className:"think-block__summary",children:[a.jsx($,{name:"sparkle",size:12}),"思考过程"]}),a.jsx("div",{className:"think-block__body",children:e})]})}function G9({chat:e,placeholder:t,emptyHint:n,onSend:r,title:s,subtitle:i}){const{messages:o,busy:l}=NT(e),[c,u]=w.useState(""),d=w.useRef(null);w.useEffect(()=>{const h=d.current;h&&(h.scrollTop=h.scrollHeight)},[o,l]);function f(){const h=c.trim();!h||l||!r||(u(""),r(h))}return a.jsxs("div",{className:"chat",children:[s?a.jsxs("div",{className:"chat__head",children:[a.jsx("div",{className:"chat__head-title",children:s}),i?a.jsx("div",{className:"chat__head-sub",children:i}):null]}):null,a.jsxs("div",{className:"chat__body",ref:d,children:[o.length===0?a.jsx("div",{className:"chat__empty",children:n??"开始对话,agent 将引导你完成配置。"}):a.jsx(ea,{initial:!1,children:o.map(h=>a.jsx(W9,{msg:h},h.id))}),l?a.jsxs("div",{className:"chat__typing","aria-hidden":!0,children:[a.jsx("span",{}),a.jsx("span",{}),a.jsx("span",{})]}):null]}),r?a.jsxs("div",{className:"chat__composer",children:[a.jsx("textarea",{className:"chat__input",rows:1,value:c,placeholder:t??"输入消息…",disabled:l,onChange:h=>u(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),f())}}),a.jsx("button",{type:"button",className:"primary chat__send",disabled:l||!c.trim(),onClick:f,"aria-label":"发送",children:a.jsx($,{name:"send",size:16,color:"#fff"})})]}):null]})}const q9=280;function Y9({form:e,formKey:t=null,interactive:n,submittedAnswers:r,onSubmit:s}){const i=w.useRef(null),[o,l]=w.useState(!1),c=(e==null?void 0:e.questions.length)??0,u=r!==void 0,[d,f]=w.useState(0);w.useEffect(()=>{f(u?c:0)},[t,u,c]),w.useEffect(()=>{if(u){f(c);return}if(d>=c)return;const y=window.setTimeout(()=>f(m=>Math.min(m+1,c)),q9);return()=>window.clearTimeout(y)},[u,c,d]);const h=d>=c,p=u?c:Math.min(d,c),g=e?{...e,questions:e.questions.slice(0,p)}:null,x=!u&&!h,_=!!e&&n&&!x,v=_&&o;return a.jsxs("div",{className:"questions-panel",children:[a.jsx("div",{className:"questions-panel-body",children:g?a.jsxs(a.Fragment,{children:[a.jsx(CT,{ref:i,form:g,interactive:n,submittedAnswers:r,hideInternalSubmit:!0,onReadyChange:l,onSubmit:s}),x?a.jsxs("div",{className:"questions-panel-typing","aria-hidden":!0,children:[a.jsx("span",{className:"questions-panel-dot"}),a.jsx("span",{className:"questions-panel-dot"}),a.jsx("span",{className:"questions-panel-dot"})]}):null]}):a.jsx("div",{className:"questions-panel-skeleton",children:"正在生成问题…"})}),u?null:a.jsxs("div",{className:"questions-panel-foot",children:[a.jsx("span",{className:"questions-panel-status",children:x?"正在生成问题…":"选择或填写后继续"}),a.jsx("button",{type:"button",className:"ghost questions-skip",disabled:!_,onClick:()=>{var y;return(y=i.current)==null?void 0:y.skipAll()},children:"全部跳过"}),a.jsx("button",{type:"button",className:"primary questions-continue",disabled:!v,onClick:()=>{var y;return(y=i.current)==null?void 0:y.submit()},children:"继续"})]})]})}const Wu=lt(function({chat:t,work:n,workHead:r,hideWork:s=!1,onSend:i,chatTitle:o,chatSubtitle:l,chatPlaceholder:c,chatEmptyHint:u}){const{pendingForm:d,formTransitioning:f}=NT(t),h=B.layout,p=!s&&h.chatCollapsed;function g(_){_.preventDefault();const v=_.clientX,y=h.chatWidth,m=_.pointerId;_.currentTarget.setPointerCapture(m);function b(k){const S=Math.max(280,Math.min(720,y+k.clientX-v));B.setChatWidth(S)}function j(k){y+k.clientX-v<340&&B.setChatCollapsed(!0),window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",j)}window.addEventListener("pointermove",b),window.addEventListener("pointerup",j,{once:!0})}const x={"--chat-width":`${h.chatWidth}px`};return a.jsxs("div",{className:"split"+(p?" split--chat-collapsed":"")+(s?" split--work-hidden":""),style:x,children:[p?a.jsx("button",{type:"button",className:"split-chat-peek",onClick:()=>B.setChatCollapsed(!1),title:"展开对话","aria-label":"展开对话",children:a.jsx(X9,{})}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"split__chat",children:a.jsx(G9,{chat:t,onSend:i,title:o,subtitle:l,placeholder:c,emptyHint:u})}),!s&&a.jsx("button",{type:"button",className:"split-resizer",onPointerDown:g,title:"拖拽调整对话宽度;拖到较窄会自动收起","aria-label":"拖拽调整对话宽度"})]}),!s&&a.jsx("div",{className:"split__work",children:d?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"work-head",children:[a.jsx("div",{className:"work-head__title",children:"问题"}),a.jsx("div",{className:"work-head__sub",children:"回答后继续"})]}),a.jsx(Y9,{form:d.form,formKey:d.segmentId,interactive:!0,onSubmit:(_,v)=>t.submitForm(v)})]}):f?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"work-head",children:[a.jsx("div",{className:"work-head__title",children:"问题"}),a.jsx("div",{className:"work-head__sub",children:"生成下一步"})]}),a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"empty-hint",children:"正在生成下一步配置问题…"})})]}):a.jsxs(a.Fragment,{children:[r,n]})})]})});function X9(){return a.jsx("span",{"aria-hidden":!0,children:"›"})}function PT({title:e,missing:t,warnings:n=[],onClose:r,onLocate:s}){return a.jsx("div",{className:"modal-overlay",onClick:r,children:a.jsxs("div",{className:"modal-card",onClick:i=>i.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsx("span",{className:"modal-card__icon",children:a.jsx($,{name:"warn",size:16})}),a.jsx("span",{className:"modal-card__title",children:e??"无法进入下一步"}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:r,children:a.jsx($,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[t.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"modal-card__section-label",children:"当前阶段还缺少以下必填配置:"}),a.jsx("ul",{className:"modal-card__list",children:t.map((i,o)=>a.jsxs("li",{className:"modal-card__item modal-card__item--error",children:[a.jsxs("span",{className:"modal-card__item-scope",children:["[",Yw(i.scope),"]"]}),a.jsx("span",{className:"modal-card__item-target",children:i.target}),a.jsx("span",{className:"modal-card__item-label",children:i.label}),a.jsx("button",{type:"button",className:"modal-card__locate",onClick:()=>s(i),children:"定位 →"})]},`${i.code}-${i.target}-${o}`))})]}),n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"modal-card__section-label modal-card__section-label--warn",children:"以下为建议项(不阻断):"}),a.jsx("ul",{className:"modal-card__list",children:n.map((i,o)=>a.jsxs("li",{className:"modal-card__item modal-card__item--warn",children:[a.jsxs("span",{className:"modal-card__item-scope",children:["[",Yw(i.scope),"]"]}),a.jsx("span",{className:"modal-card__item-label",children:i.label})]},`${i.code}-${i.target}-${o}`))})]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:r,children:"稍后处理"}),t.length>0&&a.jsx("button",{type:"button",className:"primary modal-card__btn",onClick:()=>s(t[0]),children:"去补齐第一项 →"})]})]})})}function Yw(e){switch(e){case"project":return"项目";case"workflow":return"工作流";case"step":return"步骤";case"env":return"环境变量"}}const Q9=[{id:"claude",name:"Claude Code",vendor:"Anthropic",detected:!0,selected:!0,capabilities:["编码","推理","长上下文"],desc:"本地已检测到 CLI,可作为工作流设计与复杂步骤执行引擎"},{id:"qoder",name:"Qoder",vendor:"Qoder",detected:!0,selected:!0,capabilities:["编码","仓库理解"],desc:"适合把业务流程落成配置、脚本与可审查产物"},{id:"codex",name:"Codex",vendor:"OpenAI",detected:!1,selected:!1,capabilities:["编码","自动修复"],desc:"未检测到,安装 CLI 后可作为候选执行引擎"},{id:"qwenwork",name:"千问办公",vendor:"Alibaba",detected:!1,selected:!1,capabilities:["办公智能体","业务流程"],desc:"启动千问办公桌面应用后可作为候选执行引擎"}],Z9=[{id:"classify",name:"信息校验",recipe:"validate-onboarding",engine:"llm_only",auto:!0,inputs:["员工姓名","身份证号","入职日期"],outputs:["校验结论","异常项"]},{id:"investigate",name:"权限准备",recipe:"prepare-access",engine:"qoder",auto:!0,inputs:["员工姓名","部门","岗位","校验结论"],outputs:["权限清单"]},{id:"draft_reply",name:"入职指引草拟",recipe:"draft-onboarding-guide",engine:"llm_only",auto:!0,inputs:["员工姓名","部门","岗位","权限清单"],outputs:["入职指引"]},{id:"quality_check",name:"法务与 HR 复核",recipe:"hr-legal-review",engine:"llm_only",auto:!1,needsHuman:!0,inputs:["入职指引","异常项"],outputs:["复核结论"]},{id:"send_reply",name:"发送入职通知",recipe:"send-onboarding-notice",engine:"llm_only",auto:!0,inputs:["员工姓名","入职指引","复核结论"],outputs:["发送状态"]}],AT=[{id:"fld_employee_name",name:"员工姓名",type:"text",required:!0,group:"business"},{id:"fld_department",name:"部门",type:"text",required:!0,group:"business"},{id:"fld_position",name:"岗位",type:"text",group:"business"},{id:"fld_priority",name:"入职紧急度",type:"single_select",options:["P0-紧急","P1-高","P2-中","P3-低"],group:"business"},{id:"fld_category",name:"事项类型",type:"single_select",options:["入职办理","合同确认","设备申领","权限开通","其他"],group:"business"},{id:"fld_reply_content",name:"入职指引",type:"text",group:"business"},{id:"fld_resolution",name:"权限清单",type:"text",group:"business"},{id:"fld_satisfaction",name:"复核结论",type:"single_select",options:["通过","需补充材料","需法务复核"],group:"business"},{id:"fld_status",name:"状态",type:"single_select",options:["待处理","校验中","权限准备中","草拟指引中","复核中","发送中","已完成"],group:"process"},{id:"fld_current_step",name:"当前步骤",type:"text",group:"process"},{id:"fld_assignee",name:"处理人",type:"user",group:"process"},{id:"fld_sla_deadline",name:"SLA截止时间",type:"datetime",group:"process"},{id:"fld_event_log",name:"事件日志",type:"text",group:"process"}],RT=[{id:"v_grid",name:"全部入职事项",kind:"grid",desc:"全量入职事项列表视图"},{id:"v_kanban",name:"入职进度看板",kind:"kanban",desc:"按状态分列的看板"},{id:"v_form",name:"入职信息提交",kind:"form",desc:"给 HR 或用人团队的提交表单"},{id:"v_calendar",name:"入职日历",kind:"calendar",desc:"按入职日期查看事项"}],oy="ZQYprEoWoPLkorKyuBeBDRd9V1waOeDk",IT="1HixpC7",J9="epHNF75";function MT(e,t,n){const r=new URLSearchParams({entrance:"data",sheetId:t});return n!=null&&n.trim()&&r.set("viewId",n.trim()),`https://alidocs.dingtalk.com/i/nodes/${e}?iframeQuery=${encodeURIComponent(r.toString())}`}MT(oy,IT,J9);const eK=[{id:"hr_partner",name:"HR 业务伙伴",persona:"你是谨慎、温和且注重证据的 HR 业务伙伴。你负责把员工相关流程转化为可执行步骤,先核对制度和人员条件,再给出清晰的处理建议。涉及员工权益、绩效、离职、纪律处分等敏感事项时,必须标出风险点、建议人工复核,并避免使用带倾向性的判断语言。",skills:["policy_interpretation","eligibility_check","document_draft","handoff_summary"],knowledge:["kb_hr_policy","kb_org_people"]},{id:"legal_counsel",name:"法务顾问",persona:"你是业务友好型法务顾问,负责识别合同、合规和隐私风险,并把复杂法务意见转成业务能执行的下一步动作。你不会直接替业务做最终法律承诺;对高风险条款、责任限制、数据出境、劳动争议和监管风险,需要给出风险等级、修改建议和升级路径。",skills:["risk_review","approval_gate","document_draft","handoff_summary"],knowledge:["kb_contract_templates","kb_legal_playbook"]}],tK=`# HR 入职协同 — 工作流模板
96
96
  meta:
97
97
  name: "HR 入职协同"
98
98
  version: "1.0.0"
@@ -307,20 +307,20 @@ const recipe: RecipeDefinition = {
307
307
  };
308
308
 
309
309
  export default recipe;
310
- `},sK={classify:"validate-onboarding.recipe.ts",investigate:"prepare-access.recipe.ts",draft_reply:"draft-onboarding-guide.recipe.ts",quality_check:"hr-legal-review.recipe.ts",send_reply:"send-onboarding-notice.recipe.ts"},iK=[{title:"张三入职办理",customer:"张三 · 产品研发部",category:"入职办理",priority:"P0-紧急"},{title:"李四合同确认",customer:"李四 · 市场营销部",category:"合同确认",priority:"P2-中"},{title:"王五设备申领",customer:"王五 · 数据分析部",category:"设备申领",priority:"P1-高"},{title:"赵六权限开通",customer:"赵六 · 财务部",category:"权限开通",priority:"P1-高"}];function oK(){return me?null:{workflowYml:tK,configYml:nK,recipeFiles:rK,stepToRecipeFile:sK}}function $T(){return me?null:{steps:Z9,incomingTickets:iK}}function ch(){return me?null:{fieldCount:IT.length,viewCount:MT.length}}function DT(){return me?[]:Q9}const aK=[{id:"claude",type:"claudecode",name:"Claude Code",vendor:"Anthropic"},{id:"codex",type:"codex",name:"Codex CLI",vendor:"OpenAI"},{id:"qoder",type:"qoder",name:"Qoder CLI",vendor:"Alibaba"},{id:"qwenwork",type:"qwenwork",name:"千问办公",vendor:"Alibaba"}];async function lK(){let e=new Map;try{const t=await YL();e=new Map(t.available.map(n=>[n.type,{version:n.version,cmd:n.cmd}]))}catch{}return aK.map(({id:t,type:n,name:r,vendor:s})=>{const i=e.get(n);return{id:t,name:r,vendor:s,detected:!!i,selected:!!i,capabilities:i?[i.version?`已安装 ${i.version}`:"已安装"]:["未安装"],desc:i?`本地已检测到 CLI(${i.cmd}),可作为工作流设计与执行引擎`:"未检测到本地 CLI,需先安装后使用"}})}function cK(){return me?[]:eK}function uK(){return me?"":cy}function dK(){return me?null:{fields:IT,views:MT,tableBaseId:cy,tableSheetId:OT}}const fK=DT();function zT(e){return ay({id:"init-agents",title:"选择执行引擎",description:"本地已扫描到以下执行引擎,勾选后用于生成和执行工作流。",submitLabel:"确认引擎",questions:[{id:"agents",label:"可用执行引擎",type:"checkbox",required:!0,options:e.map(t=>({label:`${t.name}${t.detected?"":"(未检测)"}`,value:t.id,description:`${t.vendor} · ${t.capabilities.join(" / ")}`})),defaultValue:e.filter(t=>t.selected).map(t=>t.id),help:"未检测到的引擎需先安装 CLI。"}]})}const hK=zT(fK),pK=ay({id:"init-table",title:"连接 AI 表格",description:"填写目标 Base Id;Table Id 可选,留空将自动新建一张 table。",submitLabel:"连接",questions:[{id:"baseId",label:"Base Id",type:"text",required:!0,placeholder:"如:ZQYprEoWoPLkorKyuBeBDRd9V1waOeDk",defaultValue:uK(),help:"AI 表格所在多维表格(Base)的节点 Id。"},{id:"tableId",label:"Table Id(可选)",type:"text",placeholder:"留空则新建 table",help:"不填时将在该 Base 下新建一张 table。"}]});ay({id:"init-sop",title:"补充 SOP 指引",description:"SOP 不是越长越好,建议写清楚触发条件、处理步骤、人工把关点、异常升级规则。",submitLabel:"完成配置",questions:[{id:"sop",label:"用户 SOP / 处理规则",type:"textarea",placeholder:`建议格式:
310
+ `},sK={classify:"validate-onboarding.recipe.ts",investigate:"prepare-access.recipe.ts",draft_reply:"draft-onboarding-guide.recipe.ts",quality_check:"hr-legal-review.recipe.ts",send_reply:"send-onboarding-notice.recipe.ts"},iK=[{title:"张三入职办理",customer:"张三 · 产品研发部",category:"入职办理",priority:"P0-紧急"},{title:"李四合同确认",customer:"李四 · 市场营销部",category:"合同确认",priority:"P2-中"},{title:"王五设备申领",customer:"王五 · 数据分析部",category:"设备申领",priority:"P1-高"},{title:"赵六权限开通",customer:"赵六 · 财务部",category:"权限开通",priority:"P1-高"}];function oK(){return me?null:{workflowYml:tK,configYml:nK,recipeFiles:rK,stepToRecipeFile:sK}}function OT(){return me?null:{steps:Z9,incomingTickets:iK}}function ch(){return me?null:{fieldCount:AT.length,viewCount:RT.length}}function LT(){return me?[]:Q9}const aK=[{id:"claude",type:"claudecode",name:"Claude Code",vendor:"Anthropic"},{id:"codex",type:"codex",name:"Codex CLI",vendor:"OpenAI"},{id:"qoder",type:"qoder",name:"Qoder CLI",vendor:"Alibaba"},{id:"qwenwork",type:"qwenwork",name:"千问办公",vendor:"Alibaba"}];async function lK(){let e=new Map;try{const t=await GL();e=new Map(t.available.map(n=>[n.type,{version:n.version,cmd:n.cmd}]))}catch{}return aK.map(({id:t,type:n,name:r,vendor:s})=>{const i=e.get(n);return{id:t,name:r,vendor:s,detected:!!i,selected:!!i,capabilities:i?[i.version?`已安装 ${i.version}`:"已安装"]:["未安装"],desc:i?`本地已检测到 CLI(${i.cmd}),可作为工作流设计与执行引擎`:"未检测到本地 CLI,需先安装后使用"}})}function cK(){return me?[]:eK}function uK(){return me?"":oy}function dK(){return me?null:{fields:AT,views:RT,tableBaseId:oy,tableSheetId:IT}}const fK=LT();function $T(e){return sy({id:"init-agents",title:"选择执行引擎",description:"本地已扫描到以下执行引擎,勾选后用于生成和执行工作流。",submitLabel:"确认引擎",questions:[{id:"agents",label:"可用执行引擎",type:"checkbox",required:!0,options:e.map(t=>({label:`${t.name}${t.detected?"":"(未检测)"}`,value:t.id,description:`${t.vendor} · ${t.capabilities.join(" / ")}`})),defaultValue:e.filter(t=>t.selected).map(t=>t.id),help:"未检测到的引擎需先安装 CLI。"}]})}const hK=$T(fK),pK=sy({id:"init-table",title:"连接 AI 表格",description:"填写目标 Base Id;Table Id 可选,留空将自动新建一张 table。",submitLabel:"连接",questions:[{id:"baseId",label:"Base Id",type:"text",required:!0,placeholder:"如:ZQYprEoWoPLkorKyuBeBDRd9V1waOeDk",defaultValue:uK(),help:"AI 表格所在多维表格(Base)的节点 Id。"},{id:"tableId",label:"Table Id(可选)",type:"text",placeholder:"留空则新建 table",help:"不填时将在该 Base 下新建一张 table。"}]});sy({id:"init-sop",title:"补充 SOP 指引",description:"SOP 不是越长越好,建议写清楚触发条件、处理步骤、人工把关点、异常升级规则。",submitLabel:"完成配置",questions:[{id:"sop",label:"用户 SOP / 处理规则",type:"textarea",placeholder:`建议格式:
311
311
  1. 什么时候触发流程?
312
312
  2. 每一步输入什么、产出什么?
313
313
  3. 哪些情况必须人工审核?
314
314
  4. 超时、失败、风险命中时通知谁?
315
- 5. 哪些话术、动作或自动化行为必须避免?`,help:"可以先写要点,不需要一次写完;后续 design 阶段会再基于场景做澄清。"}]});const sc=cK(),km=[{kind:"say",text:"欢迎!我们先做一次性配置,之后就能反复复用。第一步:扫描本地可用的执行引擎。"},{kind:"tool",label:"扫描本地执行引擎",detail:"Claude Code · Qoder · Codex",ms:900},{kind:"form",form:hK},{kind:"say",text:"引擎已就绪。接下来连接你的 AI 表格 —— 这是工作流读写数据的地方。"},{kind:"form",form:pK},{kind:"tool",label:"校验表格连接",detail:"connected",ms:800},{kind:"say",text:sc.length>0?"表格已连接。接下来先构建角色。右侧已预置 HR 业务伙伴和法务顾问,你可以直接编辑人设、技能与共享知识库;确认角色后再补充 SOP。":"表格已连接。接下来构建角色。请在右侧添加角色并定义人设与共享知识库。参考示例:HR 业务伙伴、法务顾问。"},{kind:"do",run:()=>{if(sc.length===0)return;const e=B.initDraft.roles,t=e.some(n=>n.name.includes("客服")||n.name.includes("排查")||n.name.includes("质检"));B.patchInitDraft({roles:e.length&&!t?e:sc})}},{kind:"say",text:sc.length>0?"角色已预置。请在右侧同一个界面里确认角色人设、技能、知识库,并按需补充 SOP;准备好后点击进入设计阶段。":"准备好后点击「下一步:设计 →」进入设计阶段。"}];function mK(e){const t=e.filter(n=>n.detected).map(n=>n.name);return[{kind:"say",text:"欢迎!我们先做一次性配置,之后就能反复复用。第一步:扫描本机可用的 coding agent。"},{kind:"tool",label:"扫描本机 coding agent",detail:t.join(" · ")||"未检测到已安装的 CLI",ms:400},{kind:"form",form:zT(e)},...km.slice(3)]}function gK({roles:e,onChange:t}){var p;const[n,r]=w.useState(((p=e[0])==null?void 0:p.id)??null),s=w.useRef(null),[i,o]=w.useState(null);function l(g,x){t(e.map(_=>_.id===g?{..._,...x}:_))}function c(){const g=`role_${Date.now().toString(36)}`,x={id:g,name:"",persona:"",skills:[],knowledge:[]};t([...e,x]),r(g)}function u(g){t(e.filter(x=>x.id!==g)),n===g&&r(null)}function d(g,x){const _=e.find(v=>v.id===g);_&&l(g,{knowledge:_.knowledge.filter(v=>v!==x)})}function f(g){var x;o(g),(x=s.current)==null||x.click()}function h(g){if(!i||!g.target.files)return;const x=e.find(v=>v.id===i);if(!x)return;const _=new Set(x.knowledge);for(const v of Array.from(g.target.files)){const y=v.webkitRelativePath.split("/");y.length>=1&&_.add(y[0])}l(i,{knowledge:Array.from(_)}),o(null),g.target.value=""}return a.jsxs("div",{className:"role-panel",children:[a.jsx("input",{ref:s,type:"file",style:{display:"none"},webkitdirectory:"",directory:"",multiple:!0,onChange:h}),e.length===0&&a.jsxs("div",{style:{padding:"8px 0"},children:[a.jsx("span",{className:"cfg-muted",children:"暂无角色。点击下方「添加角色」开始配置。"}),a.jsxs("div",{className:"cfg-muted",style:{marginTop:8,fontSize:12,lineHeight:1.6},children:[a.jsx("div",{children:"参考示例:"}),a.jsxs("div",{children:["· ",a.jsx("b",{children:"HR 业务伙伴"})," — 负责员工流程转化、制度核对、入职管理"]}),a.jsxs("div",{children:["· ",a.jsx("b",{children:"法务顾问"})," — 负责合同合规、风险识别、审批把关"]})]})]}),e.map(g=>{const x=n===g.id;return a.jsxs(Ze.div,{className:`role-item${x?" is-open":""}`,variants:Ct,initial:"hidden",animate:"visible",layout:!0,children:[a.jsxs("div",{className:"role-item__head",children:[a.jsxs("button",{type:"button",className:"role-item__toggle",onClick:()=>r(x?null:g.id),children:[a.jsx($,{name:x?"chevron-down":"chevron-right",size:14}),a.jsx("span",{className:"role-item__avatar",children:a.jsx($,{name:"user",size:13})}),a.jsx("input",{className:"role-item__name",value:g.name,onClick:_=>_.stopPropagation(),onChange:_=>l(g.id,{name:_.target.value}),placeholder:"角色名称"})]}),a.jsxs("span",{className:"role-item__summary",children:[g.knowledge.length," 知识库"]}),a.jsx("button",{type:"button",className:"role-item__remove",title:"删除角色",onClick:()=>u(g.id),children:a.jsx($,{name:"close",size:13})})]}),x&&a.jsxs("div",{className:"role-item__body",children:[a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"人设(Persona)"}),a.jsx("textarea",{className:"qf-textarea role-persona",rows:3,value:g.persona,placeholder:"描述角色定位、职责与语气…",onChange:_=>l(g.id,{persona:_.target.value})})]}),a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"共享知识库"}),g.knowledge.length>0&&a.jsx("div",{className:"kb-folder-list",children:g.knowledge.map(_=>a.jsxs("span",{className:"kb-folder-chip",children:[a.jsx($,{name:"file",size:12}),_,a.jsx("button",{type:"button",className:"kb-folder-chip__remove",onClick:()=>d(g.id,_),children:a.jsx($,{name:"close",size:10})})]},_))}),a.jsxs("button",{type:"button",className:"kb-folder-pick",onClick:()=>f(g.id),children:[a.jsx($,{name:"plus",size:14}),"选择本地文件夹"]})]})]})]},g.id)}),a.jsxs("button",{type:"button",className:"role-add",onClick:c,children:[a.jsx($,{name:"plus",size:14})," 添加角色"]})]})}function FT(e,t){switch(t){case"init":return vK(e);case"design":return VT(e);case"setup":return yK(e);case"adjust":return xK();case"test":return _K();default:return{ok:!0,missing:[],warnings:[]}}}function vK(e){const t=[],n=[];return st&&!e.init.selectedMachineId&&t.push({code:"ENGINE_NOT_SELECTED",scope:"project",target:"engine",label:"未选择执行引擎",locate:{stage:"init",panel:"engine",focusField:"selectedMachineId"}}),!st&&e.init.agentsSelected.length===0&&t.push({code:"AGENT_NOT_SELECTED",scope:"project",target:"agent",label:"未选择 Agent 引擎",locate:{stage:"init",panel:"agent"}}),e.init.roles.length===0&&t.push({code:"NO_ROLE",scope:"project",target:"role",label:"至少配置一个角色,Design 阶段的 recipe 需要绑定 role",locate:{stage:"init",panel:"role"}}),e.init.sop.trim()||n.push({code:"NO_SOP",scope:"project",target:"sop",label:"未填写 SOP,Design 澄清问题会更多",locate:{stage:"init",panel:"sop"}}),{ok:t.length===0,missing:t,warnings:n}}function VT(e){const t=[],n=[];for(const r of e.steps)if(r.configStatus==="missing"&&r.missingConfigKeys)for(const s of r.missingConfigKeys)t.push({code:"STEP_CONFIG_MISSING",scope:"step",target:r.id,label:`${r.name} 缺 ${s}`,locate:{stage:"design",panel:"step-config",focusField:s}});else r.configStatus==="warning"&&n.push({code:"STEP_CONFIG_WARNING",scope:"step",target:r.id,label:`${r.name} 有可选配置未填写`,locate:{stage:"design",panel:"step-config"}});return{ok:t.length===0,missing:t,warnings:n}}function yK(e){const t=[],n=[];return Ls("setup",e.stageRuntime.setup.phase)||t.push({code:"SETUP_NOT_COMPLETE",scope:"project",target:"setup",label:"搭建阶段尚未完成",locate:{stage:"setup",panel:"setup"}}),{ok:t.length===0,missing:t,warnings:n}}function xK(e){return{ok:!1,missing:[{code:"ADJUST_NOT_COMPLETE",scope:"project",target:"adjust",label:"参数调整尚未完成",locate:{stage:"adjust",panel:"adjust"}}],warnings:[]}}function _K(e){return{ok:!1,missing:[{code:"TEST_NOT_PASSED",scope:"project",target:"test",label:"试运行尚未通过",locate:{stage:"test",panel:"test"}}],warnings:[]}}async function wK(e,t){const n=VT(t),r=await KL(e).catch(()=>null);if(!r)return{ok:n.ok,missing:n.missing,warnings:[...n.warnings,{code:"BACKEND_VALIDATE_UNAVAILABLE",scope:"project",target:"validate",label:"后端校验不可用,仅以前端配置检查为准",locate:{stage:"design",panel:"validate"}}]};const s=[...n.missing];for(const o of r.errors??[])s.push({code:"DESIGN_FILE_INVALID",scope:"workflow",target:"workflow.yml",label:o,locate:{stage:"design",panel:"files"}});const i=[...n.warnings];for(const o of r.warnings??[])i.push({code:"DESIGN_FILE_WARNING",scope:"workflow",target:"workflow.yml",label:o,locate:{stage:"design",panel:"files"}});return{ok:s.length===0,missing:s,warnings:i}}const bK={claude:"Claude",qoder:"Qoder",codex:"Codex",qwenwork:"千问办公",llm:"LLM"},Nm={claudecode:"Claude",codex:"Codex",qoder:"Qoder",codebuddy:"Codebuddy",opencode:"OpenCode",qwen:"Qwen",deepseek:"DeepSeek",trae:"Trae",qwenwork:"千问办公"};function jK(e){return e==="claudecode"?"claude":e==="codex"?"codex":e==="qoder"?"qoder":e==="qwenwork"?"qwenwork":null}function ic({icon:e,title:t,done:n,wide:r,children:s}){return a.jsxs("div",{className:`cfg-card${n?" is-done":""}${r?" cfg-card--wide":""}`,children:[a.jsxs("div",{className:"cfg-card__head",children:[a.jsx("span",{className:"cfg-card__icon",children:a.jsx($,{name:e,size:15})}),a.jsx("span",{className:"cfg-card__title",children:t}),a.jsx("span",{className:`cfg-card__status${n?" is-done":""}`,children:n?a.jsxs(a.Fragment,{children:[a.jsx($,{name:"check",size:12})," 已配置"]}):"待配置"})]}),a.jsx("div",{className:"cfg-card__body",children:s})]})}function SK({machines:e,selectedId:t,onSelect:n,loading:r,error:s,onRetry:i}){const o=e.filter(c=>c.status==="online"),l=e.filter(c=>c.status==="offline");return r?a.jsx("span",{className:"cfg-muted",children:"正在获取执行引擎列表..."}):s?a.jsxs("div",{className:"engine-empty",children:[a.jsx("div",{className:"engine-empty__text",children:"⚠️ 获取执行引擎列表失败,请检查网络或稍后重试。"}),a.jsx("button",{type:"button",className:"engine-empty__link",onClick:i,children:"重试"})]}):e.length===0?a.jsx("div",{className:"engine-empty",children:a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 没有注册的执行引擎。请先前往",a.jsx(Ue,{className:"engine-empty__link",to:"/engines",children:"执行引擎管理"}),"注册 daemon 机器。"]})}):o.length===0?a.jsxs("div",{className:"engine-empty",children:[a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 没有在线的执行引擎(共 ",e.length," 台已注册)。请启动 daemon 反连。"]}),a.jsx(Ue,{className:"engine-empty__link",to:"/engines",children:"前往执行引擎管理"})]}):a.jsxs("div",{className:"engine-selector",children:[o.length>0&&a.jsxs("div",{className:"engine-selector__group",children:[a.jsxs("div",{className:"engine-selector__label",children:["在线 (",o.length,")"]}),o.map(c=>{const u=(c.runtimes??[]).map(jK).filter(d=>d!==null);return a.jsxs("button",{type:"button",className:`engine-option${t===c.machineId?" is-selected":""}`,onClick:()=>n(c.machineId,u),children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsxs("span",{className:"engine-option__info",children:[a.jsx("span",{className:"engine-option__name",children:c.displayName||c.name}),a.jsxs("span",{className:"engine-option__caps",children:[c.runtimes.map(d=>Nm[d]??d).join(" · "),c.hasDws&&" · dws ✓"]})]}),t===c.machineId&&a.jsx($,{name:"check",size:14,color:"var(--accent)"})]},c.machineId)})]}),l.length>0&&a.jsxs("div",{className:"engine-selector__group",children:[a.jsxs("div",{className:"engine-selector__label",children:["离线 (",l.length,")"]}),l.map(c=>a.jsxs("div",{className:"engine-option engine-option--disabled",children:[a.jsx("span",{className:"machine-status machine-status--offline"}),a.jsxs("span",{className:"engine-option__info",children:[a.jsx("span",{className:"engine-option__name",children:c.displayName||c.name}),a.jsx("span",{className:"engine-option__caps",children:"离线 · 不可选"})]})]},c.machineId))]})]})}const kK=lt(function(){const t=Sr(),n=w.useRef();n.current||(n.current=new ly);const r=n.current,s=w.useRef(!1),i=B.initDraft;B.mode;const o=B.projectId,[l,c]=w.useState(!1),[u,d]=w.useState(!1),f=Ls("init",B.stageRuntime.init.phase),[h,p]=w.useState([]),[g,x]=w.useState(st),[_,v]=w.useState(!1),[y,m]=w.useState(DT()),b=w.useCallback(async()=>{x(!0);try{const A=await oy();p(A),v(!1)}catch{v(!0)}finally{x(!1)}},[]);w.useEffect(()=>{st&&b()},[b]);const j=h.find(A=>A.machineId===i.selectedMachineId&&A.status==="online"),k=st&&!g&&!!i.selectedMachineId&&!j,S=st?!g&&!!j&&i.agentsSelected.length>0:!0;w.useEffect(()=>{if(r.onFormSubmit=(A,P)=>{A==="init-agents"?B.patchInitDraft({agentsSelected:P.agents??[]}):A==="init-table"?B.patchInitDraft({tableConnected:!0,tableBaseId:String(P.baseId??""),tableId:String(P.tableId??"")}):A==="init-sop"&&B.patchInitDraft({sop:String(P.sop??"")})},!s.current){s.current=!0;const A=Ls("init",B.stageRuntime.init.phase);me&&A?r.run([{kind:"say",text:"配置已完成,可直接进入设计阶段。"}]):st?r.run([{kind:"say",text:"请在右侧选择执行引擎,然后继续完成后续配置。"}]):me?(async()=>{const P=await lK();m(P),await r.run(mK(P))})():r.run(km)}return()=>{r.onFormSubmit=null}},[r]);const N=w.useRef("");w.useEffect(()=>{if(!st||!S||!j||N.current===j.machineId)return;N.current=j.machineId;const A=km.slice(3),P=`${j.displayName||j.name}(${j.runtimes.map(I=>Nm[I]??I).join(" · ")}${j.hasDws?" · dws ✓":""})`;r.run([{kind:"say",text:`✅ 执行引擎已选定:${P}
315
+ 5. 哪些话术、动作或自动化行为必须避免?`,help:"可以先写要点,不需要一次写完;后续 design 阶段会再基于场景做澄清。"}]});const sc=cK(),km=[{kind:"say",text:"欢迎!我们先做一次性配置,之后就能反复复用。第一步:扫描本地可用的执行引擎。"},{kind:"tool",label:"扫描本地执行引擎",detail:"Claude Code · Qoder · Codex",ms:900},{kind:"form",form:hK},{kind:"say",text:"引擎已就绪。接下来连接你的 AI 表格 —— 这是工作流读写数据的地方。"},{kind:"form",form:pK},{kind:"tool",label:"校验表格连接",detail:"connected",ms:800},{kind:"say",text:sc.length>0?"表格已连接。接下来先构建角色。右侧已预置 HR 业务伙伴和法务顾问,你可以直接编辑人设、技能与共享知识库;确认角色后再补充 SOP。":"表格已连接。接下来构建角色。请在右侧添加角色并定义人设与共享知识库。参考示例:HR 业务伙伴、法务顾问。"},{kind:"do",run:()=>{if(sc.length===0)return;const e=B.initDraft.roles,t=e.some(n=>n.name.includes("客服")||n.name.includes("排查")||n.name.includes("质检"));B.patchInitDraft({roles:e.length&&!t?e:sc})}},{kind:"say",text:sc.length>0?"角色已预置。请在右侧同一个界面里确认角色人设、技能、知识库,并按需补充 SOP;准备好后点击进入设计阶段。":"准备好后点击「下一步:设计 →」进入设计阶段。"}];function mK(e){const t=e.filter(n=>n.detected).map(n=>n.name);return[{kind:"say",text:"欢迎!我们先做一次性配置,之后就能反复复用。第一步:扫描本机可用的 coding agent。"},{kind:"tool",label:"扫描本机 coding agent",detail:t.join(" · ")||"未检测到已安装的 CLI",ms:400},{kind:"form",form:$T(e)},...km.slice(3)]}function gK({roles:e,onChange:t}){var p;const[n,r]=w.useState(((p=e[0])==null?void 0:p.id)??null),s=w.useRef(null),[i,o]=w.useState(null);function l(g,x){t(e.map(_=>_.id===g?{..._,...x}:_))}function c(){const g=`role_${Date.now().toString(36)}`,x={id:g,name:"",persona:"",skills:[],knowledge:[]};t([...e,x]),r(g)}function u(g){t(e.filter(x=>x.id!==g)),n===g&&r(null)}function d(g,x){const _=e.find(v=>v.id===g);_&&l(g,{knowledge:_.knowledge.filter(v=>v!==x)})}function f(g){var x;o(g),(x=s.current)==null||x.click()}function h(g){if(!i||!g.target.files)return;const x=e.find(v=>v.id===i);if(!x)return;const _=new Set(x.knowledge);for(const v of Array.from(g.target.files)){const y=v.webkitRelativePath.split("/");y.length>=1&&_.add(y[0])}l(i,{knowledge:Array.from(_)}),o(null),g.target.value=""}return a.jsxs("div",{className:"role-panel",children:[a.jsx("input",{ref:s,type:"file",style:{display:"none"},webkitdirectory:"",directory:"",multiple:!0,onChange:h}),e.length===0&&a.jsxs("div",{style:{padding:"8px 0"},children:[a.jsx("span",{className:"cfg-muted",children:"暂无角色。点击下方「添加角色」开始配置。"}),a.jsxs("div",{className:"cfg-muted",style:{marginTop:8,fontSize:12,lineHeight:1.6},children:[a.jsx("div",{children:"参考示例:"}),a.jsxs("div",{children:["· ",a.jsx("b",{children:"HR 业务伙伴"})," — 负责员工流程转化、制度核对、入职管理"]}),a.jsxs("div",{children:["· ",a.jsx("b",{children:"法务顾问"})," — 负责合同合规、风险识别、审批把关"]})]})]}),e.map(g=>{const x=n===g.id;return a.jsxs(Ze.div,{className:`role-item${x?" is-open":""}`,variants:Ct,initial:"hidden",animate:"visible",layout:!0,children:[a.jsxs("div",{className:"role-item__head",children:[a.jsxs("button",{type:"button",className:"role-item__toggle",onClick:()=>r(x?null:g.id),children:[a.jsx($,{name:x?"chevron-down":"chevron-right",size:14}),a.jsx("span",{className:"role-item__avatar",children:a.jsx($,{name:"user",size:13})}),a.jsx("input",{className:"role-item__name",value:g.name,onClick:_=>_.stopPropagation(),onChange:_=>l(g.id,{name:_.target.value}),placeholder:"角色名称"})]}),a.jsxs("span",{className:"role-item__summary",children:[g.knowledge.length," 知识库"]}),a.jsx("button",{type:"button",className:"role-item__remove",title:"删除角色",onClick:()=>u(g.id),children:a.jsx($,{name:"close",size:13})})]}),x&&a.jsxs("div",{className:"role-item__body",children:[a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"人设(Persona)"}),a.jsx("textarea",{className:"qf-textarea role-persona",rows:3,value:g.persona,placeholder:"描述角色定位、职责与语气…",onChange:_=>l(g.id,{persona:_.target.value})})]}),a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"共享知识库"}),g.knowledge.length>0&&a.jsx("div",{className:"kb-folder-list",children:g.knowledge.map(_=>a.jsxs("span",{className:"kb-folder-chip",children:[a.jsx($,{name:"file",size:12}),_,a.jsx("button",{type:"button",className:"kb-folder-chip__remove",onClick:()=>d(g.id,_),children:a.jsx($,{name:"close",size:10})})]},_))}),a.jsxs("button",{type:"button",className:"kb-folder-pick",onClick:()=>f(g.id),children:[a.jsx($,{name:"plus",size:14}),"选择本地文件夹"]})]})]})]},g.id)}),a.jsxs("button",{type:"button",className:"role-add",onClick:c,children:[a.jsx($,{name:"plus",size:14})," 添加角色"]})]})}function DT(e,t){switch(t){case"init":return vK(e);case"design":return zT(e);case"setup":return yK(e);case"adjust":return xK();case"test":return _K();default:return{ok:!0,missing:[],warnings:[]}}}function vK(e){const t=[],n=[];return st&&!e.init.selectedMachineId&&t.push({code:"ENGINE_NOT_SELECTED",scope:"project",target:"engine",label:"未选择执行引擎",locate:{stage:"init",panel:"engine",focusField:"selectedMachineId"}}),!st&&e.init.agentsSelected.length===0&&t.push({code:"AGENT_NOT_SELECTED",scope:"project",target:"agent",label:"未选择 Agent 引擎",locate:{stage:"init",panel:"agent"}}),e.init.roles.length===0&&t.push({code:"NO_ROLE",scope:"project",target:"role",label:"至少配置一个角色,Design 阶段的 recipe 需要绑定 role",locate:{stage:"init",panel:"role"}}),e.init.sop.trim()||n.push({code:"NO_SOP",scope:"project",target:"sop",label:"未填写 SOP,Design 澄清问题会更多",locate:{stage:"init",panel:"sop"}}),{ok:t.length===0,missing:t,warnings:n}}function zT(e){const t=[],n=[];for(const r of e.steps)if(r.configStatus==="missing"&&r.missingConfigKeys)for(const s of r.missingConfigKeys)t.push({code:"STEP_CONFIG_MISSING",scope:"step",target:r.id,label:`${r.name} 缺 ${s}`,locate:{stage:"design",panel:"step-config",focusField:s}});else r.configStatus==="warning"&&n.push({code:"STEP_CONFIG_WARNING",scope:"step",target:r.id,label:`${r.name} 有可选配置未填写`,locate:{stage:"design",panel:"step-config"}});return{ok:t.length===0,missing:t,warnings:n}}function yK(e){const t=[],n=[];return Ls("setup",e.stageRuntime.setup.phase)||t.push({code:"SETUP_NOT_COMPLETE",scope:"project",target:"setup",label:"搭建阶段尚未完成",locate:{stage:"setup",panel:"setup"}}),{ok:t.length===0,missing:t,warnings:n}}function xK(e){return{ok:!1,missing:[{code:"ADJUST_NOT_COMPLETE",scope:"project",target:"adjust",label:"参数调整尚未完成",locate:{stage:"adjust",panel:"adjust"}}],warnings:[]}}function _K(e){return{ok:!1,missing:[{code:"TEST_NOT_PASSED",scope:"project",target:"test",label:"试运行尚未通过",locate:{stage:"test",panel:"test"}}],warnings:[]}}async function wK(e,t){const n=zT(t),r=await HL(e).catch(()=>null);if(!r)return{ok:n.ok,missing:n.missing,warnings:[...n.warnings,{code:"BACKEND_VALIDATE_UNAVAILABLE",scope:"project",target:"validate",label:"后端校验不可用,仅以前端配置检查为准",locate:{stage:"design",panel:"validate"}}]};const s=[...n.missing];for(const o of r.errors??[])s.push({code:"DESIGN_FILE_INVALID",scope:"workflow",target:"workflow.yml",label:o,locate:{stage:"design",panel:"files"}});const i=[...n.warnings];for(const o of r.warnings??[])i.push({code:"DESIGN_FILE_WARNING",scope:"workflow",target:"workflow.yml",label:o,locate:{stage:"design",panel:"files"}});return{ok:s.length===0,missing:s,warnings:i}}const bK={claude:"Claude",qoder:"Qoder",codex:"Codex",qwenwork:"千问办公",llm:"LLM"},Nm={claudecode:"Claude",codex:"Codex",qoder:"Qoder",codebuddy:"Codebuddy",opencode:"OpenCode",qwen:"Qwen",deepseek:"DeepSeek",trae:"Trae",qwenwork:"千问办公"};function jK(e){return e==="claudecode"?"claude":e==="codex"?"codex":e==="qoder"?"qoder":e==="qwenwork"?"qwenwork":null}function ic({icon:e,title:t,done:n,wide:r,children:s}){return a.jsxs("div",{className:`cfg-card${n?" is-done":""}${r?" cfg-card--wide":""}`,children:[a.jsxs("div",{className:"cfg-card__head",children:[a.jsx("span",{className:"cfg-card__icon",children:a.jsx($,{name:e,size:15})}),a.jsx("span",{className:"cfg-card__title",children:t}),a.jsx("span",{className:`cfg-card__status${n?" is-done":""}`,children:n?a.jsxs(a.Fragment,{children:[a.jsx($,{name:"check",size:12})," 已配置"]}):"待配置"})]}),a.jsx("div",{className:"cfg-card__body",children:s})]})}function SK({machines:e,selectedId:t,onSelect:n,loading:r,error:s,onRetry:i}){const o=e.filter(c=>c.status==="online"),l=e.filter(c=>c.status==="offline");return r?a.jsx("span",{className:"cfg-muted",children:"正在获取执行引擎列表..."}):s?a.jsxs("div",{className:"engine-empty",children:[a.jsx("div",{className:"engine-empty__text",children:"⚠️ 获取执行引擎列表失败,请检查网络或稍后重试。"}),a.jsx("button",{type:"button",className:"engine-empty__link",onClick:i,children:"重试"})]}):e.length===0?a.jsx("div",{className:"engine-empty",children:a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 没有注册的执行引擎。请先前往",a.jsx(Ue,{className:"engine-empty__link",to:"/engines",children:"执行引擎管理"}),"注册 daemon 机器。"]})}):o.length===0?a.jsxs("div",{className:"engine-empty",children:[a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 没有在线的执行引擎(共 ",e.length," 台已注册)。请启动 daemon 反连。"]}),a.jsx(Ue,{className:"engine-empty__link",to:"/engines",children:"前往执行引擎管理"})]}):a.jsxs("div",{className:"engine-selector",children:[o.length>0&&a.jsxs("div",{className:"engine-selector__group",children:[a.jsxs("div",{className:"engine-selector__label",children:["在线 (",o.length,")"]}),o.map(c=>{const u=(c.runtimes??[]).map(jK).filter(d=>d!==null);return a.jsxs("button",{type:"button",className:`engine-option${t===c.machineId?" is-selected":""}`,onClick:()=>n(c.machineId,u),children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsxs("span",{className:"engine-option__info",children:[a.jsx("span",{className:"engine-option__name",children:c.displayName||c.name}),a.jsxs("span",{className:"engine-option__caps",children:[c.runtimes.map(d=>Nm[d]??d).join(" · "),c.hasDws&&" · dws ✓"]})]}),t===c.machineId&&a.jsx($,{name:"check",size:14,color:"var(--accent)"})]},c.machineId)})]}),l.length>0&&a.jsxs("div",{className:"engine-selector__group",children:[a.jsxs("div",{className:"engine-selector__label",children:["离线 (",l.length,")"]}),l.map(c=>a.jsxs("div",{className:"engine-option engine-option--disabled",children:[a.jsx("span",{className:"machine-status machine-status--offline"}),a.jsxs("span",{className:"engine-option__info",children:[a.jsx("span",{className:"engine-option__name",children:c.displayName||c.name}),a.jsx("span",{className:"engine-option__caps",children:"离线 · 不可选"})]})]},c.machineId))]})]})}const kK=lt(function(){const t=Sr(),n=w.useRef();n.current||(n.current=new iy);const r=n.current,s=w.useRef(!1),i=B.initDraft;B.mode;const o=B.projectId,[l,c]=w.useState(!1),[u,d]=w.useState(!1),f=Ls("init",B.stageRuntime.init.phase),[h,p]=w.useState([]),[g,x]=w.useState(st),[_,v]=w.useState(!1),[y,m]=w.useState(LT()),b=w.useCallback(async()=>{x(!0);try{const A=await ry();p(A),v(!1)}catch{v(!0)}finally{x(!1)}},[]);w.useEffect(()=>{st&&b()},[b]);const j=h.find(A=>A.machineId===i.selectedMachineId&&A.status==="online"),k=st&&!g&&!!i.selectedMachineId&&!j,S=st?!g&&!!j&&i.agentsSelected.length>0:!0;w.useEffect(()=>{if(r.onFormSubmit=(A,P)=>{A==="init-agents"?B.patchInitDraft({agentsSelected:P.agents??[]}):A==="init-table"?B.patchInitDraft({tableConnected:!0,tableBaseId:String(P.baseId??""),tableId:String(P.tableId??"")}):A==="init-sop"&&B.patchInitDraft({sop:String(P.sop??"")})},!s.current){s.current=!0;const A=Ls("init",B.stageRuntime.init.phase);me&&A?r.run([{kind:"say",text:"配置已完成,可直接进入设计阶段。"}]):st?r.run([{kind:"say",text:"请在右侧选择执行引擎,然后继续完成后续配置。"}]):me?(async()=>{const P=await lK();m(P),await r.run(mK(P))})():r.run(km)}return()=>{r.onFormSubmit=null}},[r]);const N=w.useRef("");w.useEffect(()=>{if(!st||!S||!j||N.current===j.machineId)return;N.current=j.machineId;const A=km.slice(3),P=`${j.displayName||j.name}(${j.runtimes.map(I=>Nm[I]??I).join(" · ")}${j.hasDws?" · dws ✓":""})`;r.run([{kind:"say",text:`✅ 执行引擎已选定:${P}
316
316
 
317
- 接下来配置 AI 表格、模型服务、角色和 SOP。`},...A])},[S,j,r]);const R=i.agentsSelected.length>0,O=me?S&&R&&i.roles.length>0:i.roles.length>0,[D,M]=w.useState(null);function z(A,P){B.patchInitDraft({selectedMachineId:A,agentsSelected:P});const I=B.projectId;I&&ok(I,A)}async function T(){const A=FT(B.validationContext,"init");if(B.setValidation("init",A),!A.ok){M(A);return}if(d(!0),me){c(!0);try{await ik();let P=o;P||(await r.run([{kind:"tool",label:"创建真实项目工作区",detail:".sandbox/projects",ms:360}]),P=(await Bg()).id),await r.run([{kind:"tool",label:"写入真实配置",detail:"config / roles / recipes",ms:420}]);const I={...B.initDraft,machineId:B.initDraft.selectedMachineId||void 0},C=await QL(P,I);B.setProjects(Ra(B.projects,C.project)),await bu(C.project.id),await r.run([{kind:"say",text:C.warnings.length?`真实配置已生成。注意:${C.warnings[0]}`:"真实配置已生成:config、coding agent 配置和 roles 都已落盘。"}])}catch(P){await r.run([{kind:"say",text:`真实 init 失败:${P instanceof Error?P.message:String(P)}`}]),c(!1),d(!1);return}c(!1)}t("../design")}const E=u?a.jsx("div",{className:"work-body",style:{padding:16},children:a.jsx("div",{className:"empty-hint",children:me?"正在写入真实配置并准备进入设计阶段…":"正在进入设计阶段…"})}):a.jsxs("div",{className:"work-body",style:{padding:16},children:[a.jsxs("div",{className:"cfg-grid",children:[st&&a.jsx(ic,{icon:"bolt",title:"执行引擎",done:S,children:S&&j?a.jsxs("div",{className:"engine-selected",children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsx("span",{children:j.displayName||j.name}),a.jsx("span",{className:"cfg-muted",style:{marginLeft:8},children:j.runtimes.map(A=>Nm[A]??A).join(" · ")}),a.jsx("button",{type:"button",className:"engine-change-btn",onClick:()=>{B.patchInitDraft({selectedMachineId:"",agentsSelected:[]}),N.current=""},children:"更换"})]}):a.jsxs(a.Fragment,{children:[k&&a.jsx("div",{className:"engine-empty",children:a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 此前绑定的执行引擎当前不可用(已离线或被移除),请重新选择或前往",a.jsx(Ue,{className:"engine-empty__link",to:"/engines",children:"执行引擎管理"}),"。"]})}),a.jsx(SK,{machines:h,selectedId:i.selectedMachineId,onSelect:z,loading:g,error:_,onRetry:()=>void b()})]})}),!st&&a.jsx(ic,{icon:"robot",title:"Agent 引擎",done:R,children:R?a.jsx("div",{className:"agent-chips",children:i.agentsSelected.map(A=>a.jsxs("span",{className:"agent-chip",style:{"--c":`var(--agent-${A})`},children:[a.jsx("span",{className:"agent-chip__dot"}),bK[A]]},A))}):a.jsxs("span",{className:"cfg-muted",children:["待扫描 · ",y.filter(A=>A.detected).length," 个已检测"]})}),a.jsx(ic,{icon:"user",title:"角色",done:i.roles.length>0,wide:!0,children:a.jsx(gK,{roles:i.roles,onChange:A=>B.patchInitDraft({roles:A})})}),a.jsx(ic,{icon:"file",title:"SOP 指引",done:!!i.sop,wide:!0,children:a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"用户 SOP / 处理规则(可选)"}),a.jsx("textarea",{className:"qf-textarea role-persona",rows:5,value:i.sop,placeholder:`建议格式:
317
+ 接下来配置 AI 表格、模型服务、角色和 SOP。`},...A])},[S,j,r]);const R=i.agentsSelected.length>0,O=me?S&&R&&i.roles.length>0:i.roles.length>0,[D,M]=w.useState(null);function z(A,P){B.patchInitDraft({selectedMachineId:A,agentsSelected:P});const I=B.projectId;I&&ik(I,A)}async function T(){const A=DT(B.validationContext,"init");if(B.setValidation("init",A),!A.ok){M(A);return}if(d(!0),me){c(!0);try{await sk();let P=o;P||(await r.run([{kind:"tool",label:"创建真实项目工作区",detail:".sandbox/projects",ms:360}]),P=(await Fg()).id),await r.run([{kind:"tool",label:"写入真实配置",detail:"config / roles / recipes",ms:420}]);const I={...B.initDraft,machineId:B.initDraft.selectedMachineId||void 0},C=await YL(P,I);B.setProjects(Ra(B.projects,C.project)),await bu(C.project.id),await r.run([{kind:"say",text:C.warnings.length?`真实配置已生成。注意:${C.warnings[0]}`:"真实配置已生成:config、coding agent 配置和 roles 都已落盘。"}])}catch(P){await r.run([{kind:"say",text:`真实 init 失败:${P instanceof Error?P.message:String(P)}`}]),c(!1),d(!1);return}c(!1)}t("../design")}const E=u?a.jsx("div",{className:"work-body",style:{padding:16},children:a.jsx("div",{className:"empty-hint",children:me?"正在写入真实配置并准备进入设计阶段…":"正在进入设计阶段…"})}):a.jsxs("div",{className:"work-body",style:{padding:16},children:[a.jsxs("div",{className:"cfg-grid",children:[st&&a.jsx(ic,{icon:"bolt",title:"执行引擎",done:S,children:S&&j?a.jsxs("div",{className:"engine-selected",children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsx("span",{children:j.displayName||j.name}),a.jsx("span",{className:"cfg-muted",style:{marginLeft:8},children:j.runtimes.map(A=>Nm[A]??A).join(" · ")}),a.jsx("button",{type:"button",className:"engine-change-btn",onClick:()=>{B.patchInitDraft({selectedMachineId:"",agentsSelected:[]}),N.current=""},children:"更换"})]}):a.jsxs(a.Fragment,{children:[k&&a.jsx("div",{className:"engine-empty",children:a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 此前绑定的执行引擎当前不可用(已离线或被移除),请重新选择或前往",a.jsx(Ue,{className:"engine-empty__link",to:"/engines",children:"执行引擎管理"}),"。"]})}),a.jsx(SK,{machines:h,selectedId:i.selectedMachineId,onSelect:z,loading:g,error:_,onRetry:()=>void b()})]})}),!st&&a.jsx(ic,{icon:"robot",title:"Agent 引擎",done:R,children:R?a.jsx("div",{className:"agent-chips",children:i.agentsSelected.map(A=>a.jsxs("span",{className:"agent-chip",style:{"--c":`var(--agent-${A})`},children:[a.jsx("span",{className:"agent-chip__dot"}),bK[A]]},A))}):a.jsxs("span",{className:"cfg-muted",children:["待扫描 · ",y.filter(A=>A.detected).length," 个已检测"]})}),a.jsx(ic,{icon:"user",title:"角色",done:i.roles.length>0,wide:!0,children:a.jsx(gK,{roles:i.roles,onChange:A=>B.patchInitDraft({roles:A})})}),a.jsx(ic,{icon:"file",title:"SOP 指引",done:!!i.sop,wide:!0,children:a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"用户 SOP / 处理规则(可选)"}),a.jsx("textarea",{className:"qf-textarea role-persona",rows:5,value:i.sop,placeholder:`建议格式:
318
318
  1. 什么时候触发流程?
319
319
  2. 每一步输入什么、产出什么?
320
320
  3. 哪些情况必须人工审核?
321
321
  4. 超时、失败、风险命中时通知谁?
322
- 5. 哪些话术、动作或自动化行为必须避免?`,onChange:A=>B.patchInitDraft({sop:A.target.value})}),a.jsx("span",{className:"cfg-muted",children:"可以先写要点,不需要一次写完;Design 阶段会继续澄清。"})]})}),O||f?a.jsxs("div",{className:"cfg-cta",children:[a.jsxs("div",{className:"cfg-cta__text",children:[a.jsx($,{name:"check",size:16}),"配置完成,可以进入设计阶段"]}),a.jsx("button",{type:"button",className:"primary cfg-cta__btn",onClick:()=>void T(),disabled:l,children:l?"写入配置中...":"下一步:设计 →"})]}):a.jsxs("div",{className:"cfg-cta cfg-cta--pending",children:[a.jsxs("div",{className:"cfg-cta__text cfg-cta__text--pending",children:[a.jsx($,{name:"warn",size:16}),i.roles.length===0?"请至少添加一个角色后继续":"请完成上方配置后继续"]}),a.jsx("button",{type:"button",className:"primary cfg-cta__btn",disabled:!0,children:"下一步:设计 →"})]})]}),D&&!D.ok&&a.jsx(RT,{title:"无法进入设计阶段",missing:D.missing,warnings:D.warnings,onClose:()=>M(null),onLocate:A=>{M(null)}})]});return a.jsx(Wu,{chat:r,chatTitle:"一次性配置向导",chatSubtitle:`${st?"执行引擎 · ":""}角色 · SOP · ${me?"真实模式":"演示模式"}`,work:E})}),Jw={claudecode:"Claude",codex:"Codex",qoder:"Qoder"};function NK({projectId:e}){var _,v,y;const[t,n]=w.useState(null),[r,s]=w.useState(!1),[i,o]=w.useState([]),[l,c]=w.useState(!1);if(w.useEffect(()=>{!st||!e||Ec(e).then(m=>n(m)).catch(()=>{})},[e]),!t||!t.machineId)return null;const u=t.status==="online",d=((_=t.machine)==null?void 0:_.runtimes)??[],f=((v=t.machine)==null?void 0:v.hasDws)??!1,h=((y=t.machine)==null?void 0:y.hostname)??t.machineId.slice(0,8);async function p(){if(!e)return;c(!0);let m=0;const b=setInterval(async()=>{m++;try{const j=await Ec(e);j.status==="online"?(clearInterval(b),n(j),c(!1)):m>=12&&(clearInterval(b),c(!1))}catch{m>=12&&(clearInterval(b),c(!1))}},5e3)}async function g(){try{const m=await oy();o(m.filter(b=>b.status==="online"))}catch{}s(!0)}async function x(m){e&&(await ok(e,m),n(await Ec(e)),s(!1))}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`engine-bar${u?"":" engine-bar--offline"}`,children:[a.jsx("span",{className:`machine-status ${u?"machine-status--online":"machine-status--offline"}`}),a.jsxs("span",{className:"engine-bar__name",children:["⚡ ",h]}),u?a.jsxs("span",{className:"engine-bar__caps",children:[d.map(m=>Jw[m]??m).join(" · "),f?" · dws ✓":""]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"engine-bar__offline-text",children:"离线"}),l?a.jsx("span",{className:"engine-bar__waiting",children:"等待重连中..."}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"engine-bar__action",onClick:()=>void p(),children:"等待重连"}),a.jsx("button",{type:"button",className:"engine-bar__action",onClick:()=>void g(),children:"切换引擎"}),a.jsx(Ue,{className:"engine-bar__action",to:"/engines",children:"管理引擎"})]})]})]}),r&&a.jsx("div",{className:"engine-switch-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"engine-switch-dialog",onClick:m=>m.stopPropagation(),children:[a.jsx("div",{className:"engine-switch-dialog__title",children:"切换执行引擎"}),i.length===0?a.jsx("div",{className:"engine-switch-dialog__empty",children:"没有其他在线引擎"}):i.map(m=>a.jsxs("button",{type:"button",className:"engine-switch-dialog__option",onClick:()=>void x(m.machineId),children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsx("span",{children:m.displayName||m.name}),a.jsx("span",{className:"engine-switch-dialog__caps",children:m.runtimes.map(b=>Jw[b]??b).join(" · ")})]},m.machineId)),a.jsx("button",{type:"button",className:"engine-switch-dialog__cancel",onClick:()=>s(!1),children:"取消"})]})})]})}class BT{constructor(t,n){le(this,"lastFilesSummary","");le(this,"lastPhase",null);le(this,"round");this.chat=t,this.projectId=n}isCurrent(){return B.projectId===this.projectId}async narrate(t){if(this.isCurrent())switch(t.type){case"stage.changed":await this.narratePhase(t.stageState.state);return;case"error":await this.chat.run([{kind:"say",text:`真实设计中断:${t.error.message}。已保留当前生成文件,右侧可查看并继续重试。`}]);return;case"design.agent_event":{const n=zL(t.event,this.round);if(n&&B.appendAgentTrace(n),t.event.type==="text"&&t.event.content){this.chat.enqueue([{kind:"agent-text",content:t.event.content}]);return}if(t.event.type==="thinking"&&t.event.content){this.chat.enqueue([{kind:"agent-thinking",content:t.event.content}]);return}if(t.event.type==="tool_use"){const r=tk({toolName:t.event.toolName,toolInput:t.event.toolInput,projectId:this.projectId});this.chat.enqueue([{kind:"tool",label:r.label,detail:r.detail,ms:80}])}return}case"design.files":{const n=PK(t.files);if(n===this.lastFilesSummary)return;this.lastFilesSummary=n,await this.chat.run([{kind:"tool",label:"同步生成文件",detail:n,ms:80}]);return}default:return}}async narratePhase(t){if(t.phase===this.lastPhase&&t.phase!=="generating")return;const n=this.lastPhase;switch(this.lastPhase=t.phase,t.phase){case"clarify_probing":await this.chat.run([{kind:"tool",label:"Agent 判读需求",detail:this.projectId,ms:80}]);return;case"clarify_awaiting":await this.chat.run([{kind:"say",text:"请先确认需求澄清卡片,再开始生成。"}]);return;case"clarify_failed":await this.chat.run([{kind:"say",text:`${t.error.message}。可以重新开始需求澄清。`}]);return;case"precheck":await this.chat.run([{kind:"tool",label:"形成需求摘要",detail:TK(t.confirmed.summary),ms:120}]);return;case"generating":t.round===1&&n!=="generating"&&B.clearAgentTrace(),this.round=t.round,await this.chat.run([{kind:"tool",label:t.isFix?"完善流程方案":"生成流程方案",detail:`第 ${t.round} 轮 · 真实 Agent 执行中`,ms:100}]);return;case"validating":await this.chat.run([{kind:"tool",label:"校验流程方案",detail:t.errors.length===0?"通过":`${t.errors.length} 个问题`,ms:100}]);return;case"syncing_schema":await this.chat.run([{kind:"tool",label:"同步字段与视图计划",detail:"写回配置",ms:80}]);return;case"ready":B.appendAgentTrace({kind:"status",text:"",boundary:!0}),await this.chat.run([{kind:"say",text:`真实工作流已生成:${B.steps.length} 个步骤;实际执行 ${t.rounds} 轮,收到 ${B.live.designAgentEvents} 个 Agent 事件。右侧画布和配置面板已切换为真实产物。`}]);return;case"generate_failed":B.appendAgentTrace({kind:"status",text:"",boundary:!0}),await this.chat.run([{kind:"say",text:`${t.error.message}。已保留当前生成文件,右侧可以先查看文件内容,再重试生成。`}]);return}}}async function EK(e,t,n){if(B.projectId!==t)return;const r=FL(n);if(r&&B.appendAgentTrace(r),n.type==="error"){await e.run([{kind:"say",text:`真实 setup 失败:${n.error.message}`}]);return}if(n.type!=="stage.changed")return;const s=n.stageState.state;switch(s.phase){case"preflight":await e.run([{kind:"say",text:"正在加载配置与工作流模板"}]);return;case"provisioning_table":await e.run([{kind:"todo-advance"},{kind:"say",text:"正在创建 AI 表格"}]);return;case"syncing_schema":await e.run([{kind:"todo-advance"},{kind:"say",text:"正在创建字段和视图"}]);return;case"auth_awaiting":await e.run([{kind:"say",text:s.error.message}]);return;case"failed":await e.run([{kind:"say",text:`真实 setup 失败:${s.error.message}`}]);return;case"ready":await e.run([{kind:"todo-advance"},{kind:"todo-advance"},{kind:"say",text:`真实 setup 已完成,AI 表格链接已生成,Table Id 已写回:${s.tableId}。`}]);return}}function CK(e,t){if(B.projectId!==e)return;const n=VL(t);n&&B.appendAgentTrace(n)}function TK(e){const n=e.replace(/^用户已确认[::]?\s*/u,"").split(/[\n。;;]/u).map(s=>s.replace(/^[-•\s]+/u,"").trim()).filter(Boolean).filter(s=>!s.toLowerCase().includes("skipped")).slice(0,3).map(s=>s.replace(/\s+/g," ")),r=n.length>0?n.join(" · "):e.replace(/\s+/g," ").trim();return Vg(r,96)}function PK(e){return e.filter(n=>!n.path.endsWith("project.json")).map(n=>{var r;return((r=jd(n.path))==null?void 0:r.name)??n.path.split("/").pop()??n.path}).join(" · ")}async function AK(e,t){const n=new BT(e,t);await e.run([{kind:"say",text:"我会调用真实设计服务,先理解你的 SOP 与角色配置,再生成可落地的工作流方案。主要耗时在真实 Agent 生成阶段。"}]);const r=e.beginTask("真实 Agent 生成工作流",t);try{await e$(t,async s=>{B.applyDesignEvent(t,s)&&(s.type==="design.files"&&await UT(t,s.files),s.type==="error"&&await uh(t),s.type==="stage.changed"&&s.stageState.state.phase==="ready"&&await $K(t),s.type==="stage.changed"&&s.stageState.state.phase==="generate_failed"&&await uh(t),await n.narrate(s))}),r(B.stageRuntime.design.phase==="ready"?"done":"error")}catch(s){r("error");const i=s instanceof Error?s.message:String(s);if(B.projectId!==t)return;B.patchLive(t,{designLiveText:`真实设计请求失败:${i}`}),await uh(t),await e.run([{kind:"say",text:`真实设计请求失败:${i}。已保留当前生成文件,右侧可查看并重新进入设计。`}])}}async function RK(e,t){const n=new BT(e,t),r=await t$(t).catch(()=>null);if(!(!r||r.events.length===0)){for(const s of r.events)if(s.type!=="stage.changed"){if(B.projectId!==t)return;await n.narrate(s)}}}async function IK(e,t){await e.run([{kind:"say",text:"开始搭建真实 AI 表格结构。该步骤会通过 dws 对目标 AI 表格产生真实字段/视图变更。"},{kind:"todo",items:["加载配置","读取 workflow","创建字段与视图","生成 AI 表格链接"]}]),await n$(t,async n=>{B.applySetupEvent(t,n)&&(n.type==="stage.changed"&&n.stageState.state.phase==="ready"&&"tableId"in n.stageState.state&&B.patchInitDraft({tableConnected:!0,tableBaseId:n.stageState.state.baseId,tableId:n.stageState.state.tableId}),await EK(e,t,n))})}async function MK(e,t){if(B.projectId!==e)return;const n=await r$(e,async r=>{B.applyRunEvent(e,r)&&CK(e,r)},t);n.mode==="relay"&&await LK(e,n.schedule,t)}const OK=3e3;async function LK(e,t,n){var s;let r=0;for(;!((s=n==null?void 0:n.signal)!=null&&s.aborted)&&B.projectId===e;){try{const[i,o,l]=await Promise.all([i$(e),o$(e),a$(e,{afterSeq:r}).catch(()=>null)]);if(B.projectId!==e)return;const c=i.schedule??null;if(await B.refreshProjectState(e),B.applyRunRecords(e,o.items),l){r=l.lastSeq;for(const u of l.events)B.appendRunTimelineEntry(e,u)}if(c&&c.desiredState==="stopped"&&!c.machineId)return}catch(i){B.appendRunPollError(e,i instanceof Error?i.message:String(i))}await new Promise(i=>setTimeout(i,OK))}}async function $K(e){const t=await Ck(e,B.currentWorkflowId).catch(()=>null);t&&B.projectId===e&&t.currentWorkflowId&&(B.setWorkflows(t.workflows),B.setCurrentWorkflow(t.currentWorkflowId,t.workflowFiles));const n=B.currentWorkflowId,[r,s]=await Promise.all([Sd(e,n).catch(()=>null),Wg(e).catch(()=>null)]);s&&B.applyServerFiles(e,s),r&&B.applyServerWorkflow(e,r)}async function uh(e){try{const t=await Wg(e);if(!B.applyServerFiles(e,t))return;await UT(e,t)}catch{}}async function UT(e,t){if(t.some(n=>n.path==="workflow.yml"||n.path.endsWith("/workflow.yml")))try{const n=await Sd(e,B.currentWorkflowId);B.applyServerWorkflow(e,n)}catch{}}function uy(e,t){const n=B.stream,r=B.projectId,s=n==null?void 0:n.stage,i=(n==null?void 0:n.endpoint)??null;w.useEffect(()=>{B.mode!=="live"||!r||s!==e||Kd(e,r,t)},[t,r,e,s,i])}const dh=new Map,Em=new Map;function Kd(e,t,n){const r=`${e}:${t}`,s=dh.get(r);if(s)return s;const i=new AbortController;Em.set(r,i);const o=(async()=>{var l;try{e==="run"?await MK(t,{signal:i.signal}):e==="design"?await AK(n,t):await IK(n,t)}finally{dh.delete(r),Em.delete(r),B.projectId===t&&((l=B.stream)==null?void 0:l.stage)===e&&await Hi(t)}})();return dh.set(r,o),o}function eb(e,t){var n;(n=Em.get(`${e}:${t}`))==null||n.abort()}function tb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function DK(e){if(Array.isArray(e))return e}function zK(e,t,n){return(t=KK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FK(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function VK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
323
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function rb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nb(Object(n),!0).forEach(function(r){zK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function BK(e,t){if(e==null)return{};var n,r,s=UK(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function UK(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function HK(e,t){return DK(e)||FK(e,t)||GK(e,t)||VK()}function WK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function KK(e){var t=WK(e,"string");return typeof t=="symbol"?t:t+""}function GK(e,t){if(e){if(typeof e=="string")return tb(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tb(e,t):void 0}}function qK(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ib(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sb(Object(n),!0).forEach(function(r){qK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function YK(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(s,i){return i(s)},r)}}function Bo(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return s.length>=e.length?e.apply(this,s):function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return t.apply(n,[].concat(s,l))}}}function Ku(e){return{}.toString.call(e).includes("Object")}function XK(e){return!Object.keys(e).length}function qa(e){return typeof e=="function"}function QK(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ZK(e,t){return Ku(t)||Kr("changeType"),Object.keys(t).some(function(n){return!QK(e,n)})&&Kr("changeField"),t}function JK(e){qa(e)||Kr("selectorType")}function eG(e){qa(e)||Ku(e)||Kr("handlerType"),Ku(e)&&Object.values(e).some(function(t){return!qa(t)})&&Kr("handlersType")}function tG(e){e||Kr("initialIsRequired"),Ku(e)||Kr("initialType"),XK(e)&&Kr("initialContent")}function nG(e,t){throw new Error(e[t]||e.default)}var rG={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Kr=Bo(nG)(rG),oc={changes:ZK,selector:JK,handler:eG,initial:tG};function sG(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};oc.initial(e),oc.handler(t);var n={current:e},r=Bo(aG)(n,t),s=Bo(oG)(n),i=Bo(oc.changes)(e),o=Bo(iG)(n);function l(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return oc.selector(u),u(n.current)}function c(u){YK(r,s,i,o)(u)}return[l,c]}function iG(e,t){return qa(t)?t(e.current):t}function oG(e,t){return e.current=ib(ib({},e.current),t),t}function aG(e,t,n){return qa(t)?t(e.current):Object.keys(n).forEach(function(r){var s;return(s=t[r])===null||s===void 0?void 0:s.call(t,e.current[r])}),n}var lG={create:sG},cG={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function uG(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return s.length>=e.length?e.apply(this,s):function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return t.apply(n,[].concat(s,l))}}}function dG(e){return{}.toString.call(e).includes("Object")}function fG(e){return e||ob("configIsRequired"),dG(e)||ob("configType"),e.urls?(hG(),{paths:{vs:e.urls.monacoBase}}):e}function hG(){console.warn(HT.deprecation)}function pG(e,t){throw new Error(e[t]||e.default)}var HT={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
322
+ 5. 哪些话术、动作或自动化行为必须避免?`,onChange:A=>B.patchInitDraft({sop:A.target.value})}),a.jsx("span",{className:"cfg-muted",children:"可以先写要点,不需要一次写完;Design 阶段会继续澄清。"})]})}),O||f?a.jsxs("div",{className:"cfg-cta",children:[a.jsxs("div",{className:"cfg-cta__text",children:[a.jsx($,{name:"check",size:16}),"配置完成,可以进入设计阶段"]}),a.jsx("button",{type:"button",className:"primary cfg-cta__btn",onClick:()=>void T(),disabled:l,children:l?"写入配置中...":"下一步:设计 →"})]}):a.jsxs("div",{className:"cfg-cta cfg-cta--pending",children:[a.jsxs("div",{className:"cfg-cta__text cfg-cta__text--pending",children:[a.jsx($,{name:"warn",size:16}),i.roles.length===0?"请至少添加一个角色后继续":"请完成上方配置后继续"]}),a.jsx("button",{type:"button",className:"primary cfg-cta__btn",disabled:!0,children:"下一步:设计 →"})]})]}),D&&!D.ok&&a.jsx(PT,{title:"无法进入设计阶段",missing:D.missing,warnings:D.warnings,onClose:()=>M(null),onLocate:A=>{M(null)}})]});return a.jsx(Wu,{chat:r,chatTitle:"一次性配置向导",chatSubtitle:`${st?"执行引擎 · ":""}角色 · SOP · ${me?"真实模式":"演示模式"}`,work:E})}),Xw={claudecode:"Claude",codex:"Codex",qoder:"Qoder"};function NK({projectId:e}){var _,v,y;const[t,n]=w.useState(null),[r,s]=w.useState(!1),[i,o]=w.useState([]),[l,c]=w.useState(!1);if(w.useEffect(()=>{!st||!e||Ec(e).then(m=>n(m)).catch(()=>{})},[e]),!t||!t.machineId)return null;const u=t.status==="online",d=((_=t.machine)==null?void 0:_.runtimes)??[],f=((v=t.machine)==null?void 0:v.hasDws)??!1,h=((y=t.machine)==null?void 0:y.hostname)??t.machineId.slice(0,8);async function p(){if(!e)return;c(!0);let m=0;const b=setInterval(async()=>{m++;try{const j=await Ec(e);j.status==="online"?(clearInterval(b),n(j),c(!1)):m>=12&&(clearInterval(b),c(!1))}catch{m>=12&&(clearInterval(b),c(!1))}},5e3)}async function g(){try{const m=await ry();o(m.filter(b=>b.status==="online"))}catch{}s(!0)}async function x(m){e&&(await ik(e,m),n(await Ec(e)),s(!1))}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`engine-bar${u?"":" engine-bar--offline"}`,children:[a.jsx("span",{className:`machine-status ${u?"machine-status--online":"machine-status--offline"}`}),a.jsxs("span",{className:"engine-bar__name",children:["⚡ ",h]}),u?a.jsxs("span",{className:"engine-bar__caps",children:[d.map(m=>Xw[m]??m).join(" · "),f?" · dws ✓":""]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"engine-bar__offline-text",children:"离线"}),l?a.jsx("span",{className:"engine-bar__waiting",children:"等待重连中..."}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"engine-bar__action",onClick:()=>void p(),children:"等待重连"}),a.jsx("button",{type:"button",className:"engine-bar__action",onClick:()=>void g(),children:"切换引擎"}),a.jsx(Ue,{className:"engine-bar__action",to:"/engines",children:"管理引擎"})]})]})]}),r&&a.jsx("div",{className:"engine-switch-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"engine-switch-dialog",onClick:m=>m.stopPropagation(),children:[a.jsx("div",{className:"engine-switch-dialog__title",children:"切换执行引擎"}),i.length===0?a.jsx("div",{className:"engine-switch-dialog__empty",children:"没有其他在线引擎"}):i.map(m=>a.jsxs("button",{type:"button",className:"engine-switch-dialog__option",onClick:()=>void x(m.machineId),children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsx("span",{children:m.displayName||m.name}),a.jsx("span",{className:"engine-switch-dialog__caps",children:m.runtimes.map(b=>Xw[b]??b).join(" · ")})]},m.machineId)),a.jsx("button",{type:"button",className:"engine-switch-dialog__cancel",onClick:()=>s(!1),children:"取消"})]})})]})}class FT{constructor(t,n){le(this,"lastFilesSummary","");le(this,"lastPhase",null);le(this,"round");this.chat=t,this.projectId=n}isCurrent(){return B.projectId===this.projectId}async narrate(t){if(this.isCurrent())switch(t.type){case"stage.changed":await this.narratePhase(t.stageState.state);return;case"error":await this.chat.run([{kind:"say",text:`真实设计中断:${t.error.message}。已保留当前生成文件,右侧可查看并继续重试。`}]);return;case"design.agent_event":{const n=$L(t.event,this.round);if(n&&B.appendAgentTrace(n),t.event.type==="text"&&t.event.content){this.chat.enqueue([{kind:"agent-text",content:t.event.content}]);return}if(t.event.type==="thinking"&&t.event.content){this.chat.enqueue([{kind:"agent-thinking",content:t.event.content}]);return}if(t.event.type==="tool_use"){const r=ek({toolName:t.event.toolName,toolInput:t.event.toolInput,projectId:this.projectId});this.chat.enqueue([{kind:"tool",label:r.label,detail:r.detail,ms:80}])}return}case"design.files":{const n=PK(t.files);if(n===this.lastFilesSummary)return;this.lastFilesSummary=n,await this.chat.run([{kind:"tool",label:"同步生成文件",detail:n,ms:80}]);return}default:return}}async narratePhase(t){if(t.phase===this.lastPhase&&t.phase!=="generating")return;const n=this.lastPhase;switch(this.lastPhase=t.phase,t.phase){case"clarify_probing":await this.chat.run([{kind:"tool",label:"Agent 判读需求",detail:this.projectId,ms:80}]);return;case"clarify_awaiting":await this.chat.run([{kind:"say",text:"请先确认需求澄清卡片,再开始生成。"}]);return;case"clarify_failed":await this.chat.run([{kind:"say",text:`${t.error.message}。可以重新开始需求澄清。`}]);return;case"precheck":await this.chat.run([{kind:"tool",label:"形成需求摘要",detail:TK(t.confirmed.summary),ms:120}]);return;case"generating":t.round===1&&n!=="generating"&&B.clearAgentTrace(),this.round=t.round,await this.chat.run([{kind:"tool",label:t.isFix?"完善流程方案":"生成流程方案",detail:`第 ${t.round} 轮 · 真实 Agent 执行中`,ms:100}]);return;case"validating":await this.chat.run([{kind:"tool",label:"校验流程方案",detail:t.errors.length===0?"通过":`${t.errors.length} 个问题`,ms:100}]);return;case"syncing_schema":await this.chat.run([{kind:"tool",label:"同步字段与视图计划",detail:"写回配置",ms:80}]);return;case"ready":B.appendAgentTrace({kind:"status",text:"",boundary:!0}),await this.chat.run([{kind:"say",text:`真实工作流已生成:${B.steps.length} 个步骤;实际执行 ${t.rounds} 轮,收到 ${B.live.designAgentEvents} 个 Agent 事件。右侧画布和配置面板已切换为真实产物。`}]);return;case"generate_failed":B.appendAgentTrace({kind:"status",text:"",boundary:!0}),await this.chat.run([{kind:"say",text:`${t.error.message}。已保留当前生成文件,右侧可以先查看文件内容,再重试生成。`}]);return}}}async function EK(e,t,n){if(B.projectId!==t)return;const r=DL(n);if(r&&B.appendAgentTrace(r),n.type==="error"){await e.run([{kind:"say",text:`真实 setup 失败:${n.error.message}`}]);return}if(n.type!=="stage.changed")return;const s=n.stageState.state;switch(s.phase){case"preflight":await e.run([{kind:"say",text:"正在加载配置与工作流模板"}]);return;case"provisioning_table":await e.run([{kind:"todo-advance"},{kind:"say",text:"正在创建 AI 表格"}]);return;case"syncing_schema":await e.run([{kind:"todo-advance"},{kind:"say",text:"正在创建字段和视图"}]);return;case"auth_awaiting":await e.run([{kind:"say",text:s.error.message}]);return;case"failed":await e.run([{kind:"say",text:`真实 setup 失败:${s.error.message}`}]);return;case"ready":await e.run([{kind:"todo-advance"},{kind:"todo-advance"},{kind:"say",text:`真实 setup 已完成,AI 表格链接已生成,Table Id 已写回:${s.tableId}。`}]);return}}function CK(e,t){if(B.projectId!==e)return;const n=zL(t);n&&B.appendAgentTrace(n)}function TK(e){const n=e.replace(/^用户已确认[::]?\s*/u,"").split(/[\n。;;]/u).map(s=>s.replace(/^[-•\s]+/u,"").trim()).filter(Boolean).filter(s=>!s.toLowerCase().includes("skipped")).slice(0,3).map(s=>s.replace(/\s+/g," ")),r=n.length>0?n.join(" · "):e.replace(/\s+/g," ").trim();return zg(r,96)}function PK(e){return e.filter(n=>!n.path.endsWith("project.json")).map(n=>{var r;return((r=jd(n.path))==null?void 0:r.name)??n.path.split("/").pop()??n.path}).join(" · ")}async function AK(e,t){const n=new FT(e,t);await e.run([{kind:"say",text:"我会调用真实设计服务,先理解你的 SOP 与角色配置,再生成可落地的工作流方案。主要耗时在真实 Agent 生成阶段。"}]);const r=e.beginTask("真实 Agent 生成工作流",t);try{await ZL(t,async s=>{B.applyDesignEvent(t,s)&&(s.type==="design.files"&&await VT(t,s.files),s.type==="error"&&await uh(t),s.type==="stage.changed"&&s.stageState.state.phase==="ready"&&await $K(t),s.type==="stage.changed"&&s.stageState.state.phase==="generate_failed"&&await uh(t),await n.narrate(s))}),r(B.stageRuntime.design.phase==="ready"?"done":"error")}catch(s){r("error");const i=s instanceof Error?s.message:String(s);if(B.projectId!==t)return;B.patchLive(t,{designLiveText:`真实设计请求失败:${i}`}),await uh(t),await e.run([{kind:"say",text:`真实设计请求失败:${i}。已保留当前生成文件,右侧可查看并重新进入设计。`}])}}async function RK(e,t){const n=new FT(e,t),r=await JL(t).catch(()=>null);if(!(!r||r.events.length===0)){for(const s of r.events)if(s.type!=="stage.changed"){if(B.projectId!==t)return;await n.narrate(s)}}}async function IK(e,t){await e.run([{kind:"say",text:"开始搭建真实 AI 表格结构。该步骤会通过 dws 对目标 AI 表格产生真实字段/视图变更。"},{kind:"todo",items:["加载配置","读取 workflow","创建字段与视图","生成 AI 表格链接"]}]),await e$(t,async n=>{B.applySetupEvent(t,n)&&(n.type==="stage.changed"&&n.stageState.state.phase==="ready"&&"tableId"in n.stageState.state&&B.patchInitDraft({tableConnected:!0,tableBaseId:n.stageState.state.baseId,tableId:n.stageState.state.tableId}),await EK(e,t,n))})}async function MK(e,t){if(B.projectId!==e)return;const n=await t$(e,async r=>{B.applyRunEvent(e,r)&&CK(e,r)},t);n.mode==="relay"&&await LK(e,n.schedule,t)}const OK=3e3;async function LK(e,t,n){var s;let r=0;for(;!((s=n==null?void 0:n.signal)!=null&&s.aborted)&&B.projectId===e;){try{const[i,o,l]=await Promise.all([r$(e),s$(e),i$(e,{afterSeq:r}).catch(()=>null)]);if(B.projectId!==e)return;const c=i.schedule??null;if(await B.refreshProjectState(e),B.applyRunRecords(e,o.items),l){r=l.lastSeq;for(const u of l.events)B.appendRunTimelineEntry(e,u)}if(c&&c.desiredState==="stopped"&&!c.machineId)return}catch(i){B.appendRunPollError(e,i instanceof Error?i.message:String(i))}await new Promise(i=>setTimeout(i,OK))}}async function $K(e){const t=await Nk(e,B.currentWorkflowId).catch(()=>null);t&&B.projectId===e&&t.currentWorkflowId&&(B.setWorkflows(t.workflows),B.setCurrentWorkflow(t.currentWorkflowId,t.workflowFiles));const n=B.currentWorkflowId,[r,s]=await Promise.all([Sd(e,n).catch(()=>null),Ug(e).catch(()=>null)]);s&&B.applyServerFiles(e,s),r&&B.applyServerWorkflow(e,r)}async function uh(e){try{const t=await Ug(e);if(!B.applyServerFiles(e,t))return;await VT(e,t)}catch{}}async function VT(e,t){if(t.some(n=>n.path==="workflow.yml"||n.path.endsWith("/workflow.yml")))try{const n=await Sd(e,B.currentWorkflowId);B.applyServerWorkflow(e,n)}catch{}}function ay(e,t){const n=B.stream,r=B.projectId,s=n==null?void 0:n.stage,i=(n==null?void 0:n.endpoint)??null;w.useEffect(()=>{B.mode!=="live"||!r||s!==e||Kd(e,r,t)},[t,r,e,s,i])}const dh=new Map,Em=new Map;function Kd(e,t,n){const r=`${e}:${t}`,s=dh.get(r);if(s)return s;const i=new AbortController;Em.set(r,i);const o=(async()=>{var l;try{e==="run"?await MK(t,{signal:i.signal}):e==="design"?await AK(n,t):await IK(n,t)}finally{dh.delete(r),Em.delete(r),B.projectId===t&&((l=B.stream)==null?void 0:l.stage)===e&&await Hi(t)}})();return dh.set(r,o),o}function Qw(e,t){var n;(n=Em.get(`${e}:${t}`))==null||n.abort()}function Zw(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function DK(e){if(Array.isArray(e))return e}function zK(e,t,n){return(t=KK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FK(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function VK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
323
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function eb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jw(Object(n),!0).forEach(function(r){zK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jw(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function BK(e,t){if(e==null)return{};var n,r,s=UK(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function UK(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function HK(e,t){return DK(e)||FK(e,t)||GK(e,t)||VK()}function WK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function KK(e){var t=WK(e,"string");return typeof t=="symbol"?t:t+""}function GK(e,t){if(e){if(typeof e=="string")return Zw(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zw(e,t):void 0}}function qK(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function nb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tb(Object(n),!0).forEach(function(r){qK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function YK(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(s,i){return i(s)},r)}}function Bo(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return s.length>=e.length?e.apply(this,s):function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return t.apply(n,[].concat(s,l))}}}function Ku(e){return{}.toString.call(e).includes("Object")}function XK(e){return!Object.keys(e).length}function qa(e){return typeof e=="function"}function QK(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ZK(e,t){return Ku(t)||Kr("changeType"),Object.keys(t).some(function(n){return!QK(e,n)})&&Kr("changeField"),t}function JK(e){qa(e)||Kr("selectorType")}function eG(e){qa(e)||Ku(e)||Kr("handlerType"),Ku(e)&&Object.values(e).some(function(t){return!qa(t)})&&Kr("handlersType")}function tG(e){e||Kr("initialIsRequired"),Ku(e)||Kr("initialType"),XK(e)&&Kr("initialContent")}function nG(e,t){throw new Error(e[t]||e.default)}var rG={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Kr=Bo(nG)(rG),oc={changes:ZK,selector:JK,handler:eG,initial:tG};function sG(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};oc.initial(e),oc.handler(t);var n={current:e},r=Bo(aG)(n,t),s=Bo(oG)(n),i=Bo(oc.changes)(e),o=Bo(iG)(n);function l(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return oc.selector(u),u(n.current)}function c(u){YK(r,s,i,o)(u)}return[l,c]}function iG(e,t){return qa(t)?t(e.current):t}function oG(e,t){return e.current=nb(nb({},e.current),t),t}function aG(e,t,n){return qa(t)?t(e.current):Object.keys(n).forEach(function(r){var s;return(s=t[r])===null||s===void 0?void 0:s.call(t,e.current[r])}),n}var lG={create:sG},cG={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function uG(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return s.length>=e.length?e.apply(this,s):function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return t.apply(n,[].concat(s,l))}}}function dG(e){return{}.toString.call(e).includes("Object")}function fG(e){return e||rb("configIsRequired"),dG(e)||rb("configType"),e.urls?(hG(),{paths:{vs:e.urls.monacoBase}}):e}function hG(){console.warn(BT.deprecation)}function pG(e,t){throw new Error(e[t]||e.default)}var BT={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
324
324
  You are using deprecated way of configuration.
325
325
 
326
326
  Instead of using
@@ -329,4 +329,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
329
329
  monaco.config({ paths: { vs: '...' } })
330
330
 
331
331
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
332
- `},ob=uG(pG)(HT),mG={config:fG},gG=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(s){return n.reduceRight(function(i,o){return o(i)},s)}};function WT(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],WT(e[n],t[n]))}),rb(rb({},e),t)}var vG={type:"cancelation",msg:"operation is manually canceled"};function fh(e){var t=!1,n=new Promise(function(r,s){e.then(function(i){return t?s(vG):r(i)}),e.catch(s)});return n.cancel=function(){return t=!0},n}var yG=["monaco"],xG=lG.create({config:cG,isInitialized:!1,resolve:null,reject:null,monaco:null}),KT=HK(xG,2),xl=KT[0],Gd=KT[1];function _G(e){var t=mG.config(e),n=t.monaco,r=BK(t,yG);Gd(function(s){return{config:WT(s.config,r),monaco:n}})}function wG(){var e=xl(function(t){var n=t.monaco,r=t.isInitialized,s=t.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!e.isInitialized){if(Gd({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),fh(hh);if(window.monaco&&window.monaco.editor)return GT(window.monaco),e.resolve(window.monaco),fh(hh);gG(bG,SG)(kG)}return fh(hh)}function bG(e){return document.body.appendChild(e)}function jG(e){var t=document.createElement("script");return e&&(t.src=e),t}function SG(e){var t=xl(function(r){var s=r.config,i=r.reject;return{config:s,reject:i}}),n=jG("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function kG(){var e=xl(function(n){var r=n.config,s=n.resolve,i=n.reject;return{config:r,resolve:s,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;GT(r),e.resolve(r)},function(n){e.reject(n)})}function GT(e){xl().monaco||Gd({monaco:e})}function NG(){return xl(function(e){var t=e.monaco;return t})}var hh=new Promise(function(e,t){return Gd({resolve:e,reject:t})}),qT={config:_G,init:wG,__getMonacoInstance:NG},EG={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ph=EG,CG={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},TG=CG;function PG({children:e}){return or.createElement("div",{style:TG.container},e)}var AG=PG,RG=AG;function IG({width:e,height:t,isEditorReady:n,loading:r,_ref:s,className:i,wrapperProps:o}){return or.createElement("section",{style:{...ph.wrapper,width:e,height:t},...o},!n&&or.createElement(RG,null,r),or.createElement("div",{ref:s,style:{...ph.fullWidth,...!n&&ph.hide},className:i}))}var MG=IG,YT=w.memo(MG);function OG(e){w.useEffect(e,[])}var XT=OG;function LG(e,t,n=!0){let r=w.useRef(!0);w.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var jt=LG;function aa(){}function ji(e,t,n,r){return $G(e,r)||DG(e,t,n,r)}function $G(e,t){return e.editor.getModel(QT(e,t))}function DG(e,t,n,r){return e.editor.createModel(t,n,r?QT(e,r):void 0)}function QT(e,t){return e.Uri.parse(t)}function zG({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:i,modifiedModelPath:o,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:d="Loading...",options:f={},height:h="100%",width:p="100%",className:g,wrapperProps:x={},beforeMount:_=aa,onMount:v=aa}){let[y,m]=w.useState(!1),[b,j]=w.useState(!0),k=w.useRef(null),S=w.useRef(null),N=w.useRef(null),R=w.useRef(v),O=w.useRef(_),D=w.useRef(!1);XT(()=>{let E=qT.init();return E.then(A=>(S.current=A)&&j(!1)).catch(A=>(A==null?void 0:A.type)!=="cancelation"&&console.error("Monaco initialization: error:",A)),()=>k.current?T():E.cancel()}),jt(()=>{if(k.current&&S.current){let E=k.current.getOriginalEditor(),A=ji(S.current,e||"",r||n||"text",i||"");A!==E.getModel()&&E.setModel(A)}},[i],y),jt(()=>{if(k.current&&S.current){let E=k.current.getModifiedEditor(),A=ji(S.current,t||"",s||n||"text",o||"");A!==E.getModel()&&E.setModel(A)}},[o],y),jt(()=>{let E=k.current.getModifiedEditor();E.getOption(S.current.editor.EditorOption.readOnly)?E.setValue(t||""):t!==E.getValue()&&(E.executeEdits("",[{range:E.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),E.pushUndoStop())},[t],y),jt(()=>{var E,A;(A=(E=k.current)==null?void 0:E.getModel())==null||A.original.setValue(e||"")},[e],y),jt(()=>{let{original:E,modified:A}=k.current.getModel();S.current.editor.setModelLanguage(E,r||n||"text"),S.current.editor.setModelLanguage(A,s||n||"text")},[n,r,s],y),jt(()=>{var E;(E=S.current)==null||E.editor.setTheme(u)},[u],y),jt(()=>{var E;(E=k.current)==null||E.updateOptions(f)},[f],y);let M=w.useCallback(()=>{var P;if(!S.current)return;O.current(S.current);let E=ji(S.current,e||"",r||n||"text",i||""),A=ji(S.current,t||"",s||n||"text",o||"");(P=k.current)==null||P.setModel({original:E,modified:A})},[n,t,s,e,r,i,o]),z=w.useCallback(()=>{var E;!D.current&&N.current&&(k.current=S.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...f}),M(),(E=S.current)==null||E.editor.setTheme(u),m(!0),D.current=!0)},[f,u,M]);w.useEffect(()=>{y&&R.current(k.current,S.current)},[y]),w.useEffect(()=>{!b&&!y&&z()},[b,y,z]);function T(){var A,P,I,C;let E=(A=k.current)==null?void 0:A.getModel();l||((P=E==null?void 0:E.original)==null||P.dispose()),c||((I=E==null?void 0:E.modified)==null||I.dispose()),(C=k.current)==null||C.dispose()}return or.createElement(YT,{width:p,height:h,isEditorReady:y,loading:d,_ref:N,className:g,wrapperProps:x})}var FG=zG;w.memo(FG);function VG(e){let t=w.useRef();return w.useEffect(()=>{t.current=e},[e]),t.current}var BG=VG,ac=new Map;function UG({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:s,path:i,theme:o="light",line:l,loading:c="Loading...",options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:h=!1,width:p="100%",height:g="100%",className:x,wrapperProps:_={},beforeMount:v=aa,onMount:y=aa,onChange:m,onValidate:b=aa}){let[j,k]=w.useState(!1),[S,N]=w.useState(!0),R=w.useRef(null),O=w.useRef(null),D=w.useRef(null),M=w.useRef(y),z=w.useRef(v),T=w.useRef(),E=w.useRef(r),A=BG(i),P=w.useRef(!1),I=w.useRef(!1);XT(()=>{let F=qT.init();return F.then(V=>(R.current=V)&&N(!1)).catch(V=>(V==null?void 0:V.type)!=="cancelation"&&console.error("Monaco initialization: error:",V)),()=>O.current?L():F.cancel()}),jt(()=>{var V,H,U,W;let F=ji(R.current,e||r||"",t||s||"",i||n||"");F!==((V=O.current)==null?void 0:V.getModel())&&(f&&ac.set(A,(H=O.current)==null?void 0:H.saveViewState()),(U=O.current)==null||U.setModel(F),f&&((W=O.current)==null||W.restoreViewState(ac.get(i))))},[i],j),jt(()=>{var F;(F=O.current)==null||F.updateOptions(u)},[u],j),jt(()=>{!O.current||r===void 0||(O.current.getOption(R.current.editor.EditorOption.readOnly)?O.current.setValue(r):r!==O.current.getValue()&&(I.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),O.current.pushUndoStop(),I.current=!1))},[r],j),jt(()=>{var V,H;let F=(V=O.current)==null?void 0:V.getModel();F&&s&&((H=R.current)==null||H.editor.setModelLanguage(F,s))},[s],j),jt(()=>{var F;l!==void 0&&((F=O.current)==null||F.revealLine(l))},[l],j),jt(()=>{var F;(F=R.current)==null||F.editor.setTheme(o)},[o],j);let C=w.useCallback(()=>{var F;if(!(!D.current||!R.current)&&!P.current){z.current(R.current);let V=i||n,H=ji(R.current,r||e||"",t||s||"",V||"");O.current=(F=R.current)==null?void 0:F.editor.create(D.current,{model:H,automaticLayout:!0,...u},d),f&&O.current.restoreViewState(ac.get(V)),R.current.editor.setTheme(o),l!==void 0&&O.current.revealLine(l),k(!0),P.current=!0}},[e,t,n,r,s,i,u,d,f,o,l]);w.useEffect(()=>{j&&M.current(O.current,R.current)},[j]),w.useEffect(()=>{!S&&!j&&C()},[S,j,C]),E.current=r,w.useEffect(()=>{var F,V;j&&m&&((F=T.current)==null||F.dispose(),T.current=(V=O.current)==null?void 0:V.onDidChangeModelContent(H=>{I.current||m(O.current.getValue(),H)}))},[j,m]),w.useEffect(()=>{if(j){let F=R.current.editor.onDidChangeMarkers(V=>{var U;let H=(U=O.current.getModel())==null?void 0:U.uri;if(H&&V.find(W=>W.path===H.path)){let W=R.current.editor.getModelMarkers({resource:H});b==null||b(W)}});return()=>{F==null||F.dispose()}}return()=>{}},[j,b]);function L(){var F,V;(F=T.current)==null||F.dispose(),h?f&&ac.set(i,O.current.saveViewState()):(V=O.current.getModel())==null||V.dispose(),O.current.dispose()}return or.createElement(YT,{width:p,height:g,isEditorReady:j,loading:c,_ref:D,className:x,wrapperProps:_})}var HG=UG,WG=w.memo(HG),KG=WG;const GG={"workflow.yml":"流程编排","aitable-workflow.config.yml":"运行配置","config.yml":"运行配置","coding-agents.config.json":"执行引擎","views.yml":"视图方案"},ir=oK(),ab=ir?[{path:"workflow.yml",label:"workflow.yml",lang:"yaml",content:ir.workflowYml,summary:"流程编排"},{path:"config.yml",label:"config.yml",lang:"yaml",content:ir.configYml,summary:"运行配置"},...Object.entries(ir.recipeFiles).map(([e,t])=>({path:`recipes/${e}`,label:e,lang:"typescript",content:t,folder:"recipes",summary:"步骤脚本"}))]:[],qG=ir?Object.fromEntries(Object.entries(ir.stepToRecipeFile).map(([e,t])=>[`recipes/${t}`,e])):{},YG=lt(function({selectedStepId:t,onPickStep:n}){const r=B.theme,s=B.projectFiles,i=B.workflowFiles,o=B.steps,[l,c]=w.useState("workflow.yml"),[u,d]=w.useState(!1),f=i.length>0?i:s,h=w.useMemo(()=>f.length===0?ab:f.map(m=>{const b=m.path.split("/").pop()??m.path;return{path:m.path,label:b,lang:m.path.endsWith(".ts")?"typescript":"yaml",content:m.content,folder:m.path.includes("/recipes/")||m.path.startsWith("recipes/")?"recipes":void 0,summary:m.path.includes("/recipes/")||m.path.startsWith("recipes/")?"步骤脚本":GG[b]??"项目文件"}}),[f]),p=w.useMemo(()=>f.length===0?(ir==null?void 0:ir.stepToRecipeFile)??{}:Object.fromEntries(o.filter(m=>m.recipe).map(m=>{var j;const b=(j=f.find(k=>k.path.endsWith(`${m.recipe}.recipe.ts`)))==null?void 0:j.path;return[m.id,(b==null?void 0:b.replace(/^recipes\//,""))??`${m.recipe}.recipe.ts`]})),[f,o]),g=w.useMemo(()=>f.length===0?qG:Object.fromEntries(Object.entries(p).map(([m,b])=>[b.startsWith("recipes/")?b:`recipes/${b}`,m])),[f.length,p]);w.useEffect(()=>{t&&p[t]&&c(`recipes/${p[t]}`)},[t,p]);const x=w.useMemo(()=>h.find(m=>m.path===l)??h[0]??ab[0],[l,h]),_=h.filter(m=>!m.folder),v=h.filter(m=>m.folder==="recipes");function y(m){c(m),n(g[m]??null)}return a.jsxs("div",{className:`code-panel${u?" tree-collapsed":""}`,children:[!u&&a.jsxs("div",{className:"code-tree",children:[a.jsxs("div",{className:"code-tree__bar",children:[a.jsx("span",{className:"code-tree__heading",children:"文件"}),a.jsx("button",{type:"button",className:"code-tree__toggle",onClick:()=>d(!0),title:"收起文件树",children:a.jsx($,{name:"chevron-left",size:14})})]}),_.map(m=>a.jsxs("button",{type:"button",className:`code-tree__file${l===m.path?" is-active":""}`,onClick:()=>y(m.path),children:[a.jsx($,{name:"file",size:13}),a.jsxs("span",{className:"code-tree__file-text",children:[a.jsx("span",{className:"code-tree__file-name",children:m.label}),m.summary?a.jsx("span",{className:"code-tree__file-summary",children:m.summary}):null]})]},m.path)),a.jsxs("div",{className:"code-tree__folder",children:[a.jsx($,{name:"folder",size:13}),"步骤脚本 recipes"]}),v.map(m=>{const b=g[m.path],j=b&&b===t;return a.jsxs("button",{type:"button",className:`code-tree__file is-nested${l===m.path?" is-active":""}${j?" is-linked":""}`,onClick:()=>y(m.path),children:[a.jsx($,{name:"file",size:13}),a.jsxs("span",{className:"code-tree__file-text",children:[a.jsx("span",{className:"code-tree__file-name",children:m.label}),m.summary?a.jsx("span",{className:"code-tree__file-summary",children:m.summary}):null]})]},m.path)})]}),u&&a.jsx("button",{type:"button",className:"code-tree__expand",onClick:()=>d(!1),title:"展开文件树",children:a.jsx($,{name:"chevron-right",size:14})}),a.jsxs("div",{className:"code-editor",children:[a.jsxs("div",{className:"code-editor__head",children:[a.jsx($,{name:"file",size:13}),a.jsx("span",{children:x.path}),a.jsx("span",{className:"code-editor__lang",children:x.lang})]}),a.jsx("div",{className:"code-editor__body",children:a.jsx(KG,{height:"100%",language:x.lang,value:x.content,theme:r==="dark"?"vs-dark":"light",options:{readOnly:!0,minimap:{enabled:!1},fontSize:12.5,lineHeight:20,scrollBeyondLastLine:!1,renderLineHighlight:"none",padding:{top:10},fontFamily:"ui-monospace, 'SF Mono', Menlo, monospace"},loading:a.jsx("div",{className:"code-editor__loading",children:"加载编辑器…"})},x.path)})]})]})});function XG({step:e,fields:t,values:n,onSave:r,onReset:s}){const[i,o]=w.useState({...n});function l(h,p){o(g=>({...g,[h]:p}))}const c=new Map;for(const h of t){const p=h.group??"通用";c.has(p)||c.set(p,[]),c.get(p).push(h)}const u=t.filter(h=>h.isEnvRef),d=new Map;for(const[h,p]of c){const g=p.filter(x=>!x.isEnvRef);g.length>0&&d.set(h,g)}function f(){r(i)}return a.jsxs("div",{className:"step-config-form",children:[a.jsxs("div",{className:"step-config-form__head",children:[a.jsx($,{name:"bolt",size:14}),a.jsxs("span",{className:"step-config-form__title",children:["步骤配置 · ",e.name]})]}),a.jsx("div",{className:"step-config-form__meta",children:a.jsxs("span",{className:"step-config-form__recipe",children:["recipe: ",e.recipe]})}),a.jsxs("div",{className:"step-config-form__body",children:[Array.from(d.entries()).map(([h,p])=>a.jsxs("fieldset",{className:"step-config-form__group",children:[a.jsx("legend",{className:"step-config-form__group-title",children:h}),p.map(g=>a.jsx(lb,{field:g,value:i[g.key]??"",onChange:x=>l(g.key,x)},g.key))]},h)),u.length>0&&a.jsxs("fieldset",{className:"step-config-form__group",children:[a.jsx("legend",{className:"step-config-form__group-title",children:"环境变量引用"}),u.map(h=>a.jsxs("div",{className:"step-config-form__env-ref",children:[a.jsxs("span",{className:"step-config-form__env-mapping",children:[h.key," = ","${env.",h.envKey??h.key.toUpperCase(),"}"]}),a.jsx(lb,{field:{...h,label:h.envKey??h.key.toUpperCase(),type:"secret"},value:i[h.envKey??h.key]??"",onChange:p=>l(h.envKey??h.key,p)})]},h.key))]})]}),a.jsxs("div",{className:"step-config-form__foot",children:[s&&a.jsx("button",{type:"button",className:"step-config-form__btn",onClick:s,children:"恢复默认"}),a.jsx("button",{type:"button",className:"primary step-config-form__btn",onClick:f,children:"保存配置"})]})]})}function lb({field:e,value:t,onChange:n}){const r=e.required&&!t.trim(),s=`qf-input${r?" is-required-empty":""}`;return a.jsxs("div",{className:"step-config-form__field",children:[a.jsxs("label",{className:"step-config-form__label",children:[e.label,e.required&&a.jsx("span",{className:"qf-required",children:"*"})]}),e.description&&a.jsx("div",{className:"step-config-form__help",children:e.description}),e.type==="select"&&e.options?a.jsxs("select",{className:`qf-select${r?" is-required-empty":""}`,value:t,onChange:i=>n(i.target.value),children:[a.jsx("option",{value:"",children:"请选择…"}),e.options.map(i=>a.jsx("option",{value:i.value,children:i.label},i.value))]}):e.type==="number"?a.jsx("input",{type:"number",className:s,value:t,placeholder:e.defaultValue,onChange:i=>n(i.target.value)}):e.type==="switch"?a.jsxs("label",{className:"qf-switch",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:t==="true",onChange:i=>n(i.target.checked?"true":"false")}),a.jsx("span",{"aria-hidden":!0})]}):e.type==="secret"?a.jsx("input",{type:"password",className:s,value:t,placeholder:"••••••••",onChange:i=>n(i.target.value)}):a.jsx("input",{type:"text",className:s,value:t,placeholder:e.defaultValue??"",onChange:i=>n(i.target.value)}),r&&a.jsx("span",{className:"step-config-form__required-hint",children:"必填"})]})}const QG=lt(function(){const t=B.steps,n=B.edges,[r,s]=w.useState(null),[i,o]=w.useState("preview"),l=t.find(u=>u.id===r)??null,c=l?[{key:"model",label:"model",type:"select",group:"AI (ai)",options:[{label:"Qwen3-Mini",value:"qwen3-mini"},{label:"Qwen3.7-Max",value:"qwen3.7-max"},{label:"DeepSeek-V3",value:"deepseek-v3"}]},{key:"engine",label:"engine",type:"select",required:!0,group:"编程引擎 (coding)",options:[{label:"qoder",value:"qoder"},{label:"codex",value:"codex"},{label:"claude",value:"claude"}]},{key:"target_branch",label:"target_branch",type:"text",group:"业务参数",defaultValue:"master"},{key:"api_key",label:"API Key",type:"secret",required:!0,isEnvRef:!0,envKey:"IDEALAB_API_KEY",group:"环境变量引用"}]:[];return a.jsxs("div",{className:"design-workspace design-workspace--tabbed",children:[a.jsxs("div",{className:"dw-tabs",children:[a.jsxs("button",{type:"button",className:`dw-tabs__tab${i==="preview"?" is-active":""}`,onClick:()=>o("preview"),children:[a.jsx($,{name:"flow",size:13}),"预览"]}),a.jsxs("button",{type:"button",className:`dw-tabs__tab${i==="code"?" is-active":""}`,onClick:()=>o("code"),children:[a.jsx($,{name:"file",size:13}),"代码"]})]}),i==="preview"?a.jsxs("div",{className:"dw-preview",children:[a.jsx("section",{className:"dw-panel dw-panel--canvas",style:{flex:1,borderRight:l?"1px solid var(--border)":"none"},children:a.jsx(xT,{steps:t,edges:n,selectedId:r,onSelect:s})}),l&&a.jsx(XG,{step:l,fields:c,values:{},onSave:u=>{console.log("保存配置",l.id,u)},onReset:()=>{}})]}):a.jsx("div",{className:"dw-code-view",children:a.jsx(YG,{selectedStepId:r,onPickStep:s})})]})}),Ao={discovery:"理解业务目标与 SOP",generate:"生成流程方案",validate:"校验配置完整性",render:"渲染真实画布与配置"};function ZG({state:e,message:t}){return a.jsxs("div",{className:"design-progress work-body",children:[a.jsxs("div",{className:"design-progress__hero",children:[a.jsx("span",{className:"design-progress__icon","aria-hidden":!0,children:a.jsx($,{name:"sparkle",size:18,color:"#fff"})}),a.jsxs("div",{children:[a.jsx("div",{className:"design-progress__title",children:"正在生成工作流设计"}),a.jsx("div",{className:"design-progress__message",children:t})]})]}),a.jsx(TT,{items:eq(e)})]})}const JG={clarify_probing:0,clarify_awaiting:0,clarify_failed:0,precheck:1,generating:1,validating:2,syncing_schema:3,ready:4,generate_failed:4};function eq(e){const t=JG[e.phase],n=e.phase==="generating"?`${Ao.generate}(第 ${e.round} 轮)`:Ao.generate;return[{id:"design-discovery",text:Ao.discovery,status:lc(0,t)},{id:"design-generate",text:n,status:lc(1,t)},{id:"design-validate",text:Ao.validate,status:lc(2,t)},{id:"design-render",text:Ao.render,status:lc(3,t)}]}function lc(e,t){return t>=4||e<t?"done":e===t?"active":"pending"}const tq={label:"交给设计 Agent 判读需求",detail:"缺口分析 / 决定是否提问"};function nq(e,t){switch(e.phase){case"clarify_probing":return{acts:[{kind:"say",text:"设计 Agent 正在判读你的 SOP、角色与表格信息,看还缺什么——需要澄清就会问你,已经清楚就直接开始生成。这一步可能要一两分钟,停在本页等即可。"}],pin:tq};case"clarify_awaiting":return{acts:[{kind:"say",text:"请确认以下设计约束,确认后我会继续生成工作流方案。"},{kind:"form",form:{...e.form,submitLabel:t.submitLabel}}]};case"precheck":return{acts:[{kind:"say",text:e.confirmed.summary}]};case"generating":case"validating":case"syncing_schema":return{acts:[]};case"ready":return{acts:t.resumed?[{kind:"say",text:`已恢复当前流程 ${t.projectId} 的设计产物,不会重复启动生成任务。右侧可继续查看流程与配置。`}]:[]};case"clarify_failed":case"generate_failed":return{acts:[{kind:"say",text:`${e.error.message}。请重新生成 Design,系统会保留当前可查看的文件。`}]}}}function rq(e){return e?e.phase==="clarify_awaiting"?`clarify_awaiting:${e.form.id}`:e.phase:"none"}const sq="正在连接设计 Agent…",mh=new Map;async function iq(e,t){const n=mh.get(e);if(n)return n;const r=(async()=>{let s=!1;const i=ZL(e).catch(async o=>{const l=o instanceof Error?o.message:String(o);await t.run([{kind:"say",text:`需求澄清准备失败:${l}`}])}).finally(()=>{s=!0});for(;!s;){const o=await Hi(e);if(o!=null&&o.stages.design)break;await new Promise(l=>setTimeout(l,500))}await i,await Hi(e)})().finally(()=>{mh.delete(e)});return mh.set(e,r),r}const oq=lt(function(){var E,A;const t=Sr(),n=w.useRef();n.current||(n.current=new ly);const r=n.current,s=w.useRef(null),i=w.useRef(null),[o,l]=w.useState(null),c=B.projectId,u=B.mode,d=B.steps,f=B.projectFiles,h=yk({snapshot:B.snapshot,live:B.live,mode:u}),p=h.state,g=h.runtime,x=h.agentEvents,_=p!==null,v=rq(p),y=((E=g.next)==null?void 0:E.kind)==="await_user"?g.next.action.label:"确认并开始设计";uy("design",r);const m=w.useRef(null),b=((A=B.stream)==null?void 0:A.stage)==="design";w.useEffect(()=>{u!=="live"||!c||b||!_||m.current===c||i.current!==null||(m.current=c,RK(r,c))},[r,u,c,b,_]);async function j(){const P=u==="live"&&c?await wK(c,B.validationContext):FT(B.validationContext,"design");if(B.setValidation("design",P),!P.ok){l(P);return}t("../setup")}function k(){u!=="live"||!c||(B.patchLive(c,{designLiveText:"重新连接真实设计服务",designAgentEvents:0}),Kd("design",c,r))}w.useEffect(()=>(r.onFormSubmit=(P,I)=>{u!=="live"||!c||(p==null?void 0:p.phase)!=="clarify_awaiting"||P===p.form.id&&(async()=>{try{const{stageState:C}=await JL(c,I);B.applyDesignEvent(c,{type:"stage.changed",stage:"design",stageState:C})}catch(C){await r.run([{kind:"say",text:`确认需求失败:${C instanceof Error?C.message:String(C)}`}])}})()},()=>{r.onFormSubmit=null}),[r,u,c,v]),w.useEffect(()=>{u!=="live"||!c||_||iq(c,r)},[r,u,c,_]),w.useEffect(()=>{if(u!=="live")return;const P=c?v:"no-project";if(i.current===P)return;const I=i.current===null;if(i.current=P,!c){r.run([{kind:"say",text:"缺少真实项目工作区,请先返回 Init 阶段完成真实配置。"}]);return}const C=s.current;if(C&&(C(p&&n_(p)?"error":"done"),s.current=null),!p)return;const L=nq(p,{projectId:c,submitLabel:y,resumed:I});let F=!1;return(async()=>(L.acts.length>0&&await r.run(L.acts),!(F||!L.pin)&&(s.current=r.beginTask(L.pin.label,L.pin.detail))))(),()=>{F=!0}},[r,u,c,v]);const S=y$(p),N=n_(p),R=f.length>0,O=d.length>0||R,D=(p==null?void 0:p.phase)==="clarify_probing"||!_||!O,M=()=>{var P;return S&&p?a.jsx(ZG,{state:p,message:g.message}):O?a.jsx(QG,{}):N?a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:[p.error.message,a.jsx("br",{}),a.jsxs("button",{type:"button",className:"primary",style:{marginTop:14},onClick:k,children:[a.jsx($,{name:"refresh",size:14,color:"#fff"}),((P=g.next)==null?void 0:P.kind)==="await_user"?g.next.action.label:"重新生成工作流设计"]})]})}):a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"empty-hint",children:"先确认需求澄清卡片,确认后将启动真实设计生成。"})})},z=a.jsxs(a.Fragment,{children:[me&&a.jsx(NK,{projectId:c}),M(),o&&!o.ok&&a.jsx(RT,{title:"无法进入搭建阶段",missing:o.missing,warnings:o.warnings,onClose:()=>l(null),onLocate:P=>{l(null)}})]}),T=()=>u!=="live"?"演示模式不提供":(p==null?void 0:p.phase)==="ready"?`完成 ${p.rounds} 轮 · ${x} 个 Agent 事件`:(p==null?void 0:p.phase)==="generating"?`第 ${p.round} 轮进行中 · ${x} 个 Agent 事件`:(p==null?void 0:p.phase)==="clarify_awaiting"?"等待确认需求澄清":p?g.message:d.length?`${d.length} 步 · 真实方案`:R?`${f.length} 个文件 · 等待真实设计启动`:"真实生成待启动";return a.jsx(Wu,{chat:r,chatTitle:"工作流设计",chatSubtitle:`需求对齐 → 可视化编排 · ${u==="live"?"真实模式":"演示模式"}`,chatEmptyHint:sq,onSend:P=>{r.addUserMessage(P),r.run([{kind:"say",text:"收到,我会据此调整工作流细节。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"flow",size:16}),a.jsx("div",{className:"work-head__title",children:"工作流"}),a.jsx("div",{className:"work-head__sub",children:T()}),d.length>0&&a.jsxs("button",{type:"button",className:"primary work-head__cta",onClick:j,children:["进入搭建阶段",a.jsx($,{name:"chevron-right",size:14,color:"#fff"})]}),N&&(d.length>0||R)&&a.jsxs("button",{type:"button",className:"primary work-head__cta",onClick:k,style:{marginLeft:8},children:[a.jsx($,{name:"refresh",size:14,color:"#fff"}),"重新生成"]})]}),work:z,hideWork:D})}),hr=dK(),dy=(hr==null?void 0:hr.fields)??[],gh=(hr==null?void 0:hr.views)??[],cb=dy.filter(e=>e.group==="business"),ub=dy.filter(e=>e.group==="process");function db(e){return[{kind:"do",run:()=>B.addMockField(e)},{kind:"wait",ms:130}]}function aq(e){return[{kind:"do",run:()=>B.addMockView(e)},{kind:"wait",ms:260}]}const lq=[{kind:"say",text:"开始搭建演示 AI 表格。我会依次创建字段、视图,并绑定事件源。"},{kind:"todo",items:["创建业务字段","创建流程字段","创建视图","绑定事件源 · 生成链接"]},{kind:"tool",label:"创建业务字段",detail:`${cb.length} 个`,ms:520},...cb.flatMap(db),{kind:"todo-advance"},{kind:"tool",label:"创建流程字段",detail:`${ub.length} 个`,ms:520},...ub.flatMap(db),{kind:"todo-advance"},{kind:"tool",label:"创建视图",detail:`${gh.length} 个`,ms:520},...gh.flatMap(aq),{kind:"todo-advance"},{kind:"tool",label:"绑定事件源 · 新记录触发",detail:"on_record_created",ms:760},{kind:"do",run:()=>{if(!hr)return;const e=B.initDraft,t=e.tableBaseId||hr.tableBaseId,n=e.tableId||hr.tableSheetId;B.setMockTableUrl(LT(t,n))}},{kind:"todo-advance"},{kind:"say",text:`搭建完成:${dy.length} 字段 · ${gh.length} 视图已就绪,事件源已绑定。可打开 AI 表格,或进入「运行」阶段启动工作流。`}];function fb(e){return e.isLive?String(e.current):`${e.current}/${e.mockTotal}`}const cq={grid:"表格",kanban:"看板",calendar:"日历",form:"表单",gantt:"甘特"},hb={text:"文本",single_select:"单选",user:"成员",datetime:"日期",number:"数字"},uq=lt(function(){var T,E,A;const t=w.useRef();t.current||(t.current=new ly);const n=t.current,r=w.useRef(!1),[s,i]=w.useState(!1),[o,l]=w.useState(""),[c,u]=w.useState(!1),d=B.mode,f=xk({snapshot:B.snapshot,mode:d,mockSetup:B.mockSetup}),h=f.schema.fields,p=f.schema.views,g=f.tableUrl,x=B.projectId,_=B.stageRuntime.setup,v=_.phase,y=v==="auth_awaiting",m=v==="failed",b=v==="ready",j=v==="preflight"||v==="provisioning_table"||v==="syncing_schema",k=d==="live",S=f.gate.kind==="open";uy("setup",n),w.useEffect(()=>{r.current||!S||(r.current=!0,n.run([{kind:"say",text:"工作流已就绪。准备好后点击右侧「开始搭建」,我会自动创建 AI 表格的字段与视图。"}]))},[n,S]),w.useEffect(()=>{(y||m||b)&&i(!1)},[y,m,b]);function N(){if(d==="live"&&!S){n.run([{kind:"say",text:"当前流程还没有完成设计,请先回到设计阶段生成 workflow 和 recipes。"}]);return}if(!(j||s&&!(y||m))){if(i(!0),d==="live"){x?Kd("setup",x,n).finally(()=>i(!1)):(i(!1),n.run([{kind:"say",text:"缺少真实项目工作区,请先返回 Init 阶段完成真实配置。"}]));return}n.run(lq).finally(()=>i(!1))}}const R=h.filter(P=>P.group==="business"),O=h.filter(P=>P.group==="process"),D=d==="live"?b:!!g||b,M=s||!!v||D;if(!S)return a.jsx(Wu,{chat:n,chatTitle:"AI 表格搭建",chatSubtitle:"创建字段 · 视图 · 绑定事件源",chatEmptyHint:"当前流程尚未到达搭建阶段",onSend:P=>{n.addUserMessage(P),n.run([{kind:"say",text:"当前流程还没有完成设计,请先回到设计阶段生成工作流。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"table",size:16}),a.jsx("div",{className:"work-head__title",children:"AI 表格"}),a.jsx("div",{className:"work-head__sub",children:"未到达"})]}),work:a.jsx("div",{className:"work-body setup-theater",children:a.jsxs("div",{className:"setup-intro",children:[a.jsx("div",{className:"setup-intro__icon",children:a.jsx($,{name:"flow",size:30,color:"#fff"})}),a.jsx("h3",{className:"setup-intro__title",children:"当前流程尚未完成设计"}),a.jsx("p",{className:"setup-intro__desc",children:"搭建阶段必须使用当前流程实例生成的 workflow 和 recipes。请先回到设计阶段完成真实工作流生成。"}),a.jsxs(Ue,{className:"primary setup-intro__cta",to:"../design",children:[a.jsx($,{name:"chevron-right",size:15,color:"#fff"}),"返回设计阶段"]})]})})});const z=a.jsx("div",{className:"work-body setup-theater",children:M?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx($,{name:y||m?"sparkle":"table",size:14}),y?"等待授权":m?"搭建失败":b?"搭建完成":"搭建进度"]}),a.jsx("p",{className:"setup-intro__desc",children:_.message}),(y||m)&&a.jsxs("button",{type:"button",className:"primary setup-intro__cta",onClick:N,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),((T=_.next)==null?void 0:T.kind)==="await_user"?_.next.action.label:"重试搭建"]})]}),D&&a.jsxs(Ze.div,{className:"table-link-card",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsxs("div",{className:"table-link-card__info",children:[a.jsx("span",{className:"table-link-card__badge",children:a.jsx($,{name:"check",size:13,color:"#fff"})}),a.jsxs("div",{children:[a.jsx("div",{className:"table-link-card__title",children:"AI 表格已就绪"}),a.jsxs("div",{className:"table-link-card__sub",children:[h.length," 字段 · ",p.length," 视图 · 事件源已绑定"]})]})]}),a.jsxs("a",{className:"primary table-link-card__open",href:g??"#",target:"_blank",rel:"noreferrer",children:[a.jsx($,{name:"link",size:14,color:"#fff"}),"打开 AI 表格"]})]}),a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx($,{name:"table",size:14}),"字段",a.jsx("span",{className:"setup-section__count",children:fb({current:h.length,mockTotal:((E=ch())==null?void 0:E.fieldCount)??0,isLive:k})})]}),R.length>0&&a.jsx("div",{className:"setup-group-label",children:"业务字段"}),a.jsx("div",{className:"field-grid",children:R.map(P=>a.jsxs(Ze.div,{className:"field-chip",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:"field-chip__name",children:P.name}),a.jsx("span",{className:"field-chip__type",children:hb[P.type]??P.type})]},P.id))}),O.length>0&&a.jsx("div",{className:"setup-group-label",children:"流程字段"}),a.jsx("div",{className:"field-grid",children:O.map(P=>a.jsxs(Ze.div,{className:"field-chip field-chip--process",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:"field-chip__name",children:P.name}),a.jsx("span",{className:"field-chip__type",children:hb[P.type]??P.type})]},P.id))})]}),p.length>0&&a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx($,{name:"flow",size:14}),"视图",a.jsx("span",{className:"setup-section__count",children:fb({current:p.length,mockTotal:((A=ch())==null?void 0:A.viewCount)??0,isLive:k})})]}),a.jsx("div",{className:"view-grid",children:p.map(P=>a.jsxs(Ze.div,{className:"view-card",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:`view-card__kind view-card__kind--${P.kind}`,children:cq[P.kind]}),a.jsx("div",{className:"view-card__name",children:P.name}),a.jsx("div",{className:"view-card__desc",children:P.desc})]},P.id))})]}),D&&a.jsxs("div",{className:"cfg-cta",children:[a.jsxs("div",{className:"cfg-cta__text",children:[a.jsx($,{name:"check",size:16}),"表格搭建完成,可进入试运行验证流程。"]}),a.jsxs(Ue,{className:"primary",to:"../test",children:["进入试运行",a.jsx($,{name:"chevron-right",size:15,color:"#fff"})]})]})]}):a.jsxs("div",{className:"setup-intro",children:[a.jsx("div",{className:"setup-intro__icon",children:a.jsx($,{name:"table",size:30,color:"#fff"})}),a.jsx("h3",{className:"setup-intro__title",children:d==="live"?"搭建真实 AI 表格结构":"搭建演示 AI 表格结构"}),a.jsx("p",{className:"setup-intro__desc",children:d==="live"?"将根据真实工作流方案创建字段与视图,并绑定新记录触发方式。":(()=>{const P=ch();return`将创建 ${(P==null?void 0:P.fieldCount)??0} 个示例字段、${(P==null?void 0:P.viewCount)??0} 个示例视图,并绑定新记录触发方式。`})()}),a.jsxs("button",{type:"button",className:"primary setup-intro__cta",onClick:N,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),"开始搭建"]})]})});return a.jsx(Wu,{chat:n,chatTitle:"AI 表格搭建",chatSubtitle:"创建字段 · 视图 · 绑定事件源",chatEmptyHint:"agent 正在准备建表…",onSend:P=>{n.addUserMessage(P),n.run([{kind:"say",text:"好的,我会据此调整表结构。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"table",size:16}),a.jsx("div",{className:"work-head__title",children:"AI 表格"}),a.jsx("div",{className:"work-head__sub",children:D?"已就绪":y?"等待授权":m?"可重试":M?"搭建中":"待搭建"})]}),work:z})}),vh=e=>new Promise(t=>setTimeout(t,e));async function dq(e,t,n){for(let r=0;r<e.length;r++){if(n!=null&&n.aborted)return;const s=e[r];if(t({type:"step-start",stepIndex:r,step:s}),await vh(300),n!=null&&n.aborted||(t({type:"step-ai",stepIndex:r,step:s}),await vh(500),n!=null&&n.aborted)||(t({type:"step-done",stepIndex:r,step:s}),r<e.length-1&&(await vh(400),n!=null&&n.aborted)))return}t({type:"all-done",stepIndex:e.length-1})}const fq={info:"dot",ai:"sparkle",ok:"check",warn:"warn",error:"close"},hq=lt(function(){const t=B.steps,n=B.mode;B.projectId;const r=B.tableUrl,i=J$({snapshot:B.snapshot,mode:n}).gate.kind==="open",[o,l]=w.useState("guide"),[c,u]=w.useState([]),[d,f]=w.useState(-1),[h,p]=w.useState(null),g=w.useRef(null);if(!i)return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"sparkle",size:16}),a.jsx("div",{className:"work-head__title",children:"试运行"}),a.jsx("div",{className:"work-head__sub",children:"未到达"})]}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"test-intro",children:[a.jsx("div",{className:"test-intro__icon",children:a.jsx($,{name:"table",size:28,color:"#fff"})}),a.jsx("h3",{className:"test-intro__title",children:"当前流程尚未完成搭建"}),a.jsx("p",{className:"test-intro__desc",children:"试运行阶段必须基于已搭建完成的 AI 表格。请先完成搭建阶段。"}),a.jsxs(Ue,{className:"primary test-intro__cta",to:"../setup",children:[a.jsx($,{name:"chevron-right",size:15,color:"#fff"}),"返回搭建阶段"]})]})})]})});async function x(){var v;l("running"),u([]),f(0),p(null),(v=g.current)==null||v.abort();const _=new AbortController;g.current=_,await dq(t,y=>{y.type==="step-start"?(f(y.stepIndex),u(m=>[...m,{id:`log_${y.step.id}_start_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:y.step.id,level:"info",text:`开始执行步骤: ${y.step.name}`}])):y.type==="step-ai"?u(m=>[...m,{id:`log_${y.step.id}_ai_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:y.step.id,level:y.step.requiresAgent?"ai":"info",text:y.step.requiresAgent?`AI Agent 执行 ${y.step.recipe}...`:`自动处理 ${y.step.recipe}...`}]):y.type==="step-done"?u(m=>[...m,{id:`log_${y.step.id}_done_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:y.step.id,level:"ok",text:`步骤 ${y.step.name} 完成`}]):y.type==="all-done"&&(l("success"),f(-1),u(m=>[...m,{id:`log_test_done_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:"test",level:"ok",text:"全部步骤执行成功,试运行通过!"}]))},_.signal)}return a.jsxs("div",{className:"test-stage",children:[a.jsxs("div",{className:"test-main",children:[a.jsxs("div",{className:"test-main__head",children:[a.jsx($,{name:"sparkle",size:16}),a.jsx("div",{className:"work-head__title",children:"试运行"}),a.jsx("div",{className:"work-head__sub",children:o==="guide"?"待开始":o==="running"?"执行中":o==="success"?"通过":"失败"}),o==="success"&&a.jsxs(Ue,{className:"primary work-head__cta",to:"../run",children:["进入正式运行",a.jsx($,{name:"chevron-right",size:14,color:"#fff"})]})]}),o==="guide"&&a.jsxs("div",{className:"test-guide",children:[a.jsx("div",{className:"test-guide__icon",children:a.jsx($,{name:"sparkle",size:30,color:"#fff"})}),a.jsx("h3",{className:"test-guide__title",children:"用一条真实记录验证整条流程"}),a.jsxs("div",{className:"test-guide__steps",children:[a.jsxs("div",{className:"test-guide__step",children:[a.jsx("span",{className:"test-guide__step-num",children:"1"}),a.jsx("span",{children:"打开 AI 表格"}),a.jsxs("a",{className:"test-guide__link",href:r??"#",target:"_blank",rel:"noreferrer",children:[a.jsx($,{name:"link",size:12})," 打开表格"]})]}),a.jsxs("div",{className:"test-guide__step",children:[a.jsx("span",{className:"test-guide__step-num",children:"2"}),a.jsx("span",{children:"新增一条记录,填写必选字段"})]}),a.jsxs("div",{className:"test-guide__step",children:[a.jsx("span",{className:"test-guide__step-num",children:"3"}),a.jsx("span",{children:"回到这里点「开始试运行」"})]})]}),a.jsxs("button",{type:"button",className:"primary test-guide__cta",onClick:()=>void x(),children:[a.jsx($,{name:"play",size:15,color:"#fff"}),"开始试运行"]})]}),o==="success"&&a.jsxs("div",{className:"test-result test-result--success",children:[a.jsx("span",{className:"test-result__icon test-result__icon--success",children:a.jsx($,{name:"check",size:24,color:"#fff"})}),a.jsx("h3",{className:"test-result__title",children:"试运行通过"}),a.jsxs("p",{className:"test-result__desc",children:["全部 ",t.length," 个步骤执行成功。可以进入正式运行阶段。"]}),a.jsxs(Ue,{className:"primary test-result__cta",to:"../run",children:["进入正式运行",a.jsx($,{name:"chevron-right",size:14,color:"#fff"})]})]}),o==="failed"&&h&&a.jsxs("div",{className:"test-result test-result--failed",children:[a.jsx("span",{className:"test-result__icon test-result__icon--failed",children:a.jsx($,{name:"close",size:24,color:"#fff"})}),a.jsxs("h3",{className:"test-result__title",children:["试运行在「",h.step.name,"」步骤失败"]}),a.jsx("p",{className:"test-result__desc",children:h.reason}),a.jsxs("div",{className:"test-result__actions",children:[a.jsx("button",{type:"button",className:"test-result__btn",onClick:()=>{l("guide")},children:"查看完整日志"}),a.jsx(Ue,{className:"primary test-result__btn",to:"../design",children:"去修正该步骤配置 →"})]})]})]}),a.jsxs("div",{className:"test-flow",children:[a.jsx("div",{className:"test-flow__head",children:"步骤流转"}),a.jsx("div",{className:"step-chain",children:t.map((_,v)=>{const y=o==="success"||v<d?"done":v===d?"active":"pending";return a.jsxs("div",{className:`chain-node is-${y}`,children:[v>0&&a.jsx("div",{className:`chain-node__line is-${y}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:y==="done"?a.jsx($,{name:"check",size:12,color:"#fff"}):y==="active"?a.jsx("span",{className:"chain-node__pulse"}):a.jsx("span",{className:"chain-node__idle"})}),a.jsxs("div",{className:"chain-node__body",children:[a.jsxs("div",{className:"chain-node__name",children:[a.jsx("span",{className:"chain-node__label",children:_.name}),_.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),!_.requiresAgent&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:_.recipe})]})]})]},_.id)})})]}),a.jsxs("div",{className:"test-logs",children:[a.jsxs("div",{className:"test-logs__head",children:[a.jsx($,{name:"file",size:14}),"试运行日志"]}),a.jsx("div",{className:"test-logs__body",children:c.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:"点击「开始试运行」后,这里会显示实时执行日志"}):a.jsx(ea,{initial:!1,children:c.map(_=>{var v;return a.jsxs(Ze.div,{layout:!0,variants:Ct,initial:"hidden",animate:"visible",className:`log-line log-line--${_.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx($,{name:fq[_.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:((v=t.find(y=>y.id===_.stepId))==null?void 0:v.name)??_.stepId}),a.jsx("span",{className:"log-line__text",children:_.text})]})]},_.id)})})})]})]})}),pq={classify:[{level:"info",text:"读取工单「{title}」标题与问题描述"},{level:"ai",text:"调用分类模型判定问题类型与紧急程度…"},{level:"ok",text:"判定为「{category}」· {priority}"}],investigate:[{level:"info",text:"检索知识库与历史相似工单"},{level:"ai",text:"Qoder 分析根因,生成排查路径…"},{level:"ok",text:"定位可能原因,产出解决方案草案"}],draft_reply:[{level:"info",text:"载入解决方案与客户「{customer}」信息"},{level:"ai",text:"以「亲和友好」语气生成回复草稿…"},{level:"ok",text:"回复草稿已生成,进入质检"}],quality_check:[{level:"warn",text:"命中人工审核卡点,暂停等待复核"},{level:"info",text:"请在步骤卡片点击「通过」或「驳回」"}],send_reply:[{level:"ai",text:"渲染最终回复并校验敏感词…"},{level:"ok",text:"已发送给客户「{customer}」,工单关闭"}]},mq=[{level:"warn",text:"人工驳回,退回「草拟回复」重写"},{level:"ai",text:"参考驳回意见重新生成回复…"},{level:"ok",text:"新草稿已生成,再次送审"}],gq={classify:1400,investigate:2e3,draft_reply:1700,quality_check:0,send_reply:1400},vq=3200,yq=520;function xq(e,t){return e.replace("{title}",t.title).replace("{customer}",t.customer).replace("{category}",t.category).replace("{priority}",t.priority)}const Ri=$T(),_q=(Ri==null?void 0:Ri.steps)??[],yh=(Ri==null?void 0:Ri.incomingTickets)??[],xh=e=>new Promise(t=>setTimeout(t,e));let wq=0;const pb=e=>`${e}_${(wq++).toString(36)}`;class bq{constructor(){le(this,"state",{running:!1,arrived:0,total:yh.length});le(this,"listeners",new Set);le(this,"approvals",new Map);le(this,"subscribe",t=>(this.listeners.add(t),()=>this.listeners.delete(t)));le(this,"getState",()=>this.state)}emit(){this.listeners.forEach(t=>t())}set(t){this.state={...this.state,...t},this.emit()}log(t,n,r,s){B.appendLog({id:pb("log"),ts:Date.now(),ticketId:t,stepId:n,level:r,text:s})}start(){this.state.running||(this.set({running:!0}),this.spawn())}isAwaiting(t){return this.approvals.has(t)}approve(t){var n;(n=this.approvals.get(t))==null||n(!0)}reject(t){var n;(n=this.approvals.get(t))==null||n(!1)}async spawn(){for(let t=0;t<yh.length;t++){if(!this.state.running)return;const n=yh[t],r={id:pb("tk"),title:n.title,customer:n.customer,category:n.category,priority:n.priority,status:"todo",currentStepId:null,doneStepIds:[],createdAt:Date.now()};B.addTicket(r),this.set({arrived:this.state.arrived+1}),this.process(r.id,n),await xh(vq)}}markDone(t,n){const r=B.live.tickets.find(s=>s.id===t);r&&B.updateTicket(t,{doneStepIds:[...r.doneStepIds,n]})}async streamLogs(t,n,r,s){for(const i of s){if(!this.state.running)return;this.log(t,n,i.level,xq(i.text,r)),await xh(yq)}}async process(t,n){for(const r of _q){if(!this.state.running)return;const s=r.needsHuman?"review":"running";if(B.updateTicket(t,{currentStepId:r.id,status:s}),await this.streamLogs(t,r.id,n,pq[r.id]??[]),r.needsHuman){let i=!1;for(;!i&&this.state.running;)if(i=await this.awaitApproval(t),!i){B.updateTicket(t,{currentStepId:"draft_reply",status:"running"});const o=B.live.tickets.find(l=>l.id===t);o&&B.updateTicket(t,{doneStepIds:o.doneStepIds.filter(l=>l!=="draft_reply")}),await this.streamLogs(t,"draft_reply",n,mq),this.markDone(t,"draft_reply"),B.updateTicket(t,{currentStepId:r.id,status:"review"})}if(!this.state.running)return}else await xh(gq[r.id]??1200);this.markDone(t,r.id)}B.updateTicket(t,{status:"done",currentStepId:null})}awaitApproval(t){return new Promise(n=>{this.approvals.set(t,r=>{this.approvals.delete(t),this.emit(),n(r)}),this.emit()})}stop(){this.set({running:!1}),this.approvals.forEach(t=>t(!0)),this.approvals.clear()}}function jq(e){return w.useSyncExternalStore(e.subscribe,e.getState,e.getState)}const mb={todo:{label:"待处理",cls:"muted"},running:{label:"处理中",cls:"blue"},review:{label:"审核中",cls:"amber"},done:{label:"已完成",cls:"green"},blocked:{label:"受阻",cls:"red"}},gb={info:"dot",ai:"sparkle",ok:"check",warn:"warn",error:"close"};function vb(e,t){return e.doneStepIds.includes(t)?"done":e.currentStepId===t?"active":"pending"}const Sq=lt(function(){const t=w.useRef();t.current||(t.current=new bq);const n=t.current,r=jq(n),s=B.mode,i=eD({snapshot:B.snapshot,live:B.live,mode:s}),o=i.tickets,l=i.logs,c=B.steps,u=B.projectId,d=B.stageRuntime.run,[f,h]=w.useState(null),[p,g]=w.useState(!1),[x,_]=w.useState(!1),[v,y]=w.useState(null),m=s==="live",b=i.gate.kind==="open",j=$T(),k=m||c.length>0?c:(j==null?void 0:j.steps)??[],S=d.phase,N=S==="failed",R=S==="stopped",O=S==="starting"||S==="listening"||S==="awaiting_machine"||S==="running_on_machine",D=m?O||p:r.running;w.useEffect(()=>{!f&&o.length>0&&h(o[o.length-1].id)},[o,f]);const M=o.find(C=>C.id===f)??null,z=l.filter(C=>C.ticketId===f),T=w.useRef(null);w.useEffect(()=>{var C;(C=T.current)==null||C.scrollIntoView({behavior:"smooth",block:"end"})},[z.length]),uy("run"),w.useEffect(()=>()=>{u&&eb("run",u)},[u]);const E={running:o.filter(C=>C.status==="running").length,review:o.filter(C=>C.status==="review").length,done:o.filter(C=>C.status==="done").length};function A(){if(m){if(!b)return;if(!u){B.appendLog(_h("缺少真实项目工作区,请先从配置阶段重新进入真实设计。"));return}if(k.length===0){B.appendLog(_h("当前流程没有可运行的真实 workflow,请先返回设计阶段重新生成。"));return}g(!0),B.patchLive(u,{tickets:[],logs:[]}),Kd("run",u).finally(()=>g(!1));return}n.start()}async function P(){if(!(!u||x)){_(!0);try{eb("run",u),(await s$(u)).mode==="local"&&await Hi(u)}catch(C){B.appendLog(_h(C instanceof Error?C.message:String(C)))}finally{_(!1),g(!1)}}}async function I(C,L){if(!(!u||v)){y(L);try{await c$(u,C,L),await Hi(u)}catch(F){const V=F instanceof Error?F.message:String(F);B.appendLog({id:`human_action_${Date.now().toString(36)}`,ts:Date.now(),ticketId:C,stepId:(M==null?void 0:M.currentStepId)??"run",level:"error",text:V})}finally{y(null)}}}if(m&&b){const C=l.filter(U=>U.ticketId==="run"),L=M??o[0]??null,F=L?l.filter(U=>U.ticketId===L.id):C,V=O?"blue":R?"green":N?"red":"muted",H=O?"监听中":N?"启动失败":R?"已停止":"待启动";return a.jsxs("div",{className:"run-stage run-stage--live",children:[a.jsxs("div",{className:"run-board",children:[a.jsxs("div",{className:"run-board__head",children:[a.jsx("span",{children:"运行记录"}),a.jsx("span",{className:"run-board__stat",children:o.length?`${o.length} 条`:H})]}),a.jsx("div",{className:"run-board__list",children:o.length===0?a.jsxs("button",{type:"button",className:"ticket-card is-selected",children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${V}`,children:H}),a.jsx("span",{className:"ticket-card__prio",children:d.phase??"run"})]}),a.jsx("div",{className:"ticket-card__title",children:"真实 AI 表格监听"}),a.jsx("div",{className:"ticket-card__meta",children:d.message}),a.jsxs("div",{className:"ticket-card__progress",children:[k.length," 个步骤 · ",C.length," 条服务日志"]})]}):o.map(U=>{const W=mb[U.status];return a.jsxs("button",{type:"button",className:`ticket-card${U.id===(L==null?void 0:L.id)?" is-selected":""}`,onClick:()=>h(U.id),children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${W.cls}`,children:W.label}),a.jsx("span",{className:"ticket-card__prio",children:U.priority})]}),a.jsx("div",{className:"ticket-card__title",children:U.title}),a.jsxs("div",{className:"ticket-card__meta",children:[U.customer," · ",U.category]}),a.jsxs("div",{className:"ticket-card__progress",children:[U.doneStepIds.length,"/",k.length," 步",U.status==="review"&&a.jsx("span",{className:"ticket-card__await",children:"待人工"})]})]},U.id)})}),a.jsxs("div",{className:"run-board__foot",children:[a.jsxs("button",{type:"button",className:"primary run-live-start",onClick:A,disabled:D,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),N?"重试运行":D?"运行中":"启动运行"]}),D&&a.jsxs("button",{type:"button",className:"ghost run-live-stop",onClick:P,disabled:x,children:[a.jsx($,{name:"close",size:13}),x?"停止中…":"停止运行"]})]})]}),a.jsxs("div",{className:"run-flow",children:[a.jsxs("div",{className:"run-flow__head",children:[a.jsx("div",{className:"run-flow__title",children:L?L.title:"当前 workflow"}),a.jsx("div",{className:"run-flow__sub",children:L?`${L.customer} · ${L.status}`:`${k.length} 个真实步骤 · ${d.message}`})]}),a.jsx("div",{className:"step-chain",children:k.map((U,W)=>{const G=!!L&&L.status==="review"&&L.currentStepId===U.id&&!!U.needsHuman,Y=L?G?"active":vb(L,U.id):R?"done":O&&W===0?"active":"pending";return a.jsxs("div",{className:`chain-node is-${Y}`,children:[W>0&&a.jsx("div",{className:`chain-node__line is-${Y}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:Y==="done"?a.jsx($,{name:"check",size:12,color:"#fff"}):Y==="active"?a.jsx("span",{className:"chain-node__pulse"}):a.jsx("span",{className:"chain-node__idle"})}),a.jsxs("div",{className:"chain-node__body",children:[a.jsxs("div",{className:"chain-node__name",children:[a.jsx("span",{className:"chain-node__label",children:U.name}),U.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),U.needsHuman&&a.jsx("span",{className:"pill pill--amber",children:"人工"}),!U.requiresAgent&&!U.needsHuman&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:U.recipe||"自动处理"}),G&&a.jsxs("div",{className:"chain-node__approve",children:[a.jsxs("button",{type:"button",className:"primary btn-approve",disabled:v!==null,onClick:()=>void I(L.id,"confirm"),children:[a.jsx($,{name:"check",size:13,color:"#fff"})," 确认发送"]}),a.jsxs("button",{type:"button",className:"btn-reject",disabled:v!==null,onClick:()=>void I(L.id,"terminate"),children:[a.jsx($,{name:"close",size:13})," 终止流程"]})]})]})]})]},U.id)})})]}),a.jsxs("div",{className:"run-logs",children:[a.jsxs("div",{className:"run-logs__head",children:[a.jsx($,{name:"file",size:14}),L?"记录执行日志":"真实运行日志",a.jsx("span",{className:"run-logs__sub",children:(L==null?void 0:L.title)??"run"})]}),a.jsx("div",{className:"run-logs__body",children:F.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:L?"等待该记录的执行日志…":"启动后这里会显示服务端 SSE 返回的真实运行日志"}):a.jsx(ea,{initial:!1,children:F.map(U=>{var W;return a.jsxs(Ze.div,{layout:!0,variants:Ct,initial:"hidden",animate:"visible",className:`log-line log-line--${U.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx($,{name:gb[U.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:((W=k.find(G=>G.id===U.stepId))==null?void 0:W.name)??U.stepId}),a.jsx("span",{className:"log-line__text",children:U.text})]})]},U.id)})})})]})]})}return b?!D&&o.length===0?a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"play",size:16}),a.jsx("div",{className:"work-head__title",children:"运行监控"}),a.jsx("div",{className:"work-head__sub",children:"待启动"})]}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"run-intro",children:[a.jsx("div",{className:"run-intro__icon",children:a.jsx($,{name:"play",size:28,color:"#fff"})}),a.jsx("h3",{className:"run-intro__title",children:m?"启动真实工作流":"启动模拟工作流"}),a.jsx("p",{className:"run-intro__desc",children:m?"启动后会连接真实运行服务,监听 AI 表格中的待处理记录,并按当前流程方案执行。":"启动后记录将陆续进入,系统自动执行分类、处理、审核与发送,人工把关环节会等待确认。"}),a.jsxs("button",{type:"button",className:"primary run-intro__cta",onClick:A,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),m?"启动真实运行":"启动模拟运行"]})]})})]})}):a.jsxs("div",{className:"run-stage",children:[a.jsxs("div",{className:"run-board",children:[a.jsxs("div",{className:"run-board__head",children:[a.jsx("span",{children:"工单队列"}),a.jsx("span",{className:"run-board__stat",children:m?D?"1/1 已连接":"0/1 待连接":`${r.arrived}/${r.total} 进入`})]}),a.jsx("div",{className:"run-board__list",children:a.jsx(ea,{initial:!1,children:o.map(C=>{const L=mb[C.status];return a.jsxs(Ze.button,{type:"button",layout:!0,variants:Ct,initial:"hidden",animate:"visible",exit:"exit",className:`ticket-card${C.id===f?" is-selected":""}`,onClick:()=>h(C.id),children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${L.cls}`,children:L.label}),a.jsx("span",{className:"ticket-card__prio",children:C.priority})]}),a.jsx("div",{className:"ticket-card__title",children:C.title}),a.jsxs("div",{className:"ticket-card__meta",children:[C.customer," · ",C.category]}),a.jsxs("div",{className:"ticket-card__progress",children:[C.doneStepIds.length,"/",k.length," 步",!m&&n.isAwaiting(C.id)&&a.jsx("span",{className:"ticket-card__await",children:"待审批"})]})]},C.id)})})}),a.jsxs("div",{className:"run-board__foot",children:["处理中 ",E.running," · 审核中 ",E.review," · 已完成 ",E.done]})]}),a.jsxs("div",{className:"run-flow",children:[a.jsx("div",{className:"run-flow__head",children:M?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"run-flow__title",children:M.title}),a.jsx("div",{className:"run-flow__sub",children:M.customer})]}):a.jsx("div",{className:"run-flow__sub",children:"选择左侧工单查看步骤流转"})}),M&&a.jsx("div",{className:"step-chain",children:k.map((C,L)=>{const F=vb(M,C.id),V=!m&&F==="active"&&C.needsHuman&&n.isAwaiting(M.id);return a.jsxs("div",{className:`chain-node is-${F}`,children:[L>0&&a.jsx("div",{className:`chain-node__line is-${F}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:F==="done"?a.jsx($,{name:"check",size:12,color:"#fff"}):F==="active"?a.jsx("span",{className:"chain-node__pulse"}):a.jsx("span",{className:"chain-node__idle"})}),a.jsxs("div",{className:"chain-node__body",children:[a.jsxs("div",{className:"chain-node__name",children:[a.jsx("span",{className:"chain-node__label",children:C.name}),C.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),C.needsHuman&&a.jsx("span",{className:"pill pill--amber",children:"人工"}),!C.requiresAgent&&!C.needsHuman&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:C.recipe||"自动处理"}),V&&a.jsxs("div",{className:"chain-node__approve",children:[a.jsxs("button",{type:"button",className:"primary btn-approve",onClick:()=>n.approve(M.id),children:[a.jsx($,{name:"check",size:13,color:"#fff"})," 通过"]}),a.jsxs("button",{type:"button",className:"btn-reject",onClick:()=>n.reject(M.id),children:[a.jsx($,{name:"close",size:13})," 驳回"]})]})]})]})]},C.id)})})]}),a.jsxs("div",{className:"run-logs",children:[a.jsxs("div",{className:"run-logs__head",children:[a.jsx($,{name:"file",size:14}),"执行日志",M&&a.jsx("span",{className:"run-logs__sub",children:M.title})]}),a.jsxs("div",{className:"run-logs__body",children:[z.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:M?"等待执行日志…":"选择工单查看日志"}):a.jsx(ea,{initial:!1,children:z.map(C=>{const L=k.find(F=>F.id===C.stepId);return a.jsxs(Ze.div,{layout:!0,variants:Ct,initial:"hidden",animate:"visible",className:`log-line log-line--${C.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx($,{name:gb[C.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:(L==null?void 0:L.name)??C.stepId}),a.jsx("span",{className:"log-line__text",children:C.text})]})]},C.id)})}),a.jsx("div",{ref:T})]})]})]}):a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"play",size:16}),a.jsx("div",{className:"work-head__title",children:"运行监控"}),a.jsx("div",{className:"work-head__sub",children:"未到达"})]}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"run-intro",children:[a.jsx("div",{className:"run-intro__icon",children:a.jsx($,{name:"table",size:28,color:"#fff"})}),a.jsx("h3",{className:"run-intro__title",children:"当前流程尚未完成搭建"}),a.jsx("p",{className:"run-intro__desc",children:"运行阶段必须基于当前流程实例已搭建完成的 AI 表格。请先完成搭建阶段,再启动真实运行监听。"}),a.jsxs(Ue,{className:"primary run-intro__cta",to:"../setup",children:[a.jsx($,{name:"chevron-right",size:15,color:"#fff"}),"返回搭建阶段"]})]})})]})})});function _h(e){return{id:`run_preflight_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"run",stepId:"run",level:"error",text:e}}function kq(){return a.jsxs(E2,{children:[a.jsx(ct,{path:"/workbench",element:a.jsx(g9,{})}),a.jsxs(ct,{path:"/",element:a.jsx(LD,{}),children:[a.jsx(ct,{index:!0,element:a.jsx(a5,{})}),a.jsx(ct,{path:"account",element:a.jsx(I9,{})}),a.jsx(ct,{path:"engines",element:a.jsx(M9,{})}),a.jsx(ct,{path:"setup",element:a.jsx(G7,{})}),a.jsxs(ct,{path:"p/:projectId",element:a.jsx(j3,{}),children:[a.jsx(ct,{index:!0,element:a.jsx(S3,{})}),a.jsx(ct,{path:"init",element:a.jsx(kK,{})}),a.jsx(ct,{path:"design",element:a.jsx(oq,{})}),a.jsx(ct,{path:"setup",element:a.jsx(uq,{})}),a.jsx(ct,{path:"test",element:a.jsx(hq,{})}),a.jsx(ct,{path:"run",element:a.jsx(Sq,{})})]}),a.jsx(ct,{path:"*",element:a.jsx(Eg,{to:"/",replace:!0})})]})]})}function Nq(){return a.jsx(Z2,{children:a.jsx(kq,{})})}const Eq=new URLSearchParams(window.location.search).has("token");Eq||w9();RS(document.getElementById("root")).render(a.jsx(Nq,{}));
332
+ `},rb=uG(pG)(BT),mG={config:fG},gG=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(s){return n.reduceRight(function(i,o){return o(i)},s)}};function UT(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],UT(e[n],t[n]))}),eb(eb({},e),t)}var vG={type:"cancelation",msg:"operation is manually canceled"};function fh(e){var t=!1,n=new Promise(function(r,s){e.then(function(i){return t?s(vG):r(i)}),e.catch(s)});return n.cancel=function(){return t=!0},n}var yG=["monaco"],xG=lG.create({config:cG,isInitialized:!1,resolve:null,reject:null,monaco:null}),HT=HK(xG,2),xl=HT[0],Gd=HT[1];function _G(e){var t=mG.config(e),n=t.monaco,r=BK(t,yG);Gd(function(s){return{config:UT(s.config,r),monaco:n}})}function wG(){var e=xl(function(t){var n=t.monaco,r=t.isInitialized,s=t.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!e.isInitialized){if(Gd({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),fh(hh);if(window.monaco&&window.monaco.editor)return WT(window.monaco),e.resolve(window.monaco),fh(hh);gG(bG,SG)(kG)}return fh(hh)}function bG(e){return document.body.appendChild(e)}function jG(e){var t=document.createElement("script");return e&&(t.src=e),t}function SG(e){var t=xl(function(r){var s=r.config,i=r.reject;return{config:s,reject:i}}),n=jG("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function kG(){var e=xl(function(n){var r=n.config,s=n.resolve,i=n.reject;return{config:r,resolve:s,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;WT(r),e.resolve(r)},function(n){e.reject(n)})}function WT(e){xl().monaco||Gd({monaco:e})}function NG(){return xl(function(e){var t=e.monaco;return t})}var hh=new Promise(function(e,t){return Gd({resolve:e,reject:t})}),KT={config:_G,init:wG,__getMonacoInstance:NG},EG={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ph=EG,CG={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},TG=CG;function PG({children:e}){return or.createElement("div",{style:TG.container},e)}var AG=PG,RG=AG;function IG({width:e,height:t,isEditorReady:n,loading:r,_ref:s,className:i,wrapperProps:o}){return or.createElement("section",{style:{...ph.wrapper,width:e,height:t},...o},!n&&or.createElement(RG,null,r),or.createElement("div",{ref:s,style:{...ph.fullWidth,...!n&&ph.hide},className:i}))}var MG=IG,GT=w.memo(MG);function OG(e){w.useEffect(e,[])}var qT=OG;function LG(e,t,n=!0){let r=w.useRef(!0);w.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var jt=LG;function aa(){}function ji(e,t,n,r){return $G(e,r)||DG(e,t,n,r)}function $G(e,t){return e.editor.getModel(YT(e,t))}function DG(e,t,n,r){return e.editor.createModel(t,n,r?YT(e,r):void 0)}function YT(e,t){return e.Uri.parse(t)}function zG({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:i,modifiedModelPath:o,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:d="Loading...",options:f={},height:h="100%",width:p="100%",className:g,wrapperProps:x={},beforeMount:_=aa,onMount:v=aa}){let[y,m]=w.useState(!1),[b,j]=w.useState(!0),k=w.useRef(null),S=w.useRef(null),N=w.useRef(null),R=w.useRef(v),O=w.useRef(_),D=w.useRef(!1);qT(()=>{let E=KT.init();return E.then(A=>(S.current=A)&&j(!1)).catch(A=>(A==null?void 0:A.type)!=="cancelation"&&console.error("Monaco initialization: error:",A)),()=>k.current?T():E.cancel()}),jt(()=>{if(k.current&&S.current){let E=k.current.getOriginalEditor(),A=ji(S.current,e||"",r||n||"text",i||"");A!==E.getModel()&&E.setModel(A)}},[i],y),jt(()=>{if(k.current&&S.current){let E=k.current.getModifiedEditor(),A=ji(S.current,t||"",s||n||"text",o||"");A!==E.getModel()&&E.setModel(A)}},[o],y),jt(()=>{let E=k.current.getModifiedEditor();E.getOption(S.current.editor.EditorOption.readOnly)?E.setValue(t||""):t!==E.getValue()&&(E.executeEdits("",[{range:E.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),E.pushUndoStop())},[t],y),jt(()=>{var E,A;(A=(E=k.current)==null?void 0:E.getModel())==null||A.original.setValue(e||"")},[e],y),jt(()=>{let{original:E,modified:A}=k.current.getModel();S.current.editor.setModelLanguage(E,r||n||"text"),S.current.editor.setModelLanguage(A,s||n||"text")},[n,r,s],y),jt(()=>{var E;(E=S.current)==null||E.editor.setTheme(u)},[u],y),jt(()=>{var E;(E=k.current)==null||E.updateOptions(f)},[f],y);let M=w.useCallback(()=>{var P;if(!S.current)return;O.current(S.current);let E=ji(S.current,e||"",r||n||"text",i||""),A=ji(S.current,t||"",s||n||"text",o||"");(P=k.current)==null||P.setModel({original:E,modified:A})},[n,t,s,e,r,i,o]),z=w.useCallback(()=>{var E;!D.current&&N.current&&(k.current=S.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...f}),M(),(E=S.current)==null||E.editor.setTheme(u),m(!0),D.current=!0)},[f,u,M]);w.useEffect(()=>{y&&R.current(k.current,S.current)},[y]),w.useEffect(()=>{!b&&!y&&z()},[b,y,z]);function T(){var A,P,I,C;let E=(A=k.current)==null?void 0:A.getModel();l||((P=E==null?void 0:E.original)==null||P.dispose()),c||((I=E==null?void 0:E.modified)==null||I.dispose()),(C=k.current)==null||C.dispose()}return or.createElement(GT,{width:p,height:h,isEditorReady:y,loading:d,_ref:N,className:g,wrapperProps:x})}var FG=zG;w.memo(FG);function VG(e){let t=w.useRef();return w.useEffect(()=>{t.current=e},[e]),t.current}var BG=VG,ac=new Map;function UG({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:s,path:i,theme:o="light",line:l,loading:c="Loading...",options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:h=!1,width:p="100%",height:g="100%",className:x,wrapperProps:_={},beforeMount:v=aa,onMount:y=aa,onChange:m,onValidate:b=aa}){let[j,k]=w.useState(!1),[S,N]=w.useState(!0),R=w.useRef(null),O=w.useRef(null),D=w.useRef(null),M=w.useRef(y),z=w.useRef(v),T=w.useRef(),E=w.useRef(r),A=BG(i),P=w.useRef(!1),I=w.useRef(!1);qT(()=>{let F=KT.init();return F.then(V=>(R.current=V)&&N(!1)).catch(V=>(V==null?void 0:V.type)!=="cancelation"&&console.error("Monaco initialization: error:",V)),()=>O.current?L():F.cancel()}),jt(()=>{var V,H,U,W;let F=ji(R.current,e||r||"",t||s||"",i||n||"");F!==((V=O.current)==null?void 0:V.getModel())&&(f&&ac.set(A,(H=O.current)==null?void 0:H.saveViewState()),(U=O.current)==null||U.setModel(F),f&&((W=O.current)==null||W.restoreViewState(ac.get(i))))},[i],j),jt(()=>{var F;(F=O.current)==null||F.updateOptions(u)},[u],j),jt(()=>{!O.current||r===void 0||(O.current.getOption(R.current.editor.EditorOption.readOnly)?O.current.setValue(r):r!==O.current.getValue()&&(I.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),O.current.pushUndoStop(),I.current=!1))},[r],j),jt(()=>{var V,H;let F=(V=O.current)==null?void 0:V.getModel();F&&s&&((H=R.current)==null||H.editor.setModelLanguage(F,s))},[s],j),jt(()=>{var F;l!==void 0&&((F=O.current)==null||F.revealLine(l))},[l],j),jt(()=>{var F;(F=R.current)==null||F.editor.setTheme(o)},[o],j);let C=w.useCallback(()=>{var F;if(!(!D.current||!R.current)&&!P.current){z.current(R.current);let V=i||n,H=ji(R.current,r||e||"",t||s||"",V||"");O.current=(F=R.current)==null?void 0:F.editor.create(D.current,{model:H,automaticLayout:!0,...u},d),f&&O.current.restoreViewState(ac.get(V)),R.current.editor.setTheme(o),l!==void 0&&O.current.revealLine(l),k(!0),P.current=!0}},[e,t,n,r,s,i,u,d,f,o,l]);w.useEffect(()=>{j&&M.current(O.current,R.current)},[j]),w.useEffect(()=>{!S&&!j&&C()},[S,j,C]),E.current=r,w.useEffect(()=>{var F,V;j&&m&&((F=T.current)==null||F.dispose(),T.current=(V=O.current)==null?void 0:V.onDidChangeModelContent(H=>{I.current||m(O.current.getValue(),H)}))},[j,m]),w.useEffect(()=>{if(j){let F=R.current.editor.onDidChangeMarkers(V=>{var U;let H=(U=O.current.getModel())==null?void 0:U.uri;if(H&&V.find(W=>W.path===H.path)){let W=R.current.editor.getModelMarkers({resource:H});b==null||b(W)}});return()=>{F==null||F.dispose()}}return()=>{}},[j,b]);function L(){var F,V;(F=T.current)==null||F.dispose(),h?f&&ac.set(i,O.current.saveViewState()):(V=O.current.getModel())==null||V.dispose(),O.current.dispose()}return or.createElement(GT,{width:p,height:g,isEditorReady:j,loading:c,_ref:D,className:x,wrapperProps:_})}var HG=UG,WG=w.memo(HG),KG=WG;const GG={"workflow.yml":"流程编排","aitable-workflow.config.yml":"运行配置","config.yml":"运行配置","coding-agents.config.json":"执行引擎","views.yml":"视图方案"},ir=oK(),sb=ir?[{path:"workflow.yml",label:"workflow.yml",lang:"yaml",content:ir.workflowYml,summary:"流程编排"},{path:"config.yml",label:"config.yml",lang:"yaml",content:ir.configYml,summary:"运行配置"},...Object.entries(ir.recipeFiles).map(([e,t])=>({path:`recipes/${e}`,label:e,lang:"typescript",content:t,folder:"recipes",summary:"步骤脚本"}))]:[],qG=ir?Object.fromEntries(Object.entries(ir.stepToRecipeFile).map(([e,t])=>[`recipes/${t}`,e])):{},YG=lt(function({selectedStepId:t,onPickStep:n}){const r=B.theme,s=B.projectFiles,i=B.workflowFiles,o=B.steps,[l,c]=w.useState("workflow.yml"),[u,d]=w.useState(!1),f=i.length>0?i:s,h=w.useMemo(()=>f.length===0?sb:f.map(m=>{const b=m.path.split("/").pop()??m.path;return{path:m.path,label:b,lang:m.path.endsWith(".ts")?"typescript":"yaml",content:m.content,folder:m.path.includes("/recipes/")||m.path.startsWith("recipes/")?"recipes":void 0,summary:m.path.includes("/recipes/")||m.path.startsWith("recipes/")?"步骤脚本":GG[b]??"项目文件"}}),[f]),p=w.useMemo(()=>f.length===0?(ir==null?void 0:ir.stepToRecipeFile)??{}:Object.fromEntries(o.filter(m=>m.recipe).map(m=>{var j;const b=(j=f.find(k=>k.path.endsWith(`${m.recipe}.recipe.ts`)))==null?void 0:j.path;return[m.id,(b==null?void 0:b.replace(/^recipes\//,""))??`${m.recipe}.recipe.ts`]})),[f,o]),g=w.useMemo(()=>f.length===0?qG:Object.fromEntries(Object.entries(p).map(([m,b])=>[b.startsWith("recipes/")?b:`recipes/${b}`,m])),[f.length,p]);w.useEffect(()=>{t&&p[t]&&c(`recipes/${p[t]}`)},[t,p]);const x=w.useMemo(()=>h.find(m=>m.path===l)??h[0]??sb[0],[l,h]),_=h.filter(m=>!m.folder),v=h.filter(m=>m.folder==="recipes");function y(m){c(m),n(g[m]??null)}return a.jsxs("div",{className:`code-panel${u?" tree-collapsed":""}`,children:[!u&&a.jsxs("div",{className:"code-tree",children:[a.jsxs("div",{className:"code-tree__bar",children:[a.jsx("span",{className:"code-tree__heading",children:"文件"}),a.jsx("button",{type:"button",className:"code-tree__toggle",onClick:()=>d(!0),title:"收起文件树",children:a.jsx($,{name:"chevron-left",size:14})})]}),_.map(m=>a.jsxs("button",{type:"button",className:`code-tree__file${l===m.path?" is-active":""}`,onClick:()=>y(m.path),children:[a.jsx($,{name:"file",size:13}),a.jsxs("span",{className:"code-tree__file-text",children:[a.jsx("span",{className:"code-tree__file-name",children:m.label}),m.summary?a.jsx("span",{className:"code-tree__file-summary",children:m.summary}):null]})]},m.path)),a.jsxs("div",{className:"code-tree__folder",children:[a.jsx($,{name:"folder",size:13}),"步骤脚本 recipes"]}),v.map(m=>{const b=g[m.path],j=b&&b===t;return a.jsxs("button",{type:"button",className:`code-tree__file is-nested${l===m.path?" is-active":""}${j?" is-linked":""}`,onClick:()=>y(m.path),children:[a.jsx($,{name:"file",size:13}),a.jsxs("span",{className:"code-tree__file-text",children:[a.jsx("span",{className:"code-tree__file-name",children:m.label}),m.summary?a.jsx("span",{className:"code-tree__file-summary",children:m.summary}):null]})]},m.path)})]}),u&&a.jsx("button",{type:"button",className:"code-tree__expand",onClick:()=>d(!1),title:"展开文件树",children:a.jsx($,{name:"chevron-right",size:14})}),a.jsxs("div",{className:"code-editor",children:[a.jsxs("div",{className:"code-editor__head",children:[a.jsx($,{name:"file",size:13}),a.jsx("span",{children:x.path}),a.jsx("span",{className:"code-editor__lang",children:x.lang})]}),a.jsx("div",{className:"code-editor__body",children:a.jsx(KG,{height:"100%",language:x.lang,value:x.content,theme:r==="dark"?"vs-dark":"light",options:{readOnly:!0,minimap:{enabled:!1},fontSize:12.5,lineHeight:20,scrollBeyondLastLine:!1,renderLineHighlight:"none",padding:{top:10},fontFamily:"ui-monospace, 'SF Mono', Menlo, monospace"},loading:a.jsx("div",{className:"code-editor__loading",children:"加载编辑器…"})},x.path)})]})]})});function XG({step:e,fields:t,values:n,onSave:r,onReset:s}){const[i,o]=w.useState({...n});function l(h,p){o(g=>({...g,[h]:p}))}const c=new Map;for(const h of t){const p=h.group??"通用";c.has(p)||c.set(p,[]),c.get(p).push(h)}const u=t.filter(h=>h.isEnvRef),d=new Map;for(const[h,p]of c){const g=p.filter(x=>!x.isEnvRef);g.length>0&&d.set(h,g)}function f(){r(i)}return a.jsxs("div",{className:"step-config-form",children:[a.jsxs("div",{className:"step-config-form__head",children:[a.jsx($,{name:"bolt",size:14}),a.jsxs("span",{className:"step-config-form__title",children:["步骤配置 · ",e.name]})]}),a.jsx("div",{className:"step-config-form__meta",children:a.jsxs("span",{className:"step-config-form__recipe",children:["recipe: ",e.recipe]})}),a.jsxs("div",{className:"step-config-form__body",children:[Array.from(d.entries()).map(([h,p])=>a.jsxs("fieldset",{className:"step-config-form__group",children:[a.jsx("legend",{className:"step-config-form__group-title",children:h}),p.map(g=>a.jsx(ib,{field:g,value:i[g.key]??"",onChange:x=>l(g.key,x)},g.key))]},h)),u.length>0&&a.jsxs("fieldset",{className:"step-config-form__group",children:[a.jsx("legend",{className:"step-config-form__group-title",children:"环境变量引用"}),u.map(h=>a.jsxs("div",{className:"step-config-form__env-ref",children:[a.jsxs("span",{className:"step-config-form__env-mapping",children:[h.key," = ","${env.",h.envKey??h.key.toUpperCase(),"}"]}),a.jsx(ib,{field:{...h,label:h.envKey??h.key.toUpperCase(),type:"secret"},value:i[h.envKey??h.key]??"",onChange:p=>l(h.envKey??h.key,p)})]},h.key))]})]}),a.jsxs("div",{className:"step-config-form__foot",children:[s&&a.jsx("button",{type:"button",className:"step-config-form__btn",onClick:s,children:"恢复默认"}),a.jsx("button",{type:"button",className:"primary step-config-form__btn",onClick:f,children:"保存配置"})]})]})}function ib({field:e,value:t,onChange:n}){const r=e.required&&!t.trim(),s=`qf-input${r?" is-required-empty":""}`;return a.jsxs("div",{className:"step-config-form__field",children:[a.jsxs("label",{className:"step-config-form__label",children:[e.label,e.required&&a.jsx("span",{className:"qf-required",children:"*"})]}),e.description&&a.jsx("div",{className:"step-config-form__help",children:e.description}),e.type==="select"&&e.options?a.jsxs("select",{className:`qf-select${r?" is-required-empty":""}`,value:t,onChange:i=>n(i.target.value),children:[a.jsx("option",{value:"",children:"请选择…"}),e.options.map(i=>a.jsx("option",{value:i.value,children:i.label},i.value))]}):e.type==="number"?a.jsx("input",{type:"number",className:s,value:t,placeholder:e.defaultValue,onChange:i=>n(i.target.value)}):e.type==="switch"?a.jsxs("label",{className:"qf-switch",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:t==="true",onChange:i=>n(i.target.checked?"true":"false")}),a.jsx("span",{"aria-hidden":!0})]}):e.type==="secret"?a.jsx("input",{type:"password",className:s,value:t,placeholder:"••••••••",onChange:i=>n(i.target.value)}):a.jsx("input",{type:"text",className:s,value:t,placeholder:e.defaultValue??"",onChange:i=>n(i.target.value)}),r&&a.jsx("span",{className:"step-config-form__required-hint",children:"必填"})]})}const QG=lt(function(){const t=B.steps,n=B.edges,[r,s]=w.useState(null),[i,o]=w.useState("preview"),l=t.find(u=>u.id===r)??null,c=l?[{key:"model",label:"model",type:"select",group:"AI (ai)",options:[{label:"Qwen3-Mini",value:"qwen3-mini"},{label:"Qwen3.7-Max",value:"qwen3.7-max"},{label:"DeepSeek-V3",value:"deepseek-v3"}]},{key:"engine",label:"engine",type:"select",required:!0,group:"编程引擎 (coding)",options:[{label:"qoder",value:"qoder"},{label:"codex",value:"codex"},{label:"claude",value:"claude"}]},{key:"target_branch",label:"target_branch",type:"text",group:"业务参数",defaultValue:"master"},{key:"api_key",label:"API Key",type:"secret",required:!0,isEnvRef:!0,envKey:"IDEALAB_API_KEY",group:"环境变量引用"}]:[];return a.jsxs("div",{className:"design-workspace design-workspace--tabbed",children:[a.jsxs("div",{className:"dw-tabs",children:[a.jsxs("button",{type:"button",className:`dw-tabs__tab${i==="preview"?" is-active":""}`,onClick:()=>o("preview"),children:[a.jsx($,{name:"flow",size:13}),"预览"]}),a.jsxs("button",{type:"button",className:`dw-tabs__tab${i==="code"?" is-active":""}`,onClick:()=>o("code"),children:[a.jsx($,{name:"file",size:13}),"代码"]})]}),i==="preview"?a.jsxs("div",{className:"dw-preview",children:[a.jsx("section",{className:"dw-panel dw-panel--canvas",style:{flex:1,borderRight:l?"1px solid var(--border)":"none"},children:a.jsx(vT,{steps:t,edges:n,selectedId:r,onSelect:s})}),l&&a.jsx(XG,{step:l,fields:c,values:{},onSave:u=>{console.log("保存配置",l.id,u)},onReset:()=>{}})]}):a.jsx("div",{className:"dw-code-view",children:a.jsx(YG,{selectedStepId:r,onPickStep:s})})]})}),Ao={discovery:"理解业务目标与 SOP",generate:"生成流程方案",validate:"校验配置完整性",render:"渲染真实画布与配置"};function ZG({state:e,message:t}){return a.jsxs("div",{className:"design-progress work-body",children:[a.jsxs("div",{className:"design-progress__hero",children:[a.jsx("span",{className:"design-progress__icon","aria-hidden":!0,children:a.jsx($,{name:"sparkle",size:18,color:"#fff"})}),a.jsxs("div",{children:[a.jsx("div",{className:"design-progress__title",children:"正在生成工作流设计"}),a.jsx("div",{className:"design-progress__message",children:t})]})]}),a.jsx(ET,{items:eq(e)})]})}const JG={clarify_probing:0,clarify_awaiting:0,clarify_failed:0,precheck:1,generating:1,validating:2,syncing_schema:3,ready:4,generate_failed:4};function eq(e){const t=JG[e.phase],n=e.phase==="generating"?`${Ao.generate}(第 ${e.round} 轮)`:Ao.generate;return[{id:"design-discovery",text:Ao.discovery,status:lc(0,t)},{id:"design-generate",text:n,status:lc(1,t)},{id:"design-validate",text:Ao.validate,status:lc(2,t)},{id:"design-render",text:Ao.render,status:lc(3,t)}]}function lc(e,t){return t>=4||e<t?"done":e===t?"active":"pending"}const tq={label:"交给设计 Agent 判读需求",detail:"缺口分析 / 决定是否提问"};function nq(e,t){switch(e.phase){case"clarify_probing":return{acts:[{kind:"say",text:"设计 Agent 正在判读你的 SOP、角色与表格信息,看还缺什么——需要澄清就会问你,已经清楚就直接开始生成。这一步可能要一两分钟,停在本页等即可。"}],pin:tq};case"clarify_awaiting":return{acts:[{kind:"say",text:"请确认以下设计约束,确认后我会继续生成工作流方案。"},{kind:"form",form:{...e.form,submitLabel:t.submitLabel}}]};case"precheck":return{acts:[{kind:"say",text:e.confirmed.summary}]};case"generating":case"validating":case"syncing_schema":return{acts:[]};case"ready":return{acts:t.resumed?[{kind:"say",text:`已恢复当前流程 ${t.projectId} 的设计产物,不会重复启动生成任务。右侧可继续查看流程与配置。`}]:[]};case"clarify_failed":case"generate_failed":return{acts:[{kind:"say",text:`${e.error.message}。请重新生成 Design,系统会保留当前可查看的文件。`}]}}}function rq(e){return e?e.phase==="clarify_awaiting"?`clarify_awaiting:${e.form.id}`:e.phase:"none"}const sq="正在连接设计 Agent…",mh=new Map;async function iq(e,t){const n=mh.get(e);if(n)return n;const r=(async()=>{let s=!1;const i=XL(e).catch(async o=>{const l=o instanceof Error?o.message:String(o);await t.run([{kind:"say",text:`需求澄清准备失败:${l}`}])}).finally(()=>{s=!0});for(;!s;){const o=await Hi(e);if(o!=null&&o.stages.design)break;await new Promise(l=>setTimeout(l,500))}await i,await Hi(e)})().finally(()=>{mh.delete(e)});return mh.set(e,r),r}const oq=lt(function(){var E,A;const t=Sr(),n=w.useRef();n.current||(n.current=new iy);const r=n.current,s=w.useRef(null),i=w.useRef(null),[o,l]=w.useState(null),c=B.projectId,u=B.mode,d=B.steps,f=B.projectFiles,h=vk({snapshot:B.snapshot,live:B.live,mode:u}),p=h.state,g=h.runtime,x=h.agentEvents,_=p!==null,v=rq(p),y=((E=g.next)==null?void 0:E.kind)==="await_user"?g.next.action.label:"确认并开始设计";ay("design",r);const m=w.useRef(null),b=((A=B.stream)==null?void 0:A.stage)==="design";w.useEffect(()=>{u!=="live"||!c||b||!_||m.current===c||i.current!==null||(m.current=c,RK(r,c))},[r,u,c,b,_]);async function j(){const P=u==="live"&&c?await wK(c,B.validationContext):DT(B.validationContext,"design");if(B.setValidation("design",P),!P.ok){l(P);return}t("../setup")}function k(){u!=="live"||!c||(B.patchLive(c,{designLiveText:"重新连接真实设计服务",designAgentEvents:0}),Kd("design",c,r))}w.useEffect(()=>(r.onFormSubmit=(P,I)=>{u!=="live"||!c||(p==null?void 0:p.phase)!=="clarify_awaiting"||P===p.form.id&&(async()=>{try{const{stageState:C}=await QL(c,I);B.applyDesignEvent(c,{type:"stage.changed",stage:"design",stageState:C})}catch(C){await r.run([{kind:"say",text:`确认需求失败:${C instanceof Error?C.message:String(C)}`}])}})()},()=>{r.onFormSubmit=null}),[r,u,c,v]),w.useEffect(()=>{u!=="live"||!c||_||iq(c,r)},[r,u,c,_]),w.useEffect(()=>{if(u!=="live")return;const P=c?v:"no-project";if(i.current===P)return;const I=i.current===null;if(i.current=P,!c){r.run([{kind:"say",text:"缺少真实项目工作区,请先返回 Init 阶段完成真实配置。"}]);return}const C=s.current;if(C&&(C(p&&Jx(p)?"error":"done"),s.current=null),!p)return;const L=nq(p,{projectId:c,submitLabel:y,resumed:I});let F=!1;return(async()=>(L.acts.length>0&&await r.run(L.acts),!(F||!L.pin)&&(s.current=r.beginTask(L.pin.label,L.pin.detail))))(),()=>{F=!0}},[r,u,c,v]);const S=g$(p),N=Jx(p),R=f.length>0,O=d.length>0||R,D=(p==null?void 0:p.phase)==="clarify_probing"||!_||!O,M=()=>{var P;return S&&p?a.jsx(ZG,{state:p,message:g.message}):O?a.jsx(QG,{}):N?a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:[p.error.message,a.jsx("br",{}),a.jsxs("button",{type:"button",className:"primary",style:{marginTop:14},onClick:k,children:[a.jsx($,{name:"refresh",size:14,color:"#fff"}),((P=g.next)==null?void 0:P.kind)==="await_user"?g.next.action.label:"重新生成工作流设计"]})]})}):a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"empty-hint",children:"先确认需求澄清卡片,确认后将启动真实设计生成。"})})},z=a.jsxs(a.Fragment,{children:[me&&a.jsx(NK,{projectId:c}),M(),o&&!o.ok&&a.jsx(PT,{title:"无法进入搭建阶段",missing:o.missing,warnings:o.warnings,onClose:()=>l(null),onLocate:P=>{l(null)}})]}),T=()=>u!=="live"?"演示模式不提供":(p==null?void 0:p.phase)==="ready"?`完成 ${p.rounds} 轮 · ${x} 个 Agent 事件`:(p==null?void 0:p.phase)==="generating"?`第 ${p.round} 轮进行中 · ${x} 个 Agent 事件`:(p==null?void 0:p.phase)==="clarify_awaiting"?"等待确认需求澄清":p?g.message:d.length?`${d.length} 步 · 真实方案`:R?`${f.length} 个文件 · 等待真实设计启动`:"真实生成待启动";return a.jsx(Wu,{chat:r,chatTitle:"工作流设计",chatSubtitle:`需求对齐 → 可视化编排 · ${u==="live"?"真实模式":"演示模式"}`,chatEmptyHint:sq,onSend:P=>{r.addUserMessage(P),r.run([{kind:"say",text:"收到,我会据此调整工作流细节。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"flow",size:16}),a.jsx("div",{className:"work-head__title",children:"工作流"}),a.jsx("div",{className:"work-head__sub",children:T()}),d.length>0&&a.jsxs("button",{type:"button",className:"primary work-head__cta",onClick:j,children:["进入搭建阶段",a.jsx($,{name:"chevron-right",size:14,color:"#fff"})]}),N&&(d.length>0||R)&&a.jsxs("button",{type:"button",className:"primary work-head__cta",onClick:k,style:{marginLeft:8},children:[a.jsx($,{name:"refresh",size:14,color:"#fff"}),"重新生成"]})]}),work:z,hideWork:D})}),hr=dK(),ly=(hr==null?void 0:hr.fields)??[],gh=(hr==null?void 0:hr.views)??[],ob=ly.filter(e=>e.group==="business"),ab=ly.filter(e=>e.group==="process");function lb(e){return[{kind:"do",run:()=>B.addMockField(e)},{kind:"wait",ms:130}]}function aq(e){return[{kind:"do",run:()=>B.addMockView(e)},{kind:"wait",ms:260}]}const lq=[{kind:"say",text:"开始搭建演示 AI 表格。我会依次创建字段、视图,并绑定事件源。"},{kind:"todo",items:["创建业务字段","创建流程字段","创建视图","绑定事件源 · 生成链接"]},{kind:"tool",label:"创建业务字段",detail:`${ob.length} 个`,ms:520},...ob.flatMap(lb),{kind:"todo-advance"},{kind:"tool",label:"创建流程字段",detail:`${ab.length} 个`,ms:520},...ab.flatMap(lb),{kind:"todo-advance"},{kind:"tool",label:"创建视图",detail:`${gh.length} 个`,ms:520},...gh.flatMap(aq),{kind:"todo-advance"},{kind:"tool",label:"绑定事件源 · 新记录触发",detail:"on_record_created",ms:760},{kind:"do",run:()=>{if(!hr)return;const e=B.initDraft,t=e.tableBaseId||hr.tableBaseId,n=e.tableId||hr.tableSheetId;B.setMockTableUrl(MT(t,n))}},{kind:"todo-advance"},{kind:"say",text:`搭建完成:${ly.length} 字段 · ${gh.length} 视图已就绪,事件源已绑定。可打开 AI 表格,或进入「运行」阶段启动工作流。`}];function cb(e){return e.isLive?String(e.current):`${e.current}/${e.mockTotal}`}const cq={grid:"表格",kanban:"看板",calendar:"日历",form:"表单",gantt:"甘特"},ub={text:"文本",single_select:"单选",user:"成员",datetime:"日期",number:"数字"},uq=lt(function(){var T,E,A;const t=w.useRef();t.current||(t.current=new iy);const n=t.current,r=w.useRef(!1),[s,i]=w.useState(!1),[o,l]=w.useState(""),[c,u]=w.useState(!1),d=B.mode,f=yk({snapshot:B.snapshot,mode:d,mockSetup:B.mockSetup}),h=f.schema.fields,p=f.schema.views,g=f.tableUrl,x=B.projectId,_=B.stageRuntime.setup,v=_.phase,y=v==="auth_awaiting",m=v==="failed",b=v==="ready",j=v==="preflight"||v==="provisioning_table"||v==="syncing_schema",k=d==="live",S=f.gate.kind==="open";ay("setup",n),w.useEffect(()=>{r.current||!S||(r.current=!0,n.run([{kind:"say",text:"工作流已就绪。准备好后点击右侧「开始搭建」,我会自动创建 AI 表格的字段与视图。"}]))},[n,S]),w.useEffect(()=>{(y||m||b)&&i(!1)},[y,m,b]);function N(){if(d==="live"&&!S){n.run([{kind:"say",text:"当前流程还没有完成设计,请先回到设计阶段生成 workflow 和 recipes。"}]);return}if(!(j||s&&!(y||m))){if(i(!0),d==="live"){x?Kd("setup",x,n).finally(()=>i(!1)):(i(!1),n.run([{kind:"say",text:"缺少真实项目工作区,请先返回 Init 阶段完成真实配置。"}]));return}n.run(lq).finally(()=>i(!1))}}const R=h.filter(P=>P.group==="business"),O=h.filter(P=>P.group==="process"),D=d==="live"?b:!!g||b,M=s||!!v||D;if(!S)return a.jsx(Wu,{chat:n,chatTitle:"AI 表格搭建",chatSubtitle:"创建字段 · 视图 · 绑定事件源",chatEmptyHint:"当前流程尚未到达搭建阶段",onSend:P=>{n.addUserMessage(P),n.run([{kind:"say",text:"当前流程还没有完成设计,请先回到设计阶段生成工作流。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"table",size:16}),a.jsx("div",{className:"work-head__title",children:"AI 表格"}),a.jsx("div",{className:"work-head__sub",children:"未到达"})]}),work:a.jsx("div",{className:"work-body setup-theater",children:a.jsxs("div",{className:"setup-intro",children:[a.jsx("div",{className:"setup-intro__icon",children:a.jsx($,{name:"flow",size:30,color:"#fff"})}),a.jsx("h3",{className:"setup-intro__title",children:"当前流程尚未完成设计"}),a.jsx("p",{className:"setup-intro__desc",children:"搭建阶段必须使用当前流程实例生成的 workflow 和 recipes。请先回到设计阶段完成真实工作流生成。"}),a.jsxs(Ue,{className:"primary setup-intro__cta",to:"../design",children:[a.jsx($,{name:"chevron-right",size:15,color:"#fff"}),"返回设计阶段"]})]})})});const z=a.jsx("div",{className:"work-body setup-theater",children:M?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx($,{name:y||m?"sparkle":"table",size:14}),y?"等待授权":m?"搭建失败":b?"搭建完成":"搭建进度"]}),a.jsx("p",{className:"setup-intro__desc",children:_.message}),(y||m)&&a.jsxs("button",{type:"button",className:"primary setup-intro__cta",onClick:N,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),((T=_.next)==null?void 0:T.kind)==="await_user"?_.next.action.label:"重试搭建"]})]}),D&&a.jsxs(Ze.div,{className:"table-link-card",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsxs("div",{className:"table-link-card__info",children:[a.jsx("span",{className:"table-link-card__badge",children:a.jsx($,{name:"check",size:13,color:"#fff"})}),a.jsxs("div",{children:[a.jsx("div",{className:"table-link-card__title",children:"AI 表格已就绪"}),a.jsxs("div",{className:"table-link-card__sub",children:[h.length," 字段 · ",p.length," 视图 · 事件源已绑定"]})]})]}),a.jsxs("a",{className:"primary table-link-card__open",href:g??"#",target:"_blank",rel:"noreferrer",children:[a.jsx($,{name:"link",size:14,color:"#fff"}),"打开 AI 表格"]})]}),a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx($,{name:"table",size:14}),"字段",a.jsx("span",{className:"setup-section__count",children:cb({current:h.length,mockTotal:((E=ch())==null?void 0:E.fieldCount)??0,isLive:k})})]}),R.length>0&&a.jsx("div",{className:"setup-group-label",children:"业务字段"}),a.jsx("div",{className:"field-grid",children:R.map(P=>a.jsxs(Ze.div,{className:"field-chip",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:"field-chip__name",children:P.name}),a.jsx("span",{className:"field-chip__type",children:ub[P.type]??P.type})]},P.id))}),O.length>0&&a.jsx("div",{className:"setup-group-label",children:"流程字段"}),a.jsx("div",{className:"field-grid",children:O.map(P=>a.jsxs(Ze.div,{className:"field-chip field-chip--process",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:"field-chip__name",children:P.name}),a.jsx("span",{className:"field-chip__type",children:ub[P.type]??P.type})]},P.id))})]}),p.length>0&&a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx($,{name:"flow",size:14}),"视图",a.jsx("span",{className:"setup-section__count",children:cb({current:p.length,mockTotal:((A=ch())==null?void 0:A.viewCount)??0,isLive:k})})]}),a.jsx("div",{className:"view-grid",children:p.map(P=>a.jsxs(Ze.div,{className:"view-card",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:`view-card__kind view-card__kind--${P.kind}`,children:cq[P.kind]}),a.jsx("div",{className:"view-card__name",children:P.name}),a.jsx("div",{className:"view-card__desc",children:P.desc})]},P.id))})]}),D&&a.jsxs("div",{className:"cfg-cta",children:[a.jsxs("div",{className:"cfg-cta__text",children:[a.jsx($,{name:"check",size:16}),"表格搭建完成,可进入试运行验证流程。"]}),a.jsxs(Ue,{className:"primary",to:"../test",children:["进入试运行",a.jsx($,{name:"chevron-right",size:15,color:"#fff"})]})]})]}):a.jsxs("div",{className:"setup-intro",children:[a.jsx("div",{className:"setup-intro__icon",children:a.jsx($,{name:"table",size:30,color:"#fff"})}),a.jsx("h3",{className:"setup-intro__title",children:d==="live"?"搭建真实 AI 表格结构":"搭建演示 AI 表格结构"}),a.jsx("p",{className:"setup-intro__desc",children:d==="live"?"将根据真实工作流方案创建字段与视图,并绑定新记录触发方式。":(()=>{const P=ch();return`将创建 ${(P==null?void 0:P.fieldCount)??0} 个示例字段、${(P==null?void 0:P.viewCount)??0} 个示例视图,并绑定新记录触发方式。`})()}),a.jsxs("button",{type:"button",className:"primary setup-intro__cta",onClick:N,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),"开始搭建"]})]})});return a.jsx(Wu,{chat:n,chatTitle:"AI 表格搭建",chatSubtitle:"创建字段 · 视图 · 绑定事件源",chatEmptyHint:"agent 正在准备建表…",onSend:P=>{n.addUserMessage(P),n.run([{kind:"say",text:"好的,我会据此调整表结构。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"table",size:16}),a.jsx("div",{className:"work-head__title",children:"AI 表格"}),a.jsx("div",{className:"work-head__sub",children:D?"已就绪":y?"等待授权":m?"可重试":M?"搭建中":"待搭建"})]}),work:z})}),vh=e=>new Promise(t=>setTimeout(t,e));async function dq(e,t,n){for(let r=0;r<e.length;r++){if(n!=null&&n.aborted)return;const s=e[r];if(t({type:"step-start",stepIndex:r,step:s}),await vh(300),n!=null&&n.aborted||(t({type:"step-ai",stepIndex:r,step:s}),await vh(500),n!=null&&n.aborted)||(t({type:"step-done",stepIndex:r,step:s}),r<e.length-1&&(await vh(400),n!=null&&n.aborted)))return}t({type:"all-done",stepIndex:e.length-1})}const fq={info:"dot",ai:"sparkle",ok:"check",warn:"warn",error:"close"},hq=lt(function(){const t=B.steps,n=B.mode;B.projectId;const r=B.tableUrl,i=Q$({snapshot:B.snapshot,mode:n}).gate.kind==="open",[o,l]=w.useState("guide"),[c,u]=w.useState([]),[d,f]=w.useState(-1),[h,p]=w.useState(null),g=w.useRef(null);if(!i)return a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"sparkle",size:16}),a.jsx("div",{className:"work-head__title",children:"试运行"}),a.jsx("div",{className:"work-head__sub",children:"未到达"})]}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"test-intro",children:[a.jsx("div",{className:"test-intro__icon",children:a.jsx($,{name:"table",size:28,color:"#fff"})}),a.jsx("h3",{className:"test-intro__title",children:"当前流程尚未完成搭建"}),a.jsx("p",{className:"test-intro__desc",children:"试运行阶段必须基于已搭建完成的 AI 表格。请先完成搭建阶段。"}),a.jsxs(Ue,{className:"primary test-intro__cta",to:"../setup",children:[a.jsx($,{name:"chevron-right",size:15,color:"#fff"}),"返回搭建阶段"]})]})})]})});async function x(){var v;l("running"),u([]),f(0),p(null),(v=g.current)==null||v.abort();const _=new AbortController;g.current=_,await dq(t,y=>{y.type==="step-start"?(f(y.stepIndex),u(m=>[...m,{id:`log_${y.step.id}_start_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:y.step.id,level:"info",text:`开始执行步骤: ${y.step.name}`}])):y.type==="step-ai"?u(m=>[...m,{id:`log_${y.step.id}_ai_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:y.step.id,level:y.step.requiresAgent?"ai":"info",text:y.step.requiresAgent?`AI Agent 执行 ${y.step.recipe}...`:`自动处理 ${y.step.recipe}...`}]):y.type==="step-done"?u(m=>[...m,{id:`log_${y.step.id}_done_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:y.step.id,level:"ok",text:`步骤 ${y.step.name} 完成`}]):y.type==="all-done"&&(l("success"),f(-1),u(m=>[...m,{id:`log_test_done_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"test",stepId:"test",level:"ok",text:"全部步骤执行成功,试运行通过!"}]))},_.signal)}return a.jsxs("div",{className:"test-stage",children:[a.jsxs("div",{className:"test-main",children:[a.jsxs("div",{className:"test-main__head",children:[a.jsx($,{name:"sparkle",size:16}),a.jsx("div",{className:"work-head__title",children:"试运行"}),a.jsx("div",{className:"work-head__sub",children:o==="guide"?"待开始":o==="running"?"执行中":o==="success"?"通过":"失败"}),o==="success"&&a.jsxs(Ue,{className:"primary work-head__cta",to:"../run",children:["进入正式运行",a.jsx($,{name:"chevron-right",size:14,color:"#fff"})]})]}),o==="guide"&&a.jsxs("div",{className:"test-guide",children:[a.jsx("div",{className:"test-guide__icon",children:a.jsx($,{name:"sparkle",size:30,color:"#fff"})}),a.jsx("h3",{className:"test-guide__title",children:"用一条真实记录验证整条流程"}),a.jsxs("div",{className:"test-guide__steps",children:[a.jsxs("div",{className:"test-guide__step",children:[a.jsx("span",{className:"test-guide__step-num",children:"1"}),a.jsx("span",{children:"打开 AI 表格"}),a.jsxs("a",{className:"test-guide__link",href:r??"#",target:"_blank",rel:"noreferrer",children:[a.jsx($,{name:"link",size:12})," 打开表格"]})]}),a.jsxs("div",{className:"test-guide__step",children:[a.jsx("span",{className:"test-guide__step-num",children:"2"}),a.jsx("span",{children:"新增一条记录,填写必选字段"})]}),a.jsxs("div",{className:"test-guide__step",children:[a.jsx("span",{className:"test-guide__step-num",children:"3"}),a.jsx("span",{children:"回到这里点「开始试运行」"})]})]}),a.jsxs("button",{type:"button",className:"primary test-guide__cta",onClick:()=>void x(),children:[a.jsx($,{name:"play",size:15,color:"#fff"}),"开始试运行"]})]}),o==="success"&&a.jsxs("div",{className:"test-result test-result--success",children:[a.jsx("span",{className:"test-result__icon test-result__icon--success",children:a.jsx($,{name:"check",size:24,color:"#fff"})}),a.jsx("h3",{className:"test-result__title",children:"试运行通过"}),a.jsxs("p",{className:"test-result__desc",children:["全部 ",t.length," 个步骤执行成功。可以进入正式运行阶段。"]}),a.jsxs(Ue,{className:"primary test-result__cta",to:"../run",children:["进入正式运行",a.jsx($,{name:"chevron-right",size:14,color:"#fff"})]})]}),o==="failed"&&h&&a.jsxs("div",{className:"test-result test-result--failed",children:[a.jsx("span",{className:"test-result__icon test-result__icon--failed",children:a.jsx($,{name:"close",size:24,color:"#fff"})}),a.jsxs("h3",{className:"test-result__title",children:["试运行在「",h.step.name,"」步骤失败"]}),a.jsx("p",{className:"test-result__desc",children:h.reason}),a.jsxs("div",{className:"test-result__actions",children:[a.jsx("button",{type:"button",className:"test-result__btn",onClick:()=>{l("guide")},children:"查看完整日志"}),a.jsx(Ue,{className:"primary test-result__btn",to:"../design",children:"去修正该步骤配置 →"})]})]})]}),a.jsxs("div",{className:"test-flow",children:[a.jsx("div",{className:"test-flow__head",children:"步骤流转"}),a.jsx("div",{className:"step-chain",children:t.map((_,v)=>{const y=o==="success"||v<d?"done":v===d?"active":"pending";return a.jsxs("div",{className:`chain-node is-${y}`,children:[v>0&&a.jsx("div",{className:`chain-node__line is-${y}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:y==="done"?a.jsx($,{name:"check",size:12,color:"#fff"}):y==="active"?a.jsx("span",{className:"chain-node__pulse"}):a.jsx("span",{className:"chain-node__idle"})}),a.jsxs("div",{className:"chain-node__body",children:[a.jsxs("div",{className:"chain-node__name",children:[a.jsx("span",{className:"chain-node__label",children:_.name}),_.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),!_.requiresAgent&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:_.recipe})]})]})]},_.id)})})]}),a.jsxs("div",{className:"test-logs",children:[a.jsxs("div",{className:"test-logs__head",children:[a.jsx($,{name:"file",size:14}),"试运行日志"]}),a.jsx("div",{className:"test-logs__body",children:c.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:"点击「开始试运行」后,这里会显示实时执行日志"}):a.jsx(ea,{initial:!1,children:c.map(_=>{var v;return a.jsxs(Ze.div,{layout:!0,variants:Ct,initial:"hidden",animate:"visible",className:`log-line log-line--${_.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx($,{name:fq[_.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:((v=t.find(y=>y.id===_.stepId))==null?void 0:v.name)??_.stepId}),a.jsx("span",{className:"log-line__text",children:_.text})]})]},_.id)})})})]})]})}),pq={classify:[{level:"info",text:"读取工单「{title}」标题与问题描述"},{level:"ai",text:"调用分类模型判定问题类型与紧急程度…"},{level:"ok",text:"判定为「{category}」· {priority}"}],investigate:[{level:"info",text:"检索知识库与历史相似工单"},{level:"ai",text:"Qoder 分析根因,生成排查路径…"},{level:"ok",text:"定位可能原因,产出解决方案草案"}],draft_reply:[{level:"info",text:"载入解决方案与客户「{customer}」信息"},{level:"ai",text:"以「亲和友好」语气生成回复草稿…"},{level:"ok",text:"回复草稿已生成,进入质检"}],quality_check:[{level:"warn",text:"命中人工审核卡点,暂停等待复核"},{level:"info",text:"请在步骤卡片点击「通过」或「驳回」"}],send_reply:[{level:"ai",text:"渲染最终回复并校验敏感词…"},{level:"ok",text:"已发送给客户「{customer}」,工单关闭"}]},mq=[{level:"warn",text:"人工驳回,退回「草拟回复」重写"},{level:"ai",text:"参考驳回意见重新生成回复…"},{level:"ok",text:"新草稿已生成,再次送审"}],gq={classify:1400,investigate:2e3,draft_reply:1700,quality_check:0,send_reply:1400},vq=3200,yq=520;function xq(e,t){return e.replace("{title}",t.title).replace("{customer}",t.customer).replace("{category}",t.category).replace("{priority}",t.priority)}const Ri=OT(),_q=(Ri==null?void 0:Ri.steps)??[],yh=(Ri==null?void 0:Ri.incomingTickets)??[],xh=e=>new Promise(t=>setTimeout(t,e));let wq=0;const db=e=>`${e}_${(wq++).toString(36)}`;class bq{constructor(){le(this,"state",{running:!1,arrived:0,total:yh.length});le(this,"listeners",new Set);le(this,"approvals",new Map);le(this,"subscribe",t=>(this.listeners.add(t),()=>this.listeners.delete(t)));le(this,"getState",()=>this.state)}emit(){this.listeners.forEach(t=>t())}set(t){this.state={...this.state,...t},this.emit()}log(t,n,r,s){B.appendLog({id:db("log"),ts:Date.now(),ticketId:t,stepId:n,level:r,text:s})}start(){this.state.running||(this.set({running:!0}),this.spawn())}isAwaiting(t){return this.approvals.has(t)}approve(t){var n;(n=this.approvals.get(t))==null||n(!0)}reject(t){var n;(n=this.approvals.get(t))==null||n(!1)}async spawn(){for(let t=0;t<yh.length;t++){if(!this.state.running)return;const n=yh[t],r={id:db("tk"),title:n.title,customer:n.customer,category:n.category,priority:n.priority,status:"todo",currentStepId:null,doneStepIds:[],createdAt:Date.now()};B.addTicket(r),this.set({arrived:this.state.arrived+1}),this.process(r.id,n),await xh(vq)}}markDone(t,n){const r=B.live.tickets.find(s=>s.id===t);r&&B.updateTicket(t,{doneStepIds:[...r.doneStepIds,n]})}async streamLogs(t,n,r,s){for(const i of s){if(!this.state.running)return;this.log(t,n,i.level,xq(i.text,r)),await xh(yq)}}async process(t,n){for(const r of _q){if(!this.state.running)return;const s=r.needsHuman?"review":"running";if(B.updateTicket(t,{currentStepId:r.id,status:s}),await this.streamLogs(t,r.id,n,pq[r.id]??[]),r.needsHuman){let i=!1;for(;!i&&this.state.running;)if(i=await this.awaitApproval(t),!i){B.updateTicket(t,{currentStepId:"draft_reply",status:"running"});const o=B.live.tickets.find(l=>l.id===t);o&&B.updateTicket(t,{doneStepIds:o.doneStepIds.filter(l=>l!=="draft_reply")}),await this.streamLogs(t,"draft_reply",n,mq),this.markDone(t,"draft_reply"),B.updateTicket(t,{currentStepId:r.id,status:"review"})}if(!this.state.running)return}else await xh(gq[r.id]??1200);this.markDone(t,r.id)}B.updateTicket(t,{status:"done",currentStepId:null})}awaitApproval(t){return new Promise(n=>{this.approvals.set(t,r=>{this.approvals.delete(t),this.emit(),n(r)}),this.emit()})}stop(){this.set({running:!1}),this.approvals.forEach(t=>t(!0)),this.approvals.clear()}}function jq(e){return w.useSyncExternalStore(e.subscribe,e.getState,e.getState)}const fb={todo:{label:"待处理",cls:"muted"},running:{label:"处理中",cls:"blue"},review:{label:"审核中",cls:"amber"},done:{label:"已完成",cls:"green"},blocked:{label:"受阻",cls:"red"}},hb={info:"dot",ai:"sparkle",ok:"check",warn:"warn",error:"close"};function pb(e,t){return e.doneStepIds.includes(t)?"done":e.currentStepId===t?"active":"pending"}const Sq=lt(function(){const t=w.useRef();t.current||(t.current=new bq);const n=t.current,r=jq(n),s=B.mode,i=Z$({snapshot:B.snapshot,live:B.live,mode:s}),o=i.tickets,l=i.logs,c=B.steps,u=B.projectId,d=B.stageRuntime.run,[f,h]=w.useState(null),[p,g]=w.useState(!1),[x,_]=w.useState(!1),[v,y]=w.useState(null),m=s==="live",b=i.gate.kind==="open",j=OT(),k=m||c.length>0?c:(j==null?void 0:j.steps)??[],S=d.phase,N=S==="failed",R=S==="stopped",O=S==="starting"||S==="listening"||S==="awaiting_machine"||S==="running_on_machine",D=m?O||p:r.running;w.useEffect(()=>{!f&&o.length>0&&h(o[o.length-1].id)},[o,f]);const M=o.find(C=>C.id===f)??null,z=l.filter(C=>C.ticketId===f),T=w.useRef(null);w.useEffect(()=>{var C;(C=T.current)==null||C.scrollIntoView({behavior:"smooth",block:"end"})},[z.length]),ay("run"),w.useEffect(()=>()=>{u&&Qw("run",u)},[u]);const E={running:o.filter(C=>C.status==="running").length,review:o.filter(C=>C.status==="review").length,done:o.filter(C=>C.status==="done").length};function A(){if(m){if(!b)return;if(!u){B.appendLog(_h("缺少真实项目工作区,请先从配置阶段重新进入真实设计。"));return}if(k.length===0){B.appendLog(_h("当前流程没有可运行的真实 workflow,请先返回设计阶段重新生成。"));return}g(!0),B.patchLive(u,{tickets:[],logs:[]}),Kd("run",u).finally(()=>g(!1));return}n.start()}async function P(){if(!(!u||x)){_(!0);try{Qw("run",u),(await n$(u)).mode==="local"&&await Hi(u)}catch(C){B.appendLog(_h(C instanceof Error?C.message:String(C)))}finally{_(!1),g(!1)}}}async function I(C,L){if(!(!u||v)){y(L);try{await a$(u,C,L),await Hi(u)}catch(F){const V=F instanceof Error?F.message:String(F);B.appendLog({id:`human_action_${Date.now().toString(36)}`,ts:Date.now(),ticketId:C,stepId:(M==null?void 0:M.currentStepId)??"run",level:"error",text:V})}finally{y(null)}}}if(m&&b){const C=l.filter(U=>U.ticketId==="run"),L=M??o[0]??null,F=L?l.filter(U=>U.ticketId===L.id):C,V=O?"blue":R?"green":N?"red":"muted",H=O?"监听中":N?"启动失败":R?"已停止":"待启动";return a.jsxs("div",{className:"run-stage run-stage--live",children:[a.jsxs("div",{className:"run-board",children:[a.jsxs("div",{className:"run-board__head",children:[a.jsx("span",{children:"运行记录"}),a.jsx("span",{className:"run-board__stat",children:o.length?`${o.length} 条`:H})]}),a.jsx("div",{className:"run-board__list",children:o.length===0?a.jsxs("button",{type:"button",className:"ticket-card is-selected",children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${V}`,children:H}),a.jsx("span",{className:"ticket-card__prio",children:d.phase??"run"})]}),a.jsx("div",{className:"ticket-card__title",children:"真实 AI 表格监听"}),a.jsx("div",{className:"ticket-card__meta",children:d.message}),a.jsxs("div",{className:"ticket-card__progress",children:[k.length," 个步骤 · ",C.length," 条服务日志"]})]}):o.map(U=>{const W=fb[U.status];return a.jsxs("button",{type:"button",className:`ticket-card${U.id===(L==null?void 0:L.id)?" is-selected":""}`,onClick:()=>h(U.id),children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${W.cls}`,children:W.label}),a.jsx("span",{className:"ticket-card__prio",children:U.priority})]}),a.jsx("div",{className:"ticket-card__title",children:U.title}),a.jsxs("div",{className:"ticket-card__meta",children:[U.customer," · ",U.category]}),a.jsxs("div",{className:"ticket-card__progress",children:[U.doneStepIds.length,"/",k.length," 步",U.status==="review"&&a.jsx("span",{className:"ticket-card__await",children:"待人工"})]})]},U.id)})}),a.jsxs("div",{className:"run-board__foot",children:[a.jsxs("button",{type:"button",className:"primary run-live-start",onClick:A,disabled:D,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),N?"重试运行":D?"运行中":"启动运行"]}),D&&a.jsxs("button",{type:"button",className:"ghost run-live-stop",onClick:P,disabled:x,children:[a.jsx($,{name:"close",size:13}),x?"停止中…":"停止运行"]})]})]}),a.jsxs("div",{className:"run-flow",children:[a.jsxs("div",{className:"run-flow__head",children:[a.jsx("div",{className:"run-flow__title",children:L?L.title:"当前 workflow"}),a.jsx("div",{className:"run-flow__sub",children:L?`${L.customer} · ${L.status}`:`${k.length} 个真实步骤 · ${d.message}`})]}),a.jsx("div",{className:"step-chain",children:k.map((U,W)=>{const G=!!L&&L.status==="review"&&L.currentStepId===U.id&&!!U.needsHuman,Y=L?G?"active":pb(L,U.id):R?"done":O&&W===0?"active":"pending";return a.jsxs("div",{className:`chain-node is-${Y}`,children:[W>0&&a.jsx("div",{className:`chain-node__line is-${Y}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:Y==="done"?a.jsx($,{name:"check",size:12,color:"#fff"}):Y==="active"?a.jsx("span",{className:"chain-node__pulse"}):a.jsx("span",{className:"chain-node__idle"})}),a.jsxs("div",{className:"chain-node__body",children:[a.jsxs("div",{className:"chain-node__name",children:[a.jsx("span",{className:"chain-node__label",children:U.name}),U.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),U.needsHuman&&a.jsx("span",{className:"pill pill--amber",children:"人工"}),!U.requiresAgent&&!U.needsHuman&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:U.recipe||"自动处理"}),G&&a.jsxs("div",{className:"chain-node__approve",children:[a.jsxs("button",{type:"button",className:"primary btn-approve",disabled:v!==null,onClick:()=>void I(L.id,"confirm"),children:[a.jsx($,{name:"check",size:13,color:"#fff"})," 确认发送"]}),a.jsxs("button",{type:"button",className:"btn-reject",disabled:v!==null,onClick:()=>void I(L.id,"terminate"),children:[a.jsx($,{name:"close",size:13})," 终止流程"]})]})]})]})]},U.id)})})]}),a.jsxs("div",{className:"run-logs",children:[a.jsxs("div",{className:"run-logs__head",children:[a.jsx($,{name:"file",size:14}),L?"记录执行日志":"真实运行日志",a.jsx("span",{className:"run-logs__sub",children:(L==null?void 0:L.title)??"run"})]}),a.jsx("div",{className:"run-logs__body",children:F.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:L?"等待该记录的执行日志…":"启动后这里会显示服务端 SSE 返回的真实运行日志"}):a.jsx(ea,{initial:!1,children:F.map(U=>{var W;return a.jsxs(Ze.div,{layout:!0,variants:Ct,initial:"hidden",animate:"visible",className:`log-line log-line--${U.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx($,{name:hb[U.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:((W=k.find(G=>G.id===U.stepId))==null?void 0:W.name)??U.stepId}),a.jsx("span",{className:"log-line__text",children:U.text})]})]},U.id)})})})]})]})}return b?!D&&o.length===0?a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"play",size:16}),a.jsx("div",{className:"work-head__title",children:"运行监控"}),a.jsx("div",{className:"work-head__sub",children:"待启动"})]}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"run-intro",children:[a.jsx("div",{className:"run-intro__icon",children:a.jsx($,{name:"play",size:28,color:"#fff"})}),a.jsx("h3",{className:"run-intro__title",children:m?"启动真实工作流":"启动模拟工作流"}),a.jsx("p",{className:"run-intro__desc",children:m?"启动后会连接真实运行服务,监听 AI 表格中的待处理记录,并按当前流程方案执行。":"启动后记录将陆续进入,系统自动执行分类、处理、审核与发送,人工把关环节会等待确认。"}),a.jsxs("button",{type:"button",className:"primary run-intro__cta",onClick:A,children:[a.jsx($,{name:"play",size:15,color:"#fff"}),m?"启动真实运行":"启动模拟运行"]})]})})]})}):a.jsxs("div",{className:"run-stage",children:[a.jsxs("div",{className:"run-board",children:[a.jsxs("div",{className:"run-board__head",children:[a.jsx("span",{children:"工单队列"}),a.jsx("span",{className:"run-board__stat",children:m?D?"1/1 已连接":"0/1 待连接":`${r.arrived}/${r.total} 进入`})]}),a.jsx("div",{className:"run-board__list",children:a.jsx(ea,{initial:!1,children:o.map(C=>{const L=fb[C.status];return a.jsxs(Ze.button,{type:"button",layout:!0,variants:Ct,initial:"hidden",animate:"visible",exit:"exit",className:`ticket-card${C.id===f?" is-selected":""}`,onClick:()=>h(C.id),children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${L.cls}`,children:L.label}),a.jsx("span",{className:"ticket-card__prio",children:C.priority})]}),a.jsx("div",{className:"ticket-card__title",children:C.title}),a.jsxs("div",{className:"ticket-card__meta",children:[C.customer," · ",C.category]}),a.jsxs("div",{className:"ticket-card__progress",children:[C.doneStepIds.length,"/",k.length," 步",!m&&n.isAwaiting(C.id)&&a.jsx("span",{className:"ticket-card__await",children:"待审批"})]})]},C.id)})})}),a.jsxs("div",{className:"run-board__foot",children:["处理中 ",E.running," · 审核中 ",E.review," · 已完成 ",E.done]})]}),a.jsxs("div",{className:"run-flow",children:[a.jsx("div",{className:"run-flow__head",children:M?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"run-flow__title",children:M.title}),a.jsx("div",{className:"run-flow__sub",children:M.customer})]}):a.jsx("div",{className:"run-flow__sub",children:"选择左侧工单查看步骤流转"})}),M&&a.jsx("div",{className:"step-chain",children:k.map((C,L)=>{const F=pb(M,C.id),V=!m&&F==="active"&&C.needsHuman&&n.isAwaiting(M.id);return a.jsxs("div",{className:`chain-node is-${F}`,children:[L>0&&a.jsx("div",{className:`chain-node__line is-${F}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:F==="done"?a.jsx($,{name:"check",size:12,color:"#fff"}):F==="active"?a.jsx("span",{className:"chain-node__pulse"}):a.jsx("span",{className:"chain-node__idle"})}),a.jsxs("div",{className:"chain-node__body",children:[a.jsxs("div",{className:"chain-node__name",children:[a.jsx("span",{className:"chain-node__label",children:C.name}),C.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),C.needsHuman&&a.jsx("span",{className:"pill pill--amber",children:"人工"}),!C.requiresAgent&&!C.needsHuman&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:C.recipe||"自动处理"}),V&&a.jsxs("div",{className:"chain-node__approve",children:[a.jsxs("button",{type:"button",className:"primary btn-approve",onClick:()=>n.approve(M.id),children:[a.jsx($,{name:"check",size:13,color:"#fff"})," 通过"]}),a.jsxs("button",{type:"button",className:"btn-reject",onClick:()=>n.reject(M.id),children:[a.jsx($,{name:"close",size:13})," 驳回"]})]})]})]})]},C.id)})})]}),a.jsxs("div",{className:"run-logs",children:[a.jsxs("div",{className:"run-logs__head",children:[a.jsx($,{name:"file",size:14}),"执行日志",M&&a.jsx("span",{className:"run-logs__sub",children:M.title})]}),a.jsxs("div",{className:"run-logs__body",children:[z.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:M?"等待执行日志…":"选择工单查看日志"}):a.jsx(ea,{initial:!1,children:z.map(C=>{const L=k.find(F=>F.id===C.stepId);return a.jsxs(Ze.div,{layout:!0,variants:Ct,initial:"hidden",animate:"visible",className:`log-line log-line--${C.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx($,{name:hb[C.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:(L==null?void 0:L.name)??C.stepId}),a.jsx("span",{className:"log-line__text",children:C.text})]})]},C.id)})}),a.jsx("div",{ref:T})]})]})]}):a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx($,{name:"play",size:16}),a.jsx("div",{className:"work-head__title",children:"运行监控"}),a.jsx("div",{className:"work-head__sub",children:"未到达"})]}),a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"run-intro",children:[a.jsx("div",{className:"run-intro__icon",children:a.jsx($,{name:"table",size:28,color:"#fff"})}),a.jsx("h3",{className:"run-intro__title",children:"当前流程尚未完成搭建"}),a.jsx("p",{className:"run-intro__desc",children:"运行阶段必须基于当前流程实例已搭建完成的 AI 表格。请先完成搭建阶段,再启动真实运行监听。"}),a.jsxs(Ue,{className:"primary run-intro__cta",to:"../setup",children:[a.jsx($,{name:"chevron-right",size:15,color:"#fff"}),"返回搭建阶段"]})]})})]})})});function _h(e){return{id:`run_preflight_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"run",stepId:"run",level:"error",text:e}}function kq(){return a.jsxs(k2,{children:[a.jsx(ct,{path:"/workbench/group-qa",element:a.jsx(g9,{})}),a.jsxs(ct,{path:"/",element:a.jsx(LD,{}),children:[a.jsx(ct,{index:!0,element:a.jsx(a5,{})}),a.jsx(ct,{path:"account",element:a.jsx(I9,{})}),a.jsx(ct,{path:"engines",element:a.jsx(M9,{})}),a.jsx(ct,{path:"setup",element:a.jsx(G7,{})}),a.jsxs(ct,{path:"p/:projectId",element:a.jsx(j3,{}),children:[a.jsx(ct,{index:!0,element:a.jsx(S3,{})}),a.jsx(ct,{path:"init",element:a.jsx(kK,{})}),a.jsx(ct,{path:"design",element:a.jsx(oq,{})}),a.jsx(ct,{path:"setup",element:a.jsx(uq,{})}),a.jsx(ct,{path:"test",element:a.jsx(hq,{})}),a.jsx(ct,{path:"run",element:a.jsx(Sq,{})})]}),a.jsx(ct,{path:"*",element:a.jsx(XS,{to:"/",replace:!0})})]})]})}function Nq(){return a.jsx(X2,{children:a.jsx(kq,{})})}const Eq=new URLSearchParams(window.location.search).has("token");Eq||w9();TS(document.getElementById("root")).render(a.jsx(Nq,{}));