@fieldwangai/agentflow 0.1.43 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lib/composer-agent.mjs +99 -6
- package/bin/lib/ui-server.mjs +202 -12
- package/builtin/nodes/display_ascii.md +1 -0
- package/builtin/nodes/display_chart.md +1 -1
- package/builtin/nodes/display_html.md +1 -1
- package/builtin/nodes/display_image.md +1 -1
- package/builtin/nodes/display_markdown.md +1 -0
- package/builtin/nodes/display_mermaid.md +1 -0
- package/builtin/nodes/display_table.md +1 -1
- package/builtin/web-ui/dist/assets/index-CcZ_lCII.js +222 -0
- package/builtin/web-ui/dist/assets/index-DLRqQLBo.css +1 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-BCquw8dA.js +0 -218
- package/builtin/web-ui/dist/assets/index-CXO3VpkR.css +0 -1
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
var F2=Object.defineProperty;var z2=(e,t,n)=>t in e?F2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Vn=(e,t,n)=>z2(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 a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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)}})();var Sd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function La(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var N1={exports:{}},jm={},j1={exports:{}},Ot={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var uf=Symbol.for("react.element"),B2=Symbol.for("react.portal"),H2=Symbol.for("react.fragment"),V2=Symbol.for("react.strict_mode"),W2=Symbol.for("react.profiler"),U2=Symbol.for("react.provider"),K2=Symbol.for("react.context"),q2=Symbol.for("react.forward_ref"),Y2=Symbol.for("react.suspense"),G2=Symbol.for("react.memo"),X2=Symbol.for("react.lazy"),h0=Symbol.iterator;function J2(e){return e===null||typeof e!="object"?null:(e=h0&&e[h0]||e["@@iterator"],typeof e=="function"?e:null)}var C1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E1=Object.assign,_1={};function nu(e,t,n){this.props=e,this.context=t,this.refs=_1,this.updater=n||C1}nu.prototype.isReactComponent={};nu.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")};nu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function P1(){}P1.prototype=nu.prototype;function Uw(e,t,n){this.props=e,this.context=t,this.refs=_1,this.updater=n||C1}var Kw=Uw.prototype=new P1;Kw.constructor=Uw;E1(Kw,nu.prototype);Kw.isPureReactComponent=!0;var m0=Array.isArray,A1=Object.prototype.hasOwnProperty,qw={current:null},I1={key:!0,ref:!0,__self:!0,__source:!0};function T1(e,t,n){var r,s={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)A1.call(t,r)&&!I1.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),d=0;d<l;d++)c[d]=arguments[d+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:uf,type:e,key:i,ref:a,props:s,_owner:qw.current}}function Q2(e,t){return{$$typeof:uf,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Yw(e){return typeof e=="object"&&e!==null&&e.$$typeof===uf}function Z2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var g0=/\/+/g;function Tg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Z2(""+e.key):t.toString(36)}function Gp(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case uf:case B2:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+Tg(a,0):r,m0(s)?(n="",e!=null&&(n=e.replace(g0,"$&/")+"/"),Gp(s,t,n,"",function(d){return d})):s!=null&&(Yw(s)&&(s=Q2(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(g0,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",m0(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Tg(i,l);a+=Gp(i,t,n,c,s)}else if(c=J2(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Tg(i,l++),a+=Gp(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 a}function sp(e,t,n){if(e==null)return e;var r=[],s=0;return Gp(e,r,"","",function(i){return t.call(n,i,s++)}),r}function eR(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 Kr={current:null},Xp={transition:null},tR={ReactCurrentDispatcher:Kr,ReactCurrentBatchConfig:Xp,ReactCurrentOwner:qw};function R1(){throw Error("act(...) is not supported in production builds of React.")}Ot.Children={map:sp,forEach:function(e,t,n){sp(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return sp(e,function(){t++}),t},toArray:function(e){return sp(e,function(t){return t})||[]},only:function(e){if(!Yw(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ot.Component=nu;Ot.Fragment=H2;Ot.Profiler=W2;Ot.PureComponent=Uw;Ot.StrictMode=V2;Ot.Suspense=Y2;Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tR;Ot.act=R1;Ot.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=E1({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=qw.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)A1.call(t,c)&&!I1.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 d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:uf,type:e.type,key:s,ref:i,props:r,_owner:a}};Ot.createContext=function(e){return e={$$typeof:K2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:U2,_context:e},e.Consumer=e};Ot.createElement=T1;Ot.createFactory=function(e){var t=T1.bind(null,e);return t.type=e,t};Ot.createRef=function(){return{current:null}};Ot.forwardRef=function(e){return{$$typeof:q2,render:e}};Ot.isValidElement=Yw;Ot.lazy=function(e){return{$$typeof:X2,_payload:{_status:-1,_result:e},_init:eR}};Ot.memo=function(e,t){return{$$typeof:G2,type:e,compare:t===void 0?null:t}};Ot.startTransition=function(e){var t=Xp.transition;Xp.transition={};try{e()}finally{Xp.transition=t}};Ot.unstable_act=R1;Ot.useCallback=function(e,t){return Kr.current.useCallback(e,t)};Ot.useContext=function(e){return Kr.current.useContext(e)};Ot.useDebugValue=function(){};Ot.useDeferredValue=function(e){return Kr.current.useDeferredValue(e)};Ot.useEffect=function(e,t){return Kr.current.useEffect(e,t)};Ot.useId=function(){return Kr.current.useId()};Ot.useImperativeHandle=function(e,t,n){return Kr.current.useImperativeHandle(e,t,n)};Ot.useInsertionEffect=function(e,t){return Kr.current.useInsertionEffect(e,t)};Ot.useLayoutEffect=function(e,t){return Kr.current.useLayoutEffect(e,t)};Ot.useMemo=function(e,t){return Kr.current.useMemo(e,t)};Ot.useReducer=function(e,t,n){return Kr.current.useReducer(e,t,n)};Ot.useRef=function(e){return Kr.current.useRef(e)};Ot.useState=function(e){return Kr.current.useState(e)};Ot.useSyncExternalStore=function(e,t,n){return Kr.current.useSyncExternalStore(e,t,n)};Ot.useTransition=function(){return Kr.current.useTransition()};Ot.version="18.3.1";j1.exports=Ot;var m=j1.exports;const nt=La(m);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var nR=m,rR=Symbol.for("react.element"),sR=Symbol.for("react.fragment"),iR=Object.prototype.hasOwnProperty,oR=nR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,aR={key:!0,ref:!0,__self:!0,__source:!0};function L1(e,t,n){var r,s={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)iR.call(t,r)&&!aR.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:rR,type:e,key:i,ref:a,props:s,_owner:oR.current}}jm.Fragment=sR;jm.jsx=L1;jm.jsxs=L1;N1.exports=jm;var o=N1.exports,Qy={},O1={exports:{}},Is={},M1={exports:{}},$1={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(P,O){var _=P.length;P.push(O);e:for(;0<_;){var Y=_-1>>>1,Q=P[Y];if(0<s(Q,O))P[Y]=O,P[_]=Q,_=Y;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var O=P[0],_=P.pop();if(_!==O){P[0]=_;e:for(var Y=0,Q=P.length,K=Q>>>1;Y<K;){var ie=2*(Y+1)-1,fe=P[ie],ye=ie+1,we=P[ye];if(0>s(fe,_))ye<Q&&0>s(we,fe)?(P[Y]=we,P[ye]=_,Y=ye):(P[Y]=fe,P[ie]=_,Y=ie);else if(ye<Q&&0>s(we,_))P[Y]=we,P[ye]=_,Y=ye;else break e}}return O}function s(P,O){var _=P.sortIndex-O.sortIndex;return _!==0?_:P.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],d=[],f=1,u=null,p=3,h=!1,g=!1,v=!1,k=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(P){for(var O=n(d);O!==null;){if(O.callback===null)r(d);else if(O.startTime<=P)r(d),O.sortIndex=O.expirationTime,t(c,O);else break;O=n(d)}}function N(P){if(v=!1,w(P),!g)if(n(c)!==null)g=!0,I(C);else{var O=n(d);O!==null&&B(N,O.startTime-P)}}function C(P,O){g=!1,v&&(v=!1,y($),$=-1),h=!0;var _=p;try{for(w(O),u=n(c);u!==null&&(!(u.expirationTime>O)||P&&!A());){var Y=u.callback;if(typeof Y=="function"){u.callback=null,p=u.priorityLevel;var Q=Y(u.expirationTime<=O);O=e.unstable_now(),typeof Q=="function"?u.callback=Q:u===n(c)&&r(c),w(O)}else r(c);u=n(c)}if(u!==null)var K=!0;else{var ie=n(d);ie!==null&&B(N,ie.startTime-O),K=!1}return K}finally{u=null,p=_,h=!1}}var j=!1,T=null,$=-1,L=5,F=-1;function A(){return!(e.unstable_now()-F<L)}function R(){if(T!==null){var P=e.unstable_now();F=P;var O=!0;try{O=T(!0,P)}finally{O?V():(j=!1,T=null)}}else j=!1}var V;if(typeof b=="function")V=function(){b(R)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,D=M.port2;M.port1.onmessage=R,V=function(){D.postMessage(null)}}else V=function(){k(R,0)};function I(P){T=P,j||(j=!0,V())}function B(P,O){$=k(function(){P(e.unstable_now())},O)}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(P){P.callback=null},e.unstable_continueExecution=function(){g||h||(g=!0,I(C))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(P){switch(p){case 1:case 2:case 3:var O=3;break;default:O=p}var _=p;p=O;try{return P()}finally{p=_}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,O){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var _=p;p=P;try{return O()}finally{p=_}},e.unstable_scheduleCallback=function(P,O,_){var Y=e.unstable_now();switch(typeof _=="object"&&_!==null?(_=_.delay,_=typeof _=="number"&&0<_?Y+_:Y):_=Y,P){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=_+Q,P={id:f++,callback:O,priorityLevel:P,startTime:_,expirationTime:Q,sortIndex:-1},_>Y?(P.sortIndex=_,t(d,P),n(c)===null&&P===n(d)&&(v?(y($),$=-1):v=!0,B(N,_-Y))):(P.sortIndex=Q,t(c,P),g||h||(g=!0,I(C))),P},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(P){var O=p;return function(){var _=p;p=O;try{return P.apply(this,arguments)}finally{p=_}}}})($1);M1.exports=$1;var lR=M1.exports;/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var cR=m,Ps=lR;function ke(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 D1=new Set,Nd={};function _l(e,t){Oc(e,t),Oc(e+"Capture",t)}function Oc(e,t){for(Nd[e]=t,e=0;e<t.length;e++)D1.add(t[e])}var Ao=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zy=Object.prototype.hasOwnProperty,uR=/^[: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]*$/,y0={},x0={};function dR(e){return Zy.call(x0,e)?!0:Zy.call(y0,e)?!1:uR.test(e)?x0[e]=!0:(y0[e]=!0,!1)}function fR(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 pR(e,t,n,r){if(t===null||typeof t>"u"||fR(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 qr(e,t,n,r,s,i,a){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=a}var Er={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Er[e]=new qr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Er[t]=new qr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Er[e]=new qr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Er[e]=new qr(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){Er[e]=new qr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Er[e]=new qr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Er[e]=new qr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Er[e]=new qr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Er[e]=new qr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Gw=/[\-:]([a-z])/g;function Xw(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(Gw,Xw);Er[t]=new qr(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(Gw,Xw);Er[t]=new qr(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(Gw,Xw);Er[t]=new qr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Er[e]=new qr(e,1,!1,e.toLowerCase(),null,!1,!1)});Er.xlinkHref=new qr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Er[e]=new qr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Jw(e,t,n,r){var s=Er.hasOwnProperty(t)?Er[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(pR(t,n,s,r)&&(n=null),r||s===null?dR(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 $o=cR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ip=Symbol.for("react.element"),oc=Symbol.for("react.portal"),ac=Symbol.for("react.fragment"),Qw=Symbol.for("react.strict_mode"),ex=Symbol.for("react.profiler"),F1=Symbol.for("react.provider"),z1=Symbol.for("react.context"),Zw=Symbol.for("react.forward_ref"),tx=Symbol.for("react.suspense"),nx=Symbol.for("react.suspense_list"),eb=Symbol.for("react.memo"),ia=Symbol.for("react.lazy"),B1=Symbol.for("react.offscreen"),w0=Symbol.iterator;function Pu(e){return e===null||typeof e!="object"?null:(e=w0&&e[w0]||e["@@iterator"],typeof e=="function"?e:null)}var $n=Object.assign,Rg;function qu(e){if(Rg===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rg=t&&t[1]||""}return`
|
|
34
|
-
`+Rg+e}var Lg=!1;function Og(e,t){if(!e||Lg)return"";Lg=!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(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var s=d.stack.split(`
|
|
35
|
-
`),i=r.stack.split(`
|
|
36
|
-
`),a=s.length-1,l=i.length-1;1<=a&&0<=l&&s[a]!==i[l];)l--;for(;1<=a&&0<=l;a--,l--)if(s[a]!==i[l]){if(a!==1||l!==1)do if(a--,l--,0>l||s[a]!==i[l]){var c=`
|
|
37
|
-
`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{Lg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?qu(e):""}function hR(e){switch(e.tag){case 5:return qu(e.type);case 16:return qu("Lazy");case 13:return qu("Suspense");case 19:return qu("SuspenseList");case 0:case 2:case 15:return e=Og(e.type,!1),e;case 11:return e=Og(e.type.render,!1),e;case 1:return e=Og(e.type,!0),e;default:return""}}function rx(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 ac:return"Fragment";case oc:return"Portal";case ex:return"Profiler";case Qw:return"StrictMode";case tx:return"Suspense";case nx:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case z1:return(e.displayName||"Context")+".Consumer";case F1:return(e._context.displayName||"Context")+".Provider";case Zw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case eb:return t=e.displayName||null,t!==null?t:rx(e.type)||"Memo";case ia:t=e._payload,e=e._init;try{return rx(e(t))}catch{}}return null}function mR(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 rx(t);case 8:return t===Qw?"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 Ea(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function H1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function gR(e){var t=H1(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(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function op(e){e._valueTracker||(e._valueTracker=gR(e))}function V1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=H1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function wh(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 sx(e,t){var n=t.checked;return $n({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function b0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ea(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 W1(e,t){t=t.checked,t!=null&&Jw(e,"checked",t,!1)}function ix(e,t){W1(e,t);var n=Ea(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")?ox(e,t.type,n):t.hasOwnProperty("defaultValue")&&ox(e,t.type,Ea(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function v0(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 ox(e,t,n){(t!=="number"||wh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Yu=Array.isArray;function Nc(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=""+Ea(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 ax(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ke(91));return $n({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function k0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ke(92));if(Yu(n)){if(1<n.length)throw Error(ke(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ea(n)}}function U1(e,t){var n=Ea(t.value),r=Ea(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 S0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function K1(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 lx(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?K1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ap,q1=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(ap=ap||document.createElement("div"),ap.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ap.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var sd={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},yR=["Webkit","ms","Moz","O"];Object.keys(sd).forEach(function(e){yR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),sd[t]=sd[e]})});function Y1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||sd.hasOwnProperty(e)&&sd[e]?(""+t).trim():t+"px"}function G1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Y1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var xR=$n({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 cx(e,t){if(t){if(xR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ke(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ke(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ke(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ke(62))}}function ux(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 dx=null;function tb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fx=null,jc=null,Cc=null;function N0(e){if(e=pf(e)){if(typeof fx!="function")throw Error(ke(280));var t=e.stateNode;t&&(t=Am(t),fx(e.stateNode,e.type,t))}}function X1(e){jc?Cc?Cc.push(e):Cc=[e]:jc=e}function J1(){if(jc){var e=jc,t=Cc;if(Cc=jc=null,N0(e),t)for(e=0;e<t.length;e++)N0(t[e])}}function Q1(e,t){return e(t)}function Z1(){}var Mg=!1;function eC(e,t,n){if(Mg)return e(t,n);Mg=!0;try{return Q1(e,t,n)}finally{Mg=!1,(jc!==null||Cc!==null)&&(Z1(),J1())}}function Cd(e,t){var n=e.stateNode;if(n===null)return null;var r=Am(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(ke(231,t,typeof n));return n}var px=!1;if(Ao)try{var Au={};Object.defineProperty(Au,"passive",{get:function(){px=!0}}),window.addEventListener("test",Au,Au),window.removeEventListener("test",Au,Au)}catch{px=!1}function wR(e,t,n,r,s,i,a,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(f){this.onError(f)}}var id=!1,bh=null,vh=!1,hx=null,bR={onError:function(e){id=!0,bh=e}};function vR(e,t,n,r,s,i,a,l,c){id=!1,bh=null,wR.apply(bR,arguments)}function kR(e,t,n,r,s,i,a,l,c){if(vR.apply(this,arguments),id){if(id){var d=bh;id=!1,bh=null}else throw Error(ke(198));vh||(vh=!0,hx=d)}}function Pl(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 tC(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 j0(e){if(Pl(e)!==e)throw Error(ke(188))}function SR(e){var t=e.alternate;if(!t){if(t=Pl(e),t===null)throw Error(ke(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 j0(s),e;if(i===r)return j0(s),t;i=i.sibling}throw Error(ke(188))}if(n.return!==r.return)n=s,r=i;else{for(var a=!1,l=s.child;l;){if(l===n){a=!0,n=s,r=i;break}if(l===r){a=!0,r=s,n=i;break}l=l.sibling}if(!a){for(l=i.child;l;){if(l===n){a=!0,n=i,r=s;break}if(l===r){a=!0,r=i,n=s;break}l=l.sibling}if(!a)throw Error(ke(189))}}if(n.alternate!==r)throw Error(ke(190))}if(n.tag!==3)throw Error(ke(188));return n.stateNode.current===n?e:t}function nC(e){return e=SR(e),e!==null?rC(e):null}function rC(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=rC(e);if(t!==null)return t;e=e.sibling}return null}var sC=Ps.unstable_scheduleCallback,C0=Ps.unstable_cancelCallback,NR=Ps.unstable_shouldYield,jR=Ps.unstable_requestPaint,Xn=Ps.unstable_now,CR=Ps.unstable_getCurrentPriorityLevel,nb=Ps.unstable_ImmediatePriority,iC=Ps.unstable_UserBlockingPriority,kh=Ps.unstable_NormalPriority,ER=Ps.unstable_LowPriority,oC=Ps.unstable_IdlePriority,Cm=null,Yi=null;function _R(e){if(Yi&&typeof Yi.onCommitFiberRoot=="function")try{Yi.onCommitFiberRoot(Cm,e,void 0,(e.current.flags&128)===128)}catch{}}var xi=Math.clz32?Math.clz32:IR,PR=Math.log,AR=Math.LN2;function IR(e){return e>>>=0,e===0?32:31-(PR(e)/AR|0)|0}var lp=64,cp=4194304;function Gu(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 Sh(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~s;l!==0?r=Gu(l):(i&=a,i!==0&&(r=Gu(i)))}else a=n&~s,a!==0?r=Gu(a):i!==0&&(r=Gu(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-xi(t),s=1<<n,r|=e[n],t&=~s;return r}function TR(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 RR(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-xi(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=TR(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function mx(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function aC(){var e=lp;return lp<<=1,!(lp&4194240)&&(lp=64),e}function $g(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function df(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-xi(t),e[t]=n}function LR(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-xi(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function rb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-xi(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Zt=0;function lC(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var cC,sb,uC,dC,fC,gx=!1,up=[],ma=null,ga=null,ya=null,Ed=new Map,_d=new Map,la=[],OR="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 E0(e,t){switch(e){case"focusin":case"focusout":ma=null;break;case"dragenter":case"dragleave":ga=null;break;case"mouseover":case"mouseout":ya=null;break;case"pointerover":case"pointerout":Ed.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_d.delete(t.pointerId)}}function Iu(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=pf(t),t!==null&&sb(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function MR(e,t,n,r,s){switch(t){case"focusin":return ma=Iu(ma,e,t,n,r,s),!0;case"dragenter":return ga=Iu(ga,e,t,n,r,s),!0;case"mouseover":return ya=Iu(ya,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Ed.set(i,Iu(Ed.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,_d.set(i,Iu(_d.get(i)||null,e,t,n,r,s)),!0}return!1}function pC(e){var t=al(e.target);if(t!==null){var n=Pl(t);if(n!==null){if(t=n.tag,t===13){if(t=tC(n),t!==null){e.blockedOn=t,fC(e.priority,function(){uC(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 Jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=yx(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);dx=r,n.target.dispatchEvent(r),dx=null}else return t=pf(n),t!==null&&sb(t),e.blockedOn=n,!1;t.shift()}return!0}function _0(e,t,n){Jp(e)&&n.delete(t)}function $R(){gx=!1,ma!==null&&Jp(ma)&&(ma=null),ga!==null&&Jp(ga)&&(ga=null),ya!==null&&Jp(ya)&&(ya=null),Ed.forEach(_0),_d.forEach(_0)}function Tu(e,t){e.blockedOn===t&&(e.blockedOn=null,gx||(gx=!0,Ps.unstable_scheduleCallback(Ps.unstable_NormalPriority,$R)))}function Pd(e){function t(s){return Tu(s,e)}if(0<up.length){Tu(up[0],e);for(var n=1;n<up.length;n++){var r=up[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ma!==null&&Tu(ma,e),ga!==null&&Tu(ga,e),ya!==null&&Tu(ya,e),Ed.forEach(t),_d.forEach(t),n=0;n<la.length;n++)r=la[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<la.length&&(n=la[0],n.blockedOn===null);)pC(n),n.blockedOn===null&&la.shift()}var Ec=$o.ReactCurrentBatchConfig,Nh=!0;function DR(e,t,n,r){var s=Zt,i=Ec.transition;Ec.transition=null;try{Zt=1,ib(e,t,n,r)}finally{Zt=s,Ec.transition=i}}function FR(e,t,n,r){var s=Zt,i=Ec.transition;Ec.transition=null;try{Zt=4,ib(e,t,n,r)}finally{Zt=s,Ec.transition=i}}function ib(e,t,n,r){if(Nh){var s=yx(e,t,n,r);if(s===null)qg(e,t,r,jh,n),E0(e,r);else if(MR(s,e,t,n,r))r.stopPropagation();else if(E0(e,r),t&4&&-1<OR.indexOf(e)){for(;s!==null;){var i=pf(s);if(i!==null&&cC(i),i=yx(e,t,n,r),i===null&&qg(e,t,r,jh,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else qg(e,t,r,null,n)}}var jh=null;function yx(e,t,n,r){if(jh=null,e=tb(r),e=al(e),e!==null)if(t=Pl(e),t===null)e=null;else if(n=t.tag,n===13){if(e=tC(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 jh=e,null}function hC(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(CR()){case nb:return 1;case iC:return 4;case kh:case ER:return 16;case oC:return 536870912;default:return 16}default:return 16}}var da=null,ob=null,Qp=null;function mC(){if(Qp)return Qp;var e,t=ob,n=t.length,r,s="value"in da?da.value:da.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===s[i-r];r++);return Qp=s.slice(e,1<r?1-r:void 0)}function Zp(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 dp(){return!0}function P0(){return!1}function Ts(e){function t(n,r,s,i,a){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=a,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)?dp:P0,this.isPropagationStopped=P0,this}return $n(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=dp)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=dp)},persist:function(){},isPersistent:dp}),t}var ru={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ab=Ts(ru),ff=$n({},ru,{view:0,detail:0}),zR=Ts(ff),Dg,Fg,Ru,Em=$n({},ff,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lb,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!==Ru&&(Ru&&e.type==="mousemove"?(Dg=e.screenX-Ru.screenX,Fg=e.screenY-Ru.screenY):Fg=Dg=0,Ru=e),Dg)},movementY:function(e){return"movementY"in e?e.movementY:Fg}}),A0=Ts(Em),BR=$n({},Em,{dataTransfer:0}),HR=Ts(BR),VR=$n({},ff,{relatedTarget:0}),zg=Ts(VR),WR=$n({},ru,{animationName:0,elapsedTime:0,pseudoElement:0}),UR=Ts(WR),KR=$n({},ru,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qR=Ts(KR),YR=$n({},ru,{data:0}),I0=Ts(YR),GR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},XR={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"},JR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function QR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=JR[e])?!!t[e]:!1}function lb(){return QR}var ZR=$n({},ff,{key:function(e){if(e.key){var t=GR[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Zp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?XR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lb,charCode:function(e){return e.type==="keypress"?Zp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Zp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),eL=Ts(ZR),tL=$n({},Em,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),T0=Ts(tL),nL=$n({},ff,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lb}),rL=Ts(nL),sL=$n({},ru,{propertyName:0,elapsedTime:0,pseudoElement:0}),iL=Ts(sL),oL=$n({},Em,{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}),aL=Ts(oL),lL=[9,13,27,32],cb=Ao&&"CompositionEvent"in window,od=null;Ao&&"documentMode"in document&&(od=document.documentMode);var cL=Ao&&"TextEvent"in window&&!od,gC=Ao&&(!cb||od&&8<od&&11>=od),R0=" ",L0=!1;function yC(e,t){switch(e){case"keyup":return lL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var lc=!1;function uL(e,t){switch(e){case"compositionend":return xC(t);case"keypress":return t.which!==32?null:(L0=!0,R0);case"textInput":return e=t.data,e===R0&&L0?null:e;default:return null}}function dL(e,t){if(lc)return e==="compositionend"||!cb&&yC(e,t)?(e=mC(),Qp=ob=da=null,lc=!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 gC&&t.locale!=="ko"?null:t.data;default:return null}}var fL={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 O0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!fL[e.type]:t==="textarea"}function wC(e,t,n,r){X1(r),t=Ch(t,"onChange"),0<t.length&&(n=new ab("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var ad=null,Ad=null;function pL(e){AC(e,0)}function _m(e){var t=dc(e);if(V1(t))return e}function hL(e,t){if(e==="change")return t}var bC=!1;if(Ao){var Bg;if(Ao){var Hg="oninput"in document;if(!Hg){var M0=document.createElement("div");M0.setAttribute("oninput","return;"),Hg=typeof M0.oninput=="function"}Bg=Hg}else Bg=!1;bC=Bg&&(!document.documentMode||9<document.documentMode)}function $0(){ad&&(ad.detachEvent("onpropertychange",vC),Ad=ad=null)}function vC(e){if(e.propertyName==="value"&&_m(Ad)){var t=[];wC(t,Ad,e,tb(e)),eC(pL,t)}}function mL(e,t,n){e==="focusin"?($0(),ad=t,Ad=n,ad.attachEvent("onpropertychange",vC)):e==="focusout"&&$0()}function gL(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _m(Ad)}function yL(e,t){if(e==="click")return _m(t)}function xL(e,t){if(e==="input"||e==="change")return _m(t)}function wL(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bi=typeof Object.is=="function"?Object.is:wL;function Id(e,t){if(bi(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(!Zy.call(t,s)||!bi(e[s],t[s]))return!1}return!0}function D0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function F0(e,t){var n=D0(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=D0(n)}}function kC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function SC(){for(var e=window,t=wh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=wh(e.document)}return t}function ub(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 bL(e){var t=SC(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&kC(n.ownerDocument.documentElement,n)){if(r!==null&&ub(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=F0(n,i);var a=F0(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.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 vL=Ao&&"documentMode"in document&&11>=document.documentMode,cc=null,xx=null,ld=null,wx=!1;function z0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wx||cc==null||cc!==wh(r)||(r=cc,"selectionStart"in r&&ub(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}),ld&&Id(ld,r)||(ld=r,r=Ch(xx,"onSelect"),0<r.length&&(t=new ab("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=cc)))}function fp(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var uc={animationend:fp("Animation","AnimationEnd"),animationiteration:fp("Animation","AnimationIteration"),animationstart:fp("Animation","AnimationStart"),transitionend:fp("Transition","TransitionEnd")},Vg={},NC={};Ao&&(NC=document.createElement("div").style,"AnimationEvent"in window||(delete uc.animationend.animation,delete uc.animationiteration.animation,delete uc.animationstart.animation),"TransitionEvent"in window||delete uc.transitionend.transition);function Pm(e){if(Vg[e])return Vg[e];if(!uc[e])return e;var t=uc[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in NC)return Vg[e]=t[n];return e}var jC=Pm("animationend"),CC=Pm("animationiteration"),EC=Pm("animationstart"),_C=Pm("transitionend"),PC=new Map,B0="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 Oa(e,t){PC.set(e,t),_l(t,[e])}for(var Wg=0;Wg<B0.length;Wg++){var Ug=B0[Wg],kL=Ug.toLowerCase(),SL=Ug[0].toUpperCase()+Ug.slice(1);Oa(kL,"on"+SL)}Oa(jC,"onAnimationEnd");Oa(CC,"onAnimationIteration");Oa(EC,"onAnimationStart");Oa("dblclick","onDoubleClick");Oa("focusin","onFocus");Oa("focusout","onBlur");Oa(_C,"onTransitionEnd");Oc("onMouseEnter",["mouseout","mouseover"]);Oc("onMouseLeave",["mouseout","mouseover"]);Oc("onPointerEnter",["pointerout","pointerover"]);Oc("onPointerLeave",["pointerout","pointerover"]);_l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));_l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));_l("onBeforeInput",["compositionend","keypress","textInput","paste"]);_l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));_l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));_l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xu="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(" "),NL=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xu));function H0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,kR(r,t,void 0,e),e.currentTarget=null}function AC(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 a=r.length-1;0<=a;a--){var l=r[a],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;H0(s,l,d),i=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,d=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;H0(s,l,d),i=c}}}if(vh)throw e=hx,vh=!1,hx=null,e}function bn(e,t){var n=t[Nx];n===void 0&&(n=t[Nx]=new Set);var r=e+"__bubble";n.has(r)||(IC(t,e,2,!1),n.add(r))}function Kg(e,t,n){var r=0;t&&(r|=4),IC(n,e,r,t)}var pp="_reactListening"+Math.random().toString(36).slice(2);function Td(e){if(!e[pp]){e[pp]=!0,D1.forEach(function(n){n!=="selectionchange"&&(NL.has(n)||Kg(n,!1,e),Kg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[pp]||(t[pp]=!0,Kg("selectionchange",!1,t))}}function IC(e,t,n,r){switch(hC(t)){case 1:var s=DR;break;case 4:s=FR;break;default:s=ib}n=s.bind(null,t,n,e),s=void 0,!px||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 qg(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;l!==null;){if(a=al(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}eC(function(){var d=i,f=tb(n),u=[];e:{var p=PC.get(e);if(p!==void 0){var h=ab,g=e;switch(e){case"keypress":if(Zp(n)===0)break e;case"keydown":case"keyup":h=eL;break;case"focusin":g="focus",h=zg;break;case"focusout":g="blur",h=zg;break;case"beforeblur":case"afterblur":h=zg;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":h=A0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=HR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=rL;break;case jC:case CC:case EC:h=UR;break;case _C:h=iL;break;case"scroll":h=zR;break;case"wheel":h=aL;break;case"copy":case"cut":case"paste":h=qR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=T0}var v=(t&4)!==0,k=!v&&e==="scroll",y=v?p!==null?p+"Capture":null:p;v=[];for(var b=d,w;b!==null;){w=b;var N=w.stateNode;if(w.tag===5&&N!==null&&(w=N,y!==null&&(N=Cd(b,y),N!=null&&v.push(Rd(b,N,w)))),k)break;b=b.return}0<v.length&&(p=new h(p,g,null,n,f),u.push({event:p,listeners:v}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==dx&&(g=n.relatedTarget||n.fromElement)&&(al(g)||g[Io]))break e;if((h||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=d,g=g?al(g):null,g!==null&&(k=Pl(g),g!==k||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=d),h!==g)){if(v=A0,N="onMouseLeave",y="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(v=T0,N="onPointerLeave",y="onPointerEnter",b="pointer"),k=h==null?p:dc(h),w=g==null?p:dc(g),p=new v(N,b+"leave",h,n,f),p.target=k,p.relatedTarget=w,N=null,al(f)===d&&(v=new v(y,b+"enter",g,n,f),v.target=w,v.relatedTarget=k,N=v),k=N,h&&g)t:{for(v=h,y=g,b=0,w=v;w;w=Gl(w))b++;for(w=0,N=y;N;N=Gl(N))w++;for(;0<b-w;)v=Gl(v),b--;for(;0<w-b;)y=Gl(y),w--;for(;b--;){if(v===y||y!==null&&v===y.alternate)break t;v=Gl(v),y=Gl(y)}v=null}else v=null;h!==null&&V0(u,p,h,v,!1),g!==null&&k!==null&&V0(u,k,g,v,!0)}}e:{if(p=d?dc(d):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var C=hL;else if(O0(p))if(bC)C=xL;else{C=gL;var j=mL}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=yL);if(C&&(C=C(e,d))){wC(u,C,n,f);break e}j&&j(e,p,d),e==="focusout"&&(j=p._wrapperState)&&j.controlled&&p.type==="number"&&ox(p,"number",p.value)}switch(j=d?dc(d):window,e){case"focusin":(O0(j)||j.contentEditable==="true")&&(cc=j,xx=d,ld=null);break;case"focusout":ld=xx=cc=null;break;case"mousedown":wx=!0;break;case"contextmenu":case"mouseup":case"dragend":wx=!1,z0(u,n,f);break;case"selectionchange":if(vL)break;case"keydown":case"keyup":z0(u,n,f)}var T;if(cb)e:{switch(e){case"compositionstart":var $="onCompositionStart";break e;case"compositionend":$="onCompositionEnd";break e;case"compositionupdate":$="onCompositionUpdate";break e}$=void 0}else lc?yC(e,n)&&($="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&($="onCompositionStart");$&&(gC&&n.locale!=="ko"&&(lc||$!=="onCompositionStart"?$==="onCompositionEnd"&&lc&&(T=mC()):(da=f,ob="value"in da?da.value:da.textContent,lc=!0)),j=Ch(d,$),0<j.length&&($=new I0($,e,null,n,f),u.push({event:$,listeners:j}),T?$.data=T:(T=xC(n),T!==null&&($.data=T)))),(T=cL?uL(e,n):dL(e,n))&&(d=Ch(d,"onBeforeInput"),0<d.length&&(f=new I0("onBeforeInput","beforeinput",null,n,f),u.push({event:f,listeners:d}),f.data=T))}AC(u,t)})}function Rd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ch(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Cd(e,n),i!=null&&r.unshift(Rd(e,i,s)),i=Cd(e,t),i!=null&&r.push(Rd(e,i,s))),e=e.return}return r}function Gl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function V0(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,s?(c=Cd(n,i),c!=null&&a.unshift(Rd(n,c,l))):s||(c=Cd(n,i),c!=null&&a.push(Rd(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var jL=/\r\n?/g,CL=/\u0000|\uFFFD/g;function W0(e){return(typeof e=="string"?e:""+e).replace(jL,`
|
|
38
|
-
`).replace(CL,"")}function hp(e,t,n){if(t=W0(t),W0(e)!==t&&n)throw Error(ke(425))}function Eh(){}var bx=null,vx=null;function kx(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 Sx=typeof setTimeout=="function"?setTimeout:void 0,EL=typeof clearTimeout=="function"?clearTimeout:void 0,U0=typeof Promise=="function"?Promise:void 0,_L=typeof queueMicrotask=="function"?queueMicrotask:typeof U0<"u"?function(e){return U0.resolve(null).then(e).catch(PL)}:Sx;function PL(e){setTimeout(function(){throw e})}function Yg(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),Pd(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Pd(t)}function xa(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 K0(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 su=Math.random().toString(36).slice(2),Wi="__reactFiber$"+su,Ld="__reactProps$"+su,Io="__reactContainer$"+su,Nx="__reactEvents$"+su,AL="__reactListeners$"+su,IL="__reactHandles$"+su;function al(e){var t=e[Wi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Io]||n[Wi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=K0(e);e!==null;){if(n=e[Wi])return n;e=K0(e)}return t}e=n,n=e.parentNode}return null}function pf(e){return e=e[Wi]||e[Io],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function dc(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ke(33))}function Am(e){return e[Ld]||null}var jx=[],fc=-1;function Ma(e){return{current:e}}function kn(e){0>fc||(e.current=jx[fc],jx[fc]=null,fc--)}function fn(e,t){fc++,jx[fc]=e.current,e.current=t}var _a={},Mr=Ma(_a),as=Ma(!1),yl=_a;function Mc(e,t){var n=e.type.contextTypes;if(!n)return _a;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 ls(e){return e=e.childContextTypes,e!=null}function _h(){kn(as),kn(Mr)}function q0(e,t,n){if(Mr.current!==_a)throw Error(ke(168));fn(Mr,t),fn(as,n)}function TC(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(ke(108,mR(e)||"Unknown",s));return $n({},n,r)}function Ph(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_a,yl=Mr.current,fn(Mr,e),fn(as,as.current),!0}function Y0(e,t,n){var r=e.stateNode;if(!r)throw Error(ke(169));n?(e=TC(e,t,yl),r.__reactInternalMemoizedMergedChildContext=e,kn(as),kn(Mr),fn(Mr,e)):kn(as),fn(as,n)}var vo=null,Im=!1,Gg=!1;function RC(e){vo===null?vo=[e]:vo.push(e)}function TL(e){Im=!0,RC(e)}function $a(){if(!Gg&&vo!==null){Gg=!0;var e=0,t=Zt;try{var n=vo;for(Zt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}vo=null,Im=!1}catch(s){throw vo!==null&&(vo=vo.slice(e+1)),sC(nb,$a),s}finally{Zt=t,Gg=!1}}return null}var pc=[],hc=0,Ah=null,Ih=0,Ws=[],Us=0,xl=null,No=1,jo="";function nl(e,t){pc[hc++]=Ih,pc[hc++]=Ah,Ah=e,Ih=t}function LC(e,t,n){Ws[Us++]=No,Ws[Us++]=jo,Ws[Us++]=xl,xl=e;var r=No;e=jo;var s=32-xi(r)-1;r&=~(1<<s),n+=1;var i=32-xi(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,No=1<<32-xi(t)+s|n<<s|r,jo=i+e}else No=1<<i|n<<s|r,jo=e}function db(e){e.return!==null&&(nl(e,1),LC(e,1,0))}function fb(e){for(;e===Ah;)Ah=pc[--hc],pc[hc]=null,Ih=pc[--hc],pc[hc]=null;for(;e===xl;)xl=Ws[--Us],Ws[Us]=null,jo=Ws[--Us],Ws[Us]=null,No=Ws[--Us],Ws[Us]=null}var Es=null,js=null,En=!1,pi=null;function OC(e,t){var n=Ys(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 G0(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,Es=e,js=xa(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Es=e,js=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=xl!==null?{id:No,overflow:jo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ys(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Es=e,js=null,!0):!1;default:return!1}}function Cx(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ex(e){if(En){var t=js;if(t){var n=t;if(!G0(e,t)){if(Cx(e))throw Error(ke(418));t=xa(n.nextSibling);var r=Es;t&&G0(e,t)?OC(r,n):(e.flags=e.flags&-4097|2,En=!1,Es=e)}}else{if(Cx(e))throw Error(ke(418));e.flags=e.flags&-4097|2,En=!1,Es=e}}}function X0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Es=e}function mp(e){if(e!==Es)return!1;if(!En)return X0(e),En=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!kx(e.type,e.memoizedProps)),t&&(t=js)){if(Cx(e))throw MC(),Error(ke(418));for(;t;)OC(e,t),t=xa(t.nextSibling)}if(X0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ke(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){js=xa(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}js=null}}else js=Es?xa(e.stateNode.nextSibling):null;return!0}function MC(){for(var e=js;e;)e=xa(e.nextSibling)}function $c(){js=Es=null,En=!1}function pb(e){pi===null?pi=[e]:pi.push(e)}var RL=$o.ReactCurrentBatchConfig;function Lu(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(ke(309));var r=n.stateNode}if(!r)throw Error(ke(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(a){var l=s.refs;a===null?delete l[i]:l[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(ke(284));if(!n._owner)throw Error(ke(290,e))}return e}function gp(e,t){throw e=Object.prototype.toString.call(t),Error(ke(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function J0(e){var t=e._init;return t(e._payload)}function $C(e){function t(y,b){if(e){var w=y.deletions;w===null?(y.deletions=[b],y.flags|=16):w.push(b)}}function n(y,b){if(!e)return null;for(;b!==null;)t(y,b),b=b.sibling;return null}function r(y,b){for(y=new Map;b!==null;)b.key!==null?y.set(b.key,b):y.set(b.index,b),b=b.sibling;return y}function s(y,b){return y=ka(y,b),y.index=0,y.sibling=null,y}function i(y,b,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<b?(y.flags|=2,b):w):(y.flags|=2,b)):(y.flags|=1048576,b)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,b,w,N){return b===null||b.tag!==6?(b=ny(w,y.mode,N),b.return=y,b):(b=s(b,w),b.return=y,b)}function c(y,b,w,N){var C=w.type;return C===ac?f(y,b,w.props.children,N,w.key):b!==null&&(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ia&&J0(C)===b.type)?(N=s(b,w.props),N.ref=Lu(y,b,w),N.return=y,N):(N=oh(w.type,w.key,w.props,null,y.mode,N),N.ref=Lu(y,b,w),N.return=y,N)}function d(y,b,w,N){return b===null||b.tag!==4||b.stateNode.containerInfo!==w.containerInfo||b.stateNode.implementation!==w.implementation?(b=ry(w,y.mode,N),b.return=y,b):(b=s(b,w.children||[]),b.return=y,b)}function f(y,b,w,N,C){return b===null||b.tag!==7?(b=fl(w,y.mode,N,C),b.return=y,b):(b=s(b,w),b.return=y,b)}function u(y,b,w){if(typeof b=="string"&&b!==""||typeof b=="number")return b=ny(""+b,y.mode,w),b.return=y,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ip:return w=oh(b.type,b.key,b.props,null,y.mode,w),w.ref=Lu(y,null,b),w.return=y,w;case oc:return b=ry(b,y.mode,w),b.return=y,b;case ia:var N=b._init;return u(y,N(b._payload),w)}if(Yu(b)||Pu(b))return b=fl(b,y.mode,w,null),b.return=y,b;gp(y,b)}return null}function p(y,b,w,N){var C=b!==null?b.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:l(y,b,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case ip:return w.key===C?c(y,b,w,N):null;case oc:return w.key===C?d(y,b,w,N):null;case ia:return C=w._init,p(y,b,C(w._payload),N)}if(Yu(w)||Pu(w))return C!==null?null:f(y,b,w,N,null);gp(y,w)}return null}function h(y,b,w,N,C){if(typeof N=="string"&&N!==""||typeof N=="number")return y=y.get(w)||null,l(b,y,""+N,C);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case ip:return y=y.get(N.key===null?w:N.key)||null,c(b,y,N,C);case oc:return y=y.get(N.key===null?w:N.key)||null,d(b,y,N,C);case ia:var j=N._init;return h(y,b,w,j(N._payload),C)}if(Yu(N)||Pu(N))return y=y.get(w)||null,f(b,y,N,C,null);gp(b,N)}return null}function g(y,b,w,N){for(var C=null,j=null,T=b,$=b=0,L=null;T!==null&&$<w.length;$++){T.index>$?(L=T,T=null):L=T.sibling;var F=p(y,T,w[$],N);if(F===null){T===null&&(T=L);break}e&&T&&F.alternate===null&&t(y,T),b=i(F,b,$),j===null?C=F:j.sibling=F,j=F,T=L}if($===w.length)return n(y,T),En&&nl(y,$),C;if(T===null){for(;$<w.length;$++)T=u(y,w[$],N),T!==null&&(b=i(T,b,$),j===null?C=T:j.sibling=T,j=T);return En&&nl(y,$),C}for(T=r(y,T);$<w.length;$++)L=h(T,y,$,w[$],N),L!==null&&(e&&L.alternate!==null&&T.delete(L.key===null?$:L.key),b=i(L,b,$),j===null?C=L:j.sibling=L,j=L);return e&&T.forEach(function(A){return t(y,A)}),En&&nl(y,$),C}function v(y,b,w,N){var C=Pu(w);if(typeof C!="function")throw Error(ke(150));if(w=C.call(w),w==null)throw Error(ke(151));for(var j=C=null,T=b,$=b=0,L=null,F=w.next();T!==null&&!F.done;$++,F=w.next()){T.index>$?(L=T,T=null):L=T.sibling;var A=p(y,T,F.value,N);if(A===null){T===null&&(T=L);break}e&&T&&A.alternate===null&&t(y,T),b=i(A,b,$),j===null?C=A:j.sibling=A,j=A,T=L}if(F.done)return n(y,T),En&&nl(y,$),C;if(T===null){for(;!F.done;$++,F=w.next())F=u(y,F.value,N),F!==null&&(b=i(F,b,$),j===null?C=F:j.sibling=F,j=F);return En&&nl(y,$),C}for(T=r(y,T);!F.done;$++,F=w.next())F=h(T,y,$,F.value,N),F!==null&&(e&&F.alternate!==null&&T.delete(F.key===null?$:F.key),b=i(F,b,$),j===null?C=F:j.sibling=F,j=F);return e&&T.forEach(function(R){return t(y,R)}),En&&nl(y,$),C}function k(y,b,w,N){if(typeof w=="object"&&w!==null&&w.type===ac&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ip:e:{for(var C=w.key,j=b;j!==null;){if(j.key===C){if(C=w.type,C===ac){if(j.tag===7){n(y,j.sibling),b=s(j,w.props.children),b.return=y,y=b;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ia&&J0(C)===j.type){n(y,j.sibling),b=s(j,w.props),b.ref=Lu(y,j,w),b.return=y,y=b;break e}n(y,j);break}else t(y,j);j=j.sibling}w.type===ac?(b=fl(w.props.children,y.mode,N,w.key),b.return=y,y=b):(N=oh(w.type,w.key,w.props,null,y.mode,N),N.ref=Lu(y,b,w),N.return=y,y=N)}return a(y);case oc:e:{for(j=w.key;b!==null;){if(b.key===j)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(y,b.sibling),b=s(b,w.children||[]),b.return=y,y=b;break e}else{n(y,b);break}else t(y,b);b=b.sibling}b=ry(w,y.mode,N),b.return=y,y=b}return a(y);case ia:return j=w._init,k(y,b,j(w._payload),N)}if(Yu(w))return g(y,b,w,N);if(Pu(w))return v(y,b,w,N);gp(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(y,b.sibling),b=s(b,w),b.return=y,y=b):(n(y,b),b=ny(w,y.mode,N),b.return=y,y=b),a(y)):n(y,b)}return k}var Dc=$C(!0),DC=$C(!1),Th=Ma(null),Rh=null,mc=null,hb=null;function mb(){hb=mc=Rh=null}function gb(e){var t=Th.current;kn(Th),e._currentValue=t}function _x(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 _c(e,t){Rh=e,hb=mc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ns=!0),e.firstContext=null)}function Xs(e){var t=e._currentValue;if(hb!==e)if(e={context:e,memoizedValue:t,next:null},mc===null){if(Rh===null)throw Error(ke(308));mc=e,Rh.dependencies={lanes:0,firstContext:e}}else mc=mc.next=e;return t}var ll=null;function yb(e){ll===null?ll=[e]:ll.push(e)}function FC(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,yb(t)):(n.next=s.next,s.next=n),t.interleaved=n,To(e,r)}function To(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 oa=!1;function xb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function zC(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 Po(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Wt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,To(e,n)}return s=r.interleaved,s===null?(t.next=t,yb(r)):(t.next=s.next,s.next=t),r.interleaved=t,To(e,n)}function eh(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,rb(e,n)}}function Q0(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 a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,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 Lh(e,t,n,r){var s=e.updateQueue;oa=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,d=c.next;c.next=null,a===null?i=d:a.next=d,a=c;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==a&&(l===null?f.firstBaseUpdate=d:l.next=d,f.lastBaseUpdate=c))}if(i!==null){var u=s.baseState;a=0,f=d=c=null,l=i;do{var p=l.lane,h=l.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,v=l;switch(p=t,h=n,v.tag){case 1:if(g=v.payload,typeof g=="function"){u=g.call(h,u,p);break e}u=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=v.payload,p=typeof g=="function"?g.call(h,u,p):g,p==null)break e;u=$n({},u,p);break e;case 2:oa=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(d=f=h,c=u):f=f.next=h,a|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(f===null&&(c=u),s.baseState=c,s.firstBaseUpdate=d,s.lastBaseUpdate=f,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);bl|=a,e.lanes=a,e.memoizedState=u}}function Z0(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(ke(191,s));s.call(r)}}}var hf={},Gi=Ma(hf),Od=Ma(hf),Md=Ma(hf);function cl(e){if(e===hf)throw Error(ke(174));return e}function wb(e,t){switch(fn(Md,t),fn(Od,e),fn(Gi,hf),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:lx(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=lx(t,e)}kn(Gi),fn(Gi,t)}function Fc(){kn(Gi),kn(Od),kn(Md)}function BC(e){cl(Md.current);var t=cl(Gi.current),n=lx(t,e.type);t!==n&&(fn(Od,e),fn(Gi,n))}function bb(e){Od.current===e&&(kn(Gi),kn(Od))}var On=Ma(0);function Oh(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 Xg=[];function vb(){for(var e=0;e<Xg.length;e++)Xg[e]._workInProgressVersionPrimary=null;Xg.length=0}var th=$o.ReactCurrentDispatcher,Jg=$o.ReactCurrentBatchConfig,wl=0,Mn=null,ur=null,mr=null,Mh=!1,cd=!1,$d=0,LL=0;function Tr(){throw Error(ke(321))}function kb(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!bi(e[n],t[n]))return!1;return!0}function Sb(e,t,n,r,s,i){if(wl=i,Mn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,th.current=e===null||e.memoizedState===null?DL:FL,e=n(r,s),cd){i=0;do{if(cd=!1,$d=0,25<=i)throw Error(ke(301));i+=1,mr=ur=null,t.updateQueue=null,th.current=zL,e=n(r,s)}while(cd)}if(th.current=$h,t=ur!==null&&ur.next!==null,wl=0,mr=ur=Mn=null,Mh=!1,t)throw Error(ke(300));return e}function Nb(){var e=$d!==0;return $d=0,e}function zi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mr===null?Mn.memoizedState=mr=e:mr=mr.next=e,mr}function Js(){if(ur===null){var e=Mn.alternate;e=e!==null?e.memoizedState:null}else e=ur.next;var t=mr===null?Mn.memoizedState:mr.next;if(t!==null)mr=t,ur=e;else{if(e===null)throw Error(ke(310));ur=e,e={memoizedState:ur.memoizedState,baseState:ur.baseState,baseQueue:ur.baseQueue,queue:ur.queue,next:null},mr===null?Mn.memoizedState=mr=e:mr=mr.next=e}return mr}function Dd(e,t){return typeof t=="function"?t(e):t}function Qg(e){var t=Js(),n=t.queue;if(n===null)throw Error(ke(311));n.lastRenderedReducer=e;var r=ur,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=a=null,c=null,d=i;do{var f=d.lane;if((wl&f)===f)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var u={lane:f,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=u,a=r):c=c.next=u,Mn.lanes|=f,bl|=f}d=d.next}while(d!==null&&d!==i);c===null?a=r:c.next=l,bi(r,t.memoizedState)||(ns=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Mn.lanes|=i,bl|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Zg(e){var t=Js(),n=t.queue;if(n===null)throw Error(ke(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var a=s=s.next;do i=e(i,a.action),a=a.next;while(a!==s);bi(i,t.memoizedState)||(ns=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function HC(){}function VC(e,t){var n=Mn,r=Js(),s=t(),i=!bi(r.memoizedState,s);if(i&&(r.memoizedState=s,ns=!0),r=r.queue,jb(KC.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||mr!==null&&mr.memoizedState.tag&1){if(n.flags|=2048,Fd(9,UC.bind(null,n,r,s,t),void 0,null),yr===null)throw Error(ke(349));wl&30||WC(n,t,s)}return s}function WC(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Mn.updateQueue,t===null?(t={lastEffect:null,stores:null},Mn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function UC(e,t,n,r){t.value=n,t.getSnapshot=r,qC(t)&&YC(e)}function KC(e,t,n){return n(function(){qC(t)&&YC(e)})}function qC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!bi(e,n)}catch{return!0}}function YC(e){var t=To(e,1);t!==null&&wi(t,e,1,-1)}function ek(e){var t=zi();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Dd,lastRenderedState:e},t.queue=e,e=e.dispatch=$L.bind(null,Mn,e),[t.memoizedState,e]}function Fd(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Mn.updateQueue,t===null?(t={lastEffect:null,stores:null},Mn.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 GC(){return Js().memoizedState}function nh(e,t,n,r){var s=zi();Mn.flags|=e,s.memoizedState=Fd(1|t,n,void 0,r===void 0?null:r)}function Tm(e,t,n,r){var s=Js();r=r===void 0?null:r;var i=void 0;if(ur!==null){var a=ur.memoizedState;if(i=a.destroy,r!==null&&kb(r,a.deps)){s.memoizedState=Fd(t,n,i,r);return}}Mn.flags|=e,s.memoizedState=Fd(1|t,n,i,r)}function tk(e,t){return nh(8390656,8,e,t)}function jb(e,t){return Tm(2048,8,e,t)}function XC(e,t){return Tm(4,2,e,t)}function JC(e,t){return Tm(4,4,e,t)}function QC(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 ZC(e,t,n){return n=n!=null?n.concat([e]):null,Tm(4,4,QC.bind(null,t,e),n)}function Cb(){}function eE(e,t){var n=Js();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&kb(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function tE(e,t){var n=Js();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&kb(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function nE(e,t,n){return wl&21?(bi(n,t)||(n=aC(),Mn.lanes|=n,bl|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ns=!0),e.memoizedState=n)}function OL(e,t){var n=Zt;Zt=n!==0&&4>n?n:4,e(!0);var r=Jg.transition;Jg.transition={};try{e(!1),t()}finally{Zt=n,Jg.transition=r}}function rE(){return Js().memoizedState}function ML(e,t,n){var r=va(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},sE(e))iE(t,n);else if(n=FC(e,t,n,r),n!==null){var s=Ur();wi(n,e,r,s),oE(n,t,r)}}function $L(e,t,n){var r=va(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(sE(e))iE(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,l=i(a,n);if(s.hasEagerState=!0,s.eagerState=l,bi(l,a)){var c=t.interleaved;c===null?(s.next=s,yb(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=FC(e,t,s,r),n!==null&&(s=Ur(),wi(n,e,r,s),oE(n,t,r))}}function sE(e){var t=e.alternate;return e===Mn||t!==null&&t===Mn}function iE(e,t){cd=Mh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function oE(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rb(e,n)}}var $h={readContext:Xs,useCallback:Tr,useContext:Tr,useEffect:Tr,useImperativeHandle:Tr,useInsertionEffect:Tr,useLayoutEffect:Tr,useMemo:Tr,useReducer:Tr,useRef:Tr,useState:Tr,useDebugValue:Tr,useDeferredValue:Tr,useTransition:Tr,useMutableSource:Tr,useSyncExternalStore:Tr,useId:Tr,unstable_isNewReconciler:!1},DL={readContext:Xs,useCallback:function(e,t){return zi().memoizedState=[e,t===void 0?null:t],e},useContext:Xs,useEffect:tk,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,nh(4194308,4,QC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return nh(4194308,4,e,t)},useInsertionEffect:function(e,t){return nh(4,2,e,t)},useMemo:function(e,t){var n=zi();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zi();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=ML.bind(null,Mn,e),[r.memoizedState,e]},useRef:function(e){var t=zi();return e={current:e},t.memoizedState=e},useState:ek,useDebugValue:Cb,useDeferredValue:function(e){return zi().memoizedState=e},useTransition:function(){var e=ek(!1),t=e[0];return e=OL.bind(null,e[1]),zi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Mn,s=zi();if(En){if(n===void 0)throw Error(ke(407));n=n()}else{if(n=t(),yr===null)throw Error(ke(349));wl&30||WC(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,tk(KC.bind(null,r,i,e),[e]),r.flags|=2048,Fd(9,UC.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=zi(),t=yr.identifierPrefix;if(En){var n=jo,r=No;n=(r&~(1<<32-xi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=$d++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=LL++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},FL={readContext:Xs,useCallback:eE,useContext:Xs,useEffect:jb,useImperativeHandle:ZC,useInsertionEffect:XC,useLayoutEffect:JC,useMemo:tE,useReducer:Qg,useRef:GC,useState:function(){return Qg(Dd)},useDebugValue:Cb,useDeferredValue:function(e){var t=Js();return nE(t,ur.memoizedState,e)},useTransition:function(){var e=Qg(Dd)[0],t=Js().memoizedState;return[e,t]},useMutableSource:HC,useSyncExternalStore:VC,useId:rE,unstable_isNewReconciler:!1},zL={readContext:Xs,useCallback:eE,useContext:Xs,useEffect:jb,useImperativeHandle:ZC,useInsertionEffect:XC,useLayoutEffect:JC,useMemo:tE,useReducer:Zg,useRef:GC,useState:function(){return Zg(Dd)},useDebugValue:Cb,useDeferredValue:function(e){var t=Js();return ur===null?t.memoizedState=e:nE(t,ur.memoizedState,e)},useTransition:function(){var e=Zg(Dd)[0],t=Js().memoizedState;return[e,t]},useMutableSource:HC,useSyncExternalStore:VC,useId:rE,unstable_isNewReconciler:!1};function ui(e,t){if(e&&e.defaultProps){t=$n({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Px(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:$n({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Rm={isMounted:function(e){return(e=e._reactInternals)?Pl(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ur(),s=va(e),i=Po(r,s);i.payload=t,n!=null&&(i.callback=n),t=wa(e,i,s),t!==null&&(wi(t,e,s,r),eh(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ur(),s=va(e),i=Po(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=wa(e,i,s),t!==null&&(wi(t,e,s,r),eh(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ur(),r=va(e),s=Po(n,r);s.tag=2,t!=null&&(s.callback=t),t=wa(e,s,r),t!==null&&(wi(t,e,r,n),eh(t,e,r))}};function nk(e,t,n,r,s,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!Id(n,r)||!Id(s,i):!0}function aE(e,t,n){var r=!1,s=_a,i=t.contextType;return typeof i=="object"&&i!==null?i=Xs(i):(s=ls(t)?yl:Mr.current,r=t.contextTypes,i=(r=r!=null)?Mc(e,s):_a),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Rm,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function rk(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&&Rm.enqueueReplaceState(t,t.state,null)}function Ax(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},xb(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Xs(i):(i=ls(t)?yl:Mr.current,s.context=Mc(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Px(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&&Rm.enqueueReplaceState(s,s.state,null),Lh(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function zc(e,t){try{var n="",r=t;do n+=hR(r),r=r.return;while(r);var s=n}catch(i){s=`
|
|
39
|
-
Error generating stack: `+i.message+`
|
|
40
|
-
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function ey(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ix(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var BL=typeof WeakMap=="function"?WeakMap:Map;function lE(e,t,n){n=Po(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Fh||(Fh=!0,Bx=r),Ix(e,t)},n}function cE(e,t,n){n=Po(-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(){Ix(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ix(e,t),typeof r!="function"&&(ba===null?ba=new Set([this]):ba.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function sk(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new BL;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=tO.bind(null,e,t,n),t.then(e,e))}function ik(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 ok(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=Po(-1,1),t.tag=2,wa(n,t,1))),n.lanes|=1),e)}var HL=$o.ReactCurrentOwner,ns=!1;function Vr(e,t,n,r){t.child=e===null?DC(t,null,n,r):Dc(t,e.child,n,r)}function ak(e,t,n,r,s){n=n.render;var i=t.ref;return _c(t,s),r=Sb(e,t,n,r,i,s),n=Nb(),e!==null&&!ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Ro(e,t,s)):(En&&n&&db(t),t.flags|=1,Vr(e,t,r,s),t.child)}function lk(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!Lb(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,uE(e,t,i,r,s)):(e=oh(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 a=i.memoizedProps;if(n=n.compare,n=n!==null?n:Id,n(a,r)&&e.ref===t.ref)return Ro(e,t,s)}return t.flags|=1,e=ka(i,r),e.ref=t.ref,e.return=t,t.child=e}function uE(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Id(i,r)&&e.ref===t.ref)if(ns=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(ns=!0);else return t.lanes=e.lanes,Ro(e,t,s)}return Tx(e,t,n,r,s)}function dE(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},fn(yc,vs),vs|=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,fn(yc,vs),vs|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,fn(yc,vs),vs|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,fn(yc,vs),vs|=r;return Vr(e,t,s,n),t.child}function fE(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Tx(e,t,n,r,s){var i=ls(n)?yl:Mr.current;return i=Mc(t,i),_c(t,s),n=Sb(e,t,n,r,i,s),r=Nb(),e!==null&&!ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Ro(e,t,s)):(En&&r&&db(t),t.flags|=1,Vr(e,t,n,s),t.child)}function ck(e,t,n,r,s){if(ls(n)){var i=!0;Ph(t)}else i=!1;if(_c(t,s),t.stateNode===null)rh(e,t),aE(t,n,r),Ax(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=Xs(d):(d=ls(n)?yl:Mr.current,d=Mc(t,d));var f=n.getDerivedStateFromProps,u=typeof f=="function"||typeof a.getSnapshotBeforeUpdate=="function";u||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==d)&&rk(t,a,r,d),oa=!1;var p=t.memoizedState;a.state=p,Lh(t,r,a,s),c=t.memoizedState,l!==r||p!==c||as.current||oa?(typeof f=="function"&&(Px(t,n,f,r),c=t.memoizedState),(l=oa||nk(t,n,l,r,p,c,d))?(u||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=d,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,zC(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:ui(t.type,l),a.props=d,u=t.pendingProps,p=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Xs(c):(c=ls(n)?yl:Mr.current,c=Mc(t,c));var h=n.getDerivedStateFromProps;(f=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==u||p!==c)&&rk(t,a,r,c),oa=!1,p=t.memoizedState,a.state=p,Lh(t,r,a,s);var g=t.memoizedState;l!==u||p!==g||as.current||oa?(typeof h=="function"&&(Px(t,n,h,r),g=t.memoizedState),(d=oa||nk(t,n,d,r,p,g,c)||!1)?(f||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,g,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,g,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),a.props=r,a.state=g,a.context=c,r=d):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Rx(e,t,n,r,i,s)}function Rx(e,t,n,r,s,i){fE(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&Y0(t,n,!1),Ro(e,t,i);r=t.stateNode,HL.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Dc(t,e.child,null,i),t.child=Dc(t,null,l,i)):Vr(e,t,l,i),t.memoizedState=r.state,s&&Y0(t,n,!0),t.child}function pE(e){var t=e.stateNode;t.pendingContext?q0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&q0(e,t.context,!1),wb(e,t.containerInfo)}function uk(e,t,n,r,s){return $c(),pb(s),t.flags|=256,Vr(e,t,n,r),t.child}var Lx={dehydrated:null,treeContext:null,retryLane:0};function Ox(e){return{baseLanes:e,cachePool:null,transitions:null}}function hE(e,t,n){var r=t.pendingProps,s=On.current,i=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),fn(On,s&1),e===null)return Ex(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):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=Mm(a,r,0,null),e=fl(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ox(n),t.memoizedState=Lx,e):Eb(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return VL(e,t,a,r,l,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=ka(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=ka(l,i):(i=fl(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?Ox(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Lx,r}return i=e.child,e=i.sibling,r=ka(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 Eb(e,t){return t=Mm({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function yp(e,t,n,r){return r!==null&&pb(r),Dc(t,e.child,null,n),e=Eb(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function VL(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=ey(Error(ke(422))),yp(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Mm({mode:"visible",children:r.children},s,0,null),i=fl(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Dc(t,e.child,null,a),t.child.memoizedState=Ox(a),t.memoizedState=Lx,i);if(!(t.mode&1))return yp(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(ke(419)),r=ey(i,r,void 0),yp(e,t,a,r)}if(l=(a&e.childLanes)!==0,ns||l){if(r=yr,r!==null){switch(a&-a){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|a)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,To(e,s),wi(r,e,s,-1))}return Rb(),r=ey(Error(ke(421))),yp(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=nO.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,js=xa(s.nextSibling),Es=t,En=!0,pi=null,e!==null&&(Ws[Us++]=No,Ws[Us++]=jo,Ws[Us++]=xl,No=e.id,jo=e.overflow,xl=t),t=Eb(t,r.children),t.flags|=4096,t)}function dk(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),_x(e.return,t,n)}function ty(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 mE(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(Vr(e,t,r.children,n),r=On.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&&dk(e,n,t);else if(e.tag===19)dk(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(fn(On,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&&Oh(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),ty(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&&Oh(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}ty(t,!0,n,null,i);break;case"together":ty(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function rh(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ro(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),bl|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ke(153));if(t.child!==null){for(e=t.child,n=ka(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ka(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function WL(e,t,n){switch(t.tag){case 3:pE(t),$c();break;case 5:BC(t);break;case 1:ls(t.type)&&Ph(t);break;case 4:wb(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;fn(Th,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(fn(On,On.current&1),t.flags|=128,null):n&t.child.childLanes?hE(e,t,n):(fn(On,On.current&1),e=Ro(e,t,n),e!==null?e.sibling:null);fn(On,On.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return mE(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),fn(On,On.current),r)break;return null;case 22:case 23:return t.lanes=0,dE(e,t,n)}return Ro(e,t,n)}var gE,Mx,yE,xE;gE=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}};Mx=function(){};yE=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,cl(Gi.current);var i=null;switch(n){case"input":s=sx(e,s),r=sx(e,r),i=[];break;case"select":s=$n({},s,{value:void 0}),r=$n({},r,{value:void 0}),i=[];break;case"textarea":s=ax(e,s),r=ax(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Eh)}cx(n,r);var a;n=null;for(d in s)if(!r.hasOwnProperty(d)&&s.hasOwnProperty(d)&&s[d]!=null)if(d==="style"){var l=s[d];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Nd.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var c=r[d];if(l=s!=null?s[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(i||(i=[]),i.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Nd.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&bn("scroll",e),i||l===c||(i=[])):(i=i||[]).push(d,c))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};xE=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ou(e,t){if(!En)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 Rr(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 UL(e,t,n){var r=t.pendingProps;switch(fb(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rr(t),null;case 1:return ls(t.type)&&_h(),Rr(t),null;case 3:return r=t.stateNode,Fc(),kn(as),kn(Mr),vb(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(mp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pi!==null&&(Wx(pi),pi=null))),Mx(e,t),Rr(t),null;case 5:bb(t);var s=cl(Md.current);if(n=t.type,e!==null&&t.stateNode!=null)yE(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ke(166));return Rr(t),null}if(e=cl(Gi.current),mp(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Wi]=t,r[Ld]=i,e=(t.mode&1)!==0,n){case"dialog":bn("cancel",r),bn("close",r);break;case"iframe":case"object":case"embed":bn("load",r);break;case"video":case"audio":for(s=0;s<Xu.length;s++)bn(Xu[s],r);break;case"source":bn("error",r);break;case"img":case"image":case"link":bn("error",r),bn("load",r);break;case"details":bn("toggle",r);break;case"input":b0(r,i),bn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},bn("invalid",r);break;case"textarea":k0(r,i),bn("invalid",r)}cx(n,i),s=null;for(var a in i)if(i.hasOwnProperty(a)){var l=i[a];a==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&hp(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&hp(r.textContent,l,e),s=["children",""+l]):Nd.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&bn("scroll",r)}switch(n){case"input":op(r),v0(r,i,!0);break;case"textarea":op(r),S0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Eh)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=K1(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Wi]=t,e[Ld]=r,gE(e,t,!1,!1),t.stateNode=e;e:{switch(a=ux(n,r),n){case"dialog":bn("cancel",e),bn("close",e),s=r;break;case"iframe":case"object":case"embed":bn("load",e),s=r;break;case"video":case"audio":for(s=0;s<Xu.length;s++)bn(Xu[s],e);s=r;break;case"source":bn("error",e),s=r;break;case"img":case"image":case"link":bn("error",e),bn("load",e),s=r;break;case"details":bn("toggle",e),s=r;break;case"input":b0(e,r),s=sx(e,r),bn("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=$n({},r,{value:void 0}),bn("invalid",e);break;case"textarea":k0(e,r),s=ax(e,r),bn("invalid",e);break;default:s=r}cx(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?G1(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&q1(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&jd(e,c):typeof c=="number"&&jd(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Nd.hasOwnProperty(i)?c!=null&&i==="onScroll"&&bn("scroll",e):c!=null&&Jw(e,i,c,a))}switch(n){case"input":op(e),v0(e,r,!1);break;case"textarea":op(e),S0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ea(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Nc(e,!!r.multiple,i,!1):r.defaultValue!=null&&Nc(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Eh)}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 Rr(t),null;case 6:if(e&&t.stateNode!=null)xE(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ke(166));if(n=cl(Md.current),cl(Gi.current),mp(t)){if(r=t.stateNode,n=t.memoizedProps,r[Wi]=t,(i=r.nodeValue!==n)&&(e=Es,e!==null))switch(e.tag){case 3:hp(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&hp(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Wi]=t,t.stateNode=r}return Rr(t),null;case 13:if(kn(On),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(En&&js!==null&&t.mode&1&&!(t.flags&128))MC(),$c(),t.flags|=98560,i=!1;else if(i=mp(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ke(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ke(317));i[Wi]=t}else $c(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rr(t),i=!1}else pi!==null&&(Wx(pi),pi=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||On.current&1?fr===0&&(fr=3):Rb())),t.updateQueue!==null&&(t.flags|=4),Rr(t),null);case 4:return Fc(),Mx(e,t),e===null&&Td(t.stateNode.containerInfo),Rr(t),null;case 10:return gb(t.type._context),Rr(t),null;case 17:return ls(t.type)&&_h(),Rr(t),null;case 19:if(kn(On),i=t.memoizedState,i===null)return Rr(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Ou(i,!1);else{if(fr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Oh(e),a!==null){for(t.flags|=128,Ou(i,!1),r=a.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,a=i.alternate,a===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=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return fn(On,On.current&1|2),t.child}e=e.sibling}i.tail!==null&&Xn()>Bc&&(t.flags|=128,r=!0,Ou(i,!1),t.lanes=4194304)}else{if(!r)if(e=Oh(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ou(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!En)return Rr(t),null}else 2*Xn()-i.renderingStartTime>Bc&&n!==1073741824&&(t.flags|=128,r=!0,Ou(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Xn(),t.sibling=null,n=On.current,fn(On,r?n&1|2:n&1),t):(Rr(t),null);case 22:case 23:return Tb(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?vs&1073741824&&(Rr(t),t.subtreeFlags&6&&(t.flags|=8192)):Rr(t),null;case 24:return null;case 25:return null}throw Error(ke(156,t.tag))}function KL(e,t){switch(fb(t),t.tag){case 1:return ls(t.type)&&_h(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Fc(),kn(as),kn(Mr),vb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bb(t),null;case 13:if(kn(On),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ke(340));$c()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return kn(On),null;case 4:return Fc(),null;case 10:return gb(t.type._context),null;case 22:case 23:return Tb(),null;case 24:return null;default:return null}}var xp=!1,Lr=!1,qL=typeof WeakSet=="function"?WeakSet:Set,ze=null;function gc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Wn(e,t,r)}else n.current=null}function $x(e,t,n){try{n()}catch(r){Wn(e,t,r)}}var fk=!1;function YL(e,t){if(bx=Nh,e=SC(),ub(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 a=0,l=-1,c=-1,d=0,f=0,u=e,p=null;t:for(;;){for(var h;u!==n||s!==0&&u.nodeType!==3||(l=a+s),u!==i||r!==0&&u.nodeType!==3||(c=a+r),u.nodeType===3&&(a+=u.nodeValue.length),(h=u.firstChild)!==null;)p=u,u=h;for(;;){if(u===e)break t;if(p===n&&++d===s&&(l=a),p===i&&++f===r&&(c=a),(h=u.nextSibling)!==null)break;u=p,p=u.parentNode}u=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(vx={focusedElem:e,selectionRange:n},Nh=!1,ze=t;ze!==null;)if(t=ze,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ze=e;else for(;ze!==null;){t=ze;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 v=g.memoizedProps,k=g.memoizedState,y=t.stateNode,b=y.getSnapshotBeforeUpdate(t.elementType===t.type?v:ui(t.type,v),k);y.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ke(163))}}catch(N){Wn(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,ze=e;break}ze=t.return}return g=fk,fk=!1,g}function ud(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&&$x(t,n,i)}s=s.next}while(s!==r)}}function Lm(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 Dx(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 wE(e){var t=e.alternate;t!==null&&(e.alternate=null,wE(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wi],delete t[Ld],delete t[Nx],delete t[AL],delete t[IL])),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 bE(e){return e.tag===5||e.tag===3||e.tag===4}function pk(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bE(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 Fx(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=Eh));else if(r!==4&&(e=e.child,e!==null))for(Fx(e,t,n),e=e.sibling;e!==null;)Fx(e,t,n),e=e.sibling}function zx(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(zx(e,t,n),e=e.sibling;e!==null;)zx(e,t,n),e=e.sibling}var Nr=null,di=!1;function Qo(e,t,n){for(n=n.child;n!==null;)vE(e,t,n),n=n.sibling}function vE(e,t,n){if(Yi&&typeof Yi.onCommitFiberUnmount=="function")try{Yi.onCommitFiberUnmount(Cm,n)}catch{}switch(n.tag){case 5:Lr||gc(n,t);case 6:var r=Nr,s=di;Nr=null,Qo(e,t,n),Nr=r,di=s,Nr!==null&&(di?(e=Nr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Nr.removeChild(n.stateNode));break;case 18:Nr!==null&&(di?(e=Nr,n=n.stateNode,e.nodeType===8?Yg(e.parentNode,n):e.nodeType===1&&Yg(e,n),Pd(e)):Yg(Nr,n.stateNode));break;case 4:r=Nr,s=di,Nr=n.stateNode.containerInfo,di=!0,Qo(e,t,n),Nr=r,di=s;break;case 0:case 11:case 14:case 15:if(!Lr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&$x(n,t,a),s=s.next}while(s!==r)}Qo(e,t,n);break;case 1:if(!Lr&&(gc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Wn(n,t,l)}Qo(e,t,n);break;case 21:Qo(e,t,n);break;case 22:n.mode&1?(Lr=(r=Lr)||n.memoizedState!==null,Qo(e,t,n),Lr=r):Qo(e,t,n);break;default:Qo(e,t,n)}}function hk(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new qL),t.forEach(function(r){var s=rO.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function li(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,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:Nr=l.stateNode,di=!1;break e;case 3:Nr=l.stateNode.containerInfo,di=!0;break e;case 4:Nr=l.stateNode.containerInfo,di=!0;break e}l=l.return}if(Nr===null)throw Error(ke(160));vE(i,a,s),Nr=null,di=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(d){Wn(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)kE(t,e),t=t.sibling}function kE(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(li(t,e),$i(e),r&4){try{ud(3,e,e.return),Lm(3,e)}catch(v){Wn(e,e.return,v)}try{ud(5,e,e.return)}catch(v){Wn(e,e.return,v)}}break;case 1:li(t,e),$i(e),r&512&&n!==null&&gc(n,n.return);break;case 5:if(li(t,e),$i(e),r&512&&n!==null&&gc(n,n.return),e.flags&32){var s=e.stateNode;try{jd(s,"")}catch(v){Wn(e,e.return,v)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=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&&W1(s,i),ux(l,a);var d=ux(l,i);for(a=0;a<c.length;a+=2){var f=c[a],u=c[a+1];f==="style"?G1(s,u):f==="dangerouslySetInnerHTML"?q1(s,u):f==="children"?jd(s,u):Jw(s,f,u,d)}switch(l){case"input":ix(s,i);break;case"textarea":U1(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?Nc(s,!!i.multiple,h,!1):p!==!!i.multiple&&(i.defaultValue!=null?Nc(s,!!i.multiple,i.defaultValue,!0):Nc(s,!!i.multiple,i.multiple?[]:"",!1))}s[Ld]=i}catch(v){Wn(e,e.return,v)}}break;case 6:if(li(t,e),$i(e),r&4){if(e.stateNode===null)throw Error(ke(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(v){Wn(e,e.return,v)}}break;case 3:if(li(t,e),$i(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Pd(t.containerInfo)}catch(v){Wn(e,e.return,v)}break;case 4:li(t,e),$i(e);break;case 13:li(t,e),$i(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Ab=Xn())),r&4&&hk(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Lr=(d=Lr)||f,li(t,e),Lr=d):li(t,e),$i(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!f&&e.mode&1)for(ze=e,f=e.child;f!==null;){for(u=ze=f;ze!==null;){switch(p=ze,h=p.child,p.tag){case 0:case 11:case 14:case 15:ud(4,p,p.return);break;case 1:gc(p,p.return);var g=p.stateNode;if(typeof g.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(v){Wn(r,n,v)}}break;case 5:gc(p,p.return);break;case 22:if(p.memoizedState!==null){gk(u);continue}}h!==null?(h.return=p,ze=h):gk(u)}f=f.sibling}e:for(f=null,u=e;;){if(u.tag===5){if(f===null){f=u;try{s=u.stateNode,d?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=u.stateNode,c=u.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Y1("display",a))}catch(v){Wn(e,e.return,v)}}}else if(u.tag===6){if(f===null)try{u.stateNode.nodeValue=d?"":u.memoizedProps}catch(v){Wn(e,e.return,v)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;f===u&&(f=null),u=u.return}f===u&&(f=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:li(t,e),$i(e),r&4&&hk(e);break;case 21:break;default:li(t,e),$i(e)}}function $i(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(bE(n)){var r=n;break e}n=n.return}throw Error(ke(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(jd(s,""),r.flags&=-33);var i=pk(e);zx(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=pk(e);Fx(e,l,a);break;default:throw Error(ke(161))}}catch(c){Wn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function GL(e,t,n){ze=e,SE(e)}function SE(e,t,n){for(var r=(e.mode&1)!==0;ze!==null;){var s=ze,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||xp;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Lr;l=xp;var d=Lr;if(xp=a,(Lr=c)&&!d)for(ze=s;ze!==null;)a=ze,c=a.child,a.tag===22&&a.memoizedState!==null?yk(s):c!==null?(c.return=a,ze=c):yk(s);for(;i!==null;)ze=i,SE(i),i=i.sibling;ze=s,xp=l,Lr=d}mk(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,ze=i):mk(e)}}function mk(e){for(;ze!==null;){var t=ze;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Lr||Lm(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Lr)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:ui(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Z0(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Z0(t,a,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 d=t.alternate;if(d!==null){var f=d.memoizedState;if(f!==null){var u=f.dehydrated;u!==null&&Pd(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ke(163))}Lr||t.flags&512&&Dx(t)}catch(p){Wn(t,t.return,p)}}if(t===e){ze=null;break}if(n=t.sibling,n!==null){n.return=t.return,ze=n;break}ze=t.return}}function gk(e){for(;ze!==null;){var t=ze;if(t===e){ze=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ze=n;break}ze=t.return}}function yk(e){for(;ze!==null;){var t=ze;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Lm(4,t)}catch(c){Wn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){Wn(t,s,c)}}var i=t.return;try{Dx(t)}catch(c){Wn(t,i,c)}break;case 5:var a=t.return;try{Dx(t)}catch(c){Wn(t,a,c)}}}catch(c){Wn(t,t.return,c)}if(t===e){ze=null;break}var l=t.sibling;if(l!==null){l.return=t.return,ze=l;break}ze=t.return}}var XL=Math.ceil,Dh=$o.ReactCurrentDispatcher,_b=$o.ReactCurrentOwner,Gs=$o.ReactCurrentBatchConfig,Wt=0,yr=null,nr=null,jr=0,vs=0,yc=Ma(0),fr=0,zd=null,bl=0,Om=0,Pb=0,dd=null,es=null,Ab=0,Bc=1/0,bo=null,Fh=!1,Bx=null,ba=null,wp=!1,fa=null,zh=0,fd=0,Hx=null,sh=-1,ih=0;function Ur(){return Wt&6?Xn():sh!==-1?sh:sh=Xn()}function va(e){return e.mode&1?Wt&2&&jr!==0?jr&-jr:RL.transition!==null?(ih===0&&(ih=aC()),ih):(e=Zt,e!==0||(e=window.event,e=e===void 0?16:hC(e.type)),e):1}function wi(e,t,n,r){if(50<fd)throw fd=0,Hx=null,Error(ke(185));df(e,n,r),(!(Wt&2)||e!==yr)&&(e===yr&&(!(Wt&2)&&(Om|=n),fr===4&&ca(e,jr)),cs(e,r),n===1&&Wt===0&&!(t.mode&1)&&(Bc=Xn()+500,Im&&$a()))}function cs(e,t){var n=e.callbackNode;RR(e,t);var r=Sh(e,e===yr?jr:0);if(r===0)n!==null&&C0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&C0(n),t===1)e.tag===0?TL(xk.bind(null,e)):RC(xk.bind(null,e)),_L(function(){!(Wt&6)&&$a()}),n=null;else{switch(lC(r)){case 1:n=nb;break;case 4:n=iC;break;case 16:n=kh;break;case 536870912:n=oC;break;default:n=kh}n=IE(n,NE.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function NE(e,t){if(sh=-1,ih=0,Wt&6)throw Error(ke(327));var n=e.callbackNode;if(Pc()&&e.callbackNode!==n)return null;var r=Sh(e,e===yr?jr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Bh(e,r);else{t=r;var s=Wt;Wt|=2;var i=CE();(yr!==e||jr!==t)&&(bo=null,Bc=Xn()+500,dl(e,t));do try{ZL();break}catch(l){jE(e,l)}while(!0);mb(),Dh.current=i,Wt=s,nr!==null?t=0:(yr=null,jr=0,t=fr)}if(t!==0){if(t===2&&(s=mx(e),s!==0&&(r=s,t=Vx(e,s))),t===1)throw n=zd,dl(e,0),ca(e,r),cs(e,Xn()),n;if(t===6)ca(e,r);else{if(s=e.current.alternate,!(r&30)&&!JL(s)&&(t=Bh(e,r),t===2&&(i=mx(e),i!==0&&(r=i,t=Vx(e,i))),t===1))throw n=zd,dl(e,0),ca(e,r),cs(e,Xn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(ke(345));case 2:rl(e,es,bo);break;case 3:if(ca(e,r),(r&130023424)===r&&(t=Ab+500-Xn(),10<t)){if(Sh(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Ur(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Sx(rl.bind(null,e,es,bo),t);break}rl(e,es,bo);break;case 4:if(ca(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-xi(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=Xn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*XL(r/1960))-r,10<r){e.timeoutHandle=Sx(rl.bind(null,e,es,bo),r);break}rl(e,es,bo);break;case 5:rl(e,es,bo);break;default:throw Error(ke(329))}}}return cs(e,Xn()),e.callbackNode===n?NE.bind(null,e):null}function Vx(e,t){var n=dd;return e.current.memoizedState.isDehydrated&&(dl(e,t).flags|=256),e=Bh(e,t),e!==2&&(t=es,es=n,t!==null&&Wx(t)),e}function Wx(e){es===null?es=e:es.push.apply(es,e)}function JL(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(!bi(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 ca(e,t){for(t&=~Pb,t&=~Om,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-xi(t),r=1<<n;e[n]=-1,t&=~r}}function xk(e){if(Wt&6)throw Error(ke(327));Pc();var t=Sh(e,0);if(!(t&1))return cs(e,Xn()),null;var n=Bh(e,t);if(e.tag!==0&&n===2){var r=mx(e);r!==0&&(t=r,n=Vx(e,r))}if(n===1)throw n=zd,dl(e,0),ca(e,t),cs(e,Xn()),n;if(n===6)throw Error(ke(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,rl(e,es,bo),cs(e,Xn()),null}function Ib(e,t){var n=Wt;Wt|=1;try{return e(t)}finally{Wt=n,Wt===0&&(Bc=Xn()+500,Im&&$a())}}function vl(e){fa!==null&&fa.tag===0&&!(Wt&6)&&Pc();var t=Wt;Wt|=1;var n=Gs.transition,r=Zt;try{if(Gs.transition=null,Zt=1,e)return e()}finally{Zt=r,Gs.transition=n,Wt=t,!(Wt&6)&&$a()}}function Tb(){vs=yc.current,kn(yc)}function dl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,EL(n)),nr!==null)for(n=nr.return;n!==null;){var r=n;switch(fb(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&_h();break;case 3:Fc(),kn(as),kn(Mr),vb();break;case 5:bb(r);break;case 4:Fc();break;case 13:kn(On);break;case 19:kn(On);break;case 10:gb(r.type._context);break;case 22:case 23:Tb()}n=n.return}if(yr=e,nr=e=ka(e.current,null),jr=vs=t,fr=0,zd=null,Pb=Om=bl=0,es=dd=null,ll!==null){for(t=0;t<ll.length;t++)if(n=ll[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=s,r.next=a}n.pending=r}ll=null}return e}function jE(e,t){do{var n=nr;try{if(mb(),th.current=$h,Mh){for(var r=Mn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Mh=!1}if(wl=0,mr=ur=Mn=null,cd=!1,$d=0,_b.current=null,n===null||n.return===null){fr=1,zd=t,nr=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=jr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,f=l,u=f.tag;if(!(f.mode&1)&&(u===0||u===11||u===15)){var p=f.alternate;p?(f.updateQueue=p.updateQueue,f.memoizedState=p.memoizedState,f.lanes=p.lanes):(f.updateQueue=null,f.memoizedState=null)}var h=ik(a);if(h!==null){h.flags&=-257,ok(h,a,l,i,t),h.mode&1&&sk(i,d,t),t=h,c=d;var g=t.updateQueue;if(g===null){var v=new Set;v.add(c),t.updateQueue=v}else g.add(c);break e}else{if(!(t&1)){sk(i,d,t),Rb();break e}c=Error(ke(426))}}else if(En&&l.mode&1){var k=ik(a);if(k!==null){!(k.flags&65536)&&(k.flags|=256),ok(k,a,l,i,t),pb(zc(c,l));break e}}i=c=zc(c,l),fr!==4&&(fr=2),dd===null?dd=[i]:dd.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=lE(i,c,t);Q0(i,y);break e;case 1:l=c;var b=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(ba===null||!ba.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=cE(i,l,t);Q0(i,N);break e}}i=i.return}while(i!==null)}_E(n)}catch(C){t=C,nr===n&&n!==null&&(nr=n=n.return);continue}break}while(!0)}function CE(){var e=Dh.current;return Dh.current=$h,e===null?$h:e}function Rb(){(fr===0||fr===3||fr===2)&&(fr=4),yr===null||!(bl&268435455)&&!(Om&268435455)||ca(yr,jr)}function Bh(e,t){var n=Wt;Wt|=2;var r=CE();(yr!==e||jr!==t)&&(bo=null,dl(e,t));do try{QL();break}catch(s){jE(e,s)}while(!0);if(mb(),Wt=n,Dh.current=r,nr!==null)throw Error(ke(261));return yr=null,jr=0,fr}function QL(){for(;nr!==null;)EE(nr)}function ZL(){for(;nr!==null&&!NR();)EE(nr)}function EE(e){var t=AE(e.alternate,e,vs);e.memoizedProps=e.pendingProps,t===null?_E(e):nr=t,_b.current=null}function _E(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=KL(n,t),n!==null){n.flags&=32767,nr=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{fr=6,nr=null;return}}else if(n=UL(n,t,vs),n!==null){nr=n;return}if(t=t.sibling,t!==null){nr=t;return}nr=t=e}while(t!==null);fr===0&&(fr=5)}function rl(e,t,n){var r=Zt,s=Gs.transition;try{Gs.transition=null,Zt=1,eO(e,t,n,r)}finally{Gs.transition=s,Zt=r}return null}function eO(e,t,n,r){do Pc();while(fa!==null);if(Wt&6)throw Error(ke(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(ke(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(LR(e,i),e===yr&&(nr=yr=null,jr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||wp||(wp=!0,IE(kh,function(){return Pc(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Gs.transition,Gs.transition=null;var a=Zt;Zt=1;var l=Wt;Wt|=4,_b.current=null,YL(e,n),kE(n,e),bL(vx),Nh=!!bx,vx=bx=null,e.current=n,GL(n),jR(),Wt=l,Zt=a,Gs.transition=i}else e.current=n;if(wp&&(wp=!1,fa=e,zh=s),i=e.pendingLanes,i===0&&(ba=null),_R(n.stateNode),cs(e,Xn()),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(Fh)throw Fh=!1,e=Bx,Bx=null,e;return zh&1&&e.tag!==0&&Pc(),i=e.pendingLanes,i&1?e===Hx?fd++:(fd=0,Hx=e):fd=0,$a(),null}function Pc(){if(fa!==null){var e=lC(zh),t=Gs.transition,n=Zt;try{if(Gs.transition=null,Zt=16>e?16:e,fa===null)var r=!1;else{if(e=fa,fa=null,zh=0,Wt&6)throw Error(ke(331));var s=Wt;for(Wt|=4,ze=e.current;ze!==null;){var i=ze,a=i.child;if(ze.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(ze=d;ze!==null;){var f=ze;switch(f.tag){case 0:case 11:case 15:ud(8,f,i)}var u=f.child;if(u!==null)u.return=f,ze=u;else for(;ze!==null;){f=ze;var p=f.sibling,h=f.return;if(wE(f),f===d){ze=null;break}if(p!==null){p.return=h,ze=p;break}ze=h}}}var g=i.alternate;if(g!==null){var v=g.child;if(v!==null){g.child=null;do{var k=v.sibling;v.sibling=null,v=k}while(v!==null)}}ze=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,ze=a;else e:for(;ze!==null;){if(i=ze,i.flags&2048)switch(i.tag){case 0:case 11:case 15:ud(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,ze=y;break e}ze=i.return}}var b=e.current;for(ze=b;ze!==null;){a=ze;var w=a.child;if(a.subtreeFlags&2064&&w!==null)w.return=a,ze=w;else e:for(a=b;ze!==null;){if(l=ze,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Lm(9,l)}}catch(C){Wn(l,l.return,C)}if(l===a){ze=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,ze=N;break e}ze=l.return}}if(Wt=s,$a(),Yi&&typeof Yi.onPostCommitFiberRoot=="function")try{Yi.onPostCommitFiberRoot(Cm,e)}catch{}r=!0}return r}finally{Zt=n,Gs.transition=t}}return!1}function wk(e,t,n){t=zc(n,t),t=lE(e,t,1),e=wa(e,t,1),t=Ur(),e!==null&&(df(e,1,t),cs(e,t))}function Wn(e,t,n){if(e.tag===3)wk(e,e,n);else for(;t!==null;){if(t.tag===3){wk(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ba===null||!ba.has(r))){e=zc(n,e),e=cE(t,e,1),t=wa(t,e,1),e=Ur(),t!==null&&(df(t,1,e),cs(t,e));break}}t=t.return}}function tO(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ur(),e.pingedLanes|=e.suspendedLanes&n,yr===e&&(jr&n)===n&&(fr===4||fr===3&&(jr&130023424)===jr&&500>Xn()-Ab?dl(e,0):Pb|=n),cs(e,t)}function PE(e,t){t===0&&(e.mode&1?(t=cp,cp<<=1,!(cp&130023424)&&(cp=4194304)):t=1);var n=Ur();e=To(e,t),e!==null&&(df(e,t,n),cs(e,n))}function nO(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),PE(e,n)}function rO(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(ke(314))}r!==null&&r.delete(t),PE(e,n)}var AE;AE=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||as.current)ns=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ns=!1,WL(e,t,n);ns=!!(e.flags&131072)}else ns=!1,En&&t.flags&1048576&&LC(t,Ih,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;rh(e,t),e=t.pendingProps;var s=Mc(t,Mr.current);_c(t,n),s=Sb(null,t,r,e,s,n);var i=Nb();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,ls(r)?(i=!0,Ph(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,xb(t),s.updater=Rm,t.stateNode=s,s._reactInternals=t,Ax(t,r,e,n),t=Rx(null,t,r,!0,i,n)):(t.tag=0,En&&i&&db(t),Vr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(rh(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=iO(r),e=ui(r,e),s){case 0:t=Tx(null,t,r,e,n);break e;case 1:t=ck(null,t,r,e,n);break e;case 11:t=ak(null,t,r,e,n);break e;case 14:t=lk(null,t,r,ui(r.type,e),n);break e}throw Error(ke(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ui(r,s),Tx(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ui(r,s),ck(e,t,r,s,n);case 3:e:{if(pE(t),e===null)throw Error(ke(387));r=t.pendingProps,i=t.memoizedState,s=i.element,zC(e,t),Lh(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=zc(Error(ke(423)),t),t=uk(e,t,r,n,s);break e}else if(r!==s){s=zc(Error(ke(424)),t),t=uk(e,t,r,n,s);break e}else for(js=xa(t.stateNode.containerInfo.firstChild),Es=t,En=!0,pi=null,n=DC(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if($c(),r===s){t=Ro(e,t,n);break e}Vr(e,t,r,n)}t=t.child}return t;case 5:return BC(t),e===null&&Ex(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,kx(r,s)?a=null:i!==null&&kx(r,i)&&(t.flags|=32),fE(e,t),Vr(e,t,a,n),t.child;case 6:return e===null&&Ex(t),null;case 13:return hE(e,t,n);case 4:return wb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Dc(t,null,r,n):Vr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ui(r,s),ak(e,t,r,s,n);case 7:return Vr(e,t,t.pendingProps,n),t.child;case 8:return Vr(e,t,t.pendingProps.children,n),t.child;case 12:return Vr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,fn(Th,r._currentValue),r._currentValue=a,i!==null)if(bi(i.value,a)){if(i.children===s.children&&!as.current){t=Ro(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Po(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?c.next=c:(c.next=f.next,f.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),_x(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(ke(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),_x(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Vr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,_c(t,n),s=Xs(s),r=r(s),t.flags|=1,Vr(e,t,r,n),t.child;case 14:return r=t.type,s=ui(r,t.pendingProps),s=ui(r.type,s),lk(e,t,r,s,n);case 15:return uE(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ui(r,s),rh(e,t),t.tag=1,ls(r)?(e=!0,Ph(t)):e=!1,_c(t,n),aE(t,r,s),Ax(t,r,s,n),Rx(null,t,r,!0,e,n);case 19:return mE(e,t,n);case 22:return dE(e,t,n)}throw Error(ke(156,t.tag))};function IE(e,t){return sC(e,t)}function sO(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 Ys(e,t,n,r){return new sO(e,t,n,r)}function Lb(e){return e=e.prototype,!(!e||!e.isReactComponent)}function iO(e){if(typeof e=="function")return Lb(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Zw)return 11;if(e===eb)return 14}return 2}function ka(e,t){var n=e.alternate;return n===null?(n=Ys(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 oh(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")Lb(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case ac:return fl(n.children,s,i,t);case Qw:a=8,s|=8;break;case ex:return e=Ys(12,n,t,s|2),e.elementType=ex,e.lanes=i,e;case tx:return e=Ys(13,n,t,s),e.elementType=tx,e.lanes=i,e;case nx:return e=Ys(19,n,t,s),e.elementType=nx,e.lanes=i,e;case B1:return Mm(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case F1:a=10;break e;case z1:a=9;break e;case Zw:a=11;break e;case eb:a=14;break e;case ia:a=16,r=null;break e}throw Error(ke(130,e==null?e:typeof e,""))}return t=Ys(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function fl(e,t,n,r){return e=Ys(7,e,r,t),e.lanes=n,e}function Mm(e,t,n,r){return e=Ys(22,e,r,t),e.elementType=B1,e.lanes=n,e.stateNode={isHidden:!1},e}function ny(e,t,n){return e=Ys(6,e,null,t),e.lanes=n,e}function ry(e,t,n){return t=Ys(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function oO(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=$g(0),this.expirationTimes=$g(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$g(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Ob(e,t,n,r,s,i,a,l,c){return e=new oO(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ys(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xb(i),e}function aO(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:oc,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function TE(e){if(!e)return _a;e=e._reactInternals;e:{if(Pl(e)!==e||e.tag!==1)throw Error(ke(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ls(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ke(171))}if(e.tag===1){var n=e.type;if(ls(n))return TC(e,n,t)}return t}function RE(e,t,n,r,s,i,a,l,c){return e=Ob(n,r,!0,e,s,i,a,l,c),e.context=TE(null),n=e.current,r=Ur(),s=va(n),i=Po(r,s),i.callback=t??null,wa(n,i,s),e.current.lanes=s,df(e,s,r),cs(e,r),e}function $m(e,t,n,r){var s=t.current,i=Ur(),a=va(s);return n=TE(n),t.context===null?t.context=n:t.pendingContext=n,t=Po(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=wa(s,t,a),e!==null&&(wi(e,s,a,i),eh(e,s,a)),a}function Hh(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 bk(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Mb(e,t){bk(e,t),(e=e.alternate)&&bk(e,t)}function lO(){return null}var LE=typeof reportError=="function"?reportError:function(e){console.error(e)};function $b(e){this._internalRoot=e}Dm.prototype.render=$b.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ke(409));$m(e,t,null,null)};Dm.prototype.unmount=$b.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vl(function(){$m(null,e,null,null)}),t[Io]=null}};function Dm(e){this._internalRoot=e}Dm.prototype.unstable_scheduleHydration=function(e){if(e){var t=dC();e={blockedOn:null,target:e,priority:t};for(var n=0;n<la.length&&t!==0&&t<la[n].priority;n++);la.splice(n,0,e),n===0&&pC(e)}};function Db(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Fm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function vk(){}function cO(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var d=Hh(a);i.call(d)}}var a=RE(t,r,e,0,null,!1,!1,"",vk);return e._reactRootContainer=a,e[Io]=a.current,Td(e.nodeType===8?e.parentNode:e),vl(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=Hh(c);l.call(d)}}var c=Ob(e,0,!1,null,null,!1,!1,"",vk);return e._reactRootContainer=c,e[Io]=c.current,Td(e.nodeType===8?e.parentNode:e),vl(function(){$m(t,c,n,r)}),c}function zm(e,t,n,r,s){var i=n._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var l=s;s=function(){var c=Hh(a);l.call(c)}}$m(t,a,e,s)}else a=cO(n,t,e,s,r);return Hh(a)}cC=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Gu(t.pendingLanes);n!==0&&(rb(t,n|1),cs(t,Xn()),!(Wt&6)&&(Bc=Xn()+500,$a()))}break;case 13:vl(function(){var r=To(e,1);if(r!==null){var s=Ur();wi(r,e,1,s)}}),Mb(e,1)}};sb=function(e){if(e.tag===13){var t=To(e,134217728);if(t!==null){var n=Ur();wi(t,e,134217728,n)}Mb(e,134217728)}};uC=function(e){if(e.tag===13){var t=va(e),n=To(e,t);if(n!==null){var r=Ur();wi(n,e,t,r)}Mb(e,t)}};dC=function(){return Zt};fC=function(e,t){var n=Zt;try{return Zt=e,t()}finally{Zt=n}};fx=function(e,t,n){switch(t){case"input":if(ix(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=Am(r);if(!s)throw Error(ke(90));V1(r),ix(r,s)}}}break;case"textarea":U1(e,n);break;case"select":t=n.value,t!=null&&Nc(e,!!n.multiple,t,!1)}};Q1=Ib;Z1=vl;var uO={usingClientEntryPoint:!1,Events:[pf,dc,Am,X1,J1,Ib]},Mu={findFiberByHostInstance:al,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},dO={bundleType:Mu.bundleType,version:Mu.version,rendererPackageName:Mu.rendererPackageName,rendererConfig:Mu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:$o.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=nC(e),e===null?null:e.stateNode},findFiberByHostInstance:Mu.findFiberByHostInstance||lO,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 bp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bp.isDisabled&&bp.supportsFiber)try{Cm=bp.inject(dO),Yi=bp}catch{}}Is.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uO;Is.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Db(t))throw Error(ke(200));return aO(e,t,null,n)};Is.createRoot=function(e,t){if(!Db(e))throw Error(ke(299));var n=!1,r="",s=LE;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Ob(e,1,!1,null,null,n,!1,r,s),e[Io]=t.current,Td(e.nodeType===8?e.parentNode:e),new $b(t)};Is.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(ke(188)):(e=Object.keys(e).join(","),Error(ke(268,e)));return e=nC(t),e=e===null?null:e.stateNode,e};Is.flushSync=function(e){return vl(e)};Is.hydrate=function(e,t,n){if(!Fm(t))throw Error(ke(200));return zm(null,e,t,!0,n)};Is.hydrateRoot=function(e,t,n){if(!Db(e))throw Error(ke(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=LE;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=RE(t,null,e,1,n??null,s,!1,i,a),e[Io]=t.current,Td(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 Dm(t)};Is.render=function(e,t,n){if(!Fm(t))throw Error(ke(200));return zm(null,e,t,!1,n)};Is.unmountComponentAtNode=function(e){if(!Fm(e))throw Error(ke(40));return e._reactRootContainer?(vl(function(){zm(null,null,e,!1,function(){e._reactRootContainer=null,e[Io]=null})}),!0):!1};Is.unstable_batchedUpdates=Ib;Is.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Fm(n))throw Error(ke(200));if(e==null||e._reactInternals===void 0)throw Error(ke(38));return zm(e,t,n,!1,r)};Is.version="18.3.1-next-f1338f8080-20240426";function OE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(OE)}catch(e){console.error(e)}}OE(),O1.exports=Is;var ts=O1.exports,kk=ts;Qy.createRoot=kk.createRoot,Qy.hydrateRoot=kk.hydrateRoot;const ME=m.createContext(null);function Ux(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function fO(){const e=Ux(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function pO({children:e}){const[t,n]=m.useState(fO);m.useEffect(()=>{const i=()=>n(Ux(window.location.pathname));return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=m.useCallback(i=>{const a=i.startsWith("/")?i:`/${i}`;let l;try{l=new URL(a,window.location.origin)}catch{l=new URL("/",window.location.origin)}const c=Ux(l.pathname),d=l.search||"";window.history.pushState({},"",c+d),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(ME.Provider,{value:s,children:e})}function Da(){const e=m.useContext(ME);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function hO(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}const Sk={};function Kx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&Sk[t[0]]||(typeof t[0]=="string"&&(Sk[t[0]]=new Date),hO(...t))}const $E=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function Nk(e,t,n){e.loadNamespaces(t,$E(e,n))}function jk(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(s=>{e.options.ns.indexOf(s)<0&&e.options.ns.push(s)}),e.loadLanguages(t,$E(e,r))}function mO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],s=t.options?t.options.fallbackLng:!1,i=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const d=t.services.backendConnector.state[`${l}|${c}`];return d===-1||d===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!s||a(i,e)))}function gO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Kx("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(s,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,e))return!1}}):mO(e,t,n)}const yO=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,xO={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},wO=e=>xO[e],bO=e=>e.replace(yO,wO);let qx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:bO};function vO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};qx={...qx,...e}}function kO(){return qx}let DE;function SO(e){DE=e}function NO(){return DE}const jO={type:"3rdParty",init(e){vO(e.options.react),SO(e)}},CO=m.createContext();class EO{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const _O=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function hn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(CO)||{},i=n||r||NO();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new EO),!i){Kx("You will need to pass in an i18next instance by using initReactI18next");const w=(C,j)=>typeof j=="string"?j:j&&typeof j=="object"&&typeof j.defaultValue=="string"?j.defaultValue:Array.isArray(C)?C[C.length-1]:C,N=[w,{},!1];return N.t=w,N.i18n={},N.ready=!1,N}i.options.react&&i.options.react.wait!==void 0&&Kx("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...kO(),...i.options.react,...t},{useSuspense:l,keyPrefix:c}=a;let d=e||s||i.options&&i.options.defaultNS;d=typeof d=="string"?[d]:d||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(d);const f=(i.isInitialized||i.initializedStoreOnce)&&d.every(w=>gO(w,i,a));function u(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?d:d[0],c)}const[p,h]=m.useState(u);let g=d.join();t.lng&&(g=`${t.lng}${g}`);const v=_O(g),k=m.useRef(!0);m.useEffect(()=>{const{bindI18n:w,bindI18nStore:N}=a;k.current=!0,!f&&!l&&(t.lng?jk(i,t.lng,d,()=>{k.current&&h(u)}):Nk(i,d,()=>{k.current&&h(u)})),f&&v&&v!==g&&k.current&&h(u);function C(){k.current&&h(u)}return w&&i&&i.on(w,C),N&&i&&i.store.on(N,C),()=>{k.current=!1,w&&i&&w.split(" ").forEach(j=>i.off(j,C)),N&&i&&N.split(" ").forEach(j=>i.store.off(j,C))}},[i,g]);const y=m.useRef(!0);m.useEffect(()=>{k.current&&!y.current&&h(u),y.current=!1},[i,c]);const b=[p,i,f];if(b.t=p,b.i18n=i,b.ready=f,f||!f&&!l)return b;throw new Promise(w=>{t.lng?jk(i,t.lng,d,()=>w()):Nk(i,d,()=>w())})}const FE="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%20fill='none'%20role='img'%20aria-label='AgentFlow'%3e%3ctitle%3eAgentFlow%3c/title%3e%3crect%20width='32'%20height='32'%20rx='9'%20fill='%23131313'/%3e%3crect%20x='4.5'%20y='11'%20width='10.5'%20height='10'%20rx='3'%20fill='%232a2a2a'%20stroke='%237c4dff'%20stroke-width='1.2'/%3e%3cpath%20d='M15.25%2014.25C17.8%2012.2%2019.2%209.8%2022.25%209.25'%20stroke='%23cdbdff'%20stroke-width='1.65'%20stroke-linecap='round'%20/%3e%3cpath%20d='M15.25%2017.75C17.8%2019.8%2019.2%2022.2%2022.25%2022.75'%20stroke='%237c4dff'%20stroke-width='1.65'%20stroke-linecap='round'%20opacity='0.92'%20/%3e%3crect%20x='21.75'%20y='6'%20width='7.25'%20height='7'%20rx='2.25'%20fill='%23353534'%20stroke='%23e8deff'%20stroke-width='0.95'%20opacity='0.95'/%3e%3crect%20x='21.75'%20y='19'%20width='7.25'%20height='7'%20rx='2.25'%20fill='%23353534'%20stroke='%239ecaff'%20stroke-width='0.95'%20opacity='0.9'/%3e%3c/svg%3e",PO=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/nodes",labelKey:"common:nav.nodes",icon:"account_tree"},{to:"/my-nodes",labelKey:"common:nav.myNodes",icon:"deployed_code"},{to:"/my-flows",labelKey:"common:nav.myFlows",icon:"schema"},{to:"/skills",labelKey:"common:nav.skills",icon:"extension"},{to:"/mcps",labelKey:"common:nav.mcps",icon:"hub"},{to:"/feedback",labelKey:"common:nav.feedback",icon:"rate_review"},{to:"/settings",labelKey:"common:nav.settings",icon:"settings"}],AO=[{href:"https://agentflow-hub.com",icon:"hub",labelKey:"common:links.hub"},{href:"https://docs.agentflow-hub.com",icon:"menu_book",labelKey:"common:links.docs"},{href:"https://github.com/pproject-github/agentflow",icon:"code",labelKey:"common:links.github"}];function IO(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function TO({authUser:e,onLogout:t}){const{path:n,navigate:r}=Da(),{t:s}=hn(),[i,a]=m.useState(!1);return m.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(c=>c.json()).then(c=>{l||a(!!c.hideCommunityLinks)}).catch(()=>{}),()=>{l=!0}},[]),o.jsxs("aside",{className:"af-sidebar","aria-label":s("flow:sidebar.mainNav"),children:[o.jsxs("div",{className:"af-brand",children:[o.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:o.jsx("img",{src:FE,alt:"",width:"36",height:"36",decoding:"async"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"af-brand-title",children:"Agentflow"}),o.jsx("p",{className:"af-brand-tag",children:"Orchestration Engine"})]})]}),o.jsx("nav",{className:"af-nav",children:PO.map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(IO(n,l.to)?" af-nav-link--active":""),onClick:()=>r(l.to),children:[o.jsx("span",{className:"material-symbols-outlined",children:l.icon}),o.jsx("span",{children:s(l.labelKey)})]},l.to))}),o.jsxs("div",{className:"af-sidebar-footer",children:[o.jsxs("div",{className:"af-sidebar-user",title:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||"",children:[o.jsx("span",{className:"material-symbols-outlined",children:"person"}),o.jsx("span",{children:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||""}),e!=null&&e.isAdmin?o.jsx("span",{className:"af-sidebar-admin-badge",children:"Admin"}):null,o.jsx("button",{type:"button",className:"af-sidebar-logout",onClick:t,"aria-label":"Logout",title:"Logout",children:o.jsx("span",{className:"material-symbols-outlined",children:"logout"})})]}),!i&&AO.map(l=>{const c=s(l.labelKey);return o.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":c,title:c,children:o.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const zE="agentflow.pipelineRecent",RO=50,LO=15;function OO(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function BE(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(zE);return e?OO(e).filter(t=>t&&typeof t.flowId=="string"&&(t.flowSource==="user"||t.flowSource==="builtin"||t.flowSource==="admin"||t.flowSource==="workspace")&&t.kind==="opened"&&typeof t.at=="number"):[]}function vp(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=BE(),i=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(a=>!(a.flowId===e&&a.flowSource===t))].slice(0,RO);try{localStorage.setItem(zE,JSON.stringify(i))}catch{}}function MO(e,t){const n=e.filter(r=>r.id===t);return n.length===0||n.some(r=>(r.source??"user")==="user")?"user":n.some(r=>r.source==="workspace")?"workspace":n.some(r=>r.source==="admin")?"admin":n.some(r=>r.source==="builtin")?"builtin":n[0].source??"user"}function Yx(e,t){const n=Date.now(),r=Math.max(0,n-e),s=Math.floor(r/1e3);if(s<60)return t("flow:time.justNow");const i=Math.floor(s/60);if(i<60)return t("flow:time.minutesAgo",{n:i});const a=Math.floor(i/60);if(a<24)return t("flow:time.hoursAgo",{n:a});const l=new Date(e),c=new Date,d=new Date(c);if(d.setDate(d.getDate()-1),l.toDateString()===d.toDateString())return t("flow:time.yesterday");const f=Math.floor(a/24);return f<7?t("flow:time.daysAgo",{n:f}):`${l.getMonth()+1}/${l.getDate()}`}function $O(e,t){if(e==null||!Number.isFinite(e)||e<=0)return"--";if(e<1e3)return t("flow:time.milliseconds",{n:Math.max(1,Math.round(e))});const n=e/1e3;return t("flow:time.seconds",{n:n>=10?Math.round(n):n.toFixed(1)})}function DO(e,t,n){const r=[];for(const s of e)!s||typeof s.flowId!="string"||typeof s.at!="number"||r.push({flowId:s.flowId,flowSource:MO(n,s.flowId),kind:"executed",at:s.at});for(const s of t)r.push({flowId:s.flowId,flowSource:s.flowSource,kind:"opened",at:s.at});return r.sort((s,i)=>i.at-s.at),r.slice(0,LO)}var ks=Uint8Array,xc=Uint16Array,FO=Int32Array,HE=new ks([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]),VE=new ks([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]),zO=new ks([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),WE=function(e,t){for(var n=new xc(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new FO(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}},UE=WE(HE,2),KE=UE.b,BO=UE.r;KE[28]=258,BO[258]=28;var HO=WE(VE,0),VO=HO.b,Gx=new xc(32768);for(var vn=0;vn<32768;++vn){var Zo=(vn&43690)>>1|(vn&21845)<<1;Zo=(Zo&52428)>>2|(Zo&13107)<<2,Zo=(Zo&61680)>>4|(Zo&3855)<<4,Gx[vn]=((Zo&65280)>>8|(Zo&255)<<8)>>1}var pd=function(e,t,n){for(var r=e.length,s=0,i=new xc(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new xc(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new xc(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var d=s<<4|e[s],f=t-e[s],u=a[e[s]-1]++<<f,p=u|(1<<f)-1;u<=p;++u)l[Gx[u]>>c]=d}else for(l=new xc(r),s=0;s<r;++s)e[s]&&(l[s]=Gx[a[e[s]-1]++]>>15-e[s]);return l},mf=new ks(288);for(var vn=0;vn<144;++vn)mf[vn]=8;for(var vn=144;vn<256;++vn)mf[vn]=9;for(var vn=256;vn<280;++vn)mf[vn]=7;for(var vn=280;vn<288;++vn)mf[vn]=8;var qE=new ks(32);for(var vn=0;vn<32;++vn)qE[vn]=5;var WO=pd(mf,9,1),UO=pd(qE,5,1),sy=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ci=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},iy=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},KO=function(e){return(e+7)/8|0},Fb=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ks(e.subarray(t,n))},qO=["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"],Vs=function(e,t,n){var r=new Error(t||qO[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Vs),!n)throw r;return r},YO=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new ks(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new ks(s*3));var d=function(Ae){var Ce=n.length;if(Ae>Ce){var Ne=new ks(Math.max(Ce*2,Ae));Ne.set(n),n=Ne}},f=t.f||0,u=t.p||0,p=t.b||0,h=t.l,g=t.d,v=t.m,k=t.n,y=s*8;do{if(!h){f=ci(e,u,1);var b=ci(e,u+1,3);if(u+=3,b)if(b==1)h=WO,g=UO,v=9,k=5;else if(b==2){var j=ci(e,u,31)+257,T=ci(e,u+10,15)+4,$=j+ci(e,u+5,31)+1;u+=14;for(var L=new ks($),F=new ks(19),A=0;A<T;++A)F[zO[A]]=ci(e,u+A*3,7);u+=T*3;for(var R=sy(F),V=(1<<R)-1,M=pd(F,R,1),A=0;A<$;){var D=M[ci(e,u,V)];u+=D&15;var w=D>>4;if(w<16)L[A++]=w;else{var I=0,B=0;for(w==16?(B=3+ci(e,u,3),u+=2,I=L[A-1]):w==17?(B=3+ci(e,u,7),u+=3):w==18&&(B=11+ci(e,u,127),u+=7);B--;)L[A++]=I}}var P=L.subarray(0,j),O=L.subarray(j);v=sy(P),k=sy(O),h=pd(P,v,1),g=pd(O,k,1)}else Vs(1);else{var w=KO(u)+4,N=e[w-4]|e[w-3]<<8,C=w+N;if(C>s){c&&Vs(0);break}l&&d(p+N),n.set(e.subarray(w,C),p),t.b=p+=N,t.p=u=C*8,t.f=f;continue}if(u>y){c&&Vs(0);break}}l&&d(p+131072);for(var _=(1<<v)-1,Y=(1<<k)-1,Q=u;;Q=u){var I=h[iy(e,u)&_],K=I>>4;if(u+=I&15,u>y){c&&Vs(0);break}if(I||Vs(2),K<256)n[p++]=K;else if(K==256){Q=u,h=null;break}else{var ie=K-254;if(K>264){var A=K-257,fe=HE[A];ie=ci(e,u,(1<<fe)-1)+KE[A],u+=fe}var ye=g[iy(e,u)&Y],we=ye>>4;ye||Vs(3),u+=ye&15;var O=VO[we];if(we>3){var fe=VE[we];O+=iy(e,u)&(1<<fe)-1,u+=fe}if(u>y){c&&Vs(0);break}l&&d(p+131072);var ae=p+ie;if(p<O){var ge=i-O,_e=Math.min(O,ae);for(ge+p<0&&Vs(3);p<_e;++p)n[p]=r[ge+p]}for(;p<ae;++p)n[p]=n[p-O]}}t.l=h,t.p=Q,t.b=p,t.f=f,h&&(f=1,t.m=v,t.d=g,t.n=k)}while(!f);return p!=n.length&&a?Fb(n,0,p):n.subarray(0,p)},GO=new ks(0),Ui=function(e,t){return e[t]|e[t+1]<<8},hi=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},oy=function(e,t){return hi(e,t)+hi(e,t+4)*4294967296};function XO(e,t){return YO(e,{i:2},t&&t.out,t&&t.dictionary)}var Xx=typeof TextDecoder<"u"&&new TextDecoder,JO=0;try{Xx.decode(GO,{stream:!0}),JO=1}catch{}var QO=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:Fb(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 ZO(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(Xx)return Xx.decode(e);var s=QO(e),i=s.s,n=s.r;return n.length&&Vs(8),i}}var eM=function(e,t){return t+30+Ui(e,t+26)+Ui(e,t+28)},tM=function(e,t,n){var r=Ui(e,t+28),s=ZO(e.subarray(t+46,t+46+r),!(Ui(e,t+8)&2048)),i=t+46+r,a=hi(e,t+20),l=n&&a==4294967295?nM(e,i):[a,hi(e,t+24),hi(e,t+42)],c=l[0],d=l[1],f=l[2];return[Ui(e,t+10),c,d,s,i+Ui(e,t+30)+Ui(e,t+32),f]},nM=function(e,t){for(;Ui(e,t)!=1;t+=4+Ui(e,t+2));return[oy(e,t+12),oy(e,t+4),oy(e,t+20)]};function rM(e,t){for(var n={},r=e.length-22;hi(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Vs(13);var s=Ui(e,r+8);if(!s)return{};var i=hi(e,r+16),a=i==4294967295||s==65535;if(a){var l=hi(e,r-12);a=hi(e,l)==101075792,a&&(s=hi(e,l+32),i=hi(e,l+48))}for(var c=0;c<s;++c){var d=tM(e,i,a),f=d[0],u=d[1],p=d[2],h=d[3],g=d[4],v=d[5],k=eM(e,v);i=g,f?f==8?n[h]=XO(e.subarray(k,k+u),{out:new ks(p)}):Vs(14,"unknown compression type "+f):n[h]=Fb(e,k,k+u)}return n}const sM=8*1024*1024,iM=500;function oM(e){if(e==null||typeof e!="string")return null;let t=e.replace(/\\/g,"/").replace(/^\uFEFF/,"");for(;t.startsWith("/");)t=t.slice(1);if(!t||t.includes("\0")||/^[a-zA-Z]:/.test(t))return null;const n=t.split("/").filter(r=>r.length>0);for(const r of n)if(r==="."||r==="..")return null;return n.join("/")}function aM(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function lM(e){const t=e.toLowerCase();if(t==="flow.yaml"||t==="flow.yml")return"";const n="/flow.yaml",r="/flow.yml";let s=null;if(t.endsWith(n))s=e.slice(0,-n.length);else if(t.endsWith(r))s=e.slice(0,-r.length);else return null;return s.includes("/")?null:s}const cM=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function uM(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=rM(t),r=new Map;let s=0,i=0;for(const[c,d]of Object.entries(n)){if(c.endsWith("/"))continue;const f=oM(c);if(!f||aM(f))continue;const u=(d==null?void 0:d.length)??0;if(s+=u,s>sM||(i+=1,i>iM))return null;r.set(f,u)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const d=lM(c);d!==null&&a.add(d)}if(a.size!==1)return null;const[l]=[...a];if(l==="")return null;for(const c of r.keys())if(!(c===l||c.startsWith(`${l}/`)))return null;return cM.test(l)?l:null}catch{return null}}const ay=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function dM({file:e,onClose:t,onImported:n}){const{t:r}=hn(),s=m.useId(),i=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(""),[d,f]=m.useState("user"),[u,p]=m.useState(!1),[h,g]=m.useState(""),[v,k]=m.useState(null),y=v??e;m.useEffect(()=>{const C=requestAnimationFrame(()=>{var j;return(j=i.current)==null?void 0:j.focus()});return()=>cancelAnimationFrame(C)},[]),m.useEffect(()=>{let C=!1;return(async()=>{const j=y.name||"",T=j.toLowerCase();let $="";if(T.endsWith(".zip")){if($=await uM(y)||"",!$){const L=j.replace(/\.zip$/i,"");ay.test(L)&&($=L)}}else if(T.endsWith(".yaml")||T.endsWith(".yml")){const L=j.replace(/\.ya?ml$/i,"");ay.test(L)&&($=L)}C||c($)})(),()=>{C=!0}},[y]);const b=l.trim(),w=b.length>0&&ay.test(b);async function N(C){if(C.preventDefault(),!(!w||u)){p(!0),g("");try{const j=new FormData;j.set("flowId",b),j.set("targetSpace",d),j.set("file",y,y.name);const T=await fetch("/api/flows/import",{method:"POST",body:j}),$=await T.json().catch(()=>({}));if(!T.ok){g(typeof $.error=="string"?$.error:r("project:importModal.importFailed"));return}n({id:$.flowId,source:$.flowSource??"user"})}catch(j){g(String((j==null?void 0:j.message)||j))}finally{p(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&t()},children:o.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:C=>C.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:N,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:y.name})}),o.jsx("input",{ref:a,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:C=>{var T;const j=(T=C.target.files)==null?void 0:T[0];j&&k(j),C.target.value=""}}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:importModal.nameLabel")}),o.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"importFlowId",autoComplete:"off",spellCheck:!1,placeholder:r("project:importModal.namePlaceholder"),value:l,onChange:C=>c(C.target.value),"aria-invalid":b.length>0&&!w}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),o.jsx("div",{className:"af-import-repick",children:o.jsx("button",{type:"button",className:"af-btn-secondary af-import-repick-btn",onClick:()=>{var C;return(C=a.current)==null?void 0:C.click()},children:r("project:importModal.changeFile")})}),h?o.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:u,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!w||u,children:r(u?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const fM=/^[a-zA-Z][a-zA-Z0-9_-]*$/,Ck="af:newPipelineGuide";function pM({open:e,onClose:t,onCreated:n}){const{t:r}=hn(),s=m.useId(),i=m.useRef(null),[a,l]=m.useState(""),[c,d]=m.useState(""),[f,u]=m.useState("user"),[p,h]=m.useState(!1),[g,v]=m.useState(""),[k,y]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),d(""),u("user"),v(""),h(!1),localStorage.getItem(Ck)==="true"&&y(!0);const T=requestAnimationFrame(()=>{var $;return($=i.current)==null?void 0:$.focus()});return()=>cancelAnimationFrame(T)},[e]);const b=()=>{localStorage.removeItem(Ck),y(!1)};if(!e)return null;const w=a.trim(),N=w.length>0&&fM.test(w);async function C(j){if(j.preventDefault(),!(!N||p)){h(!0),v(""),b();try{const T=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:w,description:c.trim(),targetSpace:f})}),$=await T.json().catch(()=>({}));if(!T.ok){v(typeof $.error=="string"?$.error:r("project:newPipelineModal.createFailed"));return}n({id:$.flowId,source:$.flowSource??"user"})}catch(T){v(String((T==null?void 0:T.message)||T))}finally{h(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&(b(),t())},children:o.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:j=>j.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{b(),t()},"aria-label":r("project:newPipelineModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),k?o.jsx("div",{className:"af-new-pipeline-guide",children:o.jsxs("div",{className:"af-new-pipeline-guide-content",children:[o.jsx("span",{className:"material-symbols-outlined af-new-pipeline-guide-icon",children:"lightbulb"}),o.jsxs("div",{className:"af-new-pipeline-guide-text",children:[o.jsx("p",{children:o.jsx("strong",{children:r("onboarding:newPipeline.guideTitle")})}),o.jsx("p",{children:r("onboarding:newPipeline.guideDesc")})]}),o.jsx("button",{type:"button",className:"af-new-pipeline-guide-close",onClick:b,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:C,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:newPipelineModal.lead")}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.nameLabel")}),o.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"pipelineName",autoComplete:"off",spellCheck:!1,placeholder:r("project:newPipelineModal.namePlaceholder"),value:a,onChange:j=>l(j.target.value),"aria-invalid":w.length>0&&!N}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(k?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-new-pipeline-textarea",name:"pipelineDescription",rows:3,placeholder:r(k?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:j=>d(j.target.value)}),k?o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),g?o.jsx("p",{className:"af-err af-new-pipeline-err",children:g}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{b(),t()},disabled:p,children:r("project:newPipelineModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!N||p,children:r(p?"project:newPipelineModal.creating":k?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const YE="agentflow.pipelineViewPreference";function GE(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function XE(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(YE)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function hM(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(YE,JSON.stringify(e))}catch{}}function Vh(e){return e==="pipeline"?"pipeline":"workspace"}function mM(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function JE(e,t,n,r=!1){if(!e)return;const s=XE();s[GE(e,t,r)]={view:Vh(n),at:Date.now()},hM(s)}function gM(e,t="workspace"){if(!(e!=null&&e.id))return Vh(t);const r=XE()[GE(e.id,e.source??"user",!!e.archived)],s=Vh((r==null?void 0:r.view)||t);return s==="pipeline"&&!mM(e)?"workspace":s}function zb(e,t="workspace"){if(!(e!=null&&e.id))return t==="pipeline"?"/flow":"/workspace";const n=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&n.set(t==="pipeline"?"flowArchived":"archived","1"),`/${Vh(t)==="pipeline"?"flow":"workspace"}?${n.toString()}`}function kp(e,t="workspace"){return zb(e,gM(e,t))}function yM(e,t){const n=String(e||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),r=String(t||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),s=Math.max(n.length,r.length);for(let i=0;i<s;i+=1){const a=Number.isFinite(n[i])?n[i]:0,l=Number.isFinite(r[i])?r[i]:0;if(a!==l)return a>l?1:-1}return 0}function Jx(e){return String((e==null?void 0:e.version)||"").trim()}function xM(e){const t=Jx(e),n=[(e==null?void 0:e.agent)||"codex",(e==null?void 0:e.kind)||"skill"];return t&&n.push(`v${t}`),n.join(" · ")}function wM({onChanged:e}){const[t,n]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[r,s]=m.useState([]),[i,a]=m.useState(""),[l,c]=m.useState("keyword"),[d,f]=m.useState([]),[u,p]=m.useState({}),[h,g]=m.useState(""),[v,k]=m.useState(""),[y,b]=m.useState(""),w=m.useCallback(async()=>{k("");try{const[L,F]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),A=await L.json().catch(()=>({}));L.ok&&n({available:!!A.available,version:typeof A.version=="string"?A.version:"",loggedIn:!!A.loggedIn,user:typeof A.user=="string"?A.user:"",error:typeof A.error=="string"?A.error:""});const R=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+F.status);s(Array.isArray(R.skills)?R.skills:[]),p({})}catch(L){k(String(L.message||L))}},[]);m.useEffect(()=>{w()},[w]);const N=m.useCallback(async()=>{const L=i.trim();if(L){g("search"),k(""),b("");try{const F=await fetch(`/api/skillhub/search?q=${encodeURIComponent(L)}&mode=${encodeURIComponent(l)}`),A=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof A.error=="string"?A.error:"HTTP "+F.status);f(Array.isArray(A.items)?A.items:[])}catch(F){k(String(F.message||F))}finally{g("")}}},[i,l]),C=m.useCallback(async(L,F=!1)=>{const A=L&&typeof L=="object"?L:null,R=String(A?A.slug||A.name||A.collection||A.skillId||A.id:L||"").trim();if(R){g(`install:${R}`),k(""),b("");try{const V=A?{slug:A.slug||"",skillId:A.skillId||"",collection:A.collection||"",collectionName:A.collection&&A.name||"",target:"global",agent:"codex",force:F}:{slug:R,target:"global",agent:"codex",force:F},M=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)}),D=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof D.error=="string"?D.error:"HTTP "+M.status);b(F?`已更新 ${R}`:`已安装 ${R}`),await w(),typeof e=="function"&&await e()}catch(V){k(String(V.message||V))}finally{g("")}}},[w,e]),j=m.useCallback(async()=>{if(r.length!==0){g("check-updates"),k(""),b("");try{const L=await Promise.all(r.map(async R=>{const V=String(R.name||"").trim();if(!V)return null;try{const M=await fetch(`/api/skillhub/search?q=${encodeURIComponent(V)}&mode=keyword`),D=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof D.error=="string"?D.error:"HTTP "+M.status);const I=Array.isArray(D.items)?D.items:[],B=I.find(Y=>Y.slug===V||Y.name===V||Y.id===V)||I[0],P=Jx(R),O=String((B==null?void 0:B.version)||"").trim();let _="unknown";return B?P&&O?_=yM(P,O)<0?"update":"current":O&&(_="remote-only"):_="missing",[V,{state:_,latestVersion:O,installedVersion:P,summary:(B==null?void 0:B.summary)||""}]}catch(M){return[V,{state:"error",error:String(M.message||M),installedVersion:Jx(R)}]}})),F={};for(const R of L)R&&(F[R[0]]=R[1]);p(F);const A=Object.values(F).filter(R=>R.state==="update").length;b(A>0?`发现 ${A} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{g("")}}},[r]),T=m.useCallback(async L=>{const F=String(L||"").trim();if(F){g(`uninstall:${F}`),k(""),b("");try{const A=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:F,target:"global",agent:"codex"})}),R=await A.json().catch(()=>({}));if(!A.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+A.status);b(`已卸载 ${F}`),await w(),typeof e=="function"&&await e()}catch(A){k(String(A.message||A))}finally{g("")}}},[w,e]),$=m.useCallback(async()=>{g("update-cli"),k(""),b("");try{const L=await fetch("/api/skillhub/update",{method:"POST"}),F=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof F.error=="string"?F.error:"HTTP "+L.status);b("SkillHub CLI 已更新"),await w()}catch(L){k(String(L.message||L))}finally{g("")}},[w]);return o.jsxs("section",{className:"af-set-card af-set-card--span-all af-set-skillhub",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"SkillHub"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"搜索、安装、更新和卸载 Codex 全局 skills。"})]}),o.jsxs("div",{className:"af-set-skillhub-head-actions",children:[o.jsxs("div",{className:"af-set-skillhub-status",children:[o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:"extension"}),o.jsx("span",{children:t.loggedIn?`已登录 ${t.user}`:"未登录 SkillHub"}),o.jsx("span",{className:"af-set-badge"+(t.available?" af-set-badge--ok":" af-set-badge--err"),children:t.available?`v${t.version}`:"not found"})]}),o.jsxs("div",{className:"af-set-skillhub-toolbar",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:w,disabled:!!h,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:!!h||r.length===0,children:h==="check-updates"?"检查中…":"检查更新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:$,disabled:!!h,children:h==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),o.jsxs("div",{className:"af-set-skillhub-search",children:[o.jsxs("select",{className:"af-set-input af-set-input--sm af-set-skillhub-search-mode",value:l,onChange:L=>{c(L.target.value),f([])},children:[o.jsx("option",{value:"keyword",children:"关键词"}),o.jsx("option",{value:"skillId",children:"Skill ID"}),o.jsx("option",{value:"collectionId",children:"Collection ID"})]}),o.jsx("input",{className:"af-set-input af-set-input--sm",value:i,onChange:L=>a(L.target.value),onKeyDown:L=>{L.key==="Enter"&&N()},placeholder:l==="collectionId"?"输入 collection id,例如 1":l==="skillId"?"输入 skill id":"搜索 skill slug / 关键词,例如 android、issue-tracker"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>N(),disabled:!i.trim()||h==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),h==="search"?"搜索中…":"搜索"]})]}),v?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:v}):null,y?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:y}):null,o.jsxs("div",{className:"af-set-skillhub-grid",children:[o.jsxs("div",{className:"af-set-skillhub-pane",children:[o.jsxs("div",{className:"af-set-skillhub-pane-head",children:[o.jsx("h3",{children:"已安装"}),o.jsx("span",{children:r.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:r.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 Codex 全局 skills"}):r.map(L=>{const F=u[L.name],A=!F||F.state==="update"||F.state==="remote-only"||F.state==="unknown"||F.state==="error",R=h===`install:${L.name}`?"更新中…":(F==null?void 0:F.state)==="current"?"已最新":(F==null?void 0:F.state)==="update"&&F.latestVersion?`更新到 v${F.latestVersion}`:(F==null?void 0:F.state)==="remote-only"&&F.latestVersion?`安装 v${F.latestVersion}`:"重装";return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:L.displayName||L.name}),o.jsx("div",{className:"af-set-skillhub-meta",children:xM(L)}),o.jsx("div",{className:"af-set-skillhub-version-row",children:F?F.state==="update"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",F.installedVersion?`v${F.installedVersion} -> `:"","v",F.latestVersion]}):F.state==="current"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",F.latestVersion||F.installedVersion]}):F.state==="remote-only"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",F.latestVersion,",本地版本未知"]}):F.state==="missing"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):F.state==="error"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--err",children:"检查失败"}):o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"状态未知"}):o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未检查远端版本"})})]}),o.jsxs("div",{className:"af-set-skillhub-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>C(L.name,!0),disabled:!!h||!A,children:R}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>T(L.name),disabled:!!h,children:"卸载"})]})]},`${L.agent}:${L.path}:${L.name}`)})})]}),o.jsxs("div",{className:"af-set-skillhub-pane",children:[o.jsxs("div",{className:"af-set-skillhub-pane-head",children:[o.jsx("h3",{children:"搜索结果"}),o.jsx("span",{children:d.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:d.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):d.map(L=>{const F=L.slug||L.name,A=L.kind==="collection"||L.collection,R=!A&&r.some(V=>V.name===F||V.name===L.name);return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:L.name||F}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[A?`collection:${L.collection}`:F,L.skillId?` · id:${L.skillId}`:"",L.version?` · ${L.version}`:""]}),L.summary?o.jsx("p",{className:"af-set-skillhub-summary",children:L.summary}):null]}),o.jsx("button",{type:"button",className:R?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>C(L,R),disabled:!!h,children:R?"更新":A?"安装合集":"安装"})]},L.id||F)})})]})]})]})}function Sa(e){return(Array.isArray(e==null?void 0:e.collections)?e.collections:[]).filter(n=>n&&typeof n=="object").map(n=>({id:String(n.id||n.name||"").trim(),name:String(n.name||n.id||"").trim(),skillKeys:Array.from(new Set((Array.isArray(n.skillKeys)?n.skillKeys:[]).map(r=>String(r||"").trim()).filter(Boolean))),builtin:!!n.builtin,createdAt:Number.isFinite(n.createdAt)?Number(n.createdAt):Date.now(),updatedAt:Number.isFinite(n.updatedAt)?Number(n.updatedAt):Date.now()})).filter(n=>n.id&&n.name)}function bM(e){return{version:1,collections:Sa({collections:e})}}function Pa(e,t){const n=new Set((Array.isArray(t)?t:[]).map(r=>r.key).filter(Boolean));return(Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).filter(r=>n.has(r))}function QE(e,t){const n=new Set(Array.isArray(e)?e:[]);for(const r of Array.isArray(t)?t:[])r&&n.add(r);return Array.from(n)}function ZE(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function e_(e,t,n){const r=Pa(e,n);if(r.length===0)return"empty";const s=r.filter(i=>t.has(i)).length;return s===0?"none":s===r.length?"all":"partial"}function vM(e,t,n){const r=String(e||"").trim().toLowerCase(),s=Sa({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return Pa(s,t)}function t_(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(d=>d.key).filter(Boolean),i=String(t||"").trim().toLowerCase(),a=Sa({collections:r}),l=vM(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const d=localStorage.getItem(e);if(d!==null){const f=JSON.parse(d);if(Array.isArray(f)){const u=new Set(s),p=f.map(String).filter(y=>u.has(y));if(s.length>0&&p.length===s.length)return c;const h=new Set(p),g=new Set(l),v=l.length>0&&l.every(y=>h.has(y)),k=a.some(y=>{if(!y.builtin||y.id===i||y.name.toLowerCase()===i)return!1;const b=Pa(y,n);return b.length>0&&b.every(w=>h.has(w))});return l.length>0&&k&&!v?c:p}}}catch{}return c}function $u(e){return e==="secondary"?"af-proj-badge af-proj-badge--secondary":e==="primary"?"af-proj-badge af-proj-badge--primary":e==="muted"?"af-proj-badge af-proj-badge--muted":"af-proj-badge"}function kM(e){return e==="executed"?"material-symbols-outlined af-act-icon af-act-icon--executed":"material-symbols-outlined af-act-icon af-act-icon--opened"}function Qx(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="admin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function n_(e){const t=e.source??"user";return t==="builtin"?`builtin/pipelines / ${e.id}`:t==="admin"?`admin builtin / ${e.ownerUserId||"-"} / ${e.id}`:t==="workspace"?e.archived?`.workspace/agentflow/pipelines/_archived / ${e.id}`:`.workspace/agentflow/pipelines / ${e.id}`:e.archived?`~/agentflow/pipelines/_archived / ${e.id}`:`~/agentflow/pipelines / ${e.id}`}const SM="project:defaultCardDesc";function r_(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(SM)}function NM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gn({children:e,className:t="",query:n}){const r=n.trim(),s=String(e);if(!r)return o.jsx("span",{className:t,children:s});const i=new RegExp(`(${NM(r)})`,"gi"),a=s.split(i);return o.jsx("span",{className:t,children:a.map((l,c)=>c%2===1?o.jsx("mark",{className:"af-search-hit",children:l},c):o.jsx("span",{children:l},c))})}function jM(e,t,n){const r=[String(e.id),r_(e,n),n_(e),Qx(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function CM(e,t,n){return t?jM(e,t,n).includes(t):!0}function EM(e,t){const n=e.trim().toLowerCase();if(!n)return!0;const r=String(t.flowId).toLowerCase(),s=String(t.flowSource??"user").toLowerCase();return r.includes(n)||s.includes(n)}function ly(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function Ek(e,t){return e==="flow"?t("project:resourceSource.flow"):e==="marketplace"?t("project:resourceSource.marketplace"):e==="project"?t("project:resourceSource.global"):e||t("project:resourceSource.global")}function _k(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const _M=["all","agent","control","provide","marketplace"],PM=["all","agent","control","provide"],s_="agentflow.projects.activityPanelOpen",Zx="agentflow.projects.activitySelected";function AM(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(s_);return e!=="0"}function Pk(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function IM(){return typeof localStorage>"u"?"":localStorage.getItem(Zx)||""}function Sp(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Cn(e){return(e==null?void 0:e.key)||`${(e==null?void 0:e.id)||(e==null?void 0:e.name)||""}:${(e==null?void 0:e.source)||""}:${(e==null?void 0:e.packageId)||""}`}function ea(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function i_(e){var n;const t=(n=e==null?void 0:e.snippet)==null?void 0:n.instances;return Array.isArray(t)?t.filter(r=>r&&typeof r=="object"):t&&typeof t=="object"?Object.entries(t).map(([r,s])=>({...s&&typeof s=="object"?s:{},instanceId:(s==null?void 0:s.instanceId)||r})):[]}function o_(e){var n;const t=(n=e==null?void 0:e.snippet)==null?void 0:n.edges;return Array.isArray(t)?t.filter(r=>r&&typeof r=="object"):[]}function ew(e,t){return String((e==null?void 0:e.instanceId)||(e==null?void 0:e.id)||(e==null?void 0:e.nodeId)||`node_${t+1}`)}function Ak(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||ew(e,t))}function TM(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function Ik(e,t){return String(t==="source"?(e==null?void 0:e.source)||(e==null?void 0:e.from)||(e==null?void 0:e.sourceId)||(e==null?void 0:e.fromNode)||(e==null?void 0:e.fromInstanceId)||"":(e==null?void 0:e.target)||(e==null?void 0:e.to)||(e==null?void 0:e.targetId)||(e==null?void 0:e.toNode)||(e==null?void 0:e.toInstanceId)||"")}function RM(e){const t=(e==null?void 0:e.sourceHandle)||(e==null?void 0:e.fromHandle)||(e==null?void 0:e.output)||(e==null?void 0:e.outputName),n=(e==null?void 0:e.targetHandle)||(e==null?void 0:e.toHandle)||(e==null?void 0:e.input)||(e==null?void 0:e.inputName);return t&&n?`${t} -> ${n}`:String(t||n||"")}function cy(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function LM(e){const t=Number(e==null?void 0:e.x),n=Number(e==null?void 0:e.y);return!Number.isFinite(t)||!Number.isFinite(n)?null:{x:t,y:n}}function OM(e,t){const n=e.map(f=>f.id),r=new Set(n),s=new Map(n.map(f=>[f,0])),i=new Map(n.map(f=>[f,[]]));t.forEach(f=>{var u;!r.has(f.sourceId)||!r.has(f.targetId)||(s.set(f.targetId,(s.get(f.targetId)||0)+1),(u=i.get(f.sourceId))==null||u.push(f.targetId))});const a=new Map,l=n.filter(f=>(s.get(f)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(f=>a.set(f,0));for(let f=0;f<l.length;f+=1){const u=l[f],p=(a.get(u)||0)+1;for(const h of i.get(u)||[])(!a.has(h)||p>a.get(h))&&(a.set(h,p),l.push(h))}n.forEach((f,u)=>{a.has(f)||a.set(f,u%3)});const c=new Map,d=new Map;return n.forEach(f=>{const u=a.get(f)||0,p=c.get(u)||0;c.set(u,p+1),d.set(f,{x:u*190,y:p*86})}),d}function MM(e){var v,k,y,b;const t=i_(e),n=o_(e),r=new Map(t.map((w,N)=>[ew(w,N),Ak(w,N)])),s=t.map((w,N)=>({id:ew(w,N),title:Ak(w,N),meta:TM(w)})),i=n.map((w,N)=>{const C=Ik(w,"source"),j=Ik(w,"target");return{key:(w==null?void 0:w.id)||`${C}-${j}-${N}`,sourceId:C,targetId:j,source:r.get(C)||C||"?",target:r.get(j)||j||"?",label:RM(w)}}),a=(k=(v=e==null?void 0:e.snippet)==null?void 0:v.ui)!=null&&k.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(b=(y=e==null?void 0:e.snippet)==null?void 0:y.ui)!=null&&b.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=OM(s,i),d=s.map(w=>{const N=LM(a[w.id])||c.get(w.id)||{x:0,y:0},C=l[w.id]&&typeof l[w.id]=="object"?l[w.id]:{},j=Number(C.width),T=Number(C.height),$=Math.max(132,Math.min(210,Number.isFinite(j)?j*.62:150)),L=Math.max(48,Math.min(76,Number.isFinite(T)?T*.46:54));return{...w,x:N.x,y:N.y,width:$,height:L}}),f=new Map(d.map(w=>[w.id,w])),u=i.map(w=>{const N=f.get(w.sourceId),C=f.get(w.targetId);if(!N||!C)return null;const j=N.x+N.width,T=N.y+N.height/2,$=C.x,L=C.y+C.height/2,F=Math.max(48,Math.abs($-j)*.45);return{...w,path:`M ${j} ${T} C ${j+F} ${T}, ${$-F} ${L}, ${$} ${L}`,labelX:(j+$)/2,labelY:(T+L)/2}}).filter(Boolean),p=d.reduce((w,N)=>({minX:Math.min(w.minX,N.x),minY:Math.min(w.minY,N.y),maxX:Math.max(w.maxX,N.x+N.width),maxY:Math.max(w.maxY,N.y+N.height)}),{minX:0,minY:0,maxX:420,maxY:220}),h=36,g=`${p.minX-h} ${p.minY-h} ${Math.max(360,p.maxX-p.minX+h*2)} ${Math.max(180,p.maxY-p.minY+h*2)}`;return{nodes:s,edges:i,diagram:{nodes:d,edges:u,viewBox:g}}}function Xl({resourceKind:e="",authUser:t=null}){var Ms,en,wr,zr,ys,Yr;const{t:n}=hn(),{navigate:r,path:s}=Da(),[i,a]=m.useState(e||"all"),[l,c]=m.useState([]),[d,f]=m.useState([]),[u,p]=m.useState([]),[h,g]=m.useState([]),[v,k]=m.useState([]),[y,b]=m.useState(""),[w,N]=m.useState(!1),[C,j]=m.useState([]),[T,$]=m.useState(""),[L,F]=m.useState(""),[A,R]=m.useState(!1),[V,M]=m.useState(!1),[D,I]=m.useState(!1),[B,P]=m.useState(null),[O,_]=m.useState(!1),[Y,Q]=m.useState(""),[K,ie]=m.useState(AM),[fe,ye]=m.useState(IM),[we,ae]=m.useState("all"),[ge,_e]=m.useState(""),[Ae,Ce]=m.useState("overview"),[Ne,Ye]=m.useState({}),[Ze,Ge]=m.useState(""),[It,qe]=m.useState({}),[ct,Ht]=m.useState(""),[Le,Jt]=m.useState(""),[Qt,Nn]=m.useState({}),[ce,ee]=m.useState(""),[he,Me]=m.useState(""),[We,Qe]=m.useState(""),[Gt,mn]=m.useState(""),[gn,yn]=m.useState(""),[Pr,xn]=m.useState(!1),[Dn,xe]=m.useState(""),[De,tn]=m.useState({hiddenBuiltins:[],promoted:[]}),Fn=m.useRef(0),st=m.useRef(0),zn=m.useCallback(async()=>{var de,Ie;const W=++st.current;$("");try{const Ee=await fetch("/api/flows");if(W!==st.current)return;if(!Ee.ok)throw new Error("HTTP "+Ee.status);const Re=await Ee.json();if(W!==st.current)return;c(Array.isArray(Re)?Re:[])}catch(Ee){if(W!==st.current)return;c([]),$(String(Ee.message||Ee))}try{const Ee=await fetch("/api/pipeline-recent-runs");if(W!==st.current)return;if(Ee.ok){const Re=await Ee.json();if(W!==st.current)return;j(Array.isArray(Re.runs)?Re.runs:[])}else j([])}catch{if(W!==st.current)return;j([])}if(t!=null&&t.isAdmin)try{const Ee=await fetch("/api/admin/builtin-flows");if(W!==st.current)return;const Re=await Ee.json().catch(()=>({}));Ee.ok&&tn({hiddenBuiltins:Array.isArray((de=Re==null?void 0:Re.config)==null?void 0:de.hiddenBuiltins)?Re.config.hiddenBuiltins:[],promoted:Array.isArray((Ie=Re==null?void 0:Re.config)==null?void 0:Ie.promoted)?Re.config.promoted:[]})}catch{if(W!==st.current)return;tn({hiddenBuiltins:[],promoted:[]})}else tn({hiddenBuiltins:[],promoted:[]});R(!0)},[t==null?void 0:t.isAdmin]),Rs=m.useCallback(async(W,de)=>{if(!(t!=null&&t.isAdmin)||!(W!=null&&W.id))return;const Ie=`${de}:${W.source}:${W.id}`;xe(Ie),$("");try{const Ee=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:de,flowId:W.id,ownerUserId:W.ownerUserId||t.userId})}),Re=await Ee.json().catch(()=>({}));if(!Ee.ok)throw new Error(Re.error||"更新内置配置失败");await zn()}catch(Ee){$(String(Ee.message||Ee))}finally{xe("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,zn]),Ar=m.useCallback(async()=>{F(""),M(!1);try{const[W,de,Ie,Ee]=await Promise.all([fetch("/api/nodes"),fetch("/api/skills"),fetch("/api/skill-collections"),fetch("/api/marketplace/flow-snippets")]),Re=await W.json().catch(()=>({})),Ft=await de.json().catch(()=>({})),St=await Ie.json().catch(()=>({})),In=await Ee.json().catch(()=>({}));if(!W.ok)throw new Error(Re.error||"Nodes HTTP "+W.status);if(!de.ok)throw new Error(Ft.error||"Skills HTTP "+de.status);if(!Ie.ok)throw new Error(St.error||"Collections HTTP "+Ie.status);if(!Ee.ok)throw new Error(In.error||"Flow snippets HTTP "+Ee.status);f(Array.isArray(Re.nodes)?Re.nodes:Array.isArray(Re)?Re:[]),p(Array.isArray(Ft.skills)?Ft.skills:[]),k(Sa(St)),g(Array.isArray(In.snippets)?In.snippets:[])}catch(W){f([]),p([]),g([]),k([]),F(String(W.message||W))}finally{M(!0)}},[]);m.useEffect(()=>{R(!1),zn(),Ar()},[zn,Ar]),m.useEffect(()=>{try{localStorage.setItem(s_,K?"1":"0")}catch{}},[K]),m.useEffect(()=>{try{fe?localStorage.setItem(Zx,fe):localStorage.removeItem(Zx)}catch{}},[fe]),m.useEffect(()=>{let W=!1;return fetch("/api/ui-context").then(de=>de.json()).then(de=>{W||xn(!!de.hideCommunityLinks)}).catch(()=>{}),()=>{W=!0}},[]);const Pn=m.useCallback(async W=>{const de=Sa({collections:W});N(!0),F("");try{const Ie=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(bM(de))}),Ee=await Ie.json().catch(()=>({}));if(!Ie.ok)throw new Error(Ee.error||"Collections HTTP "+Ie.status);k(Sa(Ee))}catch(Ie){F(String(Ie.message||Ie))}finally{N(!1)}},[]),hs=m.useCallback(()=>{const W=y.trim();if(!W)return;const de=W.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Ie=new Set(v.map(St=>St.id));let Ee=de,Re=2;for(;Ie.has(Ee);)Ee=`${de}-${Re++}`;const Ft=Date.now();Pn([...v,{id:Ee,name:W,skillKeys:[],createdAt:Ft,updatedAt:Ft}]),b(""),ae(`collection:${Ee}`)},[y,Pn,v]),Ls=m.useCallback(W=>{const de=v.find(Ee=>Ee.id===W);if(de!=null&&de.builtin)return;const Ie=v.filter(Ee=>Ee.id!==W);we===`collection:${W}`&&ae("all"),Pn(Ie)},[we,Pn,v]),zo=m.useCallback((W,de,Ie)=>{const Ee=String(de||"").trim();if(!Ee)return;const Re=Date.now(),Ft=v.map(St=>{if(St.id!==W)return St;const In=new Set(St.skillKeys||[]);return Ie?In.add(Ee):In.delete(Ee),{...St,skillKeys:Array.from(In),updatedAt:Re}});Pn(Ft)},[Pn,v]),so=m.useCallback(async W=>{const de=W==null?void 0:W.packageId,Ie=W==null?void 0:W.version;if(!de||!Ie||!window.confirm(n("project:deleteMyNodeConfirm",{id:de,version:Ie})))return;const Ee=Cn(W);Me(Ee),Qe(""),F("");try{const Re=new URLSearchParams({id:de,version:Ie}),Ft=await fetch(`/api/marketplace/node?${Re.toString()}`,{method:"DELETE"}),St=await Ft.json().catch(()=>({}));if(!Ft.ok||(St==null?void 0:St.ok)===!1){const In=Array.isArray(St==null?void 0:St.usage)&&St.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:St.usage.length})}`:"";throw new Error(((St==null?void 0:St.error)||"Delete failed")+In)}Qe(n("project:deleteMyNodeSuccess",{id:de,version:Ie})),qe(In=>{const Tn={...In};return delete Tn[Ee],Tn}),Nn(In=>{const Tn={};for(const[Ir,lo]of Object.entries(In))Ir.startsWith(`${Ee}:`)||(Tn[Ir]=lo);return Tn}),_e(""),await Ar()}catch(Re){Qe(String(Re.message||Re))}finally{Me("")}},[Ar,n]),ji=m.useCallback(async W=>{const de=W==null?void 0:W.id,Ie=(W==null?void 0:W.version)||"1.0.0";if(!de||!Ie||!window.confirm(n("project:deleteMyFlowConfirm",{id:de,version:Ie})))return;const Ee=ea(W);mn(Ee),yn(""),F("");try{const Re=new URLSearchParams({id:de,version:Ie}),Ft=await fetch(`/api/marketplace/flow-snippet?${Re.toString()}`,{method:"DELETE"}),St=await Ft.json().catch(()=>({}));if(!Ft.ok||(St==null?void 0:St.ok)===!1)throw new Error((St==null?void 0:St.error)||"Delete failed");yn(n("project:deleteMyFlowSuccess",{id:de,version:Ie})),_e(""),await Ar()}catch(Re){yn(String(Re.message||Re))}finally{mn("")}},[Ar,n]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){a(e),ae("all"),_e(""),Ce("overview");return}a(W=>W==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const W=new URLSearchParams(window.location.search);let de=!1;if(W.get("tab")==="nodes"){r("/nodes");return}if(W.get("tab")==="my-nodes"){r("/my-nodes");return}if(W.get("tab")==="my-flows"){r("/my-flows");return}if(W.get("tab")==="skills"){r("/skills");return}if(W.get("tab")==="archived"&&(a("archived"),W.delete("tab"),de=!0),W.get("new")==="1"&&(I(!0),W.delete("new"),de=!0),de){const Ie=W.toString();window.history.replaceState({},"",Ie?`/projects?${Ie}`:"/projects")}},[s,r]);const ms=m.useMemo(()=>DO(C,BE(),l),[C,l,s]),io=m.useMemo(()=>ms.filter(W=>EM(Y,W)),[ms,Y]),Jn=Y.trim().toLowerCase(),gs=m.useMemo(()=>i==="archived"?l.filter(W=>W.archived):l.filter(W=>!W.archived),[l,i]),Qs=m.useMemo(()=>gs.filter(W=>CM(W,Jn,n)),[gs,Jn,n]),Bo=m.useMemo(()=>new Set((De.promoted||[]).map(W=>String((W==null?void 0:W.id)||"").trim()).filter(Boolean)),[De.promoted]),oo=m.useMemo(()=>(De.hiddenBuiltins||[]).map(W=>String(W||"").trim()).filter(Boolean),[De.hiddenBuiltins]),An=i==="nodes"||i==="my-nodes",Pe=i==="my-nodes",qt=i==="my-flows",ir=m.useMemo(()=>d.filter(W=>Pe&&W.source!=="marketplace"?!1:(we==="all"||(we==="marketplace"?W.source==="marketplace":W.type===we))&&ly(Y,[W.id,W.label,W.displayName,W.description,W.type,W.source,W.packageId,W.version])),[d,Pe,Y,we]),ut=m.useMemo(()=>{const W=new Map;for(const de of v)W.set(de.id,new Set(de.skillKeys||[]));return W},[v]),Zs=m.useMemo(()=>[{id:"all",label:"全部"},...v.map(W=>({id:`collection:${W.id}`,label:W.name,count:W.skillKeys.length,collection:W})),{id:"ungrouped",label:"未分组"}],[v]),Kn=m.useMemo(()=>u.filter(W=>{var Ee;const de=Cn(W);let Ie=we==="all";if(we.startsWith("collection:")){const Re=we.slice(11);Ie=!!((Ee=ut.get(Re))!=null&&Ee.has(de))}else we==="ungrouped"&&(Ie=!Array.from(ut.values()).some(Re=>Re.has(de)));return Ie&&ly(Y,[W.name,W.id,W.description,W.sourceLabel,W.source,W.path])}),[u,Y,we,ut]),Bn=m.useMemo(()=>h.filter(W=>ly(Y,[W.id,W.name,W.displayName,W.description,W.version,W.packageDir,Array.isArray(W.tags)?W.tags.join(" "):""])),[h,Y]),xr=An||qt||i==="skills",tt=m.useMemo(()=>ir.find(W=>Cn(W)===ge)||ir[0]||null,[ir,ge]),Ct=m.useMemo(()=>Kn.find(W=>Cn(W)===ge)||Kn[0]||null,[Kn,ge]),Vt=m.useMemo(()=>Bn.find(W=>ea(W)===ge)||Bn[0]||null,[Bn,ge]),Fr=Ct?Ne[Cn(Ct)]:null,Be=tt?It[Cn(tt)]:null,Qn=tt&&Le?Qt[`${Cn(tt)}:${Le}`]:null,Hn=n(An?"project:searchNodes":qt?"project:searchFlows":i==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(i!=="skills"||!Ct)return;const W=Cn(Ct);if(Ne[W])return;let de=!1;return Ge(W),fetch(`/api/skills/detail?key=${encodeURIComponent(W)}`).then(Ie=>Ie.json().then(Ee=>({ok:Ie.ok,json:Ee}))).then(({ok:Ie,json:Ee})=>{de||Ie&&Ee.skill&&Ye(Re=>({...Re,[W]:Ee.skill}))}).catch(()=>{}).finally(()=>{de||Ge("")}),()=>{de=!0}},[i,Ct,Ne]),m.useEffect(()=>{if(!An||!tt)return;const W=Cn(tt);if(It[W])return;let de=!1;return Ht(W),fetch(`/api/nodes/detail?id=${encodeURIComponent(tt.id)}`).then(Ie=>Ie.json().then(Ee=>({ok:Ie.ok,json:Ee}))).then(({ok:Ie,json:Ee})=>{de||Ie&&qe(Re=>({...Re,[W]:Ee}))}).catch(()=>{}).finally(()=>{de||Ht("")}),()=>{de=!0}},[An,tt,It]),m.useEffect(()=>{if(!An)return;const W=Array.isArray(Be==null?void 0:Be.files)?Be.files:[];Jt(de=>{var Ie;return de&&W.some(Ee=>Ee.path===de)?de:((Ie=W[0])==null?void 0:Ie.path)||""})},[An,Be]),m.useEffect(()=>{if(!An||!tt||!Le)return;const W=`${Cn(tt)}:${Le}`;if(Qt[W])return;let de=!1;return ee(W),fetch(`/api/nodes/file?id=${encodeURIComponent(tt.id)}&path=${encodeURIComponent(Le)}`).then(Ie=>Ie.json().then(Ee=>({ok:Ie.ok,json:Ee}))).then(({ok:Ie,json:Ee})=>{de||Ie&&Nn(Re=>({...Re,[W]:Ee}))}).catch(()=>{}).finally(()=>{de||ee("")}),()=>{de=!0}},[An,tt,Le,Qt]),m.useEffect(()=>{Qe("")},[ge,i]);const Ci=W=>{r(kp(W,"workspace"))},ei=W=>{ye(Pk(W)),r(kp({id:W.flowId,source:W.flowSource,archived:!!W.archived},"workspace"))},Ei=m.useCallback(W=>{var de,Ie;W.preventDefault(),W.stopPropagation(),(Ie=(de=W.dataTransfer)==null?void 0:de.types)!=null&&Ie.includes("Files")&&(Fn.current+=1,_(!0))},[]),Os=m.useCallback(W=>{W.preventDefault(),W.stopPropagation(),Fn.current-=1,Fn.current<=0&&(Fn.current=0,_(!1))},[]),ao=m.useCallback(W=>{W.preventDefault(),W.stopPropagation()},[]),ti=m.useCallback(W=>{var Ee,Re;W.preventDefault(),W.stopPropagation(),Fn.current=0,_(!1);const de=(Re=(Ee=W.dataTransfer)==null?void 0:Ee.files)==null?void 0:Re[0];if(!de)return;const Ie=de.name.toLowerCase();!Ie.endsWith(".yaml")&&!Ie.endsWith(".yml")&&!Ie.endsWith(".zip")||P(de)},[]);return o.jsxs("div",{className:"af-projects"+(O?" af-projects--drop-target":""),onDragEnter:Ei,onDragLeave:Os,onDragOver:ao,onDrop:ti,children:[o.jsxs("header",{className:"af-projects-top",children:[e?o.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):o.jsxs("div",{className:"af-projects-tabs",children:[o.jsx("button",{type:"button",className:i==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>a("all"),children:n("project:all")}),o.jsx("button",{type:"button",className:i==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>a("archived"),children:n("project:archived")})]}),o.jsxs("div",{className:"af-projects-top-right",children:[o.jsxs("div",{className:"af-search-wrap",children:[o.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),o.jsx("input",{className:"af-search"+(Y.trim()?" af-search--has-clear":""),type:"search",placeholder:Hn,"aria-label":Hn,autoComplete:"off",value:Y,onChange:W=>Q(W.target.value),onKeyDown:W=>{W.key==="Escape"&&(Q(""),W.currentTarget.blur())}}),Y.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>Q(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),xr?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Ar(),children:n("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(K?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":K,"aria-controls":"af-recent-activity-panel",onClick:()=>ie(W=>!W),children:o.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>I(!0),children:n("project:createNew")})]})]})]}),o.jsxs("div",{className:"af-projects-body",children:[o.jsxs("section",{className:"af-projects-main",children:[o.jsxs("header",{className:"af-projects-section-head",children:[o.jsx("h2",{className:"af-projects-h2",children:n(i==="my-nodes"?"project:myNodes":i==="my-flows"?"project:myFlows":i==="nodes"?"project:globalNodes":i==="skills"?"project:globalSkills":i==="archived"?"project:archivedPipelines":"project:activeProjects")}),o.jsx("p",{className:"af-projects-sub",children:Jn?n("project:filterResult",{count:i==="nodes"||i==="my-nodes"?ir.length:i==="my-flows"?Bn.length:i==="skills"?Kn.length:Qs.length}):i==="my-nodes"?n("project:myNodesHint",{count:ir.length}):i==="my-flows"?n("project:myFlowsHint",{count:Bn.length}):i==="nodes"?n("project:nodesHint",{count:d.length}):i==="skills"?n("project:skillsHint",{count:u.length}):n(i==="archived"?"project:archivedHint":"project:activeHint")}),T?o.jsx("p",{className:"af-err af-projects-api-hint",children:T}):null,L&&xr?o.jsx("p",{className:"af-err af-projects-api-hint",children:L}):null]}),xr?o.jsxs("div",{className:"af-resource-toolbar",children:[i==="skills"?o.jsx(wM,{onChanged:Ar}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:qt?"schema":An?Pe?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:n(qt?"project:myFlowsPurposeTitle":Pe?"project:myNodesPurposeTitle":An?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:n(qt?"project:myFlowsPurposeDesc":Pe?"project:myNodesPurposeDesc":An?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),qt?null:o.jsx("div",{className:"af-resource-filter-row",children:(An?(Pe?PM:_M).map(W=>({id:W,label:n(`project:resourceFilter.${W}`)})):Zs).map(W=>W.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(we===W.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{ae(W.id),_e("")},children:[W.label,o.jsx("em",{children:W.count}),W.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),W.collection.builtin?null:o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:w,"aria-label":`删除 ${W.collection.name}`,onClick:()=>Ls(W.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},W.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(we===W.id?" af-resource-filter--active":""),onClick:()=>{ae(W.id),_e("")},children:W.label},W.id))}),i==="skills"?o.jsx("div",{className:"af-skill-collections-manager",children:o.jsxs("div",{className:"af-skill-collections-create",children:[o.jsx("input",{className:"af-set-input af-set-input--sm",value:y,onChange:W=>b(W.target.value),onKeyDown:W=>{W.key==="Enter"&&hs()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!y.trim()||w,onClick:()=>hs(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,An?o.jsx("div",{className:"af-resource-grid",children:ir.length>0?ir.map(W=>o.jsxs("button",{type:"button",className:"af-resource-card"+(tt&&Cn(W)===Cn(tt)?" af-resource-card--active":""),onClick:()=>_e(Cn(W)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:$u(W.type==="control"?"secondary":W.type==="provide"?"primary":"muted"),children:o.jsx(Gn,{query:Y,children:W.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(Gn,{query:Y,children:Ek(W.source,n)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Gn,{query:Y,children:W.label||W.displayName||W.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Gn,{query:Y,children:W.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(Gn,{query:Y,children:W.id})}),o.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(W.inputs||{}).length,outputs:Object.keys(W.outputs||{}).length})})]}),W.packageId?o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"deployed_code"}),o.jsx("span",{className:"af-path-text",children:o.jsx(Gn,{query:Y,children:`${W.packageId}${W.version?` / ${W.version}`:""}`})})]}):null]},`${W.id}:${W.source||""}:${W.packageId||""}`)):V?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Jn?n("project:noNodeMatch",{query:Y.trim()}):n(Pe?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):qt?o.jsx("div",{className:"af-resource-grid",children:Bn.length>0?Bn.map(W=>{const de=i_(W),Ie=o_(W),Ee=Number.isFinite(Number(W.nodeCount))?Number(W.nodeCount):de.length,Re=Number.isFinite(Number(W.edgeCount))?Number(W.edgeCount):Ie.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(Vt&&ea(W)===ea(Vt)?" af-resource-card--active":""),onClick:()=>_e(ea(W)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:$u("primary"),children:o.jsx(Gn,{query:Y,children:W.version?`v${W.version}`:"flow"})}),o.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Gn,{query:Y,children:W.displayName||W.name||W.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Gn,{query:Y,children:W.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:n("project:flowSnippetNodes",{nodes:Ee,edges:Re})}),o.jsx("span",{children:o.jsx(Gn,{query:Y,children:W.id})})]}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"schema"}),o.jsx("span",{className:"af-path-text",children:o.jsx(Gn,{query:Y,children:_k(W)})})]})]},ea(W))}):V?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Jn?n("project:noFlowSnippetMatch",{query:Y.trim()}):n("project:noMyFlows")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):i==="skills"?o.jsx("div",{className:"af-resource-grid",children:Kn.length>0?Kn.map(W=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Ct&&Cn(W)===Cn(Ct)?" af-resource-card--active":""),onClick:()=>_e(Cn(W)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:$u(W.source==="builtin"?"muted":"primary"),children:o.jsx(Gn,{query:Y,children:W.sourceLabel||W.source||"skill"})}),o.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Gn,{query:Y,children:W.name||W.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Gn,{query:Y,children:W.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),o.jsx("span",{className:"af-path-text",children:o.jsx(Gn,{query:Y,children:W.path||W.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[v.filter(de=>de.skillKeys.includes(Cn(W))).slice(0,3).map(de=>o.jsx("span",{children:de.name},de.id)),v.filter(de=>de.skillKeys.includes(Cn(W))).length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},W.key||`${W.source}:${W.name}`)):V?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Jn?n("project:noSkillMatch",{query:Y.trim()}):n("project:noSkills")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):o.jsxs(o.Fragment,{children:[t!=null&&t.isAdmin&&i==="all"&&oo.length>0?o.jsxs("div",{className:"af-project-admin-panel",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"已隐藏内置"}),o.jsx("span",{children:"这些包内置流水线不会出现在普通项目列表中。"})]}),o.jsx("div",{className:"af-project-admin-hidden-list",children:oo.map(W=>{const de=Dn===`show-builtin:builtin:${W}`;return o.jsxs("button",{type:"button",disabled:de,onClick:()=>Rs({id:W,source:"builtin"},"show-builtin"),children:[o.jsx("span",{children:W}),o.jsx("em",{children:de?"恢复中":"恢复"})]},W)})})]}):null,o.jsxs("div",{className:"af-project-grid",children:[Qs.length>0?Qs.map(W=>{const de=(t==null?void 0:t.isAdmin)&&W.source==="user"&&!W.archived&&!Bo.has(W.id),Ie=(t==null?void 0:t.isAdmin)&&W.source==="admin",Ee=(t==null?void 0:t.isAdmin)&&W.source==="builtin",Re=Dn.endsWith(`:${W.source}:${W.id}`);return o.jsx("div",{className:"af-project-card",role:"button",tabIndex:0,onClick:()=>Ci(W),onKeyDown:Ft=>{(Ft.key==="Enter"||Ft.key===" ")&&(Ft.preventDefault(),Ci(W))},children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:$u(Qx(W.source,n).tone),children:o.jsx(Gn,{query:Y,children:Qx(W.source,n).label})}),W.archived?o.jsx("span",{className:$u("muted"),children:o.jsx(Gn,{query:Y,children:n("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(Gn,{query:Y,children:W.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Gn,{query:Y,children:r_(W,n)})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),o.jsx("span",{className:"af-path-text",children:o.jsx(Gn,{query:Y,children:n_(W)})})]}),t!=null&&t.isAdmin?o.jsxs("div",{className:"af-project-admin-actions",onClick:Ft=>Ft.stopPropagation(),onKeyDown:Ft=>Ft.stopPropagation(),children:[de?o.jsx("button",{type:"button",disabled:Re,onClick:()=>Rs(W,"promote"),children:"设为内置"}):null,Ie?o.jsx("button",{type:"button",disabled:Re,onClick:()=>Rs(W,"unpromote"),children:"取消内置"}):null,Ee?o.jsx("button",{type:"button",disabled:Re,onClick:()=>Rs(W,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${W.id}:${W.source??"user"}:${W.archived?"a":""}`)}):A?gs.length===0?o.jsxs("div",{className:"af-projects-empty-block",children:[o.jsx("p",{className:"af-projects-empty",children:i==="archived"?n("project:noArchived"):l.length>0?n("project:noActive"):n(T?"project:loadFailed":"project:noPipelines")}),!T&&l.length===0&&i==="all"?o.jsx("p",{className:"af-projects-empty-hint",children:n("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:noMatch",{query:Y.trim()})})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingPipelines")})}),o.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>I(!0),children:[o.jsx("span",{className:"material-symbols-outlined af-project-add-icon",children:"add_circle"}),o.jsx("span",{className:"af-project-add-label",children:n("project:newPipeline")})]}),Pr?null:o.jsxs("a",{className:"af-hub-card",href:"https://agentflow-hub.com",target:"_blank",rel:"noopener noreferrer",children:[o.jsx("div",{className:"af-hub-card__glow","aria-hidden":!0}),o.jsxs("span",{className:"af-hub-card__eyebrow",children:[o.jsx("span",{className:"material-symbols-outlined af-hub-card__eyebrow-icon",children:"hub"}),n("project:hubCard.eyebrow")]}),o.jsx("h3",{className:"af-hub-card__title",children:n("project:hubCard.title")}),o.jsx("p",{className:"af-hub-card__desc",children:n("project:hubCard.desc")}),o.jsxs("span",{className:"af-hub-card__cta",children:[n("project:hubCard.cta"),o.jsx("span",{className:"material-symbols-outlined af-hub-card__cta-icon",children:"arrow_outward"})]}),o.jsx("code",{className:"af-hub-card__cli",children:n("project:hubCard.cliHint")})]})]})]})]}),xr?o.jsx("aside",{className:"af-resource-detail","aria-label":n(An?"project:nodeDetail":qt?"project:flowDetail":"project:skillDetail"),children:An&&tt?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),o.jsxs("div",{children:[o.jsx("h3",{children:tt.label||tt.displayName||tt.id}),o.jsx("p",{children:tt.id})]})]}),o.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(W=>o.jsx("button",{type:"button",className:"af-resource-detail-tab"+(Ae===W?" af-resource-detail-tab--active":""),onClick:()=>Ce(W),children:n(`project:nodeDetailTabs.${W}`)},W))}),ct===Cn(tt)?o.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):Ae==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:tt.description||((Ms=Be==null?void 0:Be.node)==null?void 0:Ms.description)||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailType")}),o.jsx("dd",{children:tt.type||((en=Be==null?void 0:Be.node)==null?void 0:en.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:Ek(tt.source,n)})]}),tt.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPackage")}),o.jsx("dd",{children:tt.packageId})]}):null,tt.version?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:tt.version})]}):null,tt.packageDir||Be!=null&&Be.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:tt.packageDir||(Be==null?void 0:Be.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailEditable")}),o.jsx("dd",{children:(Be==null?void 0:Be.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),Pe&&tt.source==="marketplace"?o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myNodeManagement")}),o.jsx("p",{children:n("project:deleteMyNodeHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:he===Cn(tt),onClick:()=>so(tt),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),he===Cn(tt)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),We?o.jsx("p",{className:"af-resource-action-message",children:We}):null]}):null,o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:nodesMeaning")})]})]}):Ae==="schema"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeSchema")}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeInputs")}),Sp(((wr=Be==null?void 0:Be.node)==null?void 0:wr.inputs)||tt.inputs).length>0?Sp(((zr=Be==null?void 0:Be.node)==null?void 0:zr.inputs)||tt.inputs).map(W=>o.jsxs("code",{children:[W.name||W.key,W.type?`: ${W.type}`:""]},W.key)):o.jsx("em",{children:n("project:noSlots")})]}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeOutputs")}),Sp(((ys=Be==null?void 0:Be.node)==null?void 0:ys.outputs)||tt.outputs).length>0?Sp(((Yr=Be==null?void 0:Be.node)==null?void 0:Yr.outputs)||tt.outputs).map(W=>o.jsxs("code",{children:[W.name||W.key,W.type?`: ${W.type}`:""]},W.key)):o.jsx("em",{children:n("project:noSlots")})]})]}):Ae==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeRuntime")}),Be!=null&&Be.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Be.runtime,null,2)}):o.jsx("p",{children:n("project:noRuntimeManifest")}),Be!=null&&Be.body?o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"af-resource-detail-subtitle",children:n("project:nodeBody")}),o.jsx("pre",{className:"af-resource-skill-preview",children:Be.body})]}):o.jsx("p",{children:n("project:noNodeBody")})]}):Ae==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(Be==null?void 0:Be.files)&&Be.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:Be.files.map(W=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(Le===W.path?" af-node-file-item--active":""),onClick:()=>Jt(W.path),children:[o.jsx("span",{className:"material-symbols-outlined",children:"description"}),o.jsx("span",{children:W.path})]},W.path))}),o.jsxs("pre",{className:"af-resource-skill-preview",children:[ce===`${Cn(tt)}:${Le}`?n("project:loadingResources"):Qn!=null&&Qn.binary?n("project:binaryFile"):(Qn==null?void 0:Qn.content)||n("project:selectNodeFile"),Qn!=null&&Qn.truncated?`
|
|
43
|
-
|
|
44
|
-
${n("project:fileTruncated")}`:""]})]}):o.jsx("p",{children:n("project:noNodeFiles")})]}):o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeUsage")}),Array.isArray(Be==null?void 0:Be.usage)&&Be.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:Be.usage.map(W=>o.jsxs("div",{className:"af-node-usage-item",children:[o.jsx("strong",{children:W.flowId}),o.jsxs("span",{children:[W.flowSource,W.archived?` · ${n("project:archived")}`:""]}),o.jsx("em",{children:W.instances.map(de=>de.label||de.instanceId).join(", ")})]},`${W.flowSource}:${W.flowId}:${W.archived?"a":""}`))}):o.jsx("p",{children:n("project:noNodeUsage")})]})]}):qt&&Vt?(()=>{const W=MM(Vt);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"schema"}),o.jsxs("div",{children:[o.jsx("h3",{children:Vt.displayName||Vt.name||Vt.id}),o.jsx("p",{children:Vt.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Vt.description||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:Vt.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:_k(Vt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:flowSnippetScale")}),o.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(Vt.nodeCount))?Number(Vt.nodeCount):W.nodes.length,edges:Number.isFinite(Number(Vt.edgeCount))?Number(Vt.edgeCount):W.edges.length})})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:myFlowsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myFlowManagement")}),o.jsx("p",{children:n("project:deleteMyFlowHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:Gt===ea(Vt),onClick:()=>ji(Vt),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),Gt===ea(Vt)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),gn?o.jsx("p",{className:"af-resource-action-message",children:gn}):null]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:flowSnippetPreview")}),W.diagram.nodes.length>0?o.jsx("div",{className:"af-flow-snippet-map",children:o.jsxs("svg",{viewBox:W.diagram.viewBox,role:"img","aria-label":n("project:flowSnippetPreview"),children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-flow-snippet-arrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:o.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})}),o.jsx("g",{className:"af-flow-snippet-map__edges",children:W.diagram.edges.map(de=>o.jsxs("g",{children:[o.jsx("path",{d:de.path}),de.label?o.jsx("text",{x:de.labelX,y:de.labelY-5,textAnchor:"middle",children:cy(de.label,18)}):null]},de.key))}),o.jsx("g",{className:"af-flow-snippet-map__nodes",children:W.diagram.nodes.map((de,Ie)=>o.jsxs("g",{transform:`translate(${de.x} ${de.y})`,children:[o.jsx("rect",{width:de.width,height:de.height,rx:"10"}),o.jsx("circle",{cx:"19",cy:de.height/2,r:"12"}),o.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:de.height/2+4,textAnchor:"middle",children:Ie+1}),o.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:de.height/2-3,children:cy(de.title)}),o.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:de.height/2+16,children:cy(de.meta||de.id,20)})]},de.id))})]})}):o.jsx("p",{className:"af-resource-detail-desc",children:n("project:noFlowSnippetPreview")}),o.jsxs("details",{className:"af-flow-snippet-json",children:[o.jsx("summary",{children:n("project:flowSnippetJson")}),o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Vt.snippet||{},null,2)})]})]})]})})():i==="skills"&&Ct?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:Ct.name||Ct.id}),o.jsx("p",{children:Ct.sourceLabel||Ct.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Ct.description||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:Ct.sourceLabel||Ct.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:Ct.path||Ct.key})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:"Collections"}),v.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:v.map(W=>{const de=Cn(Ct),Ie=W.skillKeys.includes(de);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:Ie,disabled:w,onChange:Ee=>zo(W.id,de,Ee.target.checked)}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:W.name}),o.jsxs("span",{className:"af-composer-skill-option-desc",children:[W.skillKeys.length," skills"]})]})]},W.id)})})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:skillsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:skillPreview")}),o.jsx("pre",{className:"af-resource-skill-preview",children:Ze===Cn(Ct)?n("project:loadingResources"):(Fr==null?void 0:Fr.body)||(Fr==null?void 0:Fr.content)||n("project:skillPreviewEmpty")})]})]}):o.jsx("p",{className:"af-activity-empty",children:n("project:selectResource")})}):o.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(K?"":" af-activity--hidden"),"aria-hidden":!K,"aria-label":n("project:recentActivity"),children:[o.jsxs("h2",{className:"af-activity-title",children:[o.jsx("span",{className:"af-activity-bullet"}),n("project:recentActivity")]}),o.jsx("div",{className:"af-activity-list",children:io.length===0?o.jsx("p",{className:"af-activity-empty",children:ms.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):io.map(W=>{const de=fe===Pk(W);return o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(de?" af-activity-row--active":""),"aria-current":de?"page":void 0,onClick:()=>ei(W),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(Gn,{query:Y,children:W.flowId})}),o.jsx("span",{className:"af-activity-time",children:Yx(W.at,n)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:kM(W.kind),children:W.kind==="executed"?"play_arrow":"visibility"}),o.jsxs("p",{className:"af-activity-text",children:[W.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",Yx(W.at,n)]})]})]},`${W.kind}-${W.flowId}-${W.flowSource}-${W.at}`)})})]})]}),o.jsx(pM,{open:D,onClose:()=>I(!1),onCreated:async W=>{I(!1),await zn();const de=W.source??"user";r(kp({id:W.id,source:de},"workspace"))}}),B?o.jsx(dM,{file:B,onClose:()=>P(null),onImported:async W=>{P(null),await zn();const de=W.source??"user";r(kp({id:W.id,source:de},"workspace"))}},`${B.name}-${B.size}-${B.lastModified}`):null]})}function sr(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=sr(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var $M={value:()=>{}};function Bm(){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 ah(n)}function ah(e){this._=e}function DM(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}})}ah.prototype=Bm.prototype={constructor:ah,on:function(e,t){var n=this._,r=DM(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=FM(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(s=(e=r[i]).type)n[s]=Tk(n[s],e.name,t);else if(t==null)for(s in n)n[s]=Tk(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 ah(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 FM(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function Tk(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=$M,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var tw="http://www.w3.org/1999/xhtml";const Rk={svg:"http://www.w3.org/2000/svg",xhtml:tw,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Hm(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rk.hasOwnProperty(t)?{space:Rk[t],local:e}:e}function zM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===tw&&t.documentElement.namespaceURI===tw?t.createElement(e):t.createElementNS(n,e)}}function BM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function a_(e){var t=Hm(e);return(t.local?BM:zM)(t)}function HM(){}function Bb(e){return e==null?HM:function(){return this.querySelector(e)}}function VM(e){typeof e!="function"&&(e=Bb(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=new Array(a),c,d,f=0;f<a;++f)(c=i[f])&&(d=e.call(c,c.__data__,f,i))&&("__data__"in c&&(d.__data__=c.__data__),l[f]=d);return new As(r,this._parents)}function WM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function UM(){return[]}function l_(e){return e==null?UM:function(){return this.querySelectorAll(e)}}function KM(e){return function(){return WM(e.apply(this,arguments))}}function qM(e){typeof e=="function"?e=KM(e):e=l_(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var a=t[i],l=a.length,c,d=0;d<l;++d)(c=a[d])&&(r.push(e.call(c,c.__data__,d,a)),s.push(c));return new As(r,s)}function c_(e){return function(){return this.matches(e)}}function u_(e){return function(t){return t.matches(e)}}var YM=Array.prototype.find;function GM(e){return function(){return YM.call(this.children,e)}}function XM(){return this.firstElementChild}function JM(e){return this.select(e==null?XM:GM(typeof e=="function"?e:u_(e)))}var QM=Array.prototype.filter;function ZM(){return Array.from(this.children)}function e$(e){return function(){return QM.call(this.children,e)}}function t$(e){return this.selectAll(e==null?ZM:e$(typeof e=="function"?e:u_(e)))}function n$(e){typeof e!="function"&&(e=c_(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,d=0;d<a;++d)(c=i[d])&&e.call(c,c.__data__,d,i)&&l.push(c);return new As(r,this._parents)}function d_(e){return new Array(e.length)}function r$(){return new As(this._enter||this._groups.map(d_),this._parents)}function Wh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wh.prototype={constructor:Wh,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 s$(e){return function(){return e}}function i$(e,t,n,r,s,i){for(var a=0,l,c=t.length,d=i.length;a<d;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Wh(e,i[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function o$(e,t,n,r,s,i,a){var l,c,d=new Map,f=t.length,u=i.length,p=new Array(f),h;for(l=0;l<f;++l)(c=t[l])&&(p[l]=h=a.call(c,c.__data__,l,t)+"",d.has(h)?s[l]=c:d.set(h,c));for(l=0;l<u;++l)h=a.call(e,i[l],l,i)+"",(c=d.get(h))?(r[l]=c,c.__data__=i[l],d.delete(h)):n[l]=new Wh(e,i[l]);for(l=0;l<f;++l)(c=t[l])&&d.get(p[l])===c&&(s[l]=c)}function a$(e){return e.__data__}function l$(e,t){if(!arguments.length)return Array.from(this,a$);var n=t?o$:i$,r=this._parents,s=this._groups;typeof e!="function"&&(e=s$(e));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),d=0;d<i;++d){var f=r[d],u=s[d],p=u.length,h=c$(e.call(f,f&&f.__data__,d,r)),g=h.length,v=l[d]=new Array(g),k=a[d]=new Array(g),y=c[d]=new Array(p);n(f,u,v,k,y,h,t);for(var b=0,w=0,N,C;b<g;++b)if(N=v[b]){for(b>=w&&(w=b+1);!(C=k[w])&&++w<g;);N._next=C||null}}return a=new As(a,r),a._enter=l,a._exit=c,a}function c$(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function u$(){return new As(this._exit||this._groups.map(d_),this._parents)}function d$(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 f$(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,a=Math.min(s,i),l=new Array(s),c=0;c<a;++c)for(var d=n[c],f=r[c],u=d.length,p=l[c]=new Array(u),h,g=0;g<u;++g)(h=d[g]||f[g])&&(p[g]=h);for(;c<s;++c)l[c]=n[c];return new As(l,this._parents)}function p$(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],a;--s>=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function h$(e){e||(e=m$);function t(u,p){return u&&p?e(u.__data__,p.__data__):!u-!p}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,c=s[i]=new Array(l),d,f=0;f<l;++f)(d=a[f])&&(c[f]=d);c.sort(t)}return new As(s,this._parents).order()}function m$(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function g$(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function y$(){return Array.from(this)}function x$(){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 a=r[s];if(a)return a}return null}function w$(){let e=0;for(const t of this)++e;return e}function b$(){return!this.node()}function v$(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,a=s.length,l;i<a;++i)(l=s[i])&&e.call(l,l.__data__,i,s);return this}function k$(e){return function(){this.removeAttribute(e)}}function S$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function N$(e,t){return function(){this.setAttribute(e,t)}}function j$(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function C$(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function E$(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 _$(e,t){var n=Hm(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?S$:k$:typeof t=="function"?n.local?E$:C$:n.local?j$:N$)(n,t))}function f_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function P$(e){return function(){this.style.removeProperty(e)}}function A$(e,t,n){return function(){this.style.setProperty(e,t,n)}}function I$(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function T$(e,t,n){return arguments.length>1?this.each((t==null?P$:typeof t=="function"?I$:A$)(e,t,n??"")):Hc(this.node(),e)}function Hc(e,t){return e.style.getPropertyValue(t)||f_(e).getComputedStyle(e,null).getPropertyValue(t)}function R$(e){return function(){delete this[e]}}function L$(e,t){return function(){this[e]=t}}function O$(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function M$(e,t){return arguments.length>1?this.each((t==null?R$:typeof t=="function"?O$:L$)(e,t)):this.node()[e]}function p_(e){return e.trim().split(/^|\s+/)}function Hb(e){return e.classList||new h_(e)}function h_(e){this._node=e,this._names=p_(e.getAttribute("class")||"")}h_.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 m_(e,t){for(var n=Hb(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function g_(e,t){for(var n=Hb(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function $$(e){return function(){m_(this,e)}}function D$(e){return function(){g_(this,e)}}function F$(e,t){return function(){(t.apply(this,arguments)?m_:g_)(this,e)}}function z$(e,t){var n=p_(e+"");if(arguments.length<2){for(var r=Hb(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?F$:t?$$:D$)(n,t))}function B$(){this.textContent=""}function H$(e){return function(){this.textContent=e}}function V$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function W$(e){return arguments.length?this.each(e==null?B$:(typeof e=="function"?V$:H$)(e)):this.node().textContent}function U$(){this.innerHTML=""}function K$(e){return function(){this.innerHTML=e}}function q$(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Y$(e){return arguments.length?this.each(e==null?U$:(typeof e=="function"?q$:K$)(e)):this.node().innerHTML}function G$(){this.nextSibling&&this.parentNode.appendChild(this)}function X$(){return this.each(G$)}function J$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Q$(){return this.each(J$)}function Z$(e){var t=typeof e=="function"?e:a_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function eD(){return null}function tD(e,t){var n=typeof e=="function"?e:a_(e),r=t==null?eD:typeof t=="function"?t:Bb(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function nD(){var e=this.parentNode;e&&e.removeChild(this)}function rD(){return this.each(nD)}function sD(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function iD(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function oD(e){return this.select(e?iD:sD)}function aD(e){return arguments.length?this.property("__data__",e):this.node().__data__}function lD(e){return function(t){e.call(this,t,this.__data__)}}function cD(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 uD(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 dD(e,t,n){return function(){var r=this.__on,s,i=lD(t);if(r){for(var a=0,l=r.length;a<l;++a)if((s=r[a]).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 fD(e,t,n){var r=cD(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,d=l.length,f;c<d;++c)for(s=0,f=l[c];s<i;++s)if((a=r[s]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?dD:uD,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function y_(e,t,n){var r=f_(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 pD(e,t){return function(){return y_(this,e,t)}}function hD(e,t){return function(){return y_(this,e,t.apply(this,arguments))}}function mD(e,t){return this.each((typeof t=="function"?hD:pD)(e,t))}function*gD(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,a;s<i;++s)(a=r[s])&&(yield a)}var x_=[null];function As(e,t){this._groups=e,this._parents=t}function gf(){return new As([[document.documentElement]],x_)}function yD(){return this}As.prototype=gf.prototype={constructor:As,select:VM,selectAll:qM,selectChild:JM,selectChildren:t$,filter:n$,data:l$,enter:r$,exit:u$,join:d$,merge:f$,selection:yD,order:p$,sort:h$,call:g$,nodes:y$,node:x$,size:w$,empty:b$,each:v$,attr:_$,style:T$,property:M$,classed:z$,text:W$,html:Y$,raise:X$,lower:Q$,append:Z$,insert:tD,remove:rD,clone:oD,datum:aD,on:fD,dispatch:mD,[Symbol.iterator]:gD};function Ss(e){return typeof e=="string"?new As([[document.querySelector(e)]],[document.documentElement]):new As([[e]],x_)}function xD(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fi(e,t){if(e=xD(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 wD={passive:!1},Bd={capture:!0,passive:!1};function uy(e){e.stopImmediatePropagation()}function Ac(e){e.preventDefault(),e.stopImmediatePropagation()}function w_(e){var t=e.document.documentElement,n=Ss(e).on("dragstart.drag",Ac,Bd);"onselectstart"in t?n.on("selectstart.drag",Ac,Bd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function b_(e,t){var n=e.document.documentElement,r=Ss(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ac,Bd),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 Np=e=>()=>e;function nw(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:d,dispatch:f}){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:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}nw.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function bD(e){return!e.ctrlKey&&!e.button}function vD(){return this.parentNode}function kD(e,t){return t??{x:e.x,y:e.y}}function SD(){return navigator.maxTouchPoints||"ontouchstart"in this}function v_(){var e=bD,t=vD,n=kD,r=SD,s={},i=Bm("start","drag","end"),a=0,l,c,d,f,u=0;function p(N){N.on("mousedown.drag",h).filter(r).on("touchstart.drag",k).on("touchmove.drag",y,wD).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(N,C){if(!(f||!e.call(this,N,C))){var j=w(this,t.call(this,N,C),N,C,"mouse");j&&(Ss(N.view).on("mousemove.drag",g,Bd).on("mouseup.drag",v,Bd),w_(N.view),uy(N),d=!1,l=N.clientX,c=N.clientY,j("start",N))}}function g(N){if(Ac(N),!d){var C=N.clientX-l,j=N.clientY-c;d=C*C+j*j>u}s.mouse("drag",N)}function v(N){Ss(N.view).on("mousemove.drag mouseup.drag",null),b_(N.view,d),Ac(N),s.mouse("end",N)}function k(N,C){if(e.call(this,N,C)){var j=N.changedTouches,T=t.call(this,N,C),$=j.length,L,F;for(L=0;L<$;++L)(F=w(this,T,N,C,j[L].identifier,j[L]))&&(uy(N),F("start",N,j[L]))}}function y(N){var C=N.changedTouches,j=C.length,T,$;for(T=0;T<j;++T)($=s[C[T].identifier])&&(Ac(N),$("drag",N,C[T]))}function b(N){var C=N.changedTouches,j=C.length,T,$;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),T=0;T<j;++T)($=s[C[T].identifier])&&(uy(N),$("end",N,C[T]))}function w(N,C,j,T,$,L){var F=i.copy(),A=fi(L||j,C),R,V,M;if((M=n.call(N,new nw("beforestart",{sourceEvent:j,target:p,identifier:$,active:a,x:A[0],y:A[1],dx:0,dy:0,dispatch:F}),T))!=null)return R=M.x-A[0]||0,V=M.y-A[1]||0,function D(I,B,P){var O=A,_;switch(I){case"start":s[$]=D,_=a++;break;case"end":delete s[$],--a;case"drag":A=fi(P||B,C),_=a;break}F.call(I,N,new nw(I,{sourceEvent:B,subject:M,target:p,identifier:$,active:_,x:A[0]+R,y:A[1]+V,dx:A[0]-O[0],dy:A[1]-O[1],dispatch:F}),T)}}return p.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Np(!!N),p):e},p.container=function(N){return arguments.length?(t=typeof N=="function"?N:Np(N),p):t},p.subject=function(N){return arguments.length?(n=typeof N=="function"?N:Np(N),p):n},p.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:Np(!!N),p):r},p.on=function(){var N=i.on.apply(i,arguments);return N===i?p:N},p.clickDistance=function(N){return arguments.length?(u=(N=+N)*N,p):Math.sqrt(u)},p}function Vb(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function k_(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function yf(){}var Hd=.7,Uh=1/Hd,Ic="\\s*([+-]?\\d+)\\s*",Vd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ND=/^#([0-9a-f]{3,8})$/,jD=new RegExp(`^rgb\\(${Ic},${Ic},${Ic}\\)$`),CD=new RegExp(`^rgb\\(${Xi},${Xi},${Xi}\\)$`),ED=new RegExp(`^rgba\\(${Ic},${Ic},${Ic},${Vd}\\)$`),_D=new RegExp(`^rgba\\(${Xi},${Xi},${Xi},${Vd}\\)$`),PD=new RegExp(`^hsl\\(${Vd},${Xi},${Xi}\\)$`),AD=new RegExp(`^hsla\\(${Vd},${Xi},${Xi},${Vd}\\)$`),Lk={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};Vb(yf,kl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ok,formatHex:Ok,formatHex8:ID,formatHsl:TD,formatRgb:Mk,toString:Mk});function Ok(){return this.rgb().formatHex()}function ID(){return this.rgb().formatHex8()}function TD(){return S_(this).formatHsl()}function Mk(){return this.rgb().formatRgb()}function kl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ND.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?$k(t):n===3?new rs(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?jp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?jp(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=jD.exec(e))?new rs(t[1],t[2],t[3],1):(t=CD.exec(e))?new rs(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ED.exec(e))?jp(t[1],t[2],t[3],t[4]):(t=_D.exec(e))?jp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=PD.exec(e))?zk(t[1],t[2]/100,t[3]/100,1):(t=AD.exec(e))?zk(t[1],t[2]/100,t[3]/100,t[4]):Lk.hasOwnProperty(e)?$k(Lk[e]):e==="transparent"?new rs(NaN,NaN,NaN,0):null}function $k(e){return new rs(e>>16&255,e>>8&255,e&255,1)}function jp(e,t,n,r){return r<=0&&(e=t=n=NaN),new rs(e,t,n,r)}function RD(e){return e instanceof yf||(e=kl(e)),e?(e=e.rgb(),new rs(e.r,e.g,e.b,e.opacity)):new rs}function rw(e,t,n,r){return arguments.length===1?RD(e):new rs(e,t,n,r??1)}function rs(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Vb(rs,rw,k_(yf,{brighter(e){return e=e==null?Uh:Math.pow(Uh,e),new rs(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Hd:Math.pow(Hd,e),new rs(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rs(pl(this.r),pl(this.g),pl(this.b),Kh(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:Dk,formatHex:Dk,formatHex8:LD,formatRgb:Fk,toString:Fk}));function Dk(){return`#${ul(this.r)}${ul(this.g)}${ul(this.b)}`}function LD(){return`#${ul(this.r)}${ul(this.g)}${ul(this.b)}${ul((isNaN(this.opacity)?1:this.opacity)*255)}`}function Fk(){const e=Kh(this.opacity);return`${e===1?"rgb(":"rgba("}${pl(this.r)}, ${pl(this.g)}, ${pl(this.b)}${e===1?")":`, ${e})`}`}function Kh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function pl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ul(e){return e=pl(e),(e<16?"0":"")+e.toString(16)}function zk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new mi(e,t,n,r)}function S_(e){if(e instanceof mi)return new mi(e.h,e.s,e.l,e.opacity);if(e instanceof yf||(e=kl(e)),!e)return new mi;if(e instanceof mi)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),a=NaN,l=i-s,c=(i+s)/2;return l?(t===i?a=(n-r)/l+(n<r)*6:n===i?a=(r-t)/l+2:a=(t-n)/l+4,l/=c<.5?i+s:2-i-s,a*=60):l=c>0&&c<1?0:a,new mi(a,l,c,e.opacity)}function OD(e,t,n,r){return arguments.length===1?S_(e):new mi(e,t,n,r??1)}function mi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Vb(mi,OD,k_(yf,{brighter(e){return e=e==null?Uh:Math.pow(Uh,e),new mi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Hd:Math.pow(Hd,e),new mi(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 rs(dy(e>=240?e-240:e+120,s,r),dy(e,s,r),dy(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new mi(Bk(this.h),Cp(this.s),Cp(this.l),Kh(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=Kh(this.opacity);return`${e===1?"hsl(":"hsla("}${Bk(this.h)}, ${Cp(this.s)*100}%, ${Cp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Bk(e){return e=(e||0)%360,e<0?e+360:e}function Cp(e){return Math.max(0,Math.min(1,e||0))}function dy(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 Wb=e=>()=>e;function MD(e,t){return function(n){return e+n*t}}function $D(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 DD(e){return(e=+e)==1?N_:function(t,n){return n-t?$D(t,n,e):Wb(isNaN(t)?n:t)}}function N_(e,t){var n=t-e;return n?MD(e,n):Wb(isNaN(e)?t:e)}const qh=function e(t){var n=DD(t);function r(s,i){var a=n((s=rw(s)).r,(i=rw(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),d=N_(s.opacity,i.opacity);return function(f){return s.r=a(f),s.g=l(f),s.b=c(f),s.opacity=d(f),s+""}}return r.gamma=e,r}(1);function FD(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 zD(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function BD(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),a;for(a=0;a<r;++a)s[a]=hd(e[a],t[a]);for(;a<n;++a)i[a]=t[a];return function(l){for(a=0;a<r;++a)i[a]=s[a](l);return i}}function HD(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Hi(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function VD(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]=hd(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var sw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fy=new RegExp(sw.source,"g");function WD(e){return function(){return e}}function UD(e){return function(t){return e(t)+""}}function j_(e,t){var n=sw.lastIndex=fy.lastIndex=0,r,s,i,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=sw.exec(e))&&(s=fy.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(r=r[0])===(s=s[0])?l[a]?l[a]+=s:l[++a]=s:(l[++a]=null,c.push({i:a,x:Hi(r,s)})),n=fy.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?c[0]?UD(c[0].x):WD(t):(t=c.length,function(d){for(var f=0,u;f<t;++f)l[(u=c[f]).i]=u.x(d);return l.join("")})}function hd(e,t){var n=typeof t,r;return t==null||n==="boolean"?Wb(t):(n==="number"?Hi:n==="string"?(r=kl(t))?(t=r,qh):j_:t instanceof kl?qh:t instanceof Date?HD:zD(t)?FD:Array.isArray(t)?BD:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?VD:Hi)(e,t)}var Hk=180/Math.PI,iw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function C_(e,t,n,r,s,i){var a,l,c;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(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,a=-a),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*Hk,skewX:Math.atan(c)*Hk,scaleX:a,scaleY:l}}var Ep;function KD(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?iw:C_(t.a,t.b,t.c,t.d,t.e,t.f)}function qD(e){return e==null||(Ep||(Ep=document.createElementNS("http://www.w3.org/2000/svg","g")),Ep.setAttribute("transform",e),!(e=Ep.transform.baseVal.consolidate()))?iw:(e=e.matrix,C_(e.a,e.b,e.c,e.d,e.e,e.f))}function E_(e,t,n,r){function s(d){return d.length?d.pop()+" ":""}function i(d,f,u,p,h,g){if(d!==u||f!==p){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:Hi(d,u)},{i:v-2,x:Hi(f,p)})}else(u||p)&&h.push("translate("+u+t+p+n)}function a(d,f,u,p){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),p.push({i:u.push(s(u)+"rotate(",null,r)-2,x:Hi(d,f)})):f&&u.push(s(u)+"rotate("+f+r)}function l(d,f,u,p){d!==f?p.push({i:u.push(s(u)+"skewX(",null,r)-2,x:Hi(d,f)}):f&&u.push(s(u)+"skewX("+f+r)}function c(d,f,u,p,h,g){if(d!==u||f!==p){var v=h.push(s(h)+"scale(",null,",",null,")");g.push({i:v-4,x:Hi(d,u)},{i:v-2,x:Hi(f,p)})}else(u!==1||p!==1)&&h.push(s(h)+"scale("+u+","+p+")")}return function(d,f){var u=[],p=[];return d=e(d),f=e(f),i(d.translateX,d.translateY,f.translateX,f.translateY,u,p),a(d.rotate,f.rotate,u,p),l(d.skewX,f.skewX,u,p),c(d.scaleX,d.scaleY,f.scaleX,f.scaleY,u,p),d=f=null,function(h){for(var g=-1,v=p.length,k;++g<v;)u[(k=p[g]).i]=k.x(h);return u.join("")}}}var YD=E_(KD,"px, ","px)","deg)"),GD=E_(qD,", ",")",")"),XD=1e-12;function Vk(e){return((e=Math.exp(e))+1/e)/2}function JD(e){return((e=Math.exp(e))-1/e)/2}function QD(e){return((e=Math.exp(2*e))-1)/(e+1)}const lh=function e(t,n,r){function s(i,a){var l=i[0],c=i[1],d=i[2],f=a[0],u=a[1],p=a[2],h=f-l,g=u-c,v=h*h+g*g,k,y;if(v<XD)y=Math.log(p/d)/t,k=function(T){return[l+T*h,c+T*g,d*Math.exp(t*T*y)]};else{var b=Math.sqrt(v),w=(p*p-d*d+r*v)/(2*d*n*b),N=(p*p-d*d-r*v)/(2*p*n*b),C=Math.log(Math.sqrt(w*w+1)-w),j=Math.log(Math.sqrt(N*N+1)-N);y=(j-C)/t,k=function(T){var $=T*y,L=Vk(C),F=d/(n*b)*(L*QD(t*$+C)-JD(C));return[l+F*h,c+F*g,d*L/Vk(t*$+C)]}}return k.duration=y*1e3*t/Math.SQRT2,k}return s.rho=function(i){var a=Math.max(.001,+i),l=a*a,c=l*l;return e(a,l,c)},s}(Math.SQRT2,2,4);var Vc=0,Ju=0,Du=0,__=1e3,Yh,Qu,Gh=0,Sl=0,Vm=0,Wd=typeof performance=="object"&&performance.now?performance:Date,P_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ub(){return Sl||(P_(ZD),Sl=Wd.now()+Vm)}function ZD(){Sl=0}function Xh(){this._call=this._time=this._next=null}Xh.prototype=A_.prototype={constructor:Xh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Ub():+n)+(t==null?0:+t),!this._next&&Qu!==this&&(Qu?Qu._next=this:Yh=this,Qu=this),this._call=e,this._time=n,ow()},stop:function(){this._call&&(this._call=null,this._time=1/0,ow())}};function A_(e,t,n){var r=new Xh;return r.restart(e,t,n),r}function eF(){Ub(),++Vc;for(var e=Yh,t;e;)(t=Sl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Vc}function Wk(){Sl=(Gh=Wd.now())+Vm,Vc=Ju=0;try{eF()}finally{Vc=0,nF(),Sl=0}}function tF(){var e=Wd.now(),t=e-Gh;t>__&&(Vm-=t,Gh=e)}function nF(){for(var e,t=Yh,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:Yh=n);Qu=e,ow(r)}function ow(e){if(!Vc){Ju&&(Ju=clearTimeout(Ju));var t=e-Sl;t>24?(e<1/0&&(Ju=setTimeout(Wk,e-Wd.now()-Vm)),Du&&(Du=clearInterval(Du))):(Du||(Gh=Wd.now(),Du=setInterval(tF,__)),Vc=1,P_(Wk))}}function Uk(e,t,n){var r=new Xh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var rF=Bm("start","end","cancel","interrupt"),sF=[],I_=0,Kk=1,aw=2,ch=3,qk=4,lw=5,uh=6;function Wm(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;iF(e,n,{name:t,index:r,group:s,on:rF,tween:sF,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:I_})}function Kb(e,t){var n=Si(e,t);if(n.state>I_)throw new Error("too late; already scheduled");return n}function no(e,t){var n=Si(e,t);if(n.state>ch)throw new Error("too late; already running");return n}function Si(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function iF(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=A_(i,0,n.time);function i(d){n.state=Kk,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var f,u,p,h;if(n.state!==Kk)return c();for(f in r)if(h=r[f],h.name===n.name){if(h.state===ch)return Uk(a);h.state===qk?(h.state=uh,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[f]):+f<t&&(h.state=uh,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[f])}if(Uk(function(){n.state===ch&&(n.state=qk,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=aw,n.on.call("start",e,e.__data__,n.index,n.group),n.state===aw){for(n.state=ch,s=new Array(p=n.tween.length),f=0,u=-1;f<p;++f)(h=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(s[++u]=h);s.length=u+1}}function l(d){for(var f=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=lw,1),u=-1,p=s.length;++u<p;)s[u].call(e,f);n.state===lw&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=uh,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function dh(e,t){var n=e.__transition,r,s,i=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){i=!1;continue}s=r.state>aw&&r.state<lw,r.state=uh,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function oF(e){return this.each(function(){dh(this,e)})}function aF(e,t){var n,r;return function(){var s=no(this,e),i=s.tween;if(i!==n){r=n=i;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}s.tween=r}}function lF(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=no(this,e),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:t,value:n},c=0,d=s.length;c<d;++c)if(s[c].name===t){s[c]=l;break}c===d&&s.push(l)}i.tween=s}}function cF(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Si(this.node(),n).tween,s=0,i=r.length,a;s<i;++s)if((a=r[s]).name===e)return a.value;return null}return this.each((t==null?aF:lF)(n,e,t))}function qb(e,t,n){var r=e._id;return e.each(function(){var s=no(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Si(s,r).value[t]}}function T_(e,t){var n;return(typeof t=="number"?Hi:t instanceof kl?qh:(n=kl(t))?(t=n,qh):j_)(e,t)}function uF(e){return function(){this.removeAttribute(e)}}function dF(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fF(e,t,n){var r,s=n+"",i;return function(){var a=this.getAttribute(e);return a===s?null:a===r?i:i=t(r=a,n)}}function pF(e,t,n){var r,s=n+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===s?null:a===r?i:i=t(r=a,n)}}function hF(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function mF(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function gF(e,t){var n=Hm(e),r=n==="transform"?GD:T_;return this.attrTween(e,typeof t=="function"?(n.local?mF:hF)(n,r,qb(this,"attr."+e,t)):t==null?(n.local?dF:uF)(n):(n.local?pF:fF)(n,r,t))}function yF(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function xF(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function wF(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&xF(e,i)),n}return s._value=t,s}function bF(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&yF(e,i)),n}return s._value=t,s}function vF(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=Hm(e);return this.tween(n,(r.local?wF:bF)(r,t))}function kF(e,t){return function(){Kb(this,e).delay=+t.apply(this,arguments)}}function SF(e,t){return t=+t,function(){Kb(this,e).delay=t}}function NF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kF:SF)(t,e)):Si(this.node(),t).delay}function jF(e,t){return function(){no(this,e).duration=+t.apply(this,arguments)}}function CF(e,t){return t=+t,function(){no(this,e).duration=t}}function EF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jF:CF)(t,e)):Si(this.node(),t).duration}function _F(e,t){if(typeof t!="function")throw new Error;return function(){no(this,e).ease=t}}function PF(e){var t=this._id;return arguments.length?this.each(_F(t,e)):Si(this.node(),t).ease}function AF(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;no(this,e).ease=n}}function IF(e){if(typeof e!="function")throw new Error;return this.each(AF(this._id,e))}function TF(e){typeof e!="function"&&(e=c_(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,d=0;d<a;++d)(c=i[d])&&e.call(c,c.__data__,d,i)&&l.push(c);return new Lo(r,this._parents,this._name,this._id)}function RF(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),a=new Array(r),l=0;l<i;++l)for(var c=t[l],d=n[l],f=c.length,u=a[l]=new Array(f),p,h=0;h<f;++h)(p=c[h]||d[h])&&(u[h]=p);for(;l<r;++l)a[l]=t[l];return new Lo(a,this._parents,this._name,this._id)}function LF(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 OF(e,t,n){var r,s,i=LF(t)?Kb:no;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function MF(e,t){var n=this._id;return arguments.length<2?Si(this.node(),n).on.on(e):this.each(OF(n,e,t))}function $F(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function DF(){return this.on("end.remove",$F(this._id))}function FF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Bb(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a<s;++a)for(var l=r[a],c=l.length,d=i[a]=new Array(c),f,u,p=0;p<c;++p)(f=l[p])&&(u=e.call(f,f.__data__,p,l))&&("__data__"in f&&(u.__data__=f.__data__),d[p]=u,Wm(d[p],t,n,p,d,Si(f,n)));return new Lo(i,this._parents,t,n)}function zF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=l_(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],d=c.length,f,u=0;u<d;++u)if(f=c[u]){for(var p=e.call(f,f.__data__,u,c),h,g=Si(f,n),v=0,k=p.length;v<k;++v)(h=p[v])&&Wm(h,t,n,v,p,g);i.push(p),a.push(f)}return new Lo(i,a,t,n)}var BF=gf.prototype.constructor;function HF(){return new BF(this._groups,this._parents)}function VF(e,t){var n,r,s;return function(){var i=Hc(this,e),a=(this.style.removeProperty(e),Hc(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function R_(e){return function(){this.style.removeProperty(e)}}function WF(e,t,n){var r,s=n+"",i;return function(){var a=Hc(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function UF(e,t,n){var r,s,i;return function(){var a=Hc(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Hc(this,e))),a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l))}}function KF(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var c=no(this,e),d=c.on,f=c.value[i]==null?l||(l=R_(t)):void 0;(d!==n||s!==f)&&(r=(n=d).copy()).on(a,s=f),c.on=r}}function qF(e,t,n){var r=(e+="")=="transform"?YD:T_;return t==null?this.styleTween(e,VF(e,r)).on("end.style."+e,R_(e)):typeof t=="function"?this.styleTween(e,UF(e,r,qb(this,"style."+e,t))).each(KF(this._id,e)):this.styleTween(e,WF(e,r,t),n).on("end.style."+e,null)}function YF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function GF(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&YF(e,a,n)),r}return i._value=t,i}function XF(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,GF(e,t,n??""))}function JF(e){return function(){this.textContent=e}}function QF(e){return function(){var t=e(this);this.textContent=t??""}}function ZF(e){return this.tween("text",typeof e=="function"?QF(qb(this,"text",e)):JF(e==null?"":e+""))}function ez(e){return function(t){this.textContent=e.call(this,t)}}function tz(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&ez(s)),t}return r._value=e,r}function nz(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,tz(e))}function rz(){for(var e=this._name,t=this._id,n=L_(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,d=0;d<l;++d)if(c=a[d]){var f=Si(c,t);Wm(c,e,n,d,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Lo(r,this._parents,e,n)}function sz(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,a){var l={value:a},c={value:function(){--s===0&&i()}};n.each(function(){var d=no(this,r),f=d.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),d.on=t}),s===0&&i()})}var iz=0;function Lo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function L_(){return++iz}var xo=gf.prototype;Lo.prototype={constructor:Lo,select:FF,selectAll:zF,selectChild:xo.selectChild,selectChildren:xo.selectChildren,filter:TF,merge:RF,selection:HF,transition:rz,call:xo.call,nodes:xo.nodes,node:xo.node,size:xo.size,empty:xo.empty,each:xo.each,on:MF,attr:gF,attrTween:vF,style:qF,styleTween:XF,text:ZF,textTween:nz,remove:DF,tween:cF,delay:NF,duration:EF,ease:PF,easeVarying:IF,end:sz,[Symbol.iterator]:xo[Symbol.iterator]};function oz(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var az={time:null,delay:0,duration:250,ease:oz};function lz(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 cz(e){var t,n;e instanceof Lo?(t=e._id,e=e._name):(t=L_(),(n=az).time=Ub(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,d=0;d<l;++d)(c=a[d])&&Wm(c,e,t,d,a,n||lz(c,t));return new Lo(r,this._parents,e,t)}gf.prototype.interrupt=oF;gf.prototype.transition=cz;const _p=e=>()=>e;function uz(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 Co(e,t,n){this.k=e,this.x=t,this.y=n}Co.prototype={constructor:Co,scale:function(e){return e===1?this:new Co(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Co(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 Um=new Co(1,0,0);O_.prototype=Co.prototype;function O_(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Um;return e.__zoom}function py(e){e.stopImmediatePropagation()}function Fu(e){e.preventDefault(),e.stopImmediatePropagation()}function dz(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function fz(){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 Yk(){return this.__zoom||Um}function pz(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function hz(){return navigator.maxTouchPoints||"ontouchstart"in this}function mz(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],a=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function M_(){var e=dz,t=fz,n=mz,r=pz,s=hz,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=lh,d=Bm("start","zoom","end"),f,u,p,h=500,g=150,v=0,k=10;function y(M){M.property("__zoom",Yk).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",F).filter(s).on("touchstart.zoom",A).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(M,D,I,B){var P=M.selection?M.selection():M;P.property("__zoom",Yk),M!==P?C(M,D,I,B):P.interrupt().each(function(){j(this,arguments).event(B).start().zoom(null,typeof D=="function"?D.apply(this,arguments):D).end()})},y.scaleBy=function(M,D,I,B){y.scaleTo(M,function(){var P=this.__zoom.k,O=typeof D=="function"?D.apply(this,arguments):D;return P*O},I,B)},y.scaleTo=function(M,D,I,B){y.transform(M,function(){var P=t.apply(this,arguments),O=this.__zoom,_=I==null?N(P):typeof I=="function"?I.apply(this,arguments):I,Y=O.invert(_),Q=typeof D=="function"?D.apply(this,arguments):D;return n(w(b(O,Q),_,Y),P,a)},I,B)},y.translateBy=function(M,D,I,B){y.transform(M,function(){return n(this.__zoom.translate(typeof D=="function"?D.apply(this,arguments):D,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),a)},null,B)},y.translateTo=function(M,D,I,B,P){y.transform(M,function(){var O=t.apply(this,arguments),_=this.__zoom,Y=B==null?N(O):typeof B=="function"?B.apply(this,arguments):B;return n(Um.translate(Y[0],Y[1]).scale(_.k).translate(typeof D=="function"?-D.apply(this,arguments):-D,typeof I=="function"?-I.apply(this,arguments):-I),O,a)},B,P)};function b(M,D){return D=Math.max(i[0],Math.min(i[1],D)),D===M.k?M:new Co(D,M.x,M.y)}function w(M,D,I){var B=D[0]-I[0]*M.k,P=D[1]-I[1]*M.k;return B===M.x&&P===M.y?M:new Co(M.k,B,P)}function N(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function C(M,D,I,B){M.on("start.zoom",function(){j(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(B).end()}).tween("zoom",function(){var P=this,O=arguments,_=j(P,O).event(B),Y=t.apply(P,O),Q=I==null?N(Y):typeof I=="function"?I.apply(P,O):I,K=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),ie=P.__zoom,fe=typeof D=="function"?D.apply(P,O):D,ye=c(ie.invert(Q).concat(K/ie.k),fe.invert(Q).concat(K/fe.k));return function(we){if(we===1)we=fe;else{var ae=ye(we),ge=K/ae[2];we=new Co(ge,Q[0]-ae[0]*ge,Q[1]-ae[1]*ge)}_.zoom(null,we)}})}function j(M,D,I){return!I&&M.__zooming||new T(M,D)}function T(M,D){this.that=M,this.args=D,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,D),this.taps=0}T.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,D){return this.mouse&&M!=="mouse"&&(this.mouse[1]=D.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=D.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=D.invert(this.touch1[0])),this.that.__zoom=D,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var D=Ss(this.that).datum();d.call(M,this.that,new uz(M,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:d}),D)}};function $(M,...D){if(!e.apply(this,arguments))return;var I=j(this,D).event(M),B=this.__zoom,P=Math.max(i[0],Math.min(i[1],B.k*Math.pow(2,r.apply(this,arguments)))),O=fi(M);if(I.wheel)(I.mouse[0][0]!==O[0]||I.mouse[0][1]!==O[1])&&(I.mouse[1]=B.invert(I.mouse[0]=O)),clearTimeout(I.wheel);else{if(B.k===P)return;I.mouse=[O,B.invert(O)],dh(this),I.start()}Fu(M),I.wheel=setTimeout(_,g),I.zoom("mouse",n(w(b(B,P),I.mouse[0],I.mouse[1]),I.extent,a));function _(){I.wheel=null,I.end()}}function L(M,...D){if(p||!e.apply(this,arguments))return;var I=M.currentTarget,B=j(this,D,!0).event(M),P=Ss(M.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",K,!0),O=fi(M,I),_=M.clientX,Y=M.clientY;w_(M.view),py(M),B.mouse=[O,this.__zoom.invert(O)],dh(this),B.start();function Q(ie){if(Fu(ie),!B.moved){var fe=ie.clientX-_,ye=ie.clientY-Y;B.moved=fe*fe+ye*ye>v}B.event(ie).zoom("mouse",n(w(B.that.__zoom,B.mouse[0]=fi(ie,I),B.mouse[1]),B.extent,a))}function K(ie){P.on("mousemove.zoom mouseup.zoom",null),b_(ie.view,B.moved),Fu(ie),B.event(ie).end()}}function F(M,...D){if(e.apply(this,arguments)){var I=this.__zoom,B=fi(M.changedTouches?M.changedTouches[0]:M,this),P=I.invert(B),O=I.k*(M.shiftKey?.5:2),_=n(w(b(I,O),B,P),t.apply(this,D),a);Fu(M),l>0?Ss(this).transition().duration(l).call(C,_,B,M):Ss(this).call(y.transform,_,B,M)}}function A(M,...D){if(e.apply(this,arguments)){var I=M.touches,B=I.length,P=j(this,D,M.changedTouches.length===B).event(M),O,_,Y,Q;for(py(M),_=0;_<B;++_)Y=I[_],Q=fi(Y,this),Q=[Q,this.__zoom.invert(Q),Y.identifier],P.touch0?!P.touch1&&P.touch0[2]!==Q[2]&&(P.touch1=Q,P.taps=0):(P.touch0=Q,O=!0,P.taps=1+!!f);f&&(f=clearTimeout(f)),O&&(P.taps<2&&(u=Q[0],f=setTimeout(function(){f=null},h)),dh(this),P.start())}}function R(M,...D){if(this.__zooming){var I=j(this,D).event(M),B=M.changedTouches,P=B.length,O,_,Y,Q;for(Fu(M),O=0;O<P;++O)_=B[O],Y=fi(_,this),I.touch0&&I.touch0[2]===_.identifier?I.touch0[0]=Y:I.touch1&&I.touch1[2]===_.identifier&&(I.touch1[0]=Y);if(_=I.that.__zoom,I.touch1){var K=I.touch0[0],ie=I.touch0[1],fe=I.touch1[0],ye=I.touch1[1],we=(we=fe[0]-K[0])*we+(we=fe[1]-K[1])*we,ae=(ae=ye[0]-ie[0])*ae+(ae=ye[1]-ie[1])*ae;_=b(_,Math.sqrt(we/ae)),Y=[(K[0]+fe[0])/2,(K[1]+fe[1])/2],Q=[(ie[0]+ye[0])/2,(ie[1]+ye[1])/2]}else if(I.touch0)Y=I.touch0[0],Q=I.touch0[1];else return;I.zoom("touch",n(w(_,Y,Q),I.extent,a))}}function V(M,...D){if(this.__zooming){var I=j(this,D).event(M),B=M.changedTouches,P=B.length,O,_;for(py(M),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),O=0;O<P;++O)_=B[O],I.touch0&&I.touch0[2]===_.identifier?delete I.touch0:I.touch1&&I.touch1[2]===_.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(_=fi(_,this),Math.hypot(u[0]-_[0],u[1]-_[1])<k)){var Y=Ss(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return y.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:_p(+M),y):r},y.filter=function(M){return arguments.length?(e=typeof M=="function"?M:_p(!!M),y):e},y.touchable=function(M){return arguments.length?(s=typeof M=="function"?M:_p(!!M),y):s},y.extent=function(M){return arguments.length?(t=typeof M=="function"?M:_p([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),y):t},y.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],y):[i[0],i[1]]},y.translateExtent=function(M){return arguments.length?(a[0][0]=+M[0][0],a[1][0]=+M[1][0],a[0][1]=+M[0][1],a[1][1]=+M[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(M){return arguments.length?(n=M,y):n},y.duration=function(M){return arguments.length?(l=+M,y):l},y.interpolate=function(M){return arguments.length?(c=M,y):c},y.on=function(){var M=d.on.apply(d,arguments);return M===d?y:M},y.clickDistance=function(M){return arguments.length?(v=(M=+M)*M,y):Math.sqrt(v)},y.tapDistance=function(M){return arguments.length?(k=+M,y):k},y}const eo={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007: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."},Ud=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],$_=["Enter"," ","Escape"],D_={"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 Wc;(function(e){e.Strict="strict",e.Loose="loose"})(Wc||(Wc={}));var hl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(hl||(hl={}));var Kd;(function(e){e.Partial="partial",e.Full="full"})(Kd||(Kd={}));const F_={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ua;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ua||(ua={}));var us;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(us||(us={}));var Ke;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ke||(Ke={}));const Gk={[Ke.Left]:Ke.Right,[Ke.Right]:Ke.Left,[Ke.Top]:Ke.Bottom,[Ke.Bottom]:Ke.Top};function z_(e){return e===null?null:e?"valid":"invalid"}const B_=e=>"id"in e&&"source"in e&&"target"in e,gz=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Yb=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),xf=(e,t=[0,0])=>{const{width:n,height:r}=Do(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},yz=(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 a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):Yb(s)?s:t.nodeLookup.get(s.id));const l=a?Jh(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Km(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return qm(n)},wf=(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=Km(n,Jh(s)),r=!0)}),r?qm(n):{x:0,y:0,width:0,height:0}},Gb=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...vf(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const d of e.values()){const{measured:f,selectable:u=!0,hidden:p=!1}=d;if(a&&!u||p)continue;const h=f.width??d.width??d.initialWidth??null,g=f.height??d.height??d.initialHeight??null,v=qd(l,Kc(d)),k=(h??0)*(g??0),y=i&&v>0;(!d.internals.handleBounds||y||v>=k||d.dragging)&&c.push(d)}return c},xz=(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 wz(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function bz({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=wz(e,a),c=wf(l),d=Xb(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(d,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function H_({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??r;let u=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",eo.error005());else{const h=l.measured.width,g=l.measured.height;h&&g&&(u=[[c,d],[c+h,d+g]])}else l&&qc(a.extent)&&(u=[[a.extent[0][0]+c,a.extent[0][1]+d],[a.extent[1][0]+c,a.extent[1][1]+d]]);const p=qc(u)?Nl(t,u,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",eo.error015())),{position:{x:p.x-c+(a.measured.width??0)*f[0],y:p.y-d+(a.measured.height??0)*f[1]},positionAbsolute:p}}async function vz({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(p=>p.id)),a=[];for(const p of n){if(p.deletable===!1)continue;const h=i.has(p.id),g=!h&&p.parentId&&a.find(v=>v.id===p.parentId);(h||g)&&a.push(p)}const l=new Set(t.map(p=>p.id)),c=r.filter(p=>p.deletable!==!1),f=xz(a,c);for(const p of c)l.has(p.id)&&!f.find(g=>g.id===p.id)&&f.push(p);if(!s)return{edges:f,nodes:a};const u=await s({nodes:a,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:a}:{edges:[],nodes:[]}:u}const Uc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Nl=(e={x:0,y:0},t,n)=>({x:Uc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Uc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function V_(e,t,n){const{width:r,height:s}=Do(n),{x:i,y:a}=n.internals.positionAbsolute;return Nl(e,[[i,a],[i+r,a+s]],t)}const Xk=(e,t,n)=>e<t?Uc(Math.abs(e-t),1,t)/t:e>n?-Uc(Math.abs(e-n),1,t)/t:0,W_=(e,t,n=15,r=40)=>{const s=Xk(e.x,r,t.width-r)*n,i=Xk(e.y,r,t.height-r)*n;return[s,i]},Km=(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)}),cw=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),qm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Kc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Yb(e)?e.internals.positionAbsolute:xf(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}},Jh=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Yb(e)?e.internals.positionAbsolute:xf(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)}},U_=(e,t)=>qm(Km(cw(e),cw(t))),qd=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Jk=e=>gi(e.width)&&gi(e.height)&&gi(e.x)&&gi(e.y),gi=e=>!isNaN(e)&&isFinite(e),kz=(e,t)=>{},bf=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),vf=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?bf(l,a):l},Qh=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Jl(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(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Sz(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Jl(e,n),s=Jl(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Jl(e.top??e.y??0,n),s=Jl(e.bottom??e.y??0,n),i=Jl(e.left??e.x??0,t),a=Jl(e.right??e.x??0,t);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Nz(e,t,n,r,s,i){const{x:a,y:l}=Qh(e,[t,n,r]),{x:c,y:d}=Qh({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=s-c,u=i-d;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(u)}}const Xb=(e,t,n,r,s,i)=>{const a=Sz(i,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,d=Math.min(l,c),f=Uc(d,r,s),u=e.x+e.width/2,p=e.y+e.height/2,h=t/2-u*f,g=n/2-p*f,v=Nz(e,h,g,f,t,n),k={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:h-k.left+k.right,y:g-k.top+k.bottom,zoom:f}},Yd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function qc(e){return e!=null&&e!=="parent"}function Do(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 K_(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 q_(e,t={width:0,height:0},n,r,s){const i={...e},a=r.get(n);if(a){const l=a.origin||s;i.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function Qk(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function jz(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function Cz(e){return{...D_,...e||{}}}function md(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=yi(e),l=vf({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:d}=n?bf(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const Jb=e=>({width:e.offsetWidth,height:e.offsetHeight}),Y_=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Ez=["INPUT","SELECT","TEXTAREA"];function G_(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:Ez.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const X_=e=>"clientX"in e,yi=(e,t)=>{var i,a;const n=X_(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Zk=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...Jb(a)}})};function J_({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:l}){const c=e*.125+s*.375+a*.375+n*.125,d=t*.125+i*.375+l*.375+r*.125,f=Math.abs(c-e),u=Math.abs(d-t);return[c,d,f,u]}function Pp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function eS({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Ke.Left:return[t-Pp(t-r,i),n];case Ke.Right:return[t+Pp(r-t,i),n];case Ke.Top:return[t,n-Pp(n-s,i)];case Ke.Bottom:return[t,n+Pp(s-n,i)]}}function Q_({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:s,targetPosition:i=Ke.Top,curvature:a=.25}){const[l,c]=eS({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[d,f]=eS({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[u,p,h,g]=J_({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${c} ${d},${f} ${r},${s}`,u,p,h,g]}function Z_({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[i,l,s,a]}function _z({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const a=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 a+l}function Pz({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Km(Jh(e),Jh(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return qd(a,qm(i))>0}const Az=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Iz=(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)),Gd=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||Az;let s;return B_(e)?s={...e}:s={...e,id:r(e)},Iz(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function eP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=Z_({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const tS={[Ke.Left]:{x:-1,y:0},[Ke.Right]:{x:1,y:0},[Ke.Top]:{x:0,y:-1},[Ke.Bottom]:{x:0,y:1}},Tz=({source:e,sourcePosition:t=Ke.Bottom,target:n})=>t===Ke.Left||t===Ke.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},nS=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Rz({source:e,sourcePosition:t=Ke.Bottom,target:n,targetPosition:r=Ke.Top,center:s,offset:i,stepPosition:a}){const l=tS[t],c=tS[r],d={x:e.x+l.x*i,y:e.y+l.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},u=Tz({source:d,sourcePosition:t,target:f}),p=u.x!==0?"x":"y",h=u[p];let g=[],v,k;const y={x:0,y:0},b={x:0,y:0},[,,w,N]=Z_({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*c[p]===-1){p==="x"?(v=s.x??d.x+(f.x-d.x)*a,k=s.y??(d.y+f.y)/2):(v=s.x??(d.x+f.x)/2,k=s.y??d.y+(f.y-d.y)*a);const $=[{x:v,y:d.y},{x:v,y:f.y}],L=[{x:d.x,y:k},{x:f.x,y:k}];l[p]===h?g=p==="x"?$:L:g=p==="x"?L:$}else{const $=[{x:d.x,y:f.y}],L=[{x:f.x,y:d.y}];if(p==="x"?g=l.x===h?L:$:g=l.y===h?$:L,t===r){const M=Math.abs(e[p]-n[p]);if(M<=i){const D=Math.min(i-1,i-M);l[p]===h?y[p]=(d[p]>e[p]?-1:1)*D:b[p]=(f[p]>n[p]?-1:1)*D}}if(t!==r){const M=p==="x"?"y":"x",D=l[p]===c[M],I=d[M]>f[M],B=d[M]<f[M];(l[p]===1&&(!D&&I||D&&B)||l[p]!==1&&(!D&&B||D&&I))&&(g=p==="x"?$:L)}const F={x:d.x+y.x,y:d.y+y.y},A={x:f.x+b.x,y:f.y+b.y},R=Math.max(Math.abs(F.x-g[0].x),Math.abs(A.x-g[0].x)),V=Math.max(Math.abs(F.y-g[0].y),Math.abs(A.y-g[0].y));R>=V?(v=(F.x+A.x)/2,k=g[0].y):(v=g[0].x,k=(F.y+A.y)/2)}const C={x:d.x+y.x,y:d.y+y.y},j={x:f.x+b.x,y:f.y+b.y};return[[e,...C.x!==g[0].x||C.y!==g[0].y?[C]:[],...g,...j.x!==g[g.length-1].x||j.y!==g[g.length-1].y?[j]:[],n],v,k,w,N]}function Lz(e,t,n,r){const s=Math.min(nS(e,t)/2,nS(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const d=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+s*d},${a}Q ${i},${a} ${i},${a+s*f}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${a+s*c}Q ${i},${a} ${i+s*l},${a}`}function uw({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:s,targetPosition:i=Ke.Top,borderRadius:a=5,centerX:l,centerY:c,offset:d=20,stepPosition:f=.5}){const[u,p,h,g,v]=Rz({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:d,stepPosition:f});let k=`M${u[0].x} ${u[0].y}`;for(let y=1;y<u.length-1;y++)k+=Lz(u[y-1],u[y],u[y+1],a);return k+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[k,p,h,g,v]}function rS(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Oz(e){var u;const{sourceNode:t,targetNode:n}=e;if(!rS(t)||!rS(n))return null;const r=t.internals.handleBounds||sS(t.handles),s=n.internals.handleBounds||sS(n.handles),i=iS((r==null?void 0:r.source)??[],e.sourceHandle),a=iS(e.connectionMode===Wc.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!a)return(u=e.onError)==null||u.call(e,"008",eo.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Ke.Bottom,c=(a==null?void 0:a.position)||Ke.Top,d=jl(t,i,l),f=jl(n,a,c);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}function sS(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 jl(e,t,n=Ke.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:a,height:l}=t??Do(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Ke.Top:return{x:s+a/2,y:i};case Ke.Right:return{x:s+a,y:i+l/2};case Ke.Bottom:return{x:s+a/2,y:i+l};case Ke.Left:return{x:s,y:i+l/2}}}function iS(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function dw(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Mz(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const d=dw(c,t);i.has(d)||(a.push({id:d,color:c.color||n,...c}),i.add(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const tP=1e3,$z=10,Qb={nodeOrigin:[0,0],nodeExtent:Ud,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Dz={...Qb,checkEquality:!0};function Zb(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Fz(e,t,n){const r=Zb(Qb,n);for(const s of e.values())if(s.parentId)tv(s,e,t,r);else{const i=xf(s,r.nodeOrigin),a=qc(s.extent)?s.extent:r.nodeExtent,l=Nl(i,a,Do(s));s.internals.positionAbsolute=l}}function zz(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 ev(e){return e==="manual"}function fw(e,t,n,r={}){var f,u;const s=Zb(Dz,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!ev(s.zIndexMode)?tP:0;let c=e.length>0,d=!1;t.clear(),n.clear();for(const p of e){let h=a.get(p.id);if(s.checkEquality&&p===(h==null?void 0:h.internals.userNode))t.set(p.id,h);else{const g=xf(p,s.nodeOrigin),v=qc(p.extent)?p.extent:s.nodeExtent,k=Nl(g,v,Do(p));h={...s.defaults,...p,measured:{width:(f=p.measured)==null?void 0:f.width,height:(u=p.measured)==null?void 0:u.height},internals:{positionAbsolute:k,handleBounds:zz(p,h),z:nP(p,l,s.zIndexMode),userNode:p}},t.set(p.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),p.parentId&&tv(h,t,n,r,i),d||(d=p.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:d}}function Bz(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 tv(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Zb(Qb,r),d=e.parentId,f=t.get(d);if(!f){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Bz(e,n),s&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++s.i,f.internals.z=f.internals.z+s.i*$z),s&&f.internals.rootParentIndex!==void 0&&(s.i=f.internals.rootParentIndex);const u=i&&!ev(c)?tP:0,{x:p,y:h,z:g}=Hz(e,f,a,l,u,c),{positionAbsolute:v}=e.internals,k=p!==v.x||h!==v.y;(k||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:p,y:h}:v,z:g}})}function nP(e,t,n){const r=gi(e.zIndex)?e.zIndex:0;return ev(n)?r:r+(e.selected?t:0)}function Hz(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,c=Do(e),d=xf(e,n),f=qc(e.extent)?Nl(d,e.extent,c):d;let u=Nl({x:a+f.x,y:l+f.y},r,c);e.extent==="parent"&&(u=V_(u,c,t));const p=nP(e,s,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=p?h+1:p}}function nv(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const d=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??Kc(c),f=U_(d,l.rect);i.set(l.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},d)=>{var w;const f=c.internals.positionAbsolute,u=Do(c),p=c.origin??r,h=l.x<f.x?Math.round(Math.abs(f.x-l.x)):0,g=l.y<f.y?Math.round(Math.abs(f.y-l.y)):0,v=Math.max(u.width,Math.round(l.width)),k=Math.max(u.height,Math.round(l.height)),y=(v-u.width)*p[0],b=(k-u.height)*p[1];(h>0||g>0||y||b)&&(s.push({id:d,type:"position",position:{x:c.position.x-h+y,y:c.position.y-g+b}}),(w=n.get(d))==null||w.forEach(N=>{e.some(C=>C.id===N.id)||s.push({id:N.id,type:"position",position:{x:N.position.x+h,y:N.position.y+g}})})),(u.width<l.width||u.height<l.height||h||g)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?p[0]*h-y:0),height:k+(g?p[1]*g-b:0)}})}),s}function Vz(e,t,n,r,s,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],f=window.getComputedStyle(l),{m22:u}=new window.DOMMatrixReadOnly(f.transform),p=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const v=Jb(h.nodeElement),k=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(k||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),w=qc(g.extent)?g.extent:i;let{positionAbsolute:N}=g.internals;g.parentId&&g.extent==="parent"?N=V_(N,v,t.get(g.parentId)):w&&(N=Nl(N,w,v));const C={...g,measured:v,internals:{...g.internals,positionAbsolute:N,handleBounds:{source:Zk("source",h.nodeElement,b,u,g.id),target:Zk("target",h.nodeElement,b,u,g.id)}}};t.set(g.id,C),g.parentId&&tv(C,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,k&&(d.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&p.push({id:g.id,parentId:g.parentId,rect:Kc(C,s)}))}}if(p.length>0){const h=nv(p,t,n,s);d.push(...h)}return{changes:d,updatedInternals:c}}async function Wz({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r),l=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(l)}function oS(e,t,n,r,s,i){let a=s;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${s}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),i){a=`${s}-${e}-${i}`;const d=r.get(a)||new Map;r.set(a,d.set(n,t))}}function rP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:l},d=`${s}-${a}--${i}-${l}`,f=`${i}-${l}--${s}-${a}`;oS("source",c,f,e,s,a),oS("target",c,d,e,i,l),t.set(r.id,r)}}function sP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:sP(n,t):!1}function aS(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 Uz(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!sP(a,e))&&(a.draggable||t&&typeof a.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 hy({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[d,f]of t){const u=(a=n.get(d))==null?void 0:a.internals.userNode;u&&s.push({...u,position:f.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 Kz({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},a=bf(i,t);return{x:a.x-i.x,y:a.y-i.y}}function qz({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,l=new Map,c=!1,d={x:0,y:0},f=null,u=!1,p=null,h=!1,g=!1,v=null;function k({noDragClassName:b,handleSelector:w,domNode:N,isSelectable:C,nodeId:j,nodeClickDistance:T=0}){p=Ss(N);function $({x:R,y:V}){const{nodeLookup:M,nodeExtent:D,snapGrid:I,snapToGrid:B,nodeOrigin:P,onNodeDrag:O,onSelectionDrag:_,onError:Y,updateNodePositions:Q}=t();i={x:R,y:V};let K=!1;const ie=l.size>1,fe=ie&&D?cw(wf(l)):null,ye=ie&&B?Kz({dragItems:l,snapGrid:I,x:R,y:V}):null;for(const[we,ae]of l){if(!M.has(we))continue;let ge={x:R-ae.distance.x,y:V-ae.distance.y};B&&(ge=ye?{x:Math.round(ge.x+ye.x),y:Math.round(ge.y+ye.y)}:bf(ge,I));let _e=null;if(ie&&D&&!ae.extent&&fe){const{positionAbsolute:Ne}=ae.internals,Ye=Ne.x-fe.x+D[0][0],Ze=Ne.x+ae.measured.width-fe.x2+D[1][0],Ge=Ne.y-fe.y+D[0][1],It=Ne.y+ae.measured.height-fe.y2+D[1][1];_e=[[Ye,Ge],[Ze,It]]}const{position:Ae,positionAbsolute:Ce}=H_({nodeId:we,nextPosition:ge,nodeLookup:M,nodeExtent:_e||D,nodeOrigin:P,onError:Y});K=K||ae.position.x!==Ae.x||ae.position.y!==Ae.y,ae.position=Ae,ae.internals.positionAbsolute=Ce}if(g=g||K,!!K&&(Q(l,!0),v&&(r||O||!j&&_))){const[we,ae]=hy({nodeId:j,dragItems:l,nodeLookup:M});r==null||r(v,l,we,ae),O==null||O(v,we,ae),j||_==null||_(v,ae)}}async function L(){if(!f)return;const{transform:R,panBy:V,autoPanSpeed:M,autoPanOnNodeDrag:D}=t();if(!D){c=!1,cancelAnimationFrame(a);return}const[I,B]=W_(d,f,M);(I!==0||B!==0)&&(i.x=(i.x??0)-I/R[2],i.y=(i.y??0)-B/R[2],await V({x:I,y:B})&&$(i)),a=requestAnimationFrame(L)}function F(R){var ie;const{nodeLookup:V,multiSelectionActive:M,nodesDraggable:D,transform:I,snapGrid:B,snapToGrid:P,selectNodesOnDrag:O,onNodeDragStart:_,onSelectionDragStart:Y,unselectNodesAndEdges:Q}=t();u=!0,(!O||!C)&&!M&&j&&((ie=V.get(j))!=null&&ie.selected||Q()),C&&O&&j&&(e==null||e(j));const K=md(R.sourceEvent,{transform:I,snapGrid:B,snapToGrid:P,containerBounds:f});if(i=K,l=Uz(V,D,K,j),l.size>0&&(n||_||!j&&Y)){const[fe,ye]=hy({nodeId:j,dragItems:l,nodeLookup:V});n==null||n(R.sourceEvent,l,fe,ye),_==null||_(R.sourceEvent,fe,ye),j||Y==null||Y(R.sourceEvent,ye)}}const A=v_().clickDistance(T).on("start",R=>{const{domNode:V,nodeDragThreshold:M,transform:D,snapGrid:I,snapToGrid:B}=t();f=(V==null?void 0:V.getBoundingClientRect())||null,h=!1,g=!1,v=R.sourceEvent,M===0&&F(R),i=md(R.sourceEvent,{transform:D,snapGrid:I,snapToGrid:B,containerBounds:f}),d=yi(R.sourceEvent,f)}).on("drag",R=>{const{autoPanOnNodeDrag:V,transform:M,snapGrid:D,snapToGrid:I,nodeDragThreshold:B,nodeLookup:P}=t(),O=md(R.sourceEvent,{transform:M,snapGrid:D,snapToGrid:I,containerBounds:f});if(v=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||j&&!P.has(j))&&(h=!0),!h){if(!c&&V&&u&&(c=!0,L()),!u){const _=yi(R.sourceEvent,f),Y=_.x-d.x,Q=_.y-d.y;Math.sqrt(Y*Y+Q*Q)>B&&F(R)}(i.x!==O.xSnapped||i.y!==O.ySnapped)&&l&&u&&(d=yi(R.sourceEvent,f),$(O))}}).on("end",R=>{if(!(!u||h)&&(c=!1,u=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:V,updateNodePositions:M,onNodeDragStop:D,onSelectionDragStop:I}=t();if(g&&(M(l,!1),g=!1),s||D||!j&&I){const[B,P]=hy({nodeId:j,dragItems:l,nodeLookup:V,dragging:!1});s==null||s(R.sourceEvent,l,B,P),D==null||D(R.sourceEvent,B,P),j||I==null||I(R.sourceEvent,P)}}}).filter(R=>{const V=R.target;return!R.button&&(!b||!aS(V,`.${b}`,N))&&(!w||aS(V,w,N))});p.call(A)}function y(){p==null||p.on(".drag",null)}return{update:k,destroy:y}}function Yz(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())qd(s,Kc(i))>0&&r.push(i);return r}const Gz=250;function Xz(e,t,n,r){var l,c;let s=[],i=1/0;const a=Yz(e,n,t+Gz);for(const d of a){const f=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of f){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:p,y:h}=jl(d,u,u.position,!0),g=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(s=[{...u,x:p,y:h}],i=g):g===i&&s.push({...u,x:p,y:h}))}}if(!s.length)return null;if(s.length>1){const d=r.type==="source"?"target":"source";return s.find(f=>f.type===d)??s[0]}return s[0]}function iP(e,t,n,r,s,i=!1){var d,f,u;const a=r.get(e);if(!a)return null;const l=s==="strict"?(d=a.internals.handleBounds)==null?void 0:d[t]:[...((f=a.internals.handleBounds)==null?void 0:f.source)??[],...((u=a.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?l==null?void 0:l.find(p=>p.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...jl(a,c,c.position,!0)}:c}function oP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Jz(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const aP=()=>!0;function Qz(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:f,flowId:u,panBy:p,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:k,isValidConnection:y=aP,onReconnectEnd:b,updateConnection:w,getTransform:N,getFromHandle:C,autoPanSpeed:j,dragThreshold:T=1,handleDomNode:$}){const L=Y_(e.target);let F=0,A;const{x:R,y:V}=yi(e),M=oP(i,$),D=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!D||!M)return;const B=iP(s,M,r,c,t);if(!B)return;let P=yi(e,D),O=!1,_=null,Y=!1,Q=null;function K(){if(!f||!D)return;const[Ae,Ce]=W_(P,D,j);p({x:Ae,y:Ce}),F=requestAnimationFrame(K)}const ie={...B,nodeId:s,type:M,position:B.position},fe=c.get(s);let we={inProgress:!0,isValid:null,from:jl(fe,ie,Ke.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:fe,to:P,toHandle:null,toPosition:Gk[ie.position],toNode:null,pointer:P};function ae(){I=!0,w(we),g==null||g(e,{nodeId:s,handleId:r,handleType:M})}T===0&&ae();function ge(Ae){if(!I){const{x:It,y:qe}=yi(Ae),ct=It-R,Ht=qe-V;if(!(ct*ct+Ht*Ht>T*T))return;ae()}if(!C()||!ie){_e(Ae);return}const Ce=N();P=yi(Ae,D),A=Xz(vf(P,Ce,!1,[1,1]),n,c,ie),O||(K(),O=!0);const Ne=lP(Ae,{handle:A,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:L,lib:d,flowId:u,nodeLookup:c});Q=Ne.handleDomNode,_=Ne.connection,Y=Jz(!!A,Ne.isValid);const Ye=c.get(s),Ze=Ye?jl(Ye,ie,Ke.Left,!0):we.from,Ge={...we,from:Ze,isValid:Y,to:Ne.toHandle&&Y?Qh({x:Ne.toHandle.x,y:Ne.toHandle.y},Ce):P,toHandle:Ne.toHandle,toPosition:Y&&Ne.toHandle?Ne.toHandle.position:Gk[ie.position],toNode:Ne.toHandle?c.get(Ne.toHandle.nodeId):null,pointer:P};w(Ge),we=Ge}function _e(Ae){if(!("touches"in Ae&&Ae.touches.length>0)){if(I){(A||Q)&&_&&Y&&(v==null||v(_));const{inProgress:Ce,...Ne}=we,Ye={...Ne,toPosition:we.toHandle?we.toPosition:null};k==null||k(Ae,Ye),i&&(b==null||b(Ae,Ye))}h(),cancelAnimationFrame(F),O=!1,Y=!1,_=null,Q=null,L.removeEventListener("mousemove",ge),L.removeEventListener("mouseup",_e),L.removeEventListener("touchmove",ge),L.removeEventListener("touchend",_e)}}L.addEventListener("mousemove",ge),L.addEventListener("mouseup",_e),L.addEventListener("touchmove",ge),L.addEventListener("touchend",_e)}function lP(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:c,isValidConnection:d=aP,nodeLookup:f}){const u=i==="target",p=t?a.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:h,y:g}=yi(e),v=a.elementFromPoint(h,g),k=v!=null&&v.classList.contains(`${l}-flow__handle`)?v:p,y={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const b=oP(void 0,k),w=k.getAttribute("data-nodeid"),N=k.getAttribute("data-handleid"),C=k.classList.contains("connectable"),j=k.classList.contains("connectableend");if(!w||!b)return y;const T={source:u?w:r,sourceHandle:u?N:s,target:u?r:w,targetHandle:u?s:N};y.connection=T;const L=C&&j&&(n===Wc.Strict?u&&b==="source"||!u&&b==="target":w!==r||N!==s);y.isValid=L&&d(T),y.toHandle=iP(w,b,N,f,n,!0)}return y}const pw={onPointerDown:Qz,isValid:lP};function Zz({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Ss(e);function i({translateExtent:l,width:c,height:d,zoomStep:f=1,pannable:u=!0,zoomable:p=!0,inversePan:h=!1}){const g=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const N=n(),C=w.sourceEvent.ctrlKey&&Yd()?10:1,j=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*f,T=N[2]*Math.pow(2,j*C);t.scaleTo(T)};let v=[0,0];const k=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(v=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},y=w=>{const N=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const C=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],j=[C[0]-v[0],C[1]-v[1]];v=C;const T=r()*Math.max(N[2],Math.log(N[2]))*(h?-1:1),$={x:N[0]-j[0]*T,y:N[1]-j[1]*T},L=[[0,0],[c,d]];t.setViewportConstrained({x:$.x,y:$.y,zoom:N[2]},L,l)},b=M_().on("start",k).on("zoom",u?y:null).on("zoom.wheel",p?g:null);s.call(b,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:fi}}const Ym=e=>({x:e.x,y:e.y,zoom:e.k}),my=({x:e,y:t,zoom:n})=>Um.translate(e,t).scale(n),wc=(e,t)=>e.target.closest(`.${t}`),cP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),e3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,gy=(e,t=0,n=e3,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},uP=e=>{const t=e.ctrlKey&&Yd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function t3({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return f=>{if(wc(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&a){const k=fi(f),y=uP(f),b=u*Math.pow(2,y);r.scaleTo(n,b,k,f);return}const p=f.deltaMode===1?20:1;let h=s===hl.Vertical?0:f.deltaX*p,g=s===hl.Horizontal?0:f.deltaY*p;!Yd()&&f.shiftKey&&s!==hl.Vertical&&(h=f.deltaY*p,g=0),r.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const v=Ym(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(f,v),e.panScrollTimeout=setTimeout(()=>{d==null||d(f,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(f,v))}}function n3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=wc(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function r3({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Ym(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.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 s3({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&cP(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,Ym(i.transform)))}}function i3({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&cP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Ym(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function o3({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:f}){return u=>{var k;const p=e||t,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(wc(u,`${d}-flow__node`)||wc(u,`${d}-flow__edge`)))return!0;if(!r&&!p&&!s&&!i&&!n||a||f&&!g||wc(u,l)&&g||wc(u,c)&&(!g||s&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((k=u.touches)==null?void 0:k.length)>1)return u.preventDefault(),!1;if(!p&&!s&&!h&&g||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&v}}function a3({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=M_().scaleExtent([t,n]).translateExtent(r),p=Ss(e).call(u);b({x:s.x,y:s.y,zoom:Uc(s.zoom,t,n)},[[0,0],[f.width,f.height]],r);const h=p.on("wheel.zoom"),g=p.on("dblclick.zoom");u.wheelDelta(uP);function v(A,R){return p?new Promise(V=>{u==null||u.interpolate((R==null?void 0:R.interpolate)==="linear"?hd:lh).transform(gy(p,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>V(!0)),A)}):Promise.resolve(!1)}function k({noWheelClassName:A,noPanClassName:R,onPaneContextMenu:V,userSelectionActive:M,panOnScroll:D,panOnDrag:I,panOnScrollMode:B,panOnScrollSpeed:P,preventScrolling:O,zoomOnPinch:_,zoomOnScroll:Y,zoomOnDoubleClick:Q,zoomActivationKeyPressed:K,lib:ie,onTransformChange:fe,connectionInProgress:ye,paneClickDistance:we,selectionOnDrag:ae}){M&&!d.isZoomingOrPanning&&y();const ge=D&&!K&&!M;u.clickDistance(ae?1/0:!gi(we)||we<0?0:we);const _e=ge?t3({zoomPanValues:d,noWheelClassName:A,d3Selection:p,d3Zoom:u,panOnScrollMode:B,panOnScrollSpeed:P,zoomOnPinch:_,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):n3({noWheelClassName:A,preventScrolling:O,d3ZoomHandler:h});if(p.on("wheel.zoom",_e,{passive:!1}),!M){const Ce=r3({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:a});u.on("start",Ce);const Ne=s3({zoomPanValues:d,panOnDrag:I,onPaneContextMenu:!!V,onPanZoom:i,onTransformChange:fe});u.on("zoom",Ne);const Ye=i3({zoomPanValues:d,panOnDrag:I,panOnScroll:D,onPaneContextMenu:V,onPanZoomEnd:l,onDraggingChange:c});u.on("end",Ye)}const Ae=o3({zoomActivationKeyPressed:K,panOnDrag:I,zoomOnScroll:Y,panOnScroll:D,zoomOnDoubleClick:Q,zoomOnPinch:_,userSelectionActive:M,noPanClassName:R,noWheelClassName:A,lib:ie,connectionInProgress:ye});u.filter(Ae),Q?p.on("dblclick.zoom",g):p.on("dblclick.zoom",null)}function y(){u.on("zoom",null)}async function b(A,R,V){const M=my(A),D=u==null?void 0:u.constrain()(M,R,V);return D&&await v(D),new Promise(I=>I(D))}async function w(A,R){const V=my(A);return await v(V,R),new Promise(M=>M(V))}function N(A){if(p){const R=my(A),V=p.property("__zoom");(V.k!==A.zoom||V.x!==A.x||V.y!==A.y)&&(u==null||u.transform(p,R,null,{sync:!0}))}}function C(){const A=p?O_(p.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function j(A,R){return p?new Promise(V=>{u==null||u.interpolate((R==null?void 0:R.interpolate)==="linear"?hd:lh).scaleTo(gy(p,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>V(!0)),A)}):Promise.resolve(!1)}function T(A,R){return p?new Promise(V=>{u==null||u.interpolate((R==null?void 0:R.interpolate)==="linear"?hd:lh).scaleBy(gy(p,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>V(!0)),A)}):Promise.resolve(!1)}function $(A){u==null||u.scaleExtent(A)}function L(A){u==null||u.translateExtent(A)}function F(A){const R=!gi(A)||A<0?0:A;u==null||u.clickDistance(R)}return{update:k,destroy:y,setViewport:w,setViewportConstrained:b,getViewport:C,scaleTo:j,scaleBy:T,setScaleExtent:$,setTranslateExtent:L,syncViewport:N,setClickDistance:F}}var Yc;(function(e){e.Line="line",e.Handle="handle"})(Yc||(Yc={}));function l3({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function lS(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 ta(e,t){return Math.max(0,t-e)}function na(e,t){return Math.max(0,e-t)}function Ap(e,t,n){return Math.max(0,t-e,e-n)}function cS(e,t){return e?!t:t}function c3(e,t,n,r,s,i,a,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:f,isVertical:u}=t,p=f&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:k,minHeight:y,maxHeight:b}=r,{x:w,y:N,width:C,height:j,aspectRatio:T}=e;let $=Math.floor(f?h-e.pointerX:0),L=Math.floor(u?g-e.pointerY:0);const F=C+(c?-$:$),A=j+(d?-L:L),R=-i[0]*C,V=-i[1]*j;let M=Ap(F,v,k),D=Ap(A,y,b);if(a){let P=0,O=0;c&&$<0?P=ta(w+$+R,a[0][0]):!c&&$>0&&(P=na(w+F+R,a[1][0])),d&&L<0?O=ta(N+L+V,a[0][1]):!d&&L>0&&(O=na(N+A+V,a[1][1])),M=Math.max(M,P),D=Math.max(D,O)}if(l){let P=0,O=0;c&&$>0?P=na(w+$,l[0][0]):!c&&$<0&&(P=ta(w+F,l[1][0])),d&&L>0?O=na(N+L,l[0][1]):!d&&L<0&&(O=ta(N+A,l[1][1])),M=Math.max(M,P),D=Math.max(D,O)}if(s){if(f){const P=Ap(F/T,y,b)*T;if(M=Math.max(M,P),a){let O=0;!c&&!d||c&&!d&&p?O=na(N+V+F/T,a[1][1])*T:O=ta(N+V+(c?$:-$)/T,a[0][1])*T,M=Math.max(M,O)}if(l){let O=0;!c&&!d||c&&!d&&p?O=ta(N+F/T,l[1][1])*T:O=na(N+(c?$:-$)/T,l[0][1])*T,M=Math.max(M,O)}}if(u){const P=Ap(A*T,v,k)/T;if(D=Math.max(D,P),a){let O=0;!c&&!d||d&&!c&&p?O=na(w+A*T+R,a[1][0])/T:O=ta(w+(d?L:-L)*T+R,a[0][0])/T,D=Math.max(D,O)}if(l){let O=0;!c&&!d||d&&!c&&p?O=ta(w+A*T,l[1][0])/T:O=na(w+(d?L:-L)*T,l[0][0])/T,D=Math.max(D,O)}}}L=L+(L<0?D:-D),$=$+($<0?M:-M),s&&(p?F>A*T?L=(cS(c,d)?-$:$)/T:$=(cS(c,d)?-L:L)*T:f?(L=$/T,d=c):($=L*T,c=d));const I=c?w+$:w,B=d?N+L:N;return{width:C+(c?-$:$),height:j+(d?-L:L),x:i[0]*$*(c?-1:1)+I,y:i[1]*L*(d?-1:1)+B}}const dP={width:0,height:0,x:0,y:0},u3={...dP,pointerX:0,pointerY:0,aspectRatio:1};function d3(e){return[[0,0],[e.measured.width,e.measured.height]]}function f3(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,l=n[0]*i,c=n[1]*a;return[[r-l,s-c],[r+i-l,s+a-c]]}function p3({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Ss(e);let a={controlDirection:lS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:f,keepAspectRatio:u,resizeDirection:p,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:k}){let y={...dP},b={...u3};a={boundaries:f,resizeDirection:p,keepAspectRatio:u,controlDirection:lS(d)};let w,N=null,C=[],j,T,$,L=!1;const F=v_().on("start",A=>{const{nodeLookup:R,transform:V,snapGrid:M,snapToGrid:D,nodeOrigin:I,paneDomNode:B}=n();if(w=R.get(t),!w)return;N=(B==null?void 0:B.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:O}=md(A.sourceEvent,{transform:V,snapGrid:M,snapToGrid:D,containerBounds:N});y={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},b={...y,pointerX:P,pointerY:O,aspectRatio:y.width/y.height},j=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(j=R.get(w.parentId),T=j&&w.extent==="parent"?d3(j):void 0),C=[],$=void 0;for(const[_,Y]of R)if(Y.parentId===t&&(C.push({id:_,position:{...Y.position},extent:Y.extent}),Y.extent==="parent"||Y.expandParent)){const Q=f3(Y,w,Y.origin??I);$?$=[[Math.min(Q[0][0],$[0][0]),Math.min(Q[0][1],$[0][1])],[Math.max(Q[1][0],$[1][0]),Math.max(Q[1][1],$[1][1])]]:$=Q}h==null||h(A,{...y})}).on("drag",A=>{const{transform:R,snapGrid:V,snapToGrid:M,nodeOrigin:D}=n(),I=md(A.sourceEvent,{transform:R,snapGrid:V,snapToGrid:M,containerBounds:N}),B=[];if(!w)return;const{x:P,y:O,width:_,height:Y}=y,Q={},K=w.origin??D,{width:ie,height:fe,x:ye,y:we}=c3(b,a.controlDirection,I,a.boundaries,a.keepAspectRatio,K,T,$),ae=ie!==_,ge=fe!==Y,_e=ye!==P&&ae,Ae=we!==O&≥if(!_e&&!Ae&&!ae&&!ge)return;if((_e||Ae||K[0]===1||K[1]===1)&&(Q.x=_e?ye:y.x,Q.y=Ae?we:y.y,y.x=Q.x,y.y=Q.y,C.length>0)){const Ze=ye-P,Ge=we-O;for(const It of C)It.position={x:It.position.x-Ze+K[0]*(ie-_),y:It.position.y-Ge+K[1]*(fe-Y)},B.push(It)}if((ae||ge)&&(Q.width=ae&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ie:y.width,Q.height=ge&&(!a.resizeDirection||a.resizeDirection==="vertical")?fe:y.height,y.width=Q.width,y.height=Q.height),j&&w.expandParent){const Ze=K[0]*(Q.width??0);Q.x&&Q.x<Ze&&(y.x=Ze,b.x=b.x-(Q.x-Ze));const Ge=K[1]*(Q.height??0);Q.y&&Q.y<Ge&&(y.y=Ge,b.y=b.y-(Q.y-Ge))}const Ce=l3({width:y.width,prevWidth:_,height:y.height,prevHeight:Y,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),Ne={...y,direction:Ce};(k==null?void 0:k(A,Ne))!==!1&&(L=!0,g==null||g(A,Ne),r(Q,B))}).on("end",A=>{L&&(v==null||v(A,{...y}),s==null||s({...y}),L=!1)});i.call(F)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var fP={exports:{}},pP={},hP={exports:{}},mP={};/**
|
|
45
|
-
* @license React
|
|
46
|
-
* use-sync-external-store-shim.production.js
|
|
47
|
-
*
|
|
48
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
49
|
-
*
|
|
50
|
-
* This source code is licensed under the MIT license found in the
|
|
51
|
-
* LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/var Gc=m;function h3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var m3=typeof Object.is=="function"?Object.is:h3,g3=Gc.useState,y3=Gc.useEffect,x3=Gc.useLayoutEffect,w3=Gc.useDebugValue;function b3(e,t){var n=t(),r=g3({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return x3(function(){s.value=n,s.getSnapshot=t,yy(s)&&i({inst:s})},[e,n,t]),y3(function(){return yy(s)&&i({inst:s}),e(function(){yy(s)&&i({inst:s})})},[e]),w3(n),n}function yy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!m3(e,n)}catch{return!0}}function v3(e,t){return t()}var k3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?v3:b3;mP.useSyncExternalStore=Gc.useSyncExternalStore!==void 0?Gc.useSyncExternalStore:k3;hP.exports=mP;var gP=hP.exports;/**
|
|
53
|
-
* @license React
|
|
54
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
55
|
-
*
|
|
56
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the MIT license found in the
|
|
59
|
-
* LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/var Gm=m,S3=gP;function N3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var j3=typeof Object.is=="function"?Object.is:N3,C3=S3.useSyncExternalStore,E3=Gm.useRef,_3=Gm.useEffect,P3=Gm.useMemo,A3=Gm.useDebugValue;pP.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=E3(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=P3(function(){function c(h){if(!d){if(d=!0,f=h,h=r(h),s!==void 0&&a.hasValue){var g=a.value;if(s(g,h))return u=g}return u=h}if(g=u,j3(f,h))return g;var v=r(h);return s!==void 0&&s(g,v)?(f=h,g):(f=h,u=v)}var d=!1,f,u,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,s]);var l=C3(e,i[0],i[1]);return _3(function(){a.hasValue=!0,a.value=l},[l]),A3(l),l};fP.exports=pP;var I3=fP.exports;const T3=La(I3),R3={},uS=e=>{let t;const n=new Set,r=(f,u)=>{const p=typeof f=="function"?f(t):f;if(!Object.is(p,t)){const h=t;t=u??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(g=>g(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(R3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,s,c);return c},L3=e=>e?uS(e):uS,{useDebugValue:O3}=nt,{useSyncExternalStoreWithSelector:M3}=T3,$3=e=>e;function yP(e,t=$3,n){const r=M3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return O3(r),r}const dS=(e,t)=>{const n=L3(e),r=(s,i=t)=>yP(n,s,i);return Object.assign(r,n),r},D3=(e,t)=>e?dS(e,t):dS;function _n(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 Xm=m.createContext(null),F3=Xm.Provider,xP=eo.error001();function Bt(e,t){const n=m.useContext(Xm);if(n===null)throw new Error(xP);return yP(n,e,t)}function Sn(){const e=m.useContext(Xm);if(e===null)throw new Error(xP);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const fS={display:"none"},z3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},wP="react-flow__node-desc",bP="react-flow__edge-desc",B3="react-flow__aria-live",H3=e=>e.ariaLiveMessage,V3=e=>e.ariaLabelConfig;function W3({rfId:e}){const t=Bt(H3);return o.jsx("div",{id:`${B3}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:z3,children:t})}function U3({rfId:e,disableKeyboardA11y:t}){const n=Bt(V3);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${wP}-${e}`,style:fS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${bP}-${e}`,style:fS,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(W3,{rfId:e})]})}const Xc=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:sr(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});Xc.displayName="Panel";function K3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Xc,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const q3=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}},Ip=e=>e.id;function Y3(e,t){return _n(e.selectedNodes.map(Ip),t.selectedNodes.map(Ip))&&_n(e.selectedEdges.map(Ip),t.selectedEdges.map(Ip))}function G3({onSelectionChange:e}){const t=Sn(),{selectedNodes:n,selectedEdges:r}=Bt(q3,Y3);return m.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const X3=e=>!!e.onSelectionChangeHandlers;function J3({onSelectionChange:e}){const t=Bt(X3);return e||t?o.jsx(G3,{onSelectionChange:e}):null}const hw=typeof window<"u"?m.useLayoutEffect:m.useEffect,vP=[0,0],Q3={x:0,y:0,zoom:1},Z3=["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"],pS=[...Z3,"rfId"],e5=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}),hS={translateExtent:Ud,nodeOrigin:vP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function t5(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Bt(e5,_n),d=Sn();hw(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=hS,l()}),[]);const f=m.useRef(hS);return hw(()=>{for(const u of pS){const p=e[u],h=f.current[u];p!==h&&(typeof e[u]>"u"||(u==="nodes"?t(p):u==="edges"?n(p):u==="minZoom"?r(p):u==="maxZoom"?s(p):u==="translateExtent"?i(p):u==="nodeExtent"?a(p):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:Cz(p)}):u==="fitView"?d.setState({fitViewQueued:p}):u==="fitViewOptions"?d.setState({fitViewOptions:p}):d.setState({[u]:p})))}f.current=e},pS.map(u=>e[u])),null}function mS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function n5(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=mS(),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=mS())!=null&&r.matches?"dark":"light"}const gS=typeof document<"u"?document:null;function Xd(e=null,t={target:gS,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),s=m.useRef(!1),i=m.useRef(new Set([])),[a,l]=m.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),f=d.reduce((u,p)=>u.concat(...p),[]);return[d,f]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??gS,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=h=>{var k,y;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!d)&&G_(h))return!1;const v=xS(h.code,l);if(i.current.add(h[v]),yS(a,i.current,!1)){const b=((y=(k=h.composedPath)==null?void 0:k.call(h))==null?void 0:y[0])||h.target,w=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(s.current||!w)&&h.preventDefault(),r(!0)}},u=h=>{const g=xS(h.code,l);yS(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),s.current=!1},p=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",f),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{c==null||c.removeEventListener("keydown",f),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),n}function yS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function xS(e,t){return t.includes(e)?"code":"key"}const r5=()=>{const e=Sn();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!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:a,panZoom:l}=e.getState(),c=Xb(t,r,s,i,a,(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}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),d={x:t.x-l,y:t.y-c},f=n.snapGrid??s,u=n.snapToGrid??i;return vf(d,r,u,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=Qh(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function kP(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 a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...i};for(const c of a)s5(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 s5(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 rv(e,t){return kP(e,t)}function SP(e,t){return kP(e,t)}function sl(e,t){return{id:e,type:"select",selected:t}}function bc(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const a=t.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(sl(i.id,a)))}return r}function wS({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const l=t.get(a.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function bS(e){return{id:e.id,type:"remove"}}const vS=e=>gz(e),i5=e=>B_(e);function NP(e){return m.forwardRef(e)}function kS(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>o5(()=>n(s=>s+BigInt(1))));return hw(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function o5(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const jP=m.createContext(null);function a5({children:e}){const t=Sn(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:d,hasDefaultNodes:f,onNodesChange:u,nodeLookup:p,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let v=c;for(const y of l)v=typeof y=="function"?y(v):y;let k=wS({items:v,lookup:p});for(const y of g.values())k=y(k);f&&d(v),k.length>0?u==null||u(k):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:b,setNodes:w}=t.getState();y&&w(b)})},[]),r=kS(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:d,hasDefaultEdges:f,onEdgesChange:u,edgeLookup:p}=t.getState();let h=c;for(const g of l)h=typeof g=="function"?g(h):g;f?d(h):u&&u(wS({items:h,lookup:p}))},[]),i=kS(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(jP.Provider,{value:a,children:e})}function l5(){const e=m.useContext(jP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const c5=e=>!!e.panZoom;function Al(){const e=r5(),t=Sn(),n=l5(),r=Bt(c5),s=m.useMemo(()=>{const i=u=>t.getState().nodeLookup.get(u),a=u=>{n.nodeQueue.push(u)},l=u=>{n.edgeQueue.push(u)},c=u=>{var y,b;const{nodeLookup:p,nodeOrigin:h}=t.getState(),g=vS(u)?u:p.get(u.id),v=g.parentId?q_(g.position,g.measured,g.parentId,p,h):g.position,k={...g,position:v,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((b=g.measured)==null?void 0:b.height)??g.height};return Kc(k)},d=(u,p,h={replace:!1})=>{a(g=>g.map(v=>{if(v.id===u){const k=typeof p=="function"?p(v):p;return h.replace&&vS(k)?k:{...v,...k}}return v}))},f=(u,p,h={replace:!1})=>{l(g=>g.map(v=>{if(v.id===u){const k=typeof p=="function"?p(v):p;return h.replace&&i5(k)?k:{...v,...k}}return v}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>{var p;return(p=i(u))==null?void 0:p.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(p=>({...p}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:a,setEdges:l,addNodes:u=>{const p=Array.isArray(u)?u:[u];n.nodeQueue.push(h=>[...h,...p])},addEdges:u=>{const p=Array.isArray(u)?u:[u];n.edgeQueue.push(h=>[...h,...p])},toObject:()=>{const{nodes:u=[],edges:p=[],transform:h}=t.getState(),[g,v,k]=h;return{nodes:u.map(y=>({...y})),edges:p.map(y=>({...y})),viewport:{x:g,y:v,zoom:k}}},deleteElements:async({nodes:u=[],edges:p=[]})=>{const{nodes:h,edges:g,onNodesDelete:v,onEdgesDelete:k,triggerNodeChanges:y,triggerEdgeChanges:b,onDelete:w,onBeforeDelete:N}=t.getState(),{nodes:C,edges:j}=await vz({nodesToRemove:u,edgesToRemove:p,nodes:h,edges:g,onBeforeDelete:N}),T=j.length>0,$=C.length>0;if(T){const L=j.map(bS);k==null||k(j),b(L)}if($){const L=C.map(bS);v==null||v(C),y(L)}return($||T)&&(w==null||w({nodes:C,edges:j})),{deletedNodes:C,deletedEdges:j}},getIntersectingNodes:(u,p=!0,h)=>{const g=Jk(u),v=g?u:c(u),k=h!==void 0;return v?(h||t.getState().nodes).filter(y=>{const b=t.getState().nodeLookup.get(y.id);if(b&&!g&&(y.id===u.id||!b.internals.positionAbsolute))return!1;const w=Kc(k?y:b),N=qd(w,v);return p&&N>0||N>=w.width*w.height||N>=v.width*v.height}):[]},isNodeIntersecting:(u,p,h=!0)=>{const v=Jk(u)?u:c(u);if(!v)return!1;const k=qd(v,p);return h&&k>0||k>=p.width*p.height||k>=v.width*v.height},updateNode:d,updateNodeData:(u,p,h={replace:!1})=>{d(u,g=>{const v=typeof p=="function"?p(g):p;return h.replace?{...g,data:v}:{...g,data:{...g.data,...v}}},h)},updateEdge:f,updateEdgeData:(u,p,h={replace:!1})=>{f(u,g=>{const v=typeof p=="function"?p(g):p;return h.replace?{...g,data:v}:{...g,data:{...g.data,...v}}},h)},getNodesBounds:u=>{const{nodeLookup:p,nodeOrigin:h}=t.getState();return yz(u,{nodeLookup:p,nodeOrigin:h})},getHandleConnections:({type:u,id:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${u}${p?`-${p}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:u,handleId:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${u?p?`-${u}-${p}`:`-${u}`:""}`))==null?void 0:g.values())??[])},fitView:async u=>{const p=t.getState().fitViewResolver??jz();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:p}),n.nodeQueue.push(h=>[...h]),p.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const SS=e=>e.selected,u5=typeof window<"u"?window:void 0;function d5({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Sn(),{deleteElements:r}=Al(),s=Xd(e,{actInsideInputWithModifier:!1}),i=Xd(t,{target:u5});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(SS),edges:a.filter(SS)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function f5(e){const t=Sn();m.useEffect(()=>{const n=()=>{var s,i,a,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Jb(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",eo.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 Jm={position:"absolute",width:"100%",height:"100%",top:0,left:0},p5=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function h5({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=hl.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:f,maxZoom:u,zoomActivationKeyCode:p,preventScrolling:h=!0,children:g,noWheelClassName:v,noPanClassName:k,onViewportChange:y,isControlledViewport:b,paneClickDistance:w,selectionOnDrag:N}){const C=Sn(),j=m.useRef(null),{userSelectionActive:T,lib:$,connectionInProgress:L}=Bt(p5,_n),F=Xd(p),A=m.useRef();f5(j);const R=m.useCallback(V=>{y==null||y({x:V[0],y:V[1],zoom:V[2]}),b||C.setState({transform:V})},[y,b]);return m.useEffect(()=>{if(j.current){A.current=a3({domNode:j.current,minZoom:f,maxZoom:u,translateExtent:d,viewport:c,onDraggingChange:I=>C.setState(B=>B.paneDragging===I?B:{paneDragging:I}),onPanZoomStart:(I,B)=>{const{onViewportChangeStart:P,onMoveStart:O}=C.getState();O==null||O(I,B),P==null||P(B)},onPanZoom:(I,B)=>{const{onViewportChange:P,onMove:O}=C.getState();O==null||O(I,B),P==null||P(B)},onPanZoomEnd:(I,B)=>{const{onViewportChangeEnd:P,onMoveEnd:O}=C.getState();O==null||O(I,B),P==null||P(B)}});const{x:V,y:M,zoom:D}=A.current.getViewport();return C.setState({panZoom:A.current,transform:[V,M,D],domNode:j.current.closest(".react-flow")}),()=>{var I;(I=A.current)==null||I.destroy()}}},[]),m.useEffect(()=>{var V;(V=A.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:F,preventScrolling:h,noPanClassName:k,userSelectionActive:T,noWheelClassName:v,lib:$,onTransformChange:R,connectionInProgress:L,selectionOnDrag:N,paneClickDistance:w})},[e,t,n,r,s,i,a,l,F,h,k,T,v,$,R,L,N,w]),o.jsx("div",{className:"react-flow__renderer",ref:j,style:Jm,children:g})}const m5=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function g5(){const{userSelectionActive:e,userSelectionRect:t}=Bt(m5,_n);return e&&t?o.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 xy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},y5=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function x5({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Kd.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:u,onPaneMouseMove:p,onPaneMouseLeave:h,children:g}){const v=Sn(),{userSelectionActive:k,elementsSelectable:y,dragging:b,connectionInProgress:w}=Bt(y5,_n),N=y&&(e||k),C=m.useRef(null),j=m.useRef(),T=m.useRef(new Set),$=m.useRef(new Set),L=m.useRef(!1),F=P=>{if(L.current||w){L.current=!1;return}c==null||c(P),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},A=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}d==null||d(P)},R=f?P=>f(P):void 0,V=P=>{L.current&&(P.stopPropagation(),L.current=!1)},M=P=>{var fe,ye;const{domNode:O}=v.getState();if(j.current=O==null?void 0:O.getBoundingClientRect(),!j.current)return;const _=P.target===C.current;if(!_&&!!P.target.closest(".nokey")||!e||!(i&&_||t)||P.button!==0||!P.isPrimary)return;(ye=(fe=P.target)==null?void 0:fe.setPointerCapture)==null||ye.call(fe,P.pointerId),L.current=!1;const{x:K,y:ie}=yi(P.nativeEvent,j.current);v.setState({userSelectionRect:{width:0,height:0,startX:K,startY:ie,x:K,y:ie}}),_||(P.stopPropagation(),P.preventDefault())},D=P=>{const{userSelectionRect:O,transform:_,nodeLookup:Y,edgeLookup:Q,connectionLookup:K,triggerNodeChanges:ie,triggerEdgeChanges:fe,defaultEdgeOptions:ye,resetSelectedElements:we}=v.getState();if(!j.current||!O)return;const{x:ae,y:ge}=yi(P.nativeEvent,j.current),{startX:_e,startY:Ae}=O;if(!L.current){const Ge=t?0:s;if(Math.hypot(ae-_e,ge-Ae)<=Ge)return;we(),a==null||a(P)}L.current=!0;const Ce={startX:_e,startY:Ae,x:ae<_e?ae:_e,y:ge<Ae?ge:Ae,width:Math.abs(ae-_e),height:Math.abs(ge-Ae)},Ne=T.current,Ye=$.current;T.current=new Set(Gb(Y,Ce,_,n===Kd.Partial,!0).map(Ge=>Ge.id)),$.current=new Set;const Ze=(ye==null?void 0:ye.selectable)??!0;for(const Ge of T.current){const It=K.get(Ge);if(It)for(const{edgeId:qe}of It.values()){const ct=Q.get(qe);ct&&(ct.selectable??Ze)&&$.current.add(qe)}}if(!Qk(Ne,T.current)){const Ge=bc(Y,T.current,!0);ie(Ge)}if(!Qk(Ye,$.current)){const Ge=bc(Q,$.current);fe(Ge)}v.setState({userSelectionRect:Ce,userSelectionActive:!0,nodesSelectionActive:!1})},I=P=>{var O,_;P.button===0&&((_=(O=P.target)==null?void 0:O.releasePointerCapture)==null||_.call(O,P.pointerId),!k&&P.target===C.current&&v.getState().userSelectionRect&&(F==null||F(P)),v.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(l==null||l(P),v.setState({nodesSelectionActive:T.current.size>0})))},B=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:sr(["react-flow__pane",{draggable:B,dragging:b,selection:e}]),onClick:N?void 0:xy(F,C),onContextMenu:xy(A,C),onWheel:xy(R,C),onPointerEnter:N?void 0:u,onPointerMove:N?D:p,onPointerUp:N?I:void 0,onPointerDownCapture:N?M:void 0,onClickCapture:N?V:void 0,onPointerLeave:h,ref:C,style:Jm,children:[g,o.jsx(g5,{})]})}function mw({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),d=l.get(e);if(!d){c==null||c("012",eo.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):s([e])}function CP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=Sn(),[c,d]=m.useState(!1),f=m.useRef();return m.useEffect(()=>{f.current=qz({getStoreItems:()=>l.getState(),onNodeMouseDown:u=>{mw({id:u,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!f.current))return f.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var u;(u=f.current)==null||u.destroy()}},[n,r,t,i,e,s,a]),c}const w5=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function EP(){const e=Sn();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:d,nodeOrigin:f}=e.getState(),u=new Map,p=w5(a),h=s?i[0]:5,g=s?i[1]:5,v=n.direction.x*h*n.factor,k=n.direction.y*g*n.factor;for(const[,y]of d){if(!p(y))continue;let b={x:y.internals.positionAbsolute.x+v,y:y.internals.positionAbsolute.y+k};s&&(b=bf(b,i));const{position:w,positionAbsolute:N}=H_({nodeId:y.id,nextPosition:b,nodeLookup:d,nodeExtent:r,nodeOrigin:f,onError:l});y.position=w,y.internals.positionAbsolute=N,u.set(y.id,y)}c(u)},[])}const sv=m.createContext(null),b5=sv.Provider;sv.Consumer;const _P=()=>m.useContext(sv),v5=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),k5=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:c,isValid:d}=a,f=(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:f,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Wc.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:f&&d}};function S5({type:e="source",position:t=Ke.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:d,onMouseDown:f,onTouchStart:u,...p},h){var D,I;const g=a||null,v=e==="target",k=Sn(),y=_P(),{connectOnClick:b,noPanClassName:w,rfId:N}=Bt(v5,_n),{connectingFrom:C,connectingTo:j,clickConnecting:T,isPossibleEndHandle:$,connectionInProcess:L,clickConnectionInProcess:F,valid:A}=Bt(k5(y,g,e),_n);y||(I=(D=k.getState()).onError)==null||I.call(D,"010",eo.error010());const R=B=>{const{defaultEdgeOptions:P,onConnect:O,hasDefaultEdges:_}=k.getState(),Y={...P,...B};if(_){const{edges:Q,setEdges:K}=k.getState();K(Gd(Y,Q))}O==null||O(Y),l==null||l(Y)},V=B=>{if(!y)return;const P=X_(B.nativeEvent);if(s&&(P&&B.button===0||!P)){const O=k.getState();pw.onPointerDown(B.nativeEvent,{handleDomNode:B.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:v,handleId:g,nodeId:y,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(..._)=>{var Y,Q;return(Q=(Y=k.getState()).onConnectEnd)==null?void 0:Q.call(Y,..._)},updateConnection:O.updateConnection,onConnect:R,isValidConnection:n||((..._)=>{var Y,Q;return((Q=(Y=k.getState()).isValidConnection)==null?void 0:Q.call(Y,..._))??!0}),getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}P?f==null||f(B):u==null||u(B)},M=B=>{const{onClickConnectStart:P,onClickConnectEnd:O,connectionClickStartHandle:_,connectionMode:Y,isValidConnection:Q,lib:K,rfId:ie,nodeLookup:fe,connection:ye}=k.getState();if(!y||!_&&!s)return;if(!_){P==null||P(B.nativeEvent,{nodeId:y,handleId:g,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const we=Y_(B.target),ae=n||Q,{connection:ge,isValid:_e}=pw.isValid(B.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:Y,fromNodeId:_.nodeId,fromHandleId:_.id||null,fromType:_.type,isValidConnection:ae,flowId:ie,doc:we,lib:K,nodeLookup:fe});_e&&ge&&R(ge);const Ae=structuredClone(ye);delete Ae.inProgress,Ae.toPosition=Ae.toHandle?Ae.toHandle.position:null,O==null||O(B,Ae),k.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${N}-${y}-${g}-${e}`,className:sr(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,d,{source:!v,target:v,connectable:r,connectablestart:s,connectableend:i,clickconnecting:T,connectingfrom:C,connectingto:j,valid:A,connectionindicator:r&&(!L||$)&&(L||F?i:s)}]),onMouseDown:V,onTouchStart:V,onClick:b?M:void 0,ref:h,...p,children:c})}const fs=m.memo(NP(S5));function N5({data:e,isConnectable:t,sourcePosition:n=Ke.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(fs,{type:"source",position:n,isConnectable:t})]})}function j5({data:e,isConnectable:t,targetPosition:n=Ke.Top,sourcePosition:r=Ke.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(fs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(fs,{type:"source",position:r,isConnectable:t})]})}function C5(){return null}function E5({data:e,isConnectable:t,targetPosition:n=Ke.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(fs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Zh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},NS={input:N5,default:j5,output:E5,group:C5};function _5(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 P5=e=>{const{width:t,height:n,x:r,y:s}=wf(e.nodeLookup,{filter:i=>!!i.selected});return{width:gi(t)?t:null,height:gi(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 A5({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Sn(),{width:s,height:i,transformString:a,userSelectionActive:l}=Bt(P5,_n),c=EP(),d=m.useRef(null);m.useEffect(()=>{var h;n||(h=d.current)==null||h.focus({preventScroll:!0})},[n]);const f=!l&&s!==null&&i!==null;if(CP({nodeRef:d,disabled:!f}),!f)return null;const u=e?h=>{const g=r.getState().nodes.filter(v=>v.selected);e(h,g)}:void 0,p=h=>{Object.prototype.hasOwnProperty.call(Zh,h.key)&&(h.preventDefault(),c({direction:Zh[h.key],factor:h.shiftKey?4:1}))};return o.jsx("div",{className:sr(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:s,height:i}})})}const jS=typeof window<"u"?window:void 0,I5=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function PP({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:u,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:v,zoomActivationKeyCode:k,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:N,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:T,panOnDrag:$,defaultViewport:L,translateExtent:F,minZoom:A,maxZoom:R,preventScrolling:V,onSelectionContextMenu:M,noWheelClassName:D,noPanClassName:I,disableKeyboardA11y:B,onViewportChange:P,isControlledViewport:O}){const{nodesSelectionActive:_,userSelectionActive:Y}=Bt(I5,_n),Q=Xd(d,{target:jS}),K=Xd(v,{target:jS}),ie=K||$,fe=K||N,ye=f&&ie!==!0,we=Q||Y||ye;return d5({deleteKeyCode:c,multiSelectionKeyCode:g}),o.jsx(h5,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:fe,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:T,panOnDrag:!Q&&ie,defaultViewport:L,translateExtent:F,minZoom:A,maxZoom:R,zoomActivationKeyCode:k,preventScrolling:V,noWheelClassName:D,noPanClassName:I,onViewportChange:P,isControlledViewport:O,paneClickDistance:l,selectionOnDrag:ye,children:o.jsxs(x5,{onSelectionStart:p,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:ie,isSelecting:!!we,selectionMode:u,selectionKeyPressed:Q,paneClickDistance:l,selectionOnDrag:ye,children:[e,_&&o.jsx(A5,{onSelectionContextMenu:M,noPanClassName:I,disableKeyboardA11y:B})]})})}PP.displayName="FlowRenderer";const T5=m.memo(PP),R5=e=>t=>e?Gb(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 L5(e){return Bt(m.useCallback(R5(e),[e]),_n)}const O5=e=>e.updateNodeInternals;function M5(){const e=Bt(O5),[t]=m.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 m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function $5({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Sn(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),d=m.useRef(t),f=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!f||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[f,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(i.current){const u=d.current!==t,p=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(u||p||h)&&(d.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 D5({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:d,nodesFocusable:f,resizeObserver:u,noDragClassName:p,noPanClassName:h,disableKeyboardA11y:g,rfId:v,nodeTypes:k,nodeClickDistance:y,onError:b}){const{node:w,internals:N,isParent:C}=Bt(ae=>{const ge=ae.nodeLookup.get(e),_e=ae.parentLookup.has(e);return{node:ge,internals:ge.internals,isParent:_e}},_n);let j=w.type||"default",T=(k==null?void 0:k[j])||NS[j];T===void 0&&(b==null||b("003",eo.error003(j)),j="default",T=(k==null?void 0:k.default)||NS.default);const $=!!(w.draggable||l&&typeof w.draggable>"u"),L=!!(w.selectable||c&&typeof w.selectable>"u"),F=!!(w.connectable||d&&typeof w.connectable>"u"),A=!!(w.focusable||f&&typeof w.focusable>"u"),R=Sn(),V=K_(w),M=$5({node:w,nodeType:j,hasDimensions:V,resizeObserver:u}),D=CP({nodeRef:M,disabled:w.hidden||!$,noDragClassName:p,handleSelector:w.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:y}),I=EP();if(w.hidden)return null;const B=Do(w),P=_5(w),O=L||$||t||n||r||s,_=n?ae=>n(ae,{...N.userNode}):void 0,Y=r?ae=>r(ae,{...N.userNode}):void 0,Q=s?ae=>s(ae,{...N.userNode}):void 0,K=i?ae=>i(ae,{...N.userNode}):void 0,ie=a?ae=>a(ae,{...N.userNode}):void 0,fe=ae=>{const{selectNodesOnDrag:ge,nodeDragThreshold:_e}=R.getState();L&&(!ge||!$||_e>0)&&mw({id:e,store:R,nodeRef:M}),t&&t(ae,{...N.userNode})},ye=ae=>{if(!(G_(ae.nativeEvent)||g)){if($_.includes(ae.key)&&L){const ge=ae.key==="Escape";mw({id:e,store:R,unselect:ge,nodeRef:M})}else if($&&w.selected&&Object.prototype.hasOwnProperty.call(Zh,ae.key)){ae.preventDefault();const{ariaLabelConfig:ge}=R.getState();R.setState({ariaLiveMessage:ge["node.a11yDescription.ariaLiveMessage"]({direction:ae.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),I({direction:Zh[ae.key],factor:ae.shiftKey?4:1})}}},we=()=>{var Ye;if(g||!((Ye=M.current)!=null&&Ye.matches(":focus-visible")))return;const{transform:ae,width:ge,height:_e,autoPanOnNodeFocus:Ae,setCenter:Ce}=R.getState();if(!Ae)return;Gb(new Map([[e,w]]),{x:0,y:0,width:ge,height:_e},ae,!0).length>0||Ce(w.position.x+B.width/2,w.position.y+B.height/2,{zoom:ae[2]})};return o.jsx("div",{className:sr(["react-flow__node",`react-flow__node-${j}`,{[h]:$},w.className,{selected:w.selected,selectable:L,parent:C,draggable:$,dragging:D}]),ref:M,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:V?"visible":"hidden",...w.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:_,onMouseMove:Y,onMouseLeave:Q,onContextMenu:K,onClick:fe,onDoubleClick:ie,onKeyDown:A?ye:void 0,tabIndex:A?0:void 0,onFocus:A?we:void 0,role:w.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${wP}-${v}`,"aria-label":w.ariaLabel,...w.domAttributes,children:o.jsx(b5,{value:e,children:o.jsx(T,{id:e,data:w.data,type:j,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:w.selected??!1,selectable:L,draggable:$,deletable:w.deletable??!0,isConnectable:F,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:D,dragHandle:w.dragHandle,zIndex:N.z,parentId:w.parentId,...B})})})}var F5=m.memo(D5);const z5=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function AP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Bt(z5,_n),a=L5(e.onlyRenderVisibleElements),l=M5();return o.jsx("div",{className:"react-flow__nodes",style:Jm,children:a.map(c=>o.jsx(F5,{id:c,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:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}AP.displayName="NodeRenderer";const B5=m.memo(AP);function H5(e){return Bt(m.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),a=n.nodeLookup.get(s.target);i&&a&&Pz({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),_n)}const V5=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},W5=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},CS={[us.Arrow]:V5,[us.ArrowClosed]:W5};function U5(e){const t=Sn();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(CS,e)?CS[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",eo.error009(e)),null)},[e])}const K5=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=U5(t);return c?o.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:o.jsx(c,{color:n,strokeWidth:a})}):null},IP=({defaultColor:e,rfId:t})=>{const n=Bt(i=>i.edges),r=Bt(i=>i.defaultEdgeOptions),s=m.useMemo(()=>Mz(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?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:s.map(i=>o.jsx(K5,{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};IP.displayName="MarkerDefinitions";var q5=m.memo(IP);function TP({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...f}){const[u,p]=m.useState({x:1,y:0,width:0,height:0}),h=sr(["react-flow__edge-textwrapper",d]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const v=g.current.getBBox();p({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:h,visibility:u.width?"visible":"hidden",...f,children:[s&&o.jsx("rect",{width:u.width+2*a[0],x:-a[0],y:-a[1],height:u.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}TP.displayName="EdgeText";const Y5=m.memo(TP);function Qm({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:d=20,...f}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...f,d:e,fill:"none",className:sr(["react-flow__edge-path",f.className])}),d?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&gi(t)&&gi(n)?o.jsx(Y5,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function ES({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ke.Left||e===Ke.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function RP({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:s,targetPosition:i=Ke.Top}){const[a,l]=ES({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,d]=ES({pos:i,x1:r,y1:s,x2:e,y2:t}),[f,u,p,h]=J_({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${r},${s}`,f,u,p,h]}function LP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:k,interactionWidth:y})=>{const[b,w,N]=RP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),C=e.isInternal?void 0:t;return o.jsx(Qm,{id:C,path:b,labelX:w,labelY:N,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:k,interactionWidth:y})})}const G5=LP({isInternal:!1}),OP=LP({isInternal:!0});G5.displayName="SimpleBezierEdge";OP.displayName="SimpleBezierEdgeInternal";function MP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,sourcePosition:h=Ke.Bottom,targetPosition:g=Ke.Top,markerEnd:v,markerStart:k,pathOptions:y,interactionWidth:b})=>{const[w,N,C]=uw({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:i,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),j=e.isInternal?void 0:t;return o.jsx(Qm,{id:j,path:w,labelX:N,labelY:C,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,markerEnd:v,markerStart:k,interactionWidth:b})})}const $P=MP({isInternal:!1}),DP=MP({isInternal:!0});$P.displayName="SmoothStepEdge";DP.displayName="SmoothStepEdgeInternal";function FP(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx($P,{...n,id:r,pathOptions:m.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const X5=FP({isInternal:!1}),zP=FP({isInternal:!0});X5.displayName="StepEdge";zP.displayName="StepEdgeInternal";function BP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,markerEnd:h,markerStart:g,interactionWidth:v})=>{const[k,y,b]=eP({sourceX:n,sourceY:r,targetX:s,targetY:i}),w=e.isInternal?void 0:t;return o.jsx(Qm,{id:w,path:k,labelX:y,labelY:b,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,markerEnd:h,markerStart:g,interactionWidth:v})})}const J5=BP({isInternal:!1}),HP=BP({isInternal:!0});J5.displayName="StraightEdge";HP.displayName="StraightEdgeInternal";function VP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Ke.Bottom,targetPosition:l=Ke.Top,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:k,pathOptions:y,interactionWidth:b})=>{const[w,N,C]=Q_({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:y==null?void 0:y.curvature}),j=e.isInternal?void 0:t;return o.jsx(Qm,{id:j,path:w,labelX:N,labelY:C,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:k,interactionWidth:b})})}const Q5=VP({isInternal:!1}),WP=VP({isInternal:!0});Q5.displayName="BezierEdge";WP.displayName="BezierEdgeInternal";const _S={default:WP,straight:HP,step:zP,smoothstep:DP,simplebezier:OP},PS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Z5=(e,t,n)=>n===Ke.Left?e-t:n===Ke.Right?e+t:e,eB=(e,t,n)=>n===Ke.Top?e-t:n===Ke.Bottom?e+t:e,AS="react-flow__edgeupdater";function IS({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:sr([AS,`${AS}-${l}`]),cx:Z5(t,r,e),cy:eB(n,r,e),r,stroke:"transparent",fill:"transparent"})}function tB({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:d,onReconnectStart:f,onReconnectEnd:u,setReconnecting:p,setUpdateHover:h}){const g=Sn(),v=(N,C)=>{if(N.button!==0)return;const{autoPanOnConnect:j,domNode:T,connectionMode:$,connectionRadius:L,lib:F,onConnectStart:A,cancelConnection:R,nodeLookup:V,rfId:M,panBy:D,updateConnection:I}=g.getState(),B=C.type==="target",P=(Y,Q)=>{p(!1),u==null||u(Y,n,C.type,Q)},O=Y=>d==null?void 0:d(n,Y),_=(Y,Q)=>{p(!0),f==null||f(N,n,C.type),A==null||A(Y,Q)};pw.onPointerDown(N.nativeEvent,{autoPanOnConnect:j,connectionMode:$,connectionRadius:L,domNode:T,handleId:C.id,nodeId:C.nodeId,nodeLookup:V,isTarget:B,edgeUpdaterType:C.type,lib:F,flowId:M,cancelConnection:R,panBy:D,isValidConnection:(...Y)=>{var Q,K;return((K=(Q=g.getState()).isValidConnection)==null?void 0:K.call(Q,...Y))??!0},onConnect:O,onConnectStart:_,onConnectEnd:(...Y)=>{var Q,K;return(K=(Q=g.getState()).onConnectEnd)==null?void 0:K.call(Q,...Y)},onReconnectEnd:P,updateConnection:I,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},k=N=>v(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=N=>v(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),w=()=>h(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(IS,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:k,onMouseEnter:b,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&o.jsx(IS,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:y,onMouseEnter:b,onMouseOut:w,type:"target"})]})}function nB({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,reconnectRadius:f,onReconnect:u,onReconnectStart:p,onReconnectEnd:h,rfId:g,edgeTypes:v,noPanClassName:k,onError:y,disableKeyboardA11y:b}){let w=Bt(Ce=>Ce.edgeLookup.get(e));const N=Bt(Ce=>Ce.defaultEdgeOptions);w=N?{...N,...w}:w;let C=w.type||"default",j=(v==null?void 0:v[C])||_S[C];j===void 0&&(y==null||y("011",eo.error011(C)),C="default",j=(v==null?void 0:v.default)||_S.default);const T=!!(w.focusable||t&&typeof w.focusable>"u"),$=typeof u<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),L=!!(w.selectable||r&&typeof w.selectable>"u"),F=m.useRef(null),[A,R]=m.useState(!1),[V,M]=m.useState(!1),D=Sn(),{zIndex:I,sourceX:B,sourceY:P,targetX:O,targetY:_,sourcePosition:Y,targetPosition:Q}=Bt(m.useCallback(Ce=>{const Ne=Ce.nodeLookup.get(w.source),Ye=Ce.nodeLookup.get(w.target);if(!Ne||!Ye)return{zIndex:w.zIndex,...PS};const Ze=Oz({id:e,sourceNode:Ne,targetNode:Ye,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:Ce.connectionMode,onError:y});return{zIndex:_z({selected:w.selected,zIndex:w.zIndex,sourceNode:Ne,targetNode:Ye,elevateOnSelect:Ce.elevateEdgesOnSelect,zIndexMode:Ce.zIndexMode}),...Ze||PS}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),_n),K=m.useMemo(()=>w.markerStart?`url('#${dw(w.markerStart,g)}')`:void 0,[w.markerStart,g]),ie=m.useMemo(()=>w.markerEnd?`url('#${dw(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||B===null||P===null||O===null||_===null)return null;const fe=Ce=>{var Ge;const{addSelectedEdges:Ne,unselectNodesAndEdges:Ye,multiSelectionActive:Ze}=D.getState();L&&(D.setState({nodesSelectionActive:!1}),w.selected&&Ze?(Ye({nodes:[],edges:[w]}),(Ge=F.current)==null||Ge.blur()):Ne([e])),s&&s(Ce,w)},ye=i?Ce=>{i(Ce,{...w})}:void 0,we=a?Ce=>{a(Ce,{...w})}:void 0,ae=l?Ce=>{l(Ce,{...w})}:void 0,ge=c?Ce=>{c(Ce,{...w})}:void 0,_e=d?Ce=>{d(Ce,{...w})}:void 0,Ae=Ce=>{var Ne;if(!b&&$_.includes(Ce.key)&&L){const{unselectNodesAndEdges:Ye,addSelectedEdges:Ze}=D.getState();Ce.key==="Escape"?((Ne=F.current)==null||Ne.blur(),Ye({edges:[w]})):Ze([e])}};return o.jsx("svg",{style:{zIndex:I},children:o.jsxs("g",{className:sr(["react-flow__edge",`react-flow__edge-${C}`,w.className,k,{selected:w.selected,animated:w.animated,inactive:!L&&!s,updating:A,selectable:L}]),onClick:fe,onDoubleClick:ye,onContextMenu:we,onMouseEnter:ae,onMouseMove:ge,onMouseLeave:_e,onKeyDown:T?Ae:void 0,tabIndex:T?0:void 0,role:w.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":T?`${bP}-${g}`:void 0,ref:F,...w.domAttributes,children:[!V&&o.jsx(j,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:L,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:B,sourceY:P,targetX:O,targetY:_,sourcePosition:Y,targetPosition:Q,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:K,markerEnd:ie,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),$&&o.jsx(tB,{edge:w,isReconnectable:$,reconnectRadius:f,onReconnect:u,onReconnectStart:p,onReconnectEnd:h,sourceX:B,sourceY:P,targetX:O,targetY:_,sourcePosition:Y,targetPosition:Q,setUpdateHover:R,setReconnecting:M})]})})}var rB=m.memo(nB);const sB=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function UP({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:u,onEdgeDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:v}){const{edgesFocusable:k,edgesReconnectable:y,elementsSelectable:b,onError:w}=Bt(sB,_n),N=H5(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(q5,{defaultColor:e,rfId:n}),N.map(C=>o.jsx(rB,{id:C,edgesFocusable:k,edgesReconnectable:y,elementsSelectable:b,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:f,reconnectRadius:u,onDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:v},C))]})}UP.displayName="EdgeRenderer";const iB=m.memo(UP),oB=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function aB({children:e}){const t=Bt(oB);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function lB(e){const t=Al(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const cB=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function uB(e){const t=Bt(cB),n=Sn();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function dB(e){return e.connection.inProgress?{...e.connection,to:vf(e.connection.to,e.transform)}:{...e.connection}}function fB(e){return dB}function pB(e){const t=fB();return Bt(t,_n)}const hB=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function mB({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:c}=Bt(hB,_n);return!(i&&s&&c)?null:o.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:sr(["react-flow__connection",z_(l)]),children:o.jsx(KP,{style:t,type:n,CustomComponent:r,isValid:l})})})}const KP=({style:e,type:t=ua.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:c,to:d,toNode:f,toHandle:u,toPosition:p,pointer:h}=pB();if(!s)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:c,toPosition:p,connectionStatus:z_(r),toNode:f,toHandle:u,pointer:h});let g="";const v={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:d.x,targetY:d.y,targetPosition:p};switch(t){case ua.Bezier:[g]=Q_(v);break;case ua.SimpleBezier:[g]=RP(v);break;case ua.Step:[g]=uw({...v,borderRadius:0});break;case ua.SmoothStep:[g]=uw(v);break;default:[g]=eP(v)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};KP.displayName="ConnectionLine";const gB={};function TS(e=gB){m.useRef(e),Sn(),m.useEffect(()=>{},[e])}function yB(){Sn(),m.useRef(!1),m.useEffect(()=>{},[])}function qP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:u,onSelectionStart:p,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:v,connectionLineComponent:k,connectionLineContainerStyle:y,selectionKeyCode:b,selectionOnDrag:w,selectionMode:N,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:T,deleteKeyCode:$,onlyRenderVisibleElements:L,elementsSelectable:F,defaultViewport:A,translateExtent:R,minZoom:V,maxZoom:M,preventScrolling:D,defaultMarkerColor:I,zoomOnScroll:B,zoomOnPinch:P,panOnScroll:O,panOnScrollSpeed:_,panOnScrollMode:Y,zoomOnDoubleClick:Q,panOnDrag:K,onPaneClick:ie,onPaneMouseEnter:fe,onPaneMouseMove:ye,onPaneMouseLeave:we,onPaneScroll:ae,onPaneContextMenu:ge,paneClickDistance:_e,nodeClickDistance:Ae,onEdgeContextMenu:Ce,onEdgeMouseEnter:Ne,onEdgeMouseMove:Ye,onEdgeMouseLeave:Ze,reconnectRadius:Ge,onReconnect:It,onReconnectStart:qe,onReconnectEnd:ct,noDragClassName:Ht,noWheelClassName:Le,noPanClassName:Jt,disableKeyboardA11y:Qt,nodeExtent:Nn,rfId:ce,viewport:ee,onViewportChange:he}){return TS(e),TS(t),yB(),lB(n),uB(ee),o.jsx(T5,{onPaneClick:ie,onPaneMouseEnter:fe,onPaneMouseMove:ye,onPaneMouseLeave:we,onPaneContextMenu:ge,onPaneScroll:ae,paneClickDistance:_e,deleteKeyCode:$,selectionKeyCode:b,selectionOnDrag:w,selectionMode:N,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:T,elementsSelectable:F,zoomOnScroll:B,zoomOnPinch:P,zoomOnDoubleClick:Q,panOnScroll:O,panOnScrollSpeed:_,panOnScrollMode:Y,panOnDrag:K,defaultViewport:A,translateExtent:R,minZoom:V,maxZoom:M,onSelectionContextMenu:u,preventScrolling:D,noDragClassName:Ht,noWheelClassName:Le,noPanClassName:Jt,disableKeyboardA11y:Qt,onViewportChange:he,isControlledViewport:!!ee,children:o.jsxs(aB,{children:[o.jsx(iB,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:It,onReconnectStart:qe,onReconnectEnd:ct,onlyRenderVisibleElements:L,onEdgeContextMenu:Ce,onEdgeMouseEnter:Ne,onEdgeMouseMove:Ye,onEdgeMouseLeave:Ze,reconnectRadius:Ge,defaultMarkerColor:I,noPanClassName:Jt,disableKeyboardA11y:Qt,rfId:ce}),o.jsx(mB,{style:v,type:g,component:k,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(B5,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:Ae,onlyRenderVisibleElements:L,noPanClassName:Jt,noDragClassName:Ht,disableKeyboardA11y:Qt,nodeExtent:Nn,rfId:ce}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}qP.displayName="GraphView";const xB=m.memo(qP),RS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:d=2,nodeOrigin:f,nodeExtent:u,zIndexMode:p="basic"}={})=>{const h=new Map,g=new Map,v=new Map,k=new Map,y=r??t??[],b=n??e??[],w=f??[0,0],N=u??Ud;rP(v,k,y);const{nodesInitialized:C}=fw(b,h,g,{nodeOrigin:w,nodeExtent:N,zIndexMode:p});let j=[0,0,1];if(a&&s&&i){const T=wf(h,{filter:A=>!!((A.width||A.initialWidth)&&(A.height||A.initialHeight))}),{x:$,y:L,zoom:F}=Xb(T,s,i,c,d,(l==null?void 0:l.padding)??.1);j=[$,L,F]}return{rfId:"1",width:s??0,height:i??0,transform:j,nodes:b,nodesInitialized:C,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:k,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:d,translateExtent:Ud,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Wc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,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:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...F_},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:kz,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:D_,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},wB=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:f,nodeExtent:u,zIndexMode:p})=>D3((h,g)=>{async function v(){const{nodeLookup:k,panZoom:y,fitViewOptions:b,fitViewResolver:w,width:N,height:C,minZoom:j,maxZoom:T}=g();y&&(await bz({nodes:k,width:N,height:C,panZoom:y,minZoom:j,maxZoom:T},b),w==null||w.resolve(!0),h({fitViewResolver:null}))}return{...RS({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:f,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:p}),setNodes:k=>{const{nodeLookup:y,parentLookup:b,nodeOrigin:w,elevateNodesOnSelect:N,fitViewQueued:C,zIndexMode:j,nodesSelectionActive:T}=g(),{nodesInitialized:$,hasSelectedNodes:L}=fw(k,y,b,{nodeOrigin:w,nodeExtent:u,elevateNodesOnSelect:N,checkEquality:!0,zIndexMode:j}),F=T&&L;C&&$?(v(),h({nodes:k,nodesInitialized:$,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:F})):h({nodes:k,nodesInitialized:$,nodesSelectionActive:F})},setEdges:k=>{const{connectionLookup:y,edgeLookup:b}=g();rP(y,b,k),h({edges:k})},setDefaultNodesAndEdges:(k,y)=>{if(k){const{setNodes:b}=g();b(k),h({hasDefaultNodes:!0})}if(y){const{setEdges:b}=g();b(y),h({hasDefaultEdges:!0})}},updateNodeInternals:k=>{const{triggerNodeChanges:y,nodeLookup:b,parentLookup:w,domNode:N,nodeOrigin:C,nodeExtent:j,debug:T,fitViewQueued:$,zIndexMode:L}=g(),{changes:F,updatedInternals:A}=Vz(k,b,w,N,C,j,L);A&&(Fz(b,w,{nodeOrigin:C,nodeExtent:j,zIndexMode:L}),$?(v(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(F==null?void 0:F.length)>0&&(T&&console.log("React Flow: trigger node changes",F),y==null||y(F)))},updateNodePositions:(k,y=!1)=>{const b=[];let w=[];const{nodeLookup:N,triggerNodeChanges:C,connection:j,updateConnection:T,onNodesChangeMiddlewareMap:$}=g();for(const[L,F]of k){const A=N.get(L),R=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(F!=null&&F.position)),V={id:L,type:"position",position:R?{x:Math.max(0,F.position.x),y:Math.max(0,F.position.y)}:F.position,dragging:y};if(A&&j.inProgress&&j.fromNode.id===A.id){const M=jl(A,j.fromHandle,Ke.Left,!0);T({...j,from:M})}R&&A.parentId&&b.push({id:L,parentId:A.parentId,rect:{...F.internals.positionAbsolute,width:F.measured.width??0,height:F.measured.height??0}}),w.push(V)}if(b.length>0){const{parentLookup:L,nodeOrigin:F}=g(),A=nv(b,N,L,F);w.push(...A)}for(const L of $.values())w=L(w);C(w)},triggerNodeChanges:k=>{const{onNodesChange:y,setNodes:b,nodes:w,hasDefaultNodes:N,debug:C}=g();if(k!=null&&k.length){if(N){const j=rv(k,w);b(j)}C&&console.log("React Flow: trigger node changes",k),y==null||y(k)}},triggerEdgeChanges:k=>{const{onEdgesChange:y,setEdges:b,edges:w,hasDefaultEdges:N,debug:C}=g();if(k!=null&&k.length){if(N){const j=SP(k,w);b(j)}C&&console.log("React Flow: trigger edge changes",k),y==null||y(k)}},addSelectedNodes:k=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:C}=g();if(y){const j=k.map(T=>sl(T,!0));N(j);return}N(bc(w,new Set([...k]),!0)),C(bc(b))},addSelectedEdges:k=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:C}=g();if(y){const j=k.map(T=>sl(T,!0));C(j);return}C(bc(b,new Set([...k]))),N(bc(w,new Set,!0))},unselectNodesAndEdges:({nodes:k,edges:y}={})=>{const{edges:b,nodes:w,nodeLookup:N,triggerNodeChanges:C,triggerEdgeChanges:j}=g(),T=k||w,$=y||b,L=[];for(const A of T){if(!A.selected)continue;const R=N.get(A.id);R&&(R.selected=!1),L.push(sl(A.id,!1))}const F=[];for(const A of $)A.selected&&F.push(sl(A.id,!1));C(L),j(F)},setMinZoom:k=>{const{panZoom:y,maxZoom:b}=g();y==null||y.setScaleExtent([k,b]),h({minZoom:k})},setMaxZoom:k=>{const{panZoom:y,minZoom:b}=g();y==null||y.setScaleExtent([b,k]),h({maxZoom:k})},setTranslateExtent:k=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(k),h({translateExtent:k})},resetSelectedElements:()=>{const{edges:k,nodes:y,triggerNodeChanges:b,triggerEdgeChanges:w,elementsSelectable:N}=g();if(!N)return;const C=y.reduce((T,$)=>$.selected?[...T,sl($.id,!1)]:T,[]),j=k.reduce((T,$)=>$.selected?[...T,sl($.id,!1)]:T,[]);b(C),w(j)},setNodeExtent:k=>{const{nodes:y,nodeLookup:b,parentLookup:w,nodeOrigin:N,elevateNodesOnSelect:C,nodeExtent:j,zIndexMode:T}=g();k[0][0]===j[0][0]&&k[0][1]===j[0][1]&&k[1][0]===j[1][0]&&k[1][1]===j[1][1]||(fw(y,b,w,{nodeOrigin:N,nodeExtent:k,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:T}),h({nodeExtent:k}))},panBy:k=>{const{transform:y,width:b,height:w,panZoom:N,translateExtent:C}=g();return Wz({delta:k,panZoom:N,transform:y,translateExtent:C,width:b,height:w})},setCenter:async(k,y,b)=>{const{width:w,height:N,maxZoom:C,panZoom:j}=g();if(!j)return Promise.resolve(!1);const T=typeof(b==null?void 0:b.zoom)<"u"?b.zoom:C;return await j.setViewport({x:w/2-k*T,y:N/2-y*T,zoom:T},{duration:b==null?void 0:b.duration,ease:b==null?void 0:b.ease,interpolate:b==null?void 0:b.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...F_}})},updateConnection:k=>{h({connection:k})},reset:()=>h({...RS()})}},Object.is);function iv({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:d,nodeOrigin:f,nodeExtent:u,zIndexMode:p,children:h}){const[g]=m.useState(()=>wB({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:d,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:f,nodeExtent:u,zIndexMode:p}));return o.jsx(F3,{value:g,children:o.jsx(a5,{children:h})})}function bB({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:f,nodeOrigin:u,nodeExtent:p,zIndexMode:h}){return m.useContext(Xm)?o.jsx(o.Fragment,{children:e}):o.jsx(iv,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:u,nodeExtent:p,zIndexMode:h,children:e})}const vB={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function kB({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:f,onMoveStart:u,onMoveEnd:p,onConnect:h,onConnectStart:g,onConnectEnd:v,onClickConnectStart:k,onClickConnectEnd:y,onNodeMouseEnter:b,onNodeMouseMove:w,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:j,onNodeDragStart:T,onNodeDrag:$,onNodeDragStop:L,onNodesDelete:F,onEdgesDelete:A,onDelete:R,onSelectionChange:V,onSelectionDragStart:M,onSelectionDrag:D,onSelectionDragStop:I,onSelectionContextMenu:B,onSelectionStart:P,onSelectionEnd:O,onBeforeDelete:_,connectionMode:Y,connectionLineType:Q=ua.Bezier,connectionLineStyle:K,connectionLineComponent:ie,connectionLineContainerStyle:fe,deleteKeyCode:ye="Backspace",selectionKeyCode:we="Shift",selectionOnDrag:ae=!1,selectionMode:ge=Kd.Full,panActivationKeyCode:_e="Space",multiSelectionKeyCode:Ae=Yd()?"Meta":"Control",zoomActivationKeyCode:Ce=Yd()?"Meta":"Control",snapToGrid:Ne,snapGrid:Ye,onlyRenderVisibleElements:Ze=!1,selectNodesOnDrag:Ge,nodesDraggable:It,autoPanOnNodeFocus:qe,nodesConnectable:ct,nodesFocusable:Ht,nodeOrigin:Le=vP,edgesFocusable:Jt,edgesReconnectable:Qt,elementsSelectable:Nn=!0,defaultViewport:ce=Q3,minZoom:ee=.5,maxZoom:he=2,translateExtent:Me=Ud,preventScrolling:We=!0,nodeExtent:Qe,defaultMarkerColor:Gt="#b1b1b7",zoomOnScroll:mn=!0,zoomOnPinch:gn=!0,panOnScroll:yn=!1,panOnScrollSpeed:Pr=.5,panOnScrollMode:xn=hl.Free,zoomOnDoubleClick:Dn=!0,panOnDrag:xe=!0,onPaneClick:De,onPaneMouseEnter:tn,onPaneMouseMove:Fn,onPaneMouseLeave:st,onPaneScroll:zn,onPaneContextMenu:Rs,paneClickDistance:Ar=1,nodeClickDistance:Pn=0,children:hs,onReconnect:Ls,onReconnectStart:zo,onReconnectEnd:so,onEdgeContextMenu:ji,onEdgeDoubleClick:ms,onEdgeMouseEnter:io,onEdgeMouseMove:Jn,onEdgeMouseLeave:gs,reconnectRadius:Qs=10,onNodesChange:Bo,onEdgesChange:oo,noDragClassName:An="nodrag",noWheelClassName:Pe="nowheel",noPanClassName:qt="nopan",fitView:ir,fitViewOptions:ut,connectOnClick:Zs,attributionPosition:Kn,proOptions:Bn,defaultEdgeOptions:xr,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:Ct=!1,disableKeyboardA11y:Vt=!1,autoPanOnConnect:Fr,autoPanOnNodeDrag:Be,autoPanSpeed:Qn,connectionRadius:Hn,isValidConnection:Ci,onError:ei,style:Ei,id:Os,nodeDragThreshold:ao,connectionDragThreshold:ti,viewport:Ms,onViewportChange:en,width:wr,height:zr,colorMode:ys="light",debug:Yr,onScroll:W,ariaLabelConfig:de,zIndexMode:Ie="basic",...Ee},Re){const Ft=Os||"1",St=n5(ys),In=m.useCallback(Tn=>{Tn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),W==null||W(Tn)},[W]);return o.jsx("div",{"data-testid":"rf__wrapper",...Ee,onScroll:In,style:{...Ei,...vB},ref:Re,className:sr(["react-flow",s,St]),id:Os,role:"application",children:o.jsxs(bB,{nodes:e,edges:t,width:wr,height:zr,fitView:ir,fitViewOptions:ut,minZoom:ee,maxZoom:he,nodeOrigin:Le,nodeExtent:Qe,zIndexMode:Ie,children:[o.jsx(t5,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:v,onClickConnectStart:k,onClickConnectEnd:y,nodesDraggable:It,autoPanOnNodeFocus:qe,nodesConnectable:ct,nodesFocusable:Ht,edgesFocusable:Jt,edgesReconnectable:Qt,elementsSelectable:Nn,elevateNodesOnSelect:tt,elevateEdgesOnSelect:Ct,minZoom:ee,maxZoom:he,nodeExtent:Qe,onNodesChange:Bo,onEdgesChange:oo,snapToGrid:Ne,snapGrid:Ye,connectionMode:Y,translateExtent:Me,connectOnClick:Zs,defaultEdgeOptions:xr,fitView:ir,fitViewOptions:ut,onNodesDelete:F,onEdgesDelete:A,onDelete:R,onNodeDragStart:T,onNodeDrag:$,onNodeDragStop:L,onSelectionDrag:D,onSelectionDragStart:M,onSelectionDragStop:I,onMove:f,onMoveStart:u,onMoveEnd:p,noPanClassName:qt,nodeOrigin:Le,rfId:Ft,autoPanOnConnect:Fr,autoPanOnNodeDrag:Be,autoPanSpeed:Qn,onError:ei,connectionRadius:Hn,isValidConnection:Ci,selectNodesOnDrag:Ge,nodeDragThreshold:ao,connectionDragThreshold:ti,onBeforeDelete:_,debug:Yr,ariaLabelConfig:de,zIndexMode:Ie}),o.jsx(xB,{onInit:d,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:b,onNodeMouseMove:w,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:a,connectionLineType:Q,connectionLineStyle:K,connectionLineComponent:ie,connectionLineContainerStyle:fe,selectionKeyCode:we,selectionOnDrag:ae,selectionMode:ge,deleteKeyCode:ye,multiSelectionKeyCode:Ae,panActivationKeyCode:_e,zoomActivationKeyCode:Ce,onlyRenderVisibleElements:Ze,defaultViewport:ce,translateExtent:Me,minZoom:ee,maxZoom:he,preventScrolling:We,zoomOnScroll:mn,zoomOnPinch:gn,zoomOnDoubleClick:Dn,panOnScroll:yn,panOnScrollSpeed:Pr,panOnScrollMode:xn,panOnDrag:xe,onPaneClick:De,onPaneMouseEnter:tn,onPaneMouseMove:Fn,onPaneMouseLeave:st,onPaneScroll:zn,onPaneContextMenu:Rs,paneClickDistance:Ar,nodeClickDistance:Pn,onSelectionContextMenu:B,onSelectionStart:P,onSelectionEnd:O,onReconnect:Ls,onReconnectStart:zo,onReconnectEnd:so,onEdgeContextMenu:ji,onEdgeDoubleClick:ms,onEdgeMouseEnter:io,onEdgeMouseMove:Jn,onEdgeMouseLeave:gs,reconnectRadius:Qs,defaultMarkerColor:Gt,noDragClassName:An,noWheelClassName:Pe,noPanClassName:qt,rfId:Ft,disableKeyboardA11y:Vt,nodeExtent:Qe,viewport:Ms,onViewportChange:en}),o.jsx(J3,{onSelectionChange:V}),hs,o.jsx(K3,{proOptions:Bn,position:Kn}),o.jsx(U3,{rfId:Ft,disableKeyboardA11y:Vt})]})})}var YP=NP(kB);function GP(){const e=Sn();return m.useCallback(t=>{const{domNode:n,updateNodeInternals:r}=e.getState(),s=Array.isArray(t)?t:[t],i=new Map;s.forEach(a=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${a}"]`);l&&i.set(a,{id:a,nodeElement:l,force:!0})}),requestAnimationFrame(()=>r(i,{triggerFitView:!1}))},[])}function XP(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>rv(s,i)),[]);return[t,n,r]}function JP(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>SP(s,i)),[]);return[t,n,r]}function SB({dimensions:e,lineWidth:t,variant:n,className:r}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:sr(["react-flow__background-pattern",n,r])})}function NB({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:sr(["react-flow__background-pattern","dots",t])})}var Na;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Na||(Na={}));const jB={[Na.Dots]:1,[Na.Lines]:1,[Na.Cross]:6},CB=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function QP({id:e,variant:t=Na.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:c,className:d,patternClassName:f}){const u=m.useRef(null),{transform:p,patternId:h}=Bt(CB,_n),g=r||jB[t],v=t===Na.Dots,k=t===Na.Cross,y=Array.isArray(n)?n:[n,n],b=[y[0]*p[2]||1,y[1]*p[2]||1],w=g*p[2],N=Array.isArray(i)?i:[i,i],C=k?[w,w]:b,j=[N[0]*p[2]||1+C[0]/2,N[1]*p[2]||1+C[1]/2],T=`${h}${e||""}`;return o.jsxs("svg",{className:sr(["react-flow__background",d]),style:{...c,...Jm,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:u,"data-testid":"rf__background",children:[o.jsx("pattern",{id:T,x:p[0]%b[0],y:p[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:v?o.jsx(NB,{radius:w/2,className:f}):o.jsx(SB,{dimensions:C,lineWidth:s,variant:t,className:f})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}QP.displayName="Background";const ZP=m.memo(QP);function EB(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function _B(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function PB(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.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 AB(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 IB(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 Tp({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:sr(["react-flow__controls-button",t]),...n,children:e})}const TB=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function eA({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:d,children:f,position:u="bottom-left",orientation:p="vertical","aria-label":h}){const g=Sn(),{isInteractive:v,minZoomReached:k,maxZoomReached:y,ariaLabelConfig:b}=Bt(TB,_n),{zoomIn:w,zoomOut:N,fitView:C}=Al(),j=()=>{w(),i==null||i()},T=()=>{N(),a==null||a()},$=()=>{C(s),l==null||l()},L=()=>{g.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),c==null||c(!v)},F=p==="horizontal"?"horizontal":"vertical";return o.jsxs(Xc,{className:sr(["react-flow__controls",F,d]),position:u,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(Tp,{onClick:j,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(EB,{})}),o.jsx(Tp,{onClick:T,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:k,children:o.jsx(_B,{})})]}),n&&o.jsx(Tp,{className:"react-flow__controls-fitview",onClick:$,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:o.jsx(PB,{})}),r&&o.jsx(Tp,{className:"react-flow__controls-interactive",onClick:L,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:v?o.jsx(IB,{}):o.jsx(AB,{})}),f]})}eA.displayName="Controls";const RB=m.memo(eA);function LB({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:d,borderRadius:f,shapeRendering:u,selected:p,onClick:h}){const{background:g,backgroundColor:v}=i||{},k=a||g||v;return o.jsx("rect",{className:sr(["react-flow__minimap-node",{selected:p},d]),x:t,y:n,rx:f,ry:f,width:r,height:s,style:{fill:k,stroke:l,strokeWidth:c},shapeRendering:u,onClick:h?y=>h(y,e):void 0})}const OB=m.memo(LB),MB=e=>e.nodes.map(t=>t.id),wy=e=>e instanceof Function?e:()=>e;function $B({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=OB,onClick:a}){const l=Bt(MB,_n),c=wy(t),d=wy(e),f=wy(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(p=>o.jsx(FB,{id:p,nodeColorFunc:c,nodeStrokeColorFunc:d,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:u},p))})}function DB({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:d,x:f,y:u,width:p,height:h}=Bt(g=>{const v=g.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const k=v.internals.userNode,{x:y,y:b}=v.internals.positionAbsolute,{width:w,height:N}=Do(k);return{node:k,x:y,y:b,width:w,height:N}},_n);return!d||d.hidden||!K_(d)?null:o.jsx(l,{x:f,y:u,width:p,height:h,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:s,strokeColor:n(d),strokeWidth:i,shapeRendering:a,onClick:c,id:d.id})}const FB=m.memo(DB);var zB=m.memo($B);const BB=200,HB=150,VB=e=>!e.hidden,WB=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?U_(wf(e.nodeLookup,{filter:VB}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},UB="react-flow__minimap-desc";function tA({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:d,maskStrokeColor:f,maskStrokeWidth:u,position:p="bottom-right",onClick:h,onNodeClick:g,pannable:v=!1,zoomable:k=!1,ariaLabel:y,inversePan:b,zoomStep:w=1,offsetScale:N=5}){const C=Sn(),j=m.useRef(null),{boundingRect:T,viewBB:$,rfId:L,panZoom:F,translateExtent:A,flowWidth:R,flowHeight:V,ariaLabelConfig:M}=Bt(WB,_n),D=(e==null?void 0:e.width)??BB,I=(e==null?void 0:e.height)??HB,B=T.width/D,P=T.height/I,O=Math.max(B,P),_=O*D,Y=O*I,Q=N*O,K=T.x-(_-T.width)/2-Q,ie=T.y-(Y-T.height)/2-Q,fe=_+Q*2,ye=Y+Q*2,we=`${UB}-${L}`,ae=m.useRef(0),ge=m.useRef();ae.current=O,m.useEffect(()=>{if(j.current&&F)return ge.current=Zz({domNode:j.current,panZoom:F,getTransform:()=>C.getState().transform,getViewScale:()=>ae.current}),()=>{var Ne;(Ne=ge.current)==null||Ne.destroy()}},[F]),m.useEffect(()=>{var Ne;(Ne=ge.current)==null||Ne.update({translateExtent:A,width:R,height:V,inversePan:b,pannable:v,zoomStep:w,zoomable:k})},[v,k,b,w,A,R,V]);const _e=h?Ne=>{var Ge;const[Ye,Ze]=((Ge=ge.current)==null?void 0:Ge.pointer(Ne))||[0,0];h(Ne,{x:Ye,y:Ze})}:void 0,Ae=g?m.useCallback((Ne,Ye)=>{const Ze=C.getState().nodeLookup.get(Ye).internals.userNode;g(Ne,Ze)},[]):void 0,Ce=y??M["minimap.ariaLabel"];return o.jsx(Xc,{position:p,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*O: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 a=="number"?a:void 0},className:sr(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:D,height:I,viewBox:`${K} ${ie} ${fe} ${ye}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":we,ref:j,onClick:_e,children:[Ce&&o.jsx("title",{id:we,children:Ce}),o.jsx(zB,{onClick:Ae,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${K-Q},${ie-Q}h${fe+Q*2}v${ye+Q*2}h${-fe-Q*2}z
|
|
66
|
-
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}tA.displayName="MiniMap";const KB=m.memo(tA),qB=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,YB={[Yc.Line]:"right",[Yc.Handle]:"bottom-right"};function GB({nodeId:e,position:t,variant:n=Yc.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:c=10,maxWidth:d=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:p,autoScale:h=!0,shouldResize:g,onResizeStart:v,onResize:k,onResizeEnd:y}){const b=_P(),w=typeof e=="string"?e:b,N=Sn(),C=m.useRef(null),j=n===Yc.Handle,T=Bt(m.useCallback(qB(j&&h),[j,h]),_n),$=m.useRef(null),L=t??YB[n];m.useEffect(()=>{if(!(!C.current||!w))return $.current||($.current=p3({domNode:C.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:A,transform:R,snapGrid:V,snapToGrid:M,nodeOrigin:D,domNode:I}=N.getState();return{nodeLookup:A,transform:R,snapGrid:V,snapToGrid:M,nodeOrigin:D,paneDomNode:I}},onChange:(A,R)=>{const{triggerNodeChanges:V,nodeLookup:M,parentLookup:D,nodeOrigin:I}=N.getState(),B=[],P={x:A.x,y:A.y},O=M.get(w);if(O&&O.expandParent&&O.parentId){const _=O.origin??I,Y=A.width??O.measured.width??0,Q=A.height??O.measured.height??0,K={id:O.id,parentId:O.parentId,rect:{width:Y,height:Q,...q_({x:A.x??O.position.x,y:A.y??O.position.y},{width:Y,height:Q},O.parentId,M,_)}},ie=nv([K],M,D,I);B.push(...ie),P.x=A.x?Math.max(_[0]*Y,A.x):void 0,P.y=A.y?Math.max(_[1]*Q,A.y):void 0}if(P.x!==void 0&&P.y!==void 0){const _={id:w,type:"position",position:{...P}};B.push(_)}if(A.width!==void 0&&A.height!==void 0){const Y={id:w,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};B.push(Y)}for(const _ of R){const Y={..._,type:"position"};B.push(Y)}V(B)},onEnd:({width:A,height:R})=>{const V={id:w,type:"dimensions",resizing:!1,dimensions:{width:A,height:R}};N.getState().triggerNodeChanges([V])}})),$.current.update({controlPosition:L,boundaries:{minWidth:l,minHeight:c,maxWidth:d,maxHeight:f},keepAspectRatio:u,resizeDirection:p,onResizeStart:v,onResize:k,onResizeEnd:y,shouldResize:g}),()=>{var A;(A=$.current)==null||A.destroy()}},[L,l,c,d,f,u,v,k,y,g]);const F=L.split("-");return o.jsx("div",{className:sr(["react-flow__resize-control","nodrag",...F,n,r]),ref:C,style:{...s,scale:T,...a&&{[j?"backgroundColor":"borderColor"]:a}},children:i})}const XB=m.memo(GB);function JB(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const QB=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZB=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,e4={};function LS(e,t){return(e4.jsx?ZB:QB).test(e)}const t4=/[ \t\n\f\r]/g;function n4(e){return typeof e=="object"?e.type==="text"?OS(e.value):!1:OS(e)}function OS(e){return e.replace(t4,"")===""}let kf=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};kf.prototype.normal={};kf.prototype.property={};kf.prototype.space=void 0;function nA(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new kf(n,r,t)}function gw(e){return e.toLowerCase()}class ps{constructor(t,n){this.attribute=n,this.property=t}}ps.prototype.attribute="";ps.prototype.booleanish=!1;ps.prototype.boolean=!1;ps.prototype.commaOrSpaceSeparated=!1;ps.prototype.commaSeparated=!1;ps.prototype.defined=!1;ps.prototype.mustUseProperty=!1;ps.prototype.number=!1;ps.prototype.overloadedBoolean=!1;ps.prototype.property="";ps.prototype.spaceSeparated=!1;ps.prototype.space=void 0;let r4=0;const vt=Il(),tr=Il(),yw=Il(),Se=Il(),dn=Il(),Tc=Il(),bs=Il();function Il(){return 2**++r4}const xw=Object.freeze(Object.defineProperty({__proto__:null,boolean:vt,booleanish:tr,commaOrSpaceSeparated:bs,commaSeparated:Tc,number:Se,overloadedBoolean:yw,spaceSeparated:dn},Symbol.toStringTag,{value:"Module"})),by=Object.keys(xw);class ov extends ps{constructor(t,n,r,s){let i=-1;if(super(t,n),MS(this,"space",s),typeof r=="number")for(;++i<by.length;){const a=by[i];MS(this,by[i],(r&xw[a])===xw[a])}}}ov.prototype.defined=!0;function MS(e,t,n){n&&(e[t]=n)}function iu(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new ov(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[gw(r)]=r,n[gw(i.attribute)]=r}return new kf(t,n,e.space)}const rA=iu({properties:{ariaActiveDescendant:null,ariaAtomic:tr,ariaAutoComplete:null,ariaBusy:tr,ariaChecked:tr,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:dn,ariaCurrent:null,ariaDescribedBy:dn,ariaDetails:null,ariaDisabled:tr,ariaDropEffect:dn,ariaErrorMessage:null,ariaExpanded:tr,ariaFlowTo:dn,ariaGrabbed:tr,ariaHasPopup:null,ariaHidden:tr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:dn,ariaLevel:Se,ariaLive:null,ariaModal:tr,ariaMultiLine:tr,ariaMultiSelectable:tr,ariaOrientation:null,ariaOwns:dn,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:tr,ariaReadOnly:tr,ariaRelevant:null,ariaRequired:tr,ariaRoleDescription:dn,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:tr,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function sA(e,t){return t in e?e[t]:t}function iA(e,t){return sA(e,t.toLowerCase())}const s4=iu({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Tc,acceptCharset:dn,accessKey:dn,action:null,allow:null,allowFullScreen:vt,allowPaymentRequest:vt,allowUserMedia:vt,alt:null,as:null,async:vt,autoCapitalize:null,autoComplete:dn,autoFocus:vt,autoPlay:vt,blocking:dn,capture:null,charSet:null,checked:vt,cite:null,className:dn,cols:Se,colSpan:null,content:null,contentEditable:tr,controls:vt,controlsList:dn,coords:Se|Tc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:vt,defer:vt,dir:null,dirName:null,disabled:vt,download:yw,draggable:tr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:vt,formTarget:null,headers:dn,height:Se,hidden:yw,high:Se,href:null,hrefLang:null,htmlFor:dn,httpEquiv:dn,id:null,imageSizes:null,imageSrcSet:null,inert:vt,inputMode:null,integrity:null,is:null,isMap:vt,itemId:null,itemProp:dn,itemRef:dn,itemScope:vt,itemType:dn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:vt,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:vt,muted:vt,name:null,nonce:null,noModule:vt,noValidate:vt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:vt,optimum:Se,pattern:null,ping:dn,placeholder:null,playsInline:vt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:vt,referrerPolicy:null,rel:dn,required:vt,reversed:vt,rows:Se,rowSpan:Se,sandbox:dn,scope:null,scoped:vt,seamless:vt,selected:vt,shadowRootClonable:vt,shadowRootDelegatesFocus:vt,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:tr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:vt,useMap:null,value:tr,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:dn,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:vt,declare:vt,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:vt,noHref:vt,noShade:vt,noWrap:vt,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:tr,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:vt,disableRemotePlayback:vt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:iA}),i4=iu({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:bs,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:dn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:vt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Tc,g2:Tc,glyphName:Tc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:bs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:dn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:bs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:bs,rev:bs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:bs,requiredFeatures:bs,requiredFonts:bs,requiredFormats:bs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:bs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:bs,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:bs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:sA}),oA=iu({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),aA=iu({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:iA}),lA=iu({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),o4={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},a4=/[A-Z]/g,$S=/-[a-z]/g,l4=/^data[-\w.:]+$/i;function c4(e,t){const n=gw(t);let r=t,s=ps;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&l4.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace($S,d4);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!$S.test(i)){let a=i.replace(a4,u4);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=ov}return new s(r,t)}function u4(e){return"-"+e.toLowerCase()}function d4(e){return e.charAt(1).toUpperCase()}const f4=nA([rA,s4,oA,aA,lA],"html"),av=nA([rA,i4,oA,aA,lA],"svg");function p4(e){return e.join(" ").trim()}var lv={},DS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,h4=/\n/g,m4=/^\s*/,g4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,y4=/^:\s*/,x4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,w4=/^[;\s]*/,b4=/^\s+|\s+$/g,v4=`
|
|
67
|
-
`,FS="/",zS="*",ol="",k4="comment",S4="declaration";function N4(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(g){var v=g.match(h4);v&&(n+=v.length);var k=g.lastIndexOf(v4);r=~k?g.length-k:r+g.length}function i(){var g={line:n,column:r};return function(v){return v.position=new a(g),d(),v}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(g){var v=new Error(t.source+":"+n+":"+r+": "+g);if(v.reason=g,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function c(g){var v=g.exec(e);if(v){var k=v[0];return s(k),e=e.slice(k.length),v}}function d(){c(m4)}function f(g){var v;for(g=g||[];v=u();)v!==!1&&g.push(v);return g}function u(){var g=i();if(!(FS!=e.charAt(0)||zS!=e.charAt(1))){for(var v=2;ol!=e.charAt(v)&&(zS!=e.charAt(v)||FS!=e.charAt(v+1));)++v;if(v+=2,ol===e.charAt(v-1))return l("End of comment missing");var k=e.slice(2,v-2);return r+=2,s(k),e=e.slice(v),r+=2,g({type:k4,comment:k})}}function p(){var g=i(),v=c(g4);if(v){if(u(),!c(y4))return l("property missing ':'");var k=c(x4),y=g({type:S4,property:BS(v[0].replace(DS,ol)),value:k?BS(k[0].replace(DS,ol)):ol});return c(w4),y}}function h(){var g=[];f(g);for(var v;v=p();)v!==!1&&(g.push(v),f(g));return g}return d(),h()}function BS(e){return e?e.replace(b4,ol):ol}var j4=N4,C4=Sd&&Sd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lv,"__esModule",{value:!0});lv.default=_4;const E4=C4(j4);function _4(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,E4.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:l}=i;s?t(a,l,i):l&&(n=n||{},n[a]=l)}),n}var Zm={};Object.defineProperty(Zm,"__esModule",{value:!0});Zm.camelCase=void 0;var P4=/^--[a-zA-Z0-9_-]+$/,A4=/-([a-z])/g,I4=/^[^-]+$/,T4=/^-(webkit|moz|ms|o|khtml)-/,R4=/^-(ms)-/,L4=function(e){return!e||I4.test(e)||P4.test(e)},O4=function(e,t){return t.toUpperCase()},HS=function(e,t){return"".concat(t,"-")},M4=function(e,t){return t===void 0&&(t={}),L4(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(R4,HS):e=e.replace(T4,HS),e.replace(A4,O4))};Zm.camelCase=M4;var $4=Sd&&Sd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},D4=$4(lv),F4=Zm;function ww(e,t){var n={};return!e||typeof e!="string"||(0,D4.default)(e,function(r,s){r&&s&&(n[(0,F4.camelCase)(r,t)]=s)}),n}ww.default=ww;var z4=ww;const B4=La(z4),cA=uA("end"),cv=uA("start");function uA(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function H4(e){const t=cv(e),n=cA(e);if(t&&n)return{start:t,end:n}}function gd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?VS(e.position):"start"in e||"end"in e?VS(e):"line"in e||"column"in e?bw(e):""}function bw(e){return WS(e&&e.line)+":"+WS(e&&e.column)}function VS(e){return bw(e&&e.start)+"-"+bw(e&&e.end)}function WS(e){return e&&typeof e=="number"?e:1}class $r extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=gd(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}$r.prototype.file="";$r.prototype.name="";$r.prototype.reason="";$r.prototype.message="";$r.prototype.stack="";$r.prototype.column=void 0;$r.prototype.line=void 0;$r.prototype.ancestors=void 0;$r.prototype.cause=void 0;$r.prototype.fatal=void 0;$r.prototype.place=void 0;$r.prototype.ruleId=void 0;$r.prototype.source=void 0;const uv={}.hasOwnProperty,V4=new Map,W4=/[A-Z]/g,U4=new Set(["table","tbody","thead","tfoot","tr"]),K4=new Set(["td","th"]),dA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function q4(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=tH(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=eH(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?av:f4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=fA(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function fA(e,t,n){if(t.type==="element")return Y4(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return G4(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return J4(e,t,n);if(t.type==="mdxjsEsm")return X4(e,t);if(t.type==="root")return Q4(e,t,n);if(t.type==="text")return Z4(e,t)}function Y4(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=av,e.schema=s),e.ancestors.push(t);const i=hA(e,t.tagName,!1),a=nH(e,t);let l=fv(e,t);return U4.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!n4(c):!0})),pA(e,a,i,t),dv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function G4(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Jd(e,t.position)}function X4(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Jd(e,t.position)}function J4(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=av,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:hA(e,t.name,!0),a=rH(e,t),l=fv(e,t);return pA(e,a,i,t),dv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function Q4(e,t,n){const r={};return dv(r,fv(e,t)),e.create(t,e.Fragment,r,n)}function Z4(e,t){return t.value}function pA(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function dv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function eH(e,t,n){return r;function r(s,i,a,l){const d=Array.isArray(a.children)?n:t;return l?d(i,a,l):d(i,a)}}function tH(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=cv(r);return t(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function nH(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&uv.call(t.properties,s)){const i=sH(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&K4.has(t.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function rH(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Jd(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else Jd(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function fv(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:V4;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=s.get(c)||0;a=c+"-"+d,s.set(c,d+1)}}const l=fA(e,i,a);l!==void 0&&n.push(l)}return n}function sH(e,t,n){const r=c4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?JB(n):p4(n)),r.property==="style"){let s=typeof n=="object"?n:iH(e,String(n));return e.stylePropertyNameCase==="css"&&(s=oH(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?o4[r.property]||r.property:r.attribute,n]}}function iH(e,t){try{return B4(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new $r("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=dA+"#cannot-parse-style-attribute",s}}function hA(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,a;for(;++i<s.length;){const l=LS(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=LS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return uv.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Jd(e)}function Jd(e,t){const n=new $r("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=dA+"#cannot-handle-mdx-estrees-without-createevaluater",n}function oH(e){const t={};let n;for(n in e)uv.call(e,n)&&(t[aH(n)]=e[n]);return t}function aH(e){let t=e.replace(W4,lH);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function lH(e){return"-"+e.toLowerCase()}const vy={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},cH={};function uH(e,t){const n=cH,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return mA(e,r,s)}function mA(e,t,n){if(dH(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return US(e.children,t,n)}return Array.isArray(e)?US(e,t,n):""}function US(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=mA(e[s],t,n);return r.join("")}function dH(e){return!!(e&&typeof e=="object")}const KS=document.createElement("i");function pv(e){const t="&"+e+";";KS.innerHTML=t;const n=KS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function to(e,t,n,r){const s=e.length;let i=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function Ks(e,t){return e.length>0?(to(e,e.length,0,t),e):t}const qS={}.hasOwnProperty;function fH(e){const t={};let n=-1;for(;++n<e.length;)pH(t,e[n]);return t}function pH(e,t){let n;for(n in t){const s=(qS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){qS.call(s,a)||(s[a]=[]);const l=i[a];hH(s[a],Array.isArray(l)?l:l?[l]:[])}}}function hH(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);to(e,0,0,r)}function gA(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Rc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ki=Fa(/[A-Za-z]/),Cs=Fa(/[\dA-Za-z]/),mH=Fa(/[#-'*+\--9=?A-Z^-~]/);function vw(e){return e!==null&&(e<32||e===127)}const kw=Fa(/\d/),gH=Fa(/[\dA-Fa-f]/),yH=Fa(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function ds(e){return e!==null&&(e<0||e===32)}function Yt(e){return e===-2||e===-1||e===32}const xH=Fa(new RegExp("\\p{P}|\\p{S}","u")),wH=Fa(/\s/);function Fa(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ou(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Cs(e.charCodeAt(n+1))&&Cs(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function pn(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Yt(c)?(e.enter(n),l(c)):t(c)}function l(c){return Yt(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const bH={tokenize:vH};function vH(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),pn(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return lt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const kH={tokenize:SH},YS={tokenize:NH};function SH(e){const t=this,n=[];let r=0,s,i,a;return l;function l(w){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,c,d)(w)}return d(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&b();const N=t.events.length;let C=N,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}y(r);let T=N;for(;T<t.events.length;)t.events[T][1].end={...j},T++;return to(t.events,C+1,0,t.events.slice(N)),t.events.length=T,d(w)}return l(w)}function d(w){if(r===n.length){if(!s)return p(w);if(s.currentConstruct&&s.currentConstruct.concrete)return g(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(YS,f,u)(w)}function f(w){return s&&b(),y(r),p(w)}function u(w){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,g(w)}function p(w){return t.containerState={},e.attempt(YS,h,g)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function g(w){if(w===null){s&&b(),y(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),v(w)}function v(w){if(w===null){k(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return lt(w)?(e.consume(w),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),v)}function k(w,N){const C=t.sliceStream(w);if(N&&C.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(C),t.parser.lazy[w.start.line]){let j=s.events.length;for(;j--;)if(s.events[j][1].start.offset<a&&(!s.events[j][1].end||s.events[j][1].end.offset>a))return;const T=t.events.length;let $=T,L,F;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(L){F=t.events[$][1].end;break}L=!0}for(y(r),j=T;j<t.events.length;)t.events[j][1].end={...F},j++;to(t.events,$+1,0,t.events.slice(T)),t.events.length=j}}function y(w){let N=n.length;for(;N-- >w;){const C=n[N];t.containerState=C[1],C[0].exit.call(t,e)}n.length=w}function b(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function NH(e,t,n){return pn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function GS(e){if(e===null||ds(e)||wH(e))return 1;if(xH(e))return 2}function hv(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Sw={name:"attention",resolveAll:jH,tokenize:CH};function jH(e,t){let n=-1,r,s,i,a,l,c,d,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const u={...e[r][1].end},p={...e[n][1].start};XS(u,-c),XS(p,c),a={type:c>1?"strongSequence":"emphasisSequence",start:u,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Ks(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Ks(d,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),d=Ks(d,hv(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Ks(d,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,d=Ks(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,to(e,r-1,n-r+3,d),n=r+d.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function CH(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=GS(r);let i;return a;function a(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const d=e.exit("attentionSequence"),f=GS(c),u=!f||f===2&&s||n.includes(c),p=!s||s===2&&f||n.includes(r);return d._open=!!(i===42?u:u&&(s||!p)),d._close=!!(i===42?p:p&&(f||!u)),t(c)}}function XS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const EH={name:"autolink",tokenize:_H};function _H(e,t,n){let r=0;return s;function s(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return Ki(h)?(e.consume(h),a):h===64?n(h):d(h)}function a(h){return h===43||h===45||h===46||Cs(h)?(r=1,l(h)):d(h)}function l(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||Cs(h))&&r++<32?(e.consume(h),l):(r=0,d(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||vw(h)?n(h):(e.consume(h),c)}function d(h){return h===64?(e.consume(h),f):mH(h)?(e.consume(h),d):n(h)}function f(h){return Cs(h)?u(h):n(h)}function u(h){return h===46?(e.consume(h),r=0,f):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||Cs(h))&&r++<63){const g=h===45?p:u;return e.consume(h),g}return n(h)}}const eg={partial:!0,tokenize:PH};function PH(e,t,n){return r;function r(i){return Yt(i)?pn(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||lt(i)?t(i):n(i)}}const yA={continuation:{tokenize:IH},exit:TH,name:"blockQuote",tokenize:AH};function AH(e,t,n){const r=this;return s;function s(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Yt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function IH(e,t,n){const r=this;return s;function s(a){return Yt(a)?pn(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(yA,t,n)(a)}}function TH(e){e.exit("blockQuote")}const xA={name:"characterEscape",tokenize:RH};function RH(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return yH(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const wA={name:"characterReference",tokenize:LH};function LH(e,t,n){const r=this;let s=0,i,a;return l;function l(u){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),c}function c(u){return u===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(u),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,a=Cs,f(u))}function d(u){return u===88||u===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(u),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=gH,f):(e.enter("characterReferenceValue"),i=7,a=kw,f(u))}function f(u){if(u===59&&s){const p=e.exit("characterReferenceValue");return a===Cs&&!pv(r.sliceSerialize(p))?n(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(u)&&s++<i?(e.consume(u),f):n(u)}}const JS={partial:!0,tokenize:MH},QS={concrete:!0,name:"codeFenced",tokenize:OH};function OH(e,t,n){const r=this,s={partial:!0,tokenize:C};let i=0,a=0,l;return c;function c(j){return d(j)}function d(j){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(j)}function f(j){return j===l?(a++,e.consume(j),f):a<3?n(j):(e.exit("codeFencedFenceSequence"),Yt(j)?pn(e,u,"whitespace")(j):u(j))}function u(j){return j===null||lt(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(JS,v,N)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(j))}function p(j){return j===null||lt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(j)):Yt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),pn(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),p)}function h(j){return j===null||lt(j)?u(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||lt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(j)):j===96&&j===l?n(j):(e.consume(j),g)}function v(j){return e.attempt(s,N,k)(j)}function k(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),y}function y(j){return i>0&&Yt(j)?pn(e,b,"linePrefix",i+1)(j):b(j)}function b(j){return j===null||lt(j)?e.check(JS,v,N)(j):(e.enter("codeFlowValue"),w(j))}function w(j){return j===null||lt(j)?(e.exit("codeFlowValue"),b(j)):(e.consume(j),w)}function N(j){return e.exit("codeFenced"),t(j)}function C(j,T,$){let L=0;return F;function F(D){return j.enter("lineEnding"),j.consume(D),j.exit("lineEnding"),A}function A(D){return j.enter("codeFencedFence"),Yt(D)?pn(j,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):R(D)}function R(D){return D===l?(j.enter("codeFencedFenceSequence"),V(D)):$(D)}function V(D){return D===l?(L++,j.consume(D),V):L>=a?(j.exit("codeFencedFenceSequence"),Yt(D)?pn(j,M,"whitespace")(D):M(D)):$(D)}function M(D){return D===null||lt(D)?(j.exit("codeFencedFence"),T(D)):$(D)}}}function MH(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const ky={name:"codeIndented",tokenize:DH},$H={partial:!0,tokenize:FH};function DH(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),pn(e,i,"linePrefix",5)(d)}function i(d){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?c(d):lt(d)?e.attempt($H,a,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||lt(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function FH(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):lt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):pn(e,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):lt(a)?s(a):n(a)}}const zH={name:"codeText",previous:HH,resolve:BH,tokenize:VH};function BH(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function HH(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function VH(e,t,n){let r=0,s,i;return a;function a(u){return e.enter("codeText"),e.enter("codeTextSequence"),l(u)}function l(u){return u===96?(e.consume(u),r++,l):(e.exit("codeTextSequence"),c(u))}function c(u){return u===null?n(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),c):u===96?(i=e.enter("codeTextSequence"),s=0,f(u)):lt(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(u))}function d(u){return u===null||u===32||u===96||lt(u)?(e.exit("codeTextData"),c(u)):(e.consume(u),d)}function f(u){return u===96?(e.consume(u),s++,f):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(i.type="codeTextData",d(u))}}class WH{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&zu(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),zu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),zu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);zu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);zu(this.left,n.reverse())}}}function zu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function bA(e){const t={};let n=-1,r,s,i,a,l,c,d;const f=new WH(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,UH(f,n)),n=t[n],d=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=f.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(f.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...f.get(s)[1].start},l=f.slice(s,n),l.unshift(r),f.splice(s,n-s+1,l))}}return to(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!d}function UH(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],d={};let f,u,p=-1,h=n,g=0,v=0;const k=[v];for(;h;){for(;e.get(++s)[1]!==h;);i.push(s),h._tokenizer||(f=r.sliceStream(h),h.next||f.push(null),u&&a.defineSkip(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(f),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),u=h,h=h.next}for(h=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(v=p+1,k.push(v),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(a.events=[],h?(h._tokenizer=void 0,h.previous=void 0):k.pop(),p=k.length;p--;){const y=l.slice(k[p],k[p+1]),b=i.pop();c.push([b,b+y.length-1]),e.splice(b,2,y)}for(c.reverse(),p=-1;++p<c.length;)d[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return d}const KH={resolve:YH,tokenize:GH},qH={partial:!0,tokenize:XH};function YH(e){return bA(e),e}function GH(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):lt(l)?e.check(qH,a,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function XH(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),pn(e,i,"linePrefix")}function i(a){if(a===null||lt(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function vA(e,t,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let f=0;return u;function u(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),p):y===null||y===32||y===41||vw(y)?n(y):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(y))}function p(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(l),p(y)):y===null||y===60||lt(y)?n(y):(e.consume(y),y===92?g:h)}function g(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function v(y){return!f&&(y===null||y===41||ds(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(y)):f<d&&y===40?(e.consume(y),f++,v):y===41?(e.consume(y),f--,v):y===null||y===32||y===40||vw(y)?n(y):(e.consume(y),y===92?k:v)}function k(y){return y===40||y===41||y===92?(e.consume(y),v):v(y)}}function kA(e,t,n,r,s,i){const a=this;let l=0,c;return d;function d(h){return e.enter(r),e.enter(s),e.consume(h),e.exit(s),e.enter(i),f}function f(h){return l>999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(h):h===93?(e.exit(i),e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):lt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===null||h===91||h===93||lt(h)||l++>999?(e.exit("chunkString"),f(h)):(e.consume(h),c||(c=!Yt(h)),h===92?p:u)}function p(h){return h===91||h===92||h===93?(e.consume(h),l++,u):u(h)}}function SA(e,t,n,r,s,i){let a;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),a=p===40?41:p,c):n(p)}function c(p){return p===a?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):(e.enter(i),d(p))}function d(p){return p===a?(e.exit(i),c(a)):p===null?n(p):lt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),pn(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===a||p===null||lt(p)?(e.exit("chunkString"),d(p)):(e.consume(p),p===92?u:f)}function u(p){return p===a||p===92?(e.consume(p),f):f(p)}}function yd(e,t){let n;return r;function r(s){return lt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Yt(s)?pn(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const JH={name:"definition",tokenize:ZH},QH={partial:!0,tokenize:e8};function ZH(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),a(h)}function a(h){return kA.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=Rc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):n(h)}function c(h){return ds(h)?yd(e,d)(h):d(h)}function d(h){return vA(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function f(h){return e.attempt(QH,u,u)(h)}function u(h){return Yt(h)?pn(e,p,"whitespace")(h):p(h)}function p(h){return h===null||lt(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function e8(e,t,n){return r;function r(l){return ds(l)?yd(e,s)(l):n(l)}function s(l){return SA(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Yt(l)?pn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||lt(l)?t(l):n(l)}}const t8={name:"hardBreakEscape",tokenize:n8};function n8(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return lt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const r8={name:"headingAtx",resolve:s8,tokenize:i8};function s8(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},to(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function i8(e,t,n){let r=0;return s;function s(f){return e.enter("atxHeading"),i(f)}function i(f){return e.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&r++<6?(e.consume(f),a):f===null||ds(f)?(e.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(e.enter("atxHeadingSequence"),c(f)):f===null||lt(f)?(e.exit("atxHeading"),t(f)):Yt(f)?pn(e,l,"whitespace")(f):(e.enter("atxHeadingText"),d(f))}function c(f){return f===35?(e.consume(f),c):(e.exit("atxHeadingSequence"),l(f))}function d(f){return f===null||f===35||ds(f)?(e.exit("atxHeadingText"),l(f)):(e.consume(f),d)}}const o8=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ZS=["pre","script","style","textarea"],a8={concrete:!0,name:"htmlFlow",resolveTo:u8,tokenize:d8},l8={partial:!0,tokenize:p8},c8={partial:!0,tokenize:f8};function u8(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function d8(e,t,n){const r=this;let s,i,a,l,c;return d;function d(K){return f(K)}function f(K){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(K),u}function u(K){return K===33?(e.consume(K),p):K===47?(e.consume(K),i=!0,v):K===63?(e.consume(K),s=3,r.interrupt?t:_):Ki(K)?(e.consume(K),a=String.fromCharCode(K),k):n(K)}function p(K){return K===45?(e.consume(K),s=2,h):K===91?(e.consume(K),s=5,l=0,g):Ki(K)?(e.consume(K),s=4,r.interrupt?t:_):n(K)}function h(K){return K===45?(e.consume(K),r.interrupt?t:_):n(K)}function g(K){const ie="CDATA[";return K===ie.charCodeAt(l++)?(e.consume(K),l===ie.length?r.interrupt?t:R:g):n(K)}function v(K){return Ki(K)?(e.consume(K),a=String.fromCharCode(K),k):n(K)}function k(K){if(K===null||K===47||K===62||ds(K)){const ie=K===47,fe=a.toLowerCase();return!ie&&!i&&ZS.includes(fe)?(s=1,r.interrupt?t(K):R(K)):o8.includes(a.toLowerCase())?(s=6,ie?(e.consume(K),y):r.interrupt?t(K):R(K)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(K):i?b(K):w(K))}return K===45||Cs(K)?(e.consume(K),a+=String.fromCharCode(K),k):n(K)}function y(K){return K===62?(e.consume(K),r.interrupt?t:R):n(K)}function b(K){return Yt(K)?(e.consume(K),b):F(K)}function w(K){return K===47?(e.consume(K),F):K===58||K===95||Ki(K)?(e.consume(K),N):Yt(K)?(e.consume(K),w):F(K)}function N(K){return K===45||K===46||K===58||K===95||Cs(K)?(e.consume(K),N):C(K)}function C(K){return K===61?(e.consume(K),j):Yt(K)?(e.consume(K),C):w(K)}function j(K){return K===null||K===60||K===61||K===62||K===96?n(K):K===34||K===39?(e.consume(K),c=K,T):Yt(K)?(e.consume(K),j):$(K)}function T(K){return K===c?(e.consume(K),c=null,L):K===null||lt(K)?n(K):(e.consume(K),T)}function $(K){return K===null||K===34||K===39||K===47||K===60||K===61||K===62||K===96||ds(K)?C(K):(e.consume(K),$)}function L(K){return K===47||K===62||Yt(K)?w(K):n(K)}function F(K){return K===62?(e.consume(K),A):n(K)}function A(K){return K===null||lt(K)?R(K):Yt(K)?(e.consume(K),A):n(K)}function R(K){return K===45&&s===2?(e.consume(K),I):K===60&&s===1?(e.consume(K),B):K===62&&s===4?(e.consume(K),Y):K===63&&s===3?(e.consume(K),_):K===93&&s===5?(e.consume(K),O):lt(K)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(l8,Q,V)(K)):K===null||lt(K)?(e.exit("htmlFlowData"),V(K)):(e.consume(K),R)}function V(K){return e.check(c8,M,Q)(K)}function M(K){return e.enter("lineEnding"),e.consume(K),e.exit("lineEnding"),D}function D(K){return K===null||lt(K)?V(K):(e.enter("htmlFlowData"),R(K))}function I(K){return K===45?(e.consume(K),_):R(K)}function B(K){return K===47?(e.consume(K),a="",P):R(K)}function P(K){if(K===62){const ie=a.toLowerCase();return ZS.includes(ie)?(e.consume(K),Y):R(K)}return Ki(K)&&a.length<8?(e.consume(K),a+=String.fromCharCode(K),P):R(K)}function O(K){return K===93?(e.consume(K),_):R(K)}function _(K){return K===62?(e.consume(K),Y):K===45&&s===2?(e.consume(K),_):R(K)}function Y(K){return K===null||lt(K)?(e.exit("htmlFlowData"),Q(K)):(e.consume(K),Y)}function Q(K){return e.exit("htmlFlow"),t(K)}}function f8(e,t,n){const r=this;return s;function s(a){return lt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function p8(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(eg,t,n)}}const h8={name:"htmlText",tokenize:m8};function m8(e,t,n){const r=this;let s,i,a;return l;function l(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),c}function c(_){return _===33?(e.consume(_),d):_===47?(e.consume(_),C):_===63?(e.consume(_),w):Ki(_)?(e.consume(_),$):n(_)}function d(_){return _===45?(e.consume(_),f):_===91?(e.consume(_),i=0,g):Ki(_)?(e.consume(_),b):n(_)}function f(_){return _===45?(e.consume(_),h):n(_)}function u(_){return _===null?n(_):_===45?(e.consume(_),p):lt(_)?(a=u,B(_)):(e.consume(_),u)}function p(_){return _===45?(e.consume(_),h):u(_)}function h(_){return _===62?I(_):_===45?p(_):u(_)}function g(_){const Y="CDATA[";return _===Y.charCodeAt(i++)?(e.consume(_),i===Y.length?v:g):n(_)}function v(_){return _===null?n(_):_===93?(e.consume(_),k):lt(_)?(a=v,B(_)):(e.consume(_),v)}function k(_){return _===93?(e.consume(_),y):v(_)}function y(_){return _===62?I(_):_===93?(e.consume(_),y):v(_)}function b(_){return _===null||_===62?I(_):lt(_)?(a=b,B(_)):(e.consume(_),b)}function w(_){return _===null?n(_):_===63?(e.consume(_),N):lt(_)?(a=w,B(_)):(e.consume(_),w)}function N(_){return _===62?I(_):w(_)}function C(_){return Ki(_)?(e.consume(_),j):n(_)}function j(_){return _===45||Cs(_)?(e.consume(_),j):T(_)}function T(_){return lt(_)?(a=T,B(_)):Yt(_)?(e.consume(_),T):I(_)}function $(_){return _===45||Cs(_)?(e.consume(_),$):_===47||_===62||ds(_)?L(_):n(_)}function L(_){return _===47?(e.consume(_),I):_===58||_===95||Ki(_)?(e.consume(_),F):lt(_)?(a=L,B(_)):Yt(_)?(e.consume(_),L):I(_)}function F(_){return _===45||_===46||_===58||_===95||Cs(_)?(e.consume(_),F):A(_)}function A(_){return _===61?(e.consume(_),R):lt(_)?(a=A,B(_)):Yt(_)?(e.consume(_),A):L(_)}function R(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),s=_,V):lt(_)?(a=R,B(_)):Yt(_)?(e.consume(_),R):(e.consume(_),M)}function V(_){return _===s?(e.consume(_),s=void 0,D):_===null?n(_):lt(_)?(a=V,B(_)):(e.consume(_),V)}function M(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||ds(_)?L(_):(e.consume(_),M)}function D(_){return _===47||_===62||ds(_)?L(_):n(_)}function I(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),t):n(_)}function B(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),P}function P(_){return Yt(_)?pn(e,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):O(_)}function O(_){return e.enter("htmlTextData"),a(_)}}const mv={name:"labelEnd",resolveAll:w8,resolveTo:b8,tokenize:v8},g8={tokenize:k8},y8={tokenize:S8},x8={tokenize:N8};function w8(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&to(e,0,e.length,n),e}function b8(e,t){let n=e.length,r=0,s,i,a,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},f={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",d,t]],l=Ks(l,e.slice(i+1,i+r+3)),l=Ks(l,[["enter",f,t]]),l=Ks(l,hv(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Ks(l,[["exit",f,t],e[a-2],e[a-1],["exit",d,t]]),l=Ks(l,e.slice(a+1)),l=Ks(l,[["exit",c,t]]),to(e,i,e.length,l),e}function v8(e,t,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(p){return i?i._inactive?u(p):(a=r.parser.defined.includes(Rc(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(g8,f,a?f:u)(p):p===91?e.attempt(y8,f,a?d:u)(p):a?f(p):u(p)}function d(p){return e.attempt(x8,f,u)(p)}function f(p){return t(p)}function u(p){return i._balanced=!0,n(p)}}function k8(e,t,n){return r;function r(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),s}function s(u){return ds(u)?yd(e,i)(u):i(u)}function i(u){return u===41?f(u):vA(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function a(u){return ds(u)?yd(e,c)(u):f(u)}function l(u){return n(u)}function c(u){return u===34||u===39||u===40?SA(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):f(u)}function d(u){return ds(u)?yd(e,f)(u):f(u)}function f(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),t):n(u)}}function S8(e,t,n){const r=this;return s;function s(l){return kA.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Rc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function N8(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const j8={name:"labelStartImage",resolveAll:mv.resolveAll,tokenize:C8};function C8(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const E8={name:"labelStartLink",resolveAll:mv.resolveAll,tokenize:_8};function _8(e,t,n){const r=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Sy={name:"lineEnding",tokenize:P8};function P8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),pn(e,t,"linePrefix")}}const fh={name:"thematicBreak",tokenize:A8};function A8(e,t,n){let r=0,s;return i;function i(d){return e.enter("thematicBreak"),a(d)}function a(d){return s=d,l(d)}function l(d){return d===s?(e.enter("thematicBreakSequence"),c(d)):r>=3&&(d===null||lt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function c(d){return d===s?(e.consume(d),r++,c):(e.exit("thematicBreakSequence"),Yt(d)?pn(e,l,"whitespace")(d):l(d))}}const Zr={continuation:{tokenize:L8},exit:M8,name:"list",tokenize:R8},I8={partial:!0,tokenize:$8},T8={partial:!0,tokenize:O8};function R8(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:kw(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(fh,n,d)(h):d(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return n(h)}function c(h){return kw(h)&&++a<10?(e.consume(h),c):(!r.interrupt||a<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),d(h)):n(h)}function d(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(eg,r.interrupt?n:f,e.attempt(I8,p,u))}function f(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function u(h){return Yt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function L8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(eg,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,pn(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Yt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(T8,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,pn(e,e.attempt(Zr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function O8(e,t,n){const r=this;return pn(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function M8(e){e.exit(this.containerState.type)}function $8(e,t,n){const r=this;return pn(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Yt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const eN={name:"setextUnderline",resolveTo:D8,tokenize:F8};function D8(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function F8(e,t,n){const r=this;let s;return i;function i(d){let f=r.events.length,u;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){u=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||u)?(e.enter("setextHeadingLine"),s=d,a(d)):n(d)}function a(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),Yt(d)?pn(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||lt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const z8={tokenize:B8};function B8(e){const t=this,n=e.attempt(eg,r,e.attempt(this.parser.constructs.flowInitial,s,pn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(KH,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const H8={resolveAll:jA()},V8=NA("string"),W8=NA("text");function NA(e){return{resolveAll:jA(e==="text"?U8:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,l);return a;function a(f){return d(f)?i(f):l(f)}function l(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return d(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function d(f){if(f===null)return!0;const u=s[f];let p=-1;if(u)for(;++p<u.length;){const h=u[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function jA(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function U8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,a=-1,l=0,c;for(;i--;){const d=s[i];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const K8={42:Zr,43:Zr,45:Zr,48:Zr,49:Zr,50:Zr,51:Zr,52:Zr,53:Zr,54:Zr,55:Zr,56:Zr,57:Zr,62:yA},q8={91:JH},Y8={[-2]:ky,[-1]:ky,32:ky},G8={35:r8,42:fh,45:[eN,fh],60:a8,61:eN,95:fh,96:QS,126:QS},X8={38:wA,92:xA},J8={[-5]:Sy,[-4]:Sy,[-3]:Sy,33:j8,38:wA,42:Sw,60:[EH,h8],91:E8,92:[t8,xA],93:mv,95:Sw,96:zH},Q8={null:[Sw,H8]},Z8={null:[42,95]},e6={null:[]},t6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Z8,contentInitial:q8,disable:e6,document:K8,flow:G8,flowInitial:Y8,insideSpan:Q8,string:X8,text:J8},Symbol.toStringTag,{value:"Module"}));function n6(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:T(C),check:T(j),consume:b,enter:w,exit:N,interrupt:T(j,{interrupt:!0})},d={code:null,containerState:{},defineSkip:v,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:u};let f=t.tokenize.call(d,c);return t.resolveAll&&i.push(t),d;function u(A){return a=Ks(a,A),k(),a[a.length-1]!==null?[]:($(t,0),d.events=hv(i,d.events,d),d.events)}function p(A,R){return s6(h(A),R)}function h(A){return r6(a,A)}function g(){const{_bufferIndex:A,_index:R,line:V,column:M,offset:D}=r;return{_bufferIndex:A,_index:R,line:V,column:M,offset:D}}function v(A){s[A.line]=A.column,F()}function k(){let A;for(;r._index<a.length;){const R=a[r._index];if(typeof R=="string")for(A=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===A&&r._bufferIndex<R.length;)y(R.charCodeAt(r._bufferIndex));else y(R)}}function y(A){f=f(A)}function b(A){lt(A)?(r.line++,r.column=1,r.offset+=A===-3?2:1,F()):A!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=A}function w(A,R){const V=R||{};return V.type=A,V.start=g(),d.events.push(["enter",V,d]),l.push(V),V}function N(A){const R=l.pop();return R.end=g(),d.events.push(["exit",R,d]),R}function C(A,R){$(A,R.from)}function j(A,R){R.restore()}function T(A,R){return V;function V(M,D,I){let B,P,O,_;return Array.isArray(M)?Q(M):"tokenize"in M?Q([M]):Y(M);function Y(ye){return we;function we(ae){const ge=ae!==null&&ye[ae],_e=ae!==null&&ye.null,Ae=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(_e)?_e:_e?[_e]:[]];return Q(Ae)(ae)}}function Q(ye){return B=ye,P=0,ye.length===0?I:K(ye[P])}function K(ye){return we;function we(ae){return _=L(),O=ye,ye.partial||(d.currentConstruct=ye),ye.name&&d.parser.constructs.disable.null.includes(ye.name)?fe():ye.tokenize.call(R?Object.assign(Object.create(d),R):d,c,ie,fe)(ae)}}function ie(ye){return A(O,_),D}function fe(ye){return _.restore(),++P<B.length?K(B[P]):I}}}function $(A,R){A.resolveAll&&!i.includes(A)&&i.push(A),A.resolve&&to(d.events,R,d.events.length-R,A.resolve(d.events.slice(R),d)),A.resolveTo&&(d.events=A.resolveTo(d.events,d))}function L(){const A=g(),R=d.previous,V=d.currentConstruct,M=d.events.length,D=Array.from(l);return{from:M,restore:I};function I(){r=A,d.previous=R,d.currentConstruct=V,d.events.length=M,l=D,F()}}function F(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function r6(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let a;if(n===s)a=[e[n].slice(r,i)];else{if(a=e.slice(n,s),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function s6(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
68
|
-
`;break}case-3:{a=`\r
|
|
69
|
-
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,r.push(a)}return r.join("")}function i6(e){const r={constructs:fH([t6,...(e||{}).extensions||[]]),content:s(bH),defined:[],document:s(kH),flow:s(z8),lazy:{},string:s(V8),text:s(W8)};return r;function s(i){return a;function a(l){return n6(r,i,l)}}}function o6(e){for(;!bA(e););return e}const tN=/[\0\t\n\r]/g;function a6(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const c=[];let d,f,u,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t="",n&&(i.charCodeAt(0)===65279&&u++,n=void 0);u<i.length;){if(tN.lastIndex=u,d=tN.exec(i),p=d&&d.index!==void 0?d.index:i.length,h=i.charCodeAt(p),!d){t=i.slice(u);break}if(h===10&&u===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),u<p&&(c.push(i.slice(u,p)),e+=p-u),h){case 0:{c.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,c.push(-2);e++<f;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}u=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const l6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function c6(e){return e.replace(l6,u6)}function u6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return gA(n.slice(i?2:1),i?16:10)}return pv(n)||e}const CA={}.hasOwnProperty;function d6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),f6(n)(o6(i6(n).document().write(a6()(e,t,!0))))}function f6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ct),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(Ze),blockQuote:i(_e),characterEscape:L,characterReference:L,codeFenced:i(Ae),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Ae,a),codeText:i(Ce,a),codeTextData:L,data:L,codeFlowValue:L,definition:i(Ne),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Ye),hardBreakEscape:i(Ge),hardBreakTrailing:i(Ge),htmlFlow:i(It,a),htmlFlowData:L,htmlText:i(It,a),htmlTextData:L,image:i(qe),label:a,link:i(ct),listItem:i(Le),listItemValue:p,listOrdered:i(Ht,u),listUnordered:i(Ht),paragraph:i(Jt),reference:K,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Ze),strong:i(Qt),thematicBreak:i(ce)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:ge,autolinkProtocol:ae,blockQuote:c(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:ye,characterReference:we,codeFenced:c(k),codeFencedFence:v,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:F,codeIndented:c(y),codeText:c(D),codeTextData:F,data:F,definition:c(),definitionDestinationString:N,definitionLabelString:b,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(R),hardBreakTrailing:c(R),htmlFlow:c(V),htmlFlowData:F,htmlText:c(M),htmlTextData:F,image:c(B),label:O,labelText:P,lineEnding:A,link:c(I),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:_,resourceTitleString:Y,resource:Q,setextHeading:c($),setextHeadingLineSequence:T,setextHeadingText:j,strong:c(),thematicBreak:c()}};EA(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ee){let he={type:"root",children:[]};const Me={stack:[he],tokenStack:[],config:t,enter:l,exit:d,buffer:a,resume:f,data:n},We=[];let Qe=-1;for(;++Qe<ee.length;)if(ee[Qe][1].type==="listOrdered"||ee[Qe][1].type==="listUnordered")if(ee[Qe][0]==="enter")We.push(Qe);else{const Gt=We.pop();Qe=s(ee,Gt,Qe)}for(Qe=-1;++Qe<ee.length;){const Gt=t[ee[Qe][0]];CA.call(Gt,ee[Qe][1].type)&&Gt[ee[Qe][1].type].call(Object.assign({sliceSerialize:ee[Qe][2].sliceSerialize},Me),ee[Qe][1])}if(Me.tokenStack.length>0){const Gt=Me.tokenStack[Me.tokenStack.length-1];(Gt[1]||nN).call(Me,void 0,Gt[0])}for(he.position={start:ra(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:ra(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Qe=-1;++Qe<t.transforms.length;)he=t.transforms[Qe](he)||he;return he}function s(ee,he,Me){let We=he-1,Qe=-1,Gt=!1,mn,gn,yn,Pr;for(;++We<=Me;){const xn=ee[We];switch(xn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xn[0]==="enter"?Qe++:Qe--,Pr=void 0;break}case"lineEndingBlank":{xn[0]==="enter"&&(mn&&!Pr&&!Qe&&!yn&&(yn=We),Pr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pr=void 0}if(!Qe&&xn[0]==="enter"&&xn[1].type==="listItemPrefix"||Qe===-1&&xn[0]==="exit"&&(xn[1].type==="listUnordered"||xn[1].type==="listOrdered")){if(mn){let Dn=We;for(gn=void 0;Dn--;){const xe=ee[Dn];if(xe[1].type==="lineEnding"||xe[1].type==="lineEndingBlank"){if(xe[0]==="exit")continue;gn&&(ee[gn][1].type="lineEndingBlank",Gt=!0),xe[1].type="lineEnding",gn=Dn}else if(!(xe[1].type==="linePrefix"||xe[1].type==="blockQuotePrefix"||xe[1].type==="blockQuotePrefixWhitespace"||xe[1].type==="blockQuoteMarker"||xe[1].type==="listItemIndent"))break}yn&&(!gn||yn<gn)&&(mn._spread=!0),mn.end=Object.assign({},gn?ee[gn][1].start:xn[1].end),ee.splice(gn||We,0,["exit",mn,xn[2]]),We++,Me++}if(xn[1].type==="listItemPrefix"){const Dn={type:"listItem",_spread:!1,start:Object.assign({},xn[1].start),end:void 0};mn=Dn,ee.splice(We,0,["enter",Dn,xn[2]]),We++,Me++,yn=void 0,Pr=!0}}}return ee[he][1]._spread=Gt,Me}function i(ee,he){return Me;function Me(We){l.call(this,ee(We),We),he&&he.call(this,We)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(ee,he,Me){this.stack[this.stack.length-1].children.push(ee),this.stack.push(ee),this.tokenStack.push([he,Me||void 0]),ee.position={start:ra(he.start),end:void 0}}function c(ee){return he;function he(Me){ee&&ee.call(this,Me),d.call(this,Me)}}function d(ee,he){const Me=this.stack.pop(),We=this.tokenStack.pop();if(We)We[0].type!==ee.type&&(he?he.call(this,ee,We[0]):(We[1]||nN).call(this,ee,We[0]));else throw new Error("Cannot close `"+ee.type+"` ("+gd({start:ee.start,end:ee.end})+"): it’s not open");Me.position.end=ra(ee.end)}function f(){return uH(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function p(ee){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(ee),10),this.data.expectingFirstListItemValue=void 0}}function h(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.lang=ee}function g(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.meta=ee}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.value=ee.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.value=ee.replace(/(\r?\n|\r)$/g,"")}function b(ee){const he=this.resume(),Me=this.stack[this.stack.length-1];Me.label=he,Me.identifier=Rc(this.sliceSerialize(ee)).toLowerCase()}function w(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.title=ee}function N(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.url=ee}function C(ee){const he=this.stack[this.stack.length-1];if(!he.depth){const Me=this.sliceSerialize(ee).length;he.depth=Me}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function T(ee){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(ee).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function L(ee){const Me=this.stack[this.stack.length-1].children;let We=Me[Me.length-1];(!We||We.type!=="text")&&(We=Nn(),We.position={start:ra(ee.start),end:void 0},Me.push(We)),this.stack.push(We)}function F(ee){const he=this.stack.pop();he.value+=this.sliceSerialize(ee),he.position.end=ra(ee.end)}function A(ee){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Me=he.children[he.children.length-1];Me.position.end=ra(ee.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(he.type)&&(L.call(this,ee),F.call(this,ee))}function R(){this.data.atHardBreak=!0}function V(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.value=ee}function M(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.value=ee}function D(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.value=ee}function I(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=he,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function B(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=he,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function P(ee){const he=this.sliceSerialize(ee),Me=this.stack[this.stack.length-2];Me.label=c6(he),Me.identifier=Rc(he).toLowerCase()}function O(){const ee=this.stack[this.stack.length-1],he=this.resume(),Me=this.stack[this.stack.length-1];if(this.data.inReference=!0,Me.type==="link"){const We=ee.children;Me.children=We}else Me.alt=he}function _(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.url=ee}function Y(){const ee=this.resume(),he=this.stack[this.stack.length-1];he.title=ee}function Q(){this.data.inReference=void 0}function K(){this.data.referenceType="collapsed"}function ie(ee){const he=this.resume(),Me=this.stack[this.stack.length-1];Me.label=he,Me.identifier=Rc(this.sliceSerialize(ee)).toLowerCase(),this.data.referenceType="full"}function fe(ee){this.data.characterReferenceType=ee.type}function ye(ee){const he=this.sliceSerialize(ee),Me=this.data.characterReferenceType;let We;Me?(We=gA(he,Me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):We=pv(he);const Qe=this.stack[this.stack.length-1];Qe.value+=We}function we(ee){const he=this.stack.pop();he.position.end=ra(ee.end)}function ae(ee){F.call(this,ee);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(ee)}function ge(ee){F.call(this,ee);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(ee)}function _e(){return{type:"blockquote",children:[]}}function Ae(){return{type:"code",lang:null,meta:null,value:""}}function Ce(){return{type:"inlineCode",value:""}}function Ne(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ye(){return{type:"emphasis",children:[]}}function Ze(){return{type:"heading",depth:0,children:[]}}function Ge(){return{type:"break"}}function It(){return{type:"html",value:""}}function qe(){return{type:"image",title:null,url:"",alt:null}}function ct(){return{type:"link",title:null,url:"",children:[]}}function Ht(ee){return{type:"list",ordered:ee.type==="listOrdered",start:null,spread:ee._spread,children:[]}}function Le(ee){return{type:"listItem",spread:ee._spread,checked:null,children:[]}}function Jt(){return{type:"paragraph",children:[]}}function Qt(){return{type:"strong",children:[]}}function Nn(){return{type:"text",value:""}}function ce(){return{type:"thematicBreak"}}}function ra(e){return{line:e.line,column:e.column,offset:e.offset}}function EA(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?EA(e,r):p6(e,r)}}function p6(e,t){let n;for(n in t)if(CA.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function nN(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+gd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+gd({start:t.start,end:t.end})+") is still open")}function h6(e){const t=this;t.parser=n;function n(r){return d6(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function m6(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function g6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function y6(e,t){const n=t.value?t.value+`
|
|
71
|
-
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function x6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w6(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function b6(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=ou(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,d),e.applyData(t,d)}function v6(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function _A(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function S6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _A(e,t);const s={src:ou(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function N6(e,t){const n={src:ou(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function j6(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function C6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _A(e,t);const s={href:ou(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function E6(e,t){const n={href:ou(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _6(e,t,n){const r=e.all(t),s=n?P6(n):PA(t),i={},a=[];if(typeof t.checked=="boolean"){const f=r[0];let u;f&&f.type==="element"&&f.tagName==="p"?u=f:(u={type:"element",tagName:"p",properties:{},children:[]},r.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const f=r[l];(s||l!==0||f.type!=="element"||f.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
-
`}),f.type==="element"&&f.tagName==="p"&&!s?a.push(...f.children):a.push(f)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
|
|
73
|
-
`});const d={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,d),e.applyData(t,d)}function P6(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=PA(n[r])}return t}function PA(e){const t=e.spread;return t??e.children.length>1}function A6(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const a=r[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function I6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function T6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function R6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function L6(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),s.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=cv(t.children[1]),c=cA(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function O6(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const d=[];for(;++c<l;){const u=t.children[c],p={},h=a?a[c]:void 0;h&&(p.align=h);let g={type:"element",tagName:i,properties:p,children:[]};u&&(g.children=e.all(u),e.patch(u,g),g=e.applyData(u,g)),d.push(g)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,f),e.applyData(t,f)}function M6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const rN=9,sN=32;function $6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(iN(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(iN(t.slice(s),s>0,!1)),i.join("")}function iN(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===rN||i===sN;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===rN||i===sN;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function D6(e,t){const n={type:"text",value:$6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function F6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const z6={blockquote:m6,break:g6,code:y6,delete:x6,emphasis:w6,footnoteReference:b6,heading:v6,html:k6,imageReference:S6,image:N6,inlineCode:j6,linkReference:C6,link:E6,listItem:_6,list:A6,paragraph:I6,root:T6,strong:R6,table:L6,tableCell:M6,tableRow:O6,text:D6,thematicBreak:F6,toml:Rp,yaml:Rp,definition:Rp,footnoteDefinition:Rp};function Rp(){}const AA=-1,tg=0,xd=1,em=2,gv=3,yv=4,xv=5,wv=6,IA=7,TA=8,oN=typeof self=="object"?self:globalThis,B6=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case tg:case AA:return n(a,s);case xd:{const l=n([],s);for(const c of a)l.push(r(c));return l}case em:{const l=n({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case gv:return n(new Date(a),s);case yv:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case xv:{const l=n(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case wv:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case IA:{const{name:l,message:c}=a;return n(new oN[l](c),s)}case TA:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new oN[i](a),s)};return r},aN=e=>B6(new Map,e)(0),Ql="",{toString:H6}={},{keys:V6}=Object,Bu=e=>{const t=typeof e;if(t!=="object"||!e)return[tg,t];const n=H6.call(e).slice(8,-1);switch(n){case"Array":return[xd,Ql];case"Object":return[em,Ql];case"Date":return[gv,Ql];case"RegExp":return[yv,Ql];case"Map":return[xv,Ql];case"Set":return[wv,Ql];case"DataView":return[xd,n]}return n.includes("Array")?[xd,n]:n.includes("Error")?[IA,n]:[em,n]},Lp=([e,t])=>e===tg&&(t==="function"||t==="symbol"),W6=(e,t,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=Bu(a);switch(l){case tg:{let f=a;switch(c){case"bigint":l=TA,f=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([AA],a)}return s([l,f],a)}case xd:{if(c){let p=a;return c==="DataView"?p=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(a)),s([c,[...p]],a)}const f=[],u=s([l,f],a);for(const p of a)f.push(i(p));return u}case em:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const f=[],u=s([l,f],a);for(const p of V6(a))(e||!Lp(Bu(a[p])))&&f.push([i(p),i(a[p])]);return u}case gv:return s([l,a.toISOString()],a);case yv:{const{source:f,flags:u}=a;return s([l,{source:f,flags:u}],a)}case xv:{const f=[],u=s([l,f],a);for(const[p,h]of a)(e||!(Lp(Bu(p))||Lp(Bu(h))))&&f.push([i(p),i(h)]);return u}case wv:{const f=[],u=s([l,f],a);for(const p of a)(e||!Lp(Bu(p)))&&f.push(i(p));return u}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},lN=(e,{json:t,lossy:n}={})=>{const r=[];return W6(!(t||n),!!t,new Map,r)(e),r},tm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?aN(lN(e,t)):structuredClone(e):(e,t)=>aN(lN(e,t));function U6(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function K6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function q6(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||U6,r=e.options.footnoteBackLabel||K6,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[c]);if(!d)continue;const f=e.all(d),u=String(d.identifier).toUpperCase(),p=ou(u.toLowerCase());let h=0;const g=[],v=e.footnoteCounts.get(u);for(;v!==void 0&&++h<=v;){g.length>0&&g.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,h);typeof b=="string"&&(b={type:"text",value:b}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const k=f[f.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const b=k.children[k.children.length-1];b&&b.type==="text"?b.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...g)}else f.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(f,!0)};e.patch(d,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...tm(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
74
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
75
|
-
`}]}}const RA=function(e){if(e==null)return J6;if(typeof e=="function")return ng(e);if(typeof e=="object")return Array.isArray(e)?Y6(e):G6(e);if(typeof e=="string")return X6(e);throw new Error("Expected function, string, or object as test")};function Y6(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=RA(e[n]);return ng(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function G6(e){const t=e;return ng(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function X6(e){return ng(t);function t(n){return n&&n.type===e}}function ng(e){return t;function t(n,r,s){return!!(Q6(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function J6(){return!0}function Q6(e){return e!==null&&typeof e=="object"&&"type"in e}const LA=[],Z6=!0,cN=!1,e9="skip";function t9(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=RA(s),a=r?-1:1;l(e,void 0,[])();function l(c,d,f){const u=c&&typeof c=="object"?c:{};if(typeof u.type=="string"){const h=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=LA,g,v,k;if((!t||i(c,d,f[f.length-1]||void 0))&&(h=n9(n(c,f)),h[0]===cN))return h;if("children"in c&&c.children){const y=c;if(y.children&&h[0]!==e9)for(v=(r?y.children.length:-1)+a,k=f.concat(y);v>-1&&v<y.children.length;){const b=y.children[v];if(g=l(b,v,k)(),g[0]===cN)return g;v=typeof g[1]=="number"?g[1]:v+a}}return h}}}function n9(e){return Array.isArray(e)?e:typeof e=="number"?[Z6,e]:e==null?LA:[e]}function OA(e,t,n,r){let s,i,a;typeof t=="function"&&typeof n!="function"?(i=void 0,a=t,s=n):(i=t,a=n,s=r),t9(e,i,l,s);function l(c,d){const f=d[d.length-1],u=f?f.children.indexOf(c):void 0;return a(c,u,f)}}const Nw={}.hasOwnProperty,r9={};function s9(e,t){const n=t||r9,r=new Map,s=new Map,i=new Map,a={...z6,...n.handlers},l={all:d,applyData:o9,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:i9,wrap:l9};return OA(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const u=f.type==="definition"?r:s,p=String(f.identifier).toUpperCase();u.has(p)||u.set(p,f)}}),l;function c(f,u){const p=f.type,h=l.handlers[p];if(Nw.call(l.handlers,p)&&h)return h(l,f,u);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in f){const{children:v,...k}=f,y=tm(k);return y.children=l.all(f),y}return tm(f)}return(l.options.unknownHandler||a9)(l,f,u)}function d(f){const u=[];if("children"in f){const p=f.children;let h=-1;for(;++h<p.length;){const g=l.one(p[h],f);if(g){if(h&&p[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=uN(g.value)),!Array.isArray(g)&&g.type==="element")){const v=g.children[0];v&&v.type==="text"&&(v.value=uN(v.value))}Array.isArray(g)?u.push(...g):u.push(g)}}}return u}}function i9(e,t){e.position&&(t.position=H4(e))}function o9(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,tm(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function a9(e,t){const n=t.data||{},r="value"in t&&!(Nw.call(n,"hProperties")||Nw.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function l9(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
76
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
77
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
78
|
-
`}),n}function uN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function dN(e,t){const n=s9(e,t),r=n.one(e,void 0),s=q6(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
79
|
-
`},s),i}function c9(e,t){return e&&"run"in e?async function(n,r){const s=dN(n,{file:r,...t});await e.run(s,r)}:function(n,r){return dN(n,{file:r,...e||t})}}function fN(e){if(e)throw e}var ph=Object.prototype.hasOwnProperty,MA=Object.prototype.toString,pN=Object.defineProperty,hN=Object.getOwnPropertyDescriptor,mN=function(t){return typeof Array.isArray=="function"?Array.isArray(t):MA.call(t)==="[object Array]"},gN=function(t){if(!t||MA.call(t)!=="[object Object]")return!1;var n=ph.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ph.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||ph.call(t,s)},yN=function(t,n){pN&&n.name==="__proto__"?pN(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},xN=function(t,n){if(n==="__proto__")if(ph.call(t,n)){if(hN)return hN(t,n).value}else return;return t[n]},u9=function e(){var t,n,r,s,i,a,l=arguments[0],c=1,d=arguments.length,f=!1;for(typeof l=="boolean"&&(f=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<d;++c)if(t=arguments[c],t!=null)for(n in t)r=xN(l,n),s=xN(t,n),l!==s&&(f&&s&&(gN(s)||(i=mN(s)))?(i?(i=!1,a=r&&mN(r)?r:[]):a=r&&gN(r)?r:{},yN(l,{name:n,newValue:e(f,a,s)})):typeof s<"u"&&yN(l,{name:n,newValue:s}));return l};const Ny=La(u9);function jw(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function d9(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...d){const f=e[++i];let u=-1;if(c){a(c);return}for(;++u<s.length;)(d[u]===null||d[u]===void 0)&&(d[u]=s[u]);s=d,f?f9(f,l)(...d):a(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function f9(e,t){let n;return r;function r(...a){const l=e.length>a.length;let c;l&&a.push(s);try{c=e.apply(this,a)}catch(d){const f=d;if(l&&n)throw f;return s(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,t(a,...l))}function i(a){s(null,a)}}const Bi={basename:p9,dirname:h9,extname:m9,join:g9,sep:"/"};function p9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Sf(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function h9(e){if(Sf(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function m9(e){Sf(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function g9(...e){let t=-1,n;for(;++t<e.length;)Sf(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":y9(n)}function y9(e){Sf(e);const t=e.codePointAt(0)===47;let n=x9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function x9(e,t){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function Sf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const w9={cwd:b9};function b9(){return"/"}function Cw(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function v9(e){if(typeof e=="string")e=new URL(e);else if(!Cw(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return k9(e)}function k9(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const jy=["history","path","basename","stem","extname","dirname"];class $A{constructor(t){let n;t?Cw(t)?n={path:t}:typeof t=="string"||S9(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":w9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<jy.length;){const i=jy[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)jy.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Bi.basename(this.path):void 0}set basename(t){Ey(t,"basename"),Cy(t,"basename"),this.path=Bi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Bi.dirname(this.path):void 0}set dirname(t){wN(this.basename,"dirname"),this.path=Bi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Bi.extname(this.path):void 0}set extname(t){if(Cy(t,"extname"),wN(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Bi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Cw(t)&&(t=v9(t)),Ey(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Bi.basename(this.path,this.extname):void 0}set stem(t){Ey(t,"stem"),Cy(t,"stem"),this.path=Bi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new $r(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Cy(e,t){if(e&&e.includes(Bi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Bi.sep+"`")}function Ey(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function S9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const N9=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},j9={}.hasOwnProperty;class bv extends N9{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=d9()}copy(){const t=new bv;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ny(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ay("data",this.frozen),this.namespace[t]=n,this):j9.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ay("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Op(t),r=this.parser||this.Parser;return _y("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),_y("process",this.parser||this.Parser),Py("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=Op(t),c=r.parse(l);r.run(c,l,function(f,u,p){if(f||!u||!p)return d(f);const h=u,g=r.stringify(h,p);_9(g)?p.value=g:p.result=g,d(f,p)});function d(f,u){f||!u?a(f):i?i(u):n(void 0,u)}}}processSync(t){let n=!1,r;return this.freeze(),_y("processSync",this.parser||this.Parser),Py("processSync",this.compiler||this.Compiler),this.process(t,s),vN("processSync","process",n),r;function s(i,a){n=!0,fN(i),r=a}}run(t,n,r){bN(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=Op(n);s.run(t,c,d);function d(f,u,p){const h=u||t;f?l(f):a?a(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),vN("runSync","run",r),s;function i(a,l){fN(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=Op(n),s=this.compiler||this.Compiler;return Py("stringify",s),bN(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Ay("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[f,...u]=d;c(f,u)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(s.settings=Ny(!0,s.settings,d.settings))}function l(d){let f=-1;if(d!=null)if(Array.isArray(d))for(;++f<d.length;){const u=d[f];i(u)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,f){let u=-1,p=-1;for(;++u<r.length;)if(r[u][0]===d){p=u;break}if(p===-1)r.push([d,...f]);else if(f.length>0){let[h,...g]=f;const v=r[p][1];jw(v)&&jw(h)&&(h=Ny(!0,v,h)),r[p]=[d,h,...g]}}}}const C9=new bv().freeze();function _y(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Py(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ay(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function bN(e){if(!jw(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Op(e){return E9(e)?e:new $A(e)}function E9(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _9(e){return typeof e=="string"||P9(e)}function P9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const A9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kN=[],SN={allowDangerousHtml:!0},I9=/^(https?|ircs?|mailto|xmpp)$/i,T9=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Nf(e){const t=R9(e),n=L9(e);return O9(t.runSync(t.parse(n),n),e)}function R9(e){const t=e.rehypePlugins||kN,n=e.remarkPlugins||kN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...SN}:SN;return C9().use(h6).use(n).use(c9,r).use(t)}function L9(e){const t=e.children||"",n=new $A;return typeof t=="string"&&(n.value=t),n}function O9(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||M9;for(const f of T9)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+A9+f.id,void 0);return OA(e,d),q4(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(f,u,p){if(f.type==="raw"&&p&&typeof u=="number")return a?p.children.splice(u,1):p.children[u]={type:"text",value:f.value},u;if(f.type==="element"){let h;for(h in vy)if(Object.hasOwn(vy,h)&&Object.hasOwn(f.properties,h)){const g=f.properties[h],v=vy[h];(v===null||v.includes(f.tagName))&&(f.properties[h]=c(String(g||""),h,f))}}if(f.type==="element"){let h=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!h&&r&&typeof u=="number"&&(h=!r(f,u,p)),h&&p&&typeof u=="number")return l&&f.children?p.children.splice(u,1,...f.children):p.children.splice(u,1),u}}}function M9(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||I9.test(e.slice(0,t))?e:""}function $9(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function nm(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>nm(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${nm(t[r])}`).join(",")}}`}function NN(e){return nm({id:e.id,type:e.type,position:e.position,data:e.data,parentId:e.parentId,extent:e.extent,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition,hidden:e.hidden})}function Qd(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function jN(e){return nm({source:e.source,target:e.target,sourceHandle:e.sourceHandle??null,targetHandle:e.targetHandle??null,type:e.type,label:e.label,data:e.data,markerStart:e.markerStart,markerEnd:e.markerEnd,animated:e.animated,hidden:e.hidden,style:e.style})}function CN(e,t){return!$9(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function EN(e,t=!1){const n=new Map;for(const r of e){const s=Qd(r);if(t&&n.has(s))throw new Error(`存在重复连线键: ${s}`);n.set(s,r)}return n}function D9(e,t,n,r){const s=new Map(e.map(b=>[b.id,b])),i=new Set(n.map(b=>b.id)),a=new Set,l=[],c=[],d=n.map(b=>{const w=s.get(b.id);return w?NN(w)===NN(b)?(a.add(b.id),w):(c.push(b.id),CN(b,w)):(l.push(b.id),b)}),f=EN(t),u=EN(r,!0),p=new Set,h=[],g=[],v=r.map(b=>{const w=Qd(b),N=f.get(w);return N?jN(N)===jN(b)?(p.add(w),N):(g.push(w),CN(b,N)):(h.push(w),b)}),k=e.filter(b=>!i.has(b.id)).map(b=>b.id),y=t.map(b=>Qd(b)).filter(b=>!u.has(b));return{nodes:d,edges:v,changes:{addedNodeIds:l,updatedNodeIds:c,removedNodeIds:k,addedEdgeKeys:h,updatedEdgeKeys:g,removedEdgeKeys:y},stats:{nodeAdded:l.length,nodeRemoved:k.length,nodeReused:a.size,edgeAdded:h.length,edgeRemoved:y.length,edgeReused:p.size,nextEdgeCount:u.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function DA(e){return typeof e>"u"||e===null}function F9(e){return typeof e=="object"&&e!==null}function z9(e){return Array.isArray(e)?e:DA(e)?[]:[e]}function B9(e,t){var n,r,s,i;if(t)for(i=Object.keys(t),n=0,r=i.length;n<r;n+=1)s=i[n],e[s]=t[s];return e}function H9(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function V9(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var W9=DA,U9=F9,K9=z9,q9=H9,Y9=V9,G9=B9,dr={isNothing:W9,isObject:U9,toArray:K9,repeat:q9,isNegativeZero:Y9,extend:G9};function FA(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
80
|
-
|
|
81
|
-
`+e.mark.snippet),r+" "+n):r}function Zd(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=FA(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Zd.prototype=Object.create(Error.prototype);Zd.prototype.constructor=Zd;Zd.prototype.toString=function(t){return this.name+": "+FA(this,t)};var Wr=Zd;function Iy(e,t,n,r,s){var i="",a="",l=Math.floor(s/2)-1;return r-t>l&&(i=" ... ",t=r-l+i.length),n-r>l&&(a=" ...",n=r+l-a.length),{str:i+e.slice(t,n).replace(/\t/g,"→")+a,pos:r-t+i.length}}function Ty(e,t){return dr.repeat(" ",t-e.length)+e}function X9(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],s=[],i,a=-1;i=n.exec(e.buffer);)s.push(i.index),r.push(i.index+i[0].length),e.position<=i.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var l="",c,d,f=Math.min(e.line+t.linesAfter,s.length).toString().length,u=t.maxLength-(t.indent+f+3);for(c=1;c<=t.linesBefore&&!(a-c<0);c++)d=Iy(e.buffer,r[a-c],s[a-c],e.position-(r[a]-r[a-c]),u),l=dr.repeat(" ",t.indent)+Ty((e.line-c+1).toString(),f)+" | "+d.str+`
|
|
82
|
-
`+l;for(d=Iy(e.buffer,r[a],s[a],e.position,u),l+=dr.repeat(" ",t.indent)+Ty((e.line+1).toString(),f)+" | "+d.str+`
|
|
83
|
-
`,l+=dr.repeat("-",t.indent+f+3+d.pos)+`^
|
|
84
|
-
`,c=1;c<=t.linesAfter&&!(a+c>=s.length);c++)d=Iy(e.buffer,r[a+c],s[a+c],e.position-(r[a]-r[a+c]),u),l+=dr.repeat(" ",t.indent)+Ty((e.line+c+1).toString(),f)+" | "+d.str+`
|
|
85
|
-
`;return l.replace(/\n$/,"")}var J9=X9,Q9=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Z9=["scalar","sequence","mapping"];function eV(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function tV(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(Q9.indexOf(n)===-1)throw new Wr('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=eV(t.styleAliases||null),Z9.indexOf(this.kind)===-1)throw new Wr('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Cr=tV;function _N(e,t){var n=[];return e[t].forEach(function(r){var s=n.length;n.forEach(function(i,a){i.tag===r.tag&&i.kind===r.kind&&i.multi===r.multi&&(s=a)}),n[s]=r}),n}function nV(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(s){s.multi?(e.multi[s.kind].push(s),e.multi.fallback.push(s)):e[s.kind][s.tag]=e.fallback[s.tag]=s}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function Ew(e){return this.extend(e)}Ew.prototype.extend=function(t){var n=[],r=[];if(t instanceof Cr)r.push(t);else if(Array.isArray(t))r=r.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(r=r.concat(t.explicit));else throw new Wr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof Cr))throw new Wr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new Wr("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(i.multi)throw new Wr("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(i){if(!(i instanceof Cr))throw new Wr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(Ew.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=_N(s,"implicit"),s.compiledExplicit=_N(s,"explicit"),s.compiledTypeMap=nV(s.compiledImplicit,s.compiledExplicit),s};var zA=Ew,BA=new Cr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),HA=new Cr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),VA=new Cr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),WA=new zA({explicit:[BA,HA,VA]});function rV(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function sV(){return null}function iV(e){return e===null}var UA=new Cr("tag:yaml.org,2002:null",{kind:"scalar",resolve:rV,construct:sV,predicate:iV,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function oV(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function aV(e){return e==="true"||e==="True"||e==="TRUE"}function lV(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var KA=new Cr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:oV,construct:aV,predicate:lV,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function cV(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function uV(e){return 48<=e&&e<=55}function dV(e){return 48<=e&&e<=57}function fV(e){if(e===null)return!1;var t=e.length,n=0,r=!1,s;if(!t)return!1;if(s=e[n],(s==="-"||s==="+")&&(s=e[++n]),s==="0"){if(n+1===t)return!0;if(s=e[++n],s==="b"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(s!=="0"&&s!=="1")return!1;r=!0}return r&&s!=="_"}if(s==="x"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!cV(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!uV(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!dV(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function pV(e){var t=e,n=1,r;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),r=t[0],(r==="-"||r==="+")&&(r==="-"&&(n=-1),t=t.slice(1),r=t[0]),t==="0")return 0;if(r==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function hV(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!dr.isNegativeZero(e)}var qA=new Cr("tag:yaml.org,2002:int",{kind:"scalar",resolve:fV,construct:pV,predicate:hV,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),mV=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function gV(e){return!(e===null||!mV.test(e)||e[e.length-1]==="_")}function yV(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var xV=/^[-+]?[0-9]+e/;function wV(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(dr.isNegativeZero(e))return"-0.0";return n=e.toString(10),xV.test(n)?n.replace("e",".e"):n}function bV(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||dr.isNegativeZero(e))}var YA=new Cr("tag:yaml.org,2002:float",{kind:"scalar",resolve:gV,construct:yV,predicate:bV,represent:wV,defaultStyle:"lowercase"}),GA=WA.extend({implicit:[UA,KA,qA,YA]}),XA=GA,JA=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),QA=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function vV(e){return e===null?!1:JA.exec(e)!==null||QA.exec(e)!==null}function kV(e){var t,n,r,s,i,a,l,c=0,d=null,f,u,p;if(t=JA.exec(e),t===null&&(t=QA.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(n,r,s));if(i=+t[4],a=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(f=+t[10],u=+(t[11]||0),d=(f*60+u)*6e4,t[9]==="-"&&(d=-d)),p=new Date(Date.UTC(n,r,s,i,a,l,c)),d&&p.setTime(p.getTime()-d),p}function SV(e){return e.toISOString()}var ZA=new Cr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:vV,construct:kV,instanceOf:Date,represent:SV});function NV(e){return e==="<<"||e===null}var eI=new Cr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:NV}),vv=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
-
\r`;function jV(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=vv;for(n=0;n<s;n++)if(t=i.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function CV(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=vv,a=0,l=[];for(t=0;t<s;t++)t%4===0&&t&&(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)),a=a<<6|i.indexOf(r.charAt(t));return n=s%4*6,n===0?(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)):n===18?(l.push(a>>10&255),l.push(a>>2&255)):n===12&&l.push(a>>4&255),new Uint8Array(l)}function EV(e){var t="",n=0,r,s,i=e.length,a=vv;for(r=0;r<i;r++)r%3===0&&r&&(t+=a[n>>18&63],t+=a[n>>12&63],t+=a[n>>6&63],t+=a[n&63]),n=(n<<8)+e[r];return s=i%3,s===0?(t+=a[n>>18&63],t+=a[n>>12&63],t+=a[n>>6&63],t+=a[n&63]):s===2?(t+=a[n>>10&63],t+=a[n>>4&63],t+=a[n<<2&63],t+=a[64]):s===1&&(t+=a[n>>2&63],t+=a[n<<4&63],t+=a[64],t+=a[64]),t}function _V(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var tI=new Cr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:jV,construct:CV,predicate:_V,represent:EV}),PV=Object.prototype.hasOwnProperty,AV=Object.prototype.toString;function IV(e){if(e===null)return!0;var t=[],n,r,s,i,a,l=e;for(n=0,r=l.length;n<r;n+=1){if(s=l[n],a=!1,AV.call(s)!=="[object Object]")return!1;for(i in s)if(PV.call(s,i))if(!a)a=!0;else return!1;if(!a)return!1;if(t.indexOf(i)===-1)t.push(i);else return!1}return!0}function TV(e){return e!==null?e:[]}var nI=new Cr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:IV,construct:TV}),RV=Object.prototype.toString;function LV(e){if(e===null)return!0;var t,n,r,s,i,a=e;for(i=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(r=a[t],RV.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function OV(e){if(e===null)return[];var t,n,r,s,i,a=e;for(i=new Array(a.length),t=0,n=a.length;t<n;t+=1)r=a[t],s=Object.keys(r),i[t]=[s[0],r[s[0]]];return i}var rI=new Cr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:LV,construct:OV}),MV=Object.prototype.hasOwnProperty;function $V(e){if(e===null)return!0;var t,n=e;for(t in n)if(MV.call(n,t)&&n[t]!==null)return!1;return!0}function DV(e){return e!==null?e:{}}var sI=new Cr("tag:yaml.org,2002:set",{kind:"mapping",resolve:$V,construct:DV}),kv=XA.extend({implicit:[ZA,eI],explicit:[tI,nI,rI,sI]}),Aa=Object.prototype.hasOwnProperty,rm=1,iI=2,oI=3,sm=4,Ry=1,FV=2,PN=3,zV=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,BV=/[\x85\u2028\u2029]/,HV=/[,\[\]\{\}]/,aI=/^(?:!|!!|![a-z\-]+!)$/i,lI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function AN(e){return Object.prototype.toString.call(e)}function Ji(e){return e===10||e===13}function ml(e){return e===9||e===32}function ss(e){return e===9||e===32||e===10||e===13}function vc(e){return e===44||e===91||e===93||e===123||e===125}function VV(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function WV(e){return e===120?2:e===117?4:e===85?8:0}function UV(e){return 48<=e&&e<=57?e-48:-1}function IN(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
87
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function KV(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function cI(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var uI=new Array(256),dI=new Array(256);for(var Zl=0;Zl<256;Zl++)uI[Zl]=IN(Zl)?1:0,dI[Zl]=IN(Zl);function qV(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||kv,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function fI(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=J9(n),new Wr(t,n)}function Je(e,t){throw fI(e,t)}function im(e,t){e.onWarning&&e.onWarning.call(null,fI(e,t))}var TN={YAML:function(t,n,r){var s,i,a;t.version!==null&&Je(t,"duplication of %YAML directive"),r.length!==1&&Je(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),s===null&&Je(t,"ill-formed argument of the YAML directive"),i=parseInt(s[1],10),a=parseInt(s[2],10),i!==1&&Je(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&im(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var s,i;r.length!==2&&Je(t,"TAG directive accepts exactly two arguments"),s=r[0],i=r[1],aI.test(s)||Je(t,"ill-formed tag handle (first argument) of the TAG directive"),Aa.call(t.tagMap,s)&&Je(t,'there is a previously declared suffix for "'+s+'" tag handle'),lI.test(i)||Je(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{Je(t,"tag prefix is malformed: "+i)}t.tagMap[s]=i}};function ja(e,t,n,r){var s,i,a,l;if(t<n){if(l=e.input.slice(t,n),r)for(s=0,i=l.length;s<i;s+=1)a=l.charCodeAt(s),a===9||32<=a&&a<=1114111||Je(e,"expected valid JSON character");else zV.test(l)&&Je(e,"the stream contains non-printable characters");e.result+=l}}function RN(e,t,n,r){var s,i,a,l;for(dr.isObject(n)||Je(e,"cannot merge mappings; the provided source object is unacceptable"),s=Object.keys(n),a=0,l=s.length;a<l;a+=1)i=s[a],Aa.call(t,i)||(cI(t,i,n[i]),r[i]=!0)}function kc(e,t,n,r,s,i,a,l,c){var d,f;if(Array.isArray(s))for(s=Array.prototype.slice.call(s),d=0,f=s.length;d<f;d+=1)Array.isArray(s[d])&&Je(e,"nested arrays are not supported inside keys"),typeof s=="object"&&AN(s[d])==="[object Object]"&&(s[d]="[object Object]");if(typeof s=="object"&&AN(s)==="[object Object]"&&(s="[object Object]"),s=String(s),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(i))for(d=0,f=i.length;d<f;d+=1)RN(e,t,i[d],n);else RN(e,t,i,n);else!e.json&&!Aa.call(n,s)&&Aa.call(t,s)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,Je(e,"duplicated mapping key")),cI(t,s,i),delete n[s];return t}function Sv(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):Je(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function rr(e,t,n){for(var r=0,s=e.input.charCodeAt(e.position);s!==0;){for(;ml(s);)s===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),s=e.input.charCodeAt(++e.position);if(t&&s===35)do s=e.input.charCodeAt(++e.position);while(s!==10&&s!==13&&s!==0);if(Ji(s))for(Sv(e),s=e.input.charCodeAt(e.position),r++,e.lineIndent=0;s===32;)e.lineIndent++,s=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&im(e,"deficient indentation"),r}function rg(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||ss(n)))}function Nv(e,t){t===1?e.result+=" ":t>1&&(e.result+=dr.repeat(`
|
|
88
|
-
`,t-1))}function YV(e,t,n){var r,s,i,a,l,c,d,f,u=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),ss(h)||vc(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(s=e.input.charCodeAt(e.position+1),ss(s)||n&&vc(s)))return!1;for(e.kind="scalar",e.result="",i=a=e.position,l=!1;h!==0;){if(h===58){if(s=e.input.charCodeAt(e.position+1),ss(s)||n&&vc(s))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),ss(r))break}else{if(e.position===e.lineStart&&rg(e)||n&&vc(h))break;if(Ji(h))if(c=e.line,d=e.lineStart,f=e.lineIndent,rr(e,!1,-1),e.lineIndent>=t){l=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=c,e.lineStart=d,e.lineIndent=f;break}}l&&(ja(e,i,a,!1),Nv(e,e.line-c),i=a=e.position,l=!1),ml(h)||(a=e.position+1),h=e.input.charCodeAt(++e.position)}return ja(e,i,a,!1),e.result?!0:(e.kind=u,e.result=p,!1)}function GV(e,t){var n,r,s;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=s=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(ja(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,s=e.position;else return!0;else Ji(n)?(ja(e,r,s,!0),Nv(e,rr(e,!1,t)),r=s=e.position):e.position===e.lineStart&&rg(e)?Je(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);Je(e,"unexpected end of the stream within a single quoted scalar")}function XV(e,t){var n,r,s,i,a,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return ja(e,n,e.position,!0),e.position++,!0;if(l===92){if(ja(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),Ji(l))rr(e,!1,t);else if(l<256&&uI[l])e.result+=dI[l],e.position++;else if((a=WV(l))>0){for(s=a,i=0;s>0;s--)l=e.input.charCodeAt(++e.position),(a=VV(l))>=0?i=(i<<4)+a:Je(e,"expected hexadecimal character");e.result+=KV(i),e.position++}else Je(e,"unknown escape sequence");n=r=e.position}else Ji(l)?(ja(e,n,r,!0),Nv(e,rr(e,!1,t)),n=r=e.position):e.position===e.lineStart&&rg(e)?Je(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}Je(e,"unexpected end of the stream within a double quoted scalar")}function JV(e,t){var n=!0,r,s,i,a=e.tag,l,c=e.anchor,d,f,u,p,h,g=Object.create(null),v,k,y,b;if(b=e.input.charCodeAt(e.position),b===91)f=93,h=!1,l=[];else if(b===123)f=125,h=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),b=e.input.charCodeAt(++e.position);b!==0;){if(rr(e,!0,t),b=e.input.charCodeAt(e.position),b===f)return e.position++,e.tag=a,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=l,!0;n?b===44&&Je(e,"expected the node content, but found ','"):Je(e,"missed comma between flow collection entries"),k=v=y=null,u=p=!1,b===63&&(d=e.input.charCodeAt(e.position+1),ss(d)&&(u=p=!0,e.position++,rr(e,!0,t))),r=e.line,s=e.lineStart,i=e.position,Jc(e,t,rm,!1,!0),k=e.tag,v=e.result,rr(e,!0,t),b=e.input.charCodeAt(e.position),(p||e.line===r)&&b===58&&(u=!0,b=e.input.charCodeAt(++e.position),rr(e,!0,t),Jc(e,t,rm,!1,!0),y=e.result),h?kc(e,l,g,k,v,y,r,s,i):u?l.push(kc(e,null,g,k,v,y,r,s,i)):l.push(v),rr(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(n=!0,b=e.input.charCodeAt(++e.position)):n=!1}Je(e,"unexpected end of the stream within a flow collection")}function QV(e,t){var n,r,s=Ry,i=!1,a=!1,l=t,c=0,d=!1,f,u;if(u=e.input.charCodeAt(e.position),u===124)r=!1;else if(u===62)r=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)Ry===s?s=u===43?PN:FV:Je(e,"repeat of a chomping mode identifier");else if((f=UV(u))>=0)f===0?Je(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?Je(e,"repeat of an indentation width identifier"):(l=t+f-1,a=!0);else break;if(ml(u)){do u=e.input.charCodeAt(++e.position);while(ml(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!Ji(u)&&u!==0)}for(;u!==0;){for(Sv(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!a||e.lineIndent<l)&&u===32;)e.lineIndent++,u=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>l&&(l=e.lineIndent),Ji(u)){c++;continue}if(e.lineIndent<l){s===PN?e.result+=dr.repeat(`
|
|
89
|
-
`,i?1+c:c):s===Ry&&i&&(e.result+=`
|
|
90
|
-
`);break}for(r?ml(u)?(d=!0,e.result+=dr.repeat(`
|
|
91
|
-
`,i?1+c:c)):d?(d=!1,e.result+=dr.repeat(`
|
|
92
|
-
`,c+1)):c===0?i&&(e.result+=" "):e.result+=dr.repeat(`
|
|
93
|
-
`,c):e.result+=dr.repeat(`
|
|
94
|
-
`,i?1+c:c),i=!0,a=!0,c=0,n=e.position;!Ji(u)&&u!==0;)u=e.input.charCodeAt(++e.position);ja(e,n,e.position,!1)}return!0}function LN(e,t){var n,r=e.tag,s=e.anchor,i=[],a,l=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=i),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Je(e,"tab characters must not be used in indentation")),!(c!==45||(a=e.input.charCodeAt(e.position+1),!ss(a))));){if(l=!0,e.position++,rr(e,!0,-1)&&e.lineIndent<=t){i.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,Jc(e,t,oI,!1,!0),i.push(e.result),rr(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)Je(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return l?(e.tag=r,e.anchor=s,e.kind="sequence",e.result=i,!0):!1}function ZV(e,t,n){var r,s,i,a,l,c,d=e.tag,f=e.anchor,u={},p=Object.create(null),h=null,g=null,v=null,k=!1,y=!1,b;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),b=e.input.charCodeAt(e.position);b!==0;){if(!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Je(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,(b===63||b===58)&&ss(r))b===63?(k&&(kc(e,u,p,h,g,null,a,l,c),h=g=v=null),y=!0,k=!0,s=!0):k?(k=!1,s=!0):Je(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,b=r;else{if(a=e.line,l=e.lineStart,c=e.position,!Jc(e,n,iI,!1,!0))break;if(e.line===i){for(b=e.input.charCodeAt(e.position);ml(b);)b=e.input.charCodeAt(++e.position);if(b===58)b=e.input.charCodeAt(++e.position),ss(b)||Je(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(kc(e,u,p,h,g,null,a,l,c),h=g=v=null),y=!0,k=!1,s=!1,h=e.tag,g=e.result;else if(y)Je(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=f,!0}else if(y)Je(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=f,!0}if((e.line===i||e.lineIndent>t)&&(k&&(a=e.line,l=e.lineStart,c=e.position),Jc(e,t,sm,!0,s)&&(k?g=e.result:v=e.result),k||(kc(e,u,p,h,g,v,a,l,c),h=g=v=null),rr(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&b!==0)Je(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return k&&kc(e,u,p,h,g,null,a,l,c),y&&(e.tag=d,e.anchor=f,e.kind="mapping",e.result=u),y}function eW(e){var t,n=!1,r=!1,s,i,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&Je(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(n=!0,a=e.input.charCodeAt(++e.position)):a===33?(r=!0,s="!!",a=e.input.charCodeAt(++e.position)):s="!",t=e.position,n){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(i=e.input.slice(t,e.position),a=e.input.charCodeAt(++e.position)):Je(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!ss(a);)a===33&&(r?Je(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),aI.test(s)||Je(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),a=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),HV.test(i)&&Je(e,"tag suffix cannot contain flow indicator characters")}i&&!lI.test(i)&&Je(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{Je(e,"tag name is malformed: "+i)}return n?e.tag=i:Aa.call(e.tagMap,s)?e.tag=e.tagMap[s]+i:s==="!"?e.tag="!"+i:s==="!!"?e.tag="tag:yaml.org,2002:"+i:Je(e,'undeclared tag handle "'+s+'"'),!0}function tW(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&Je(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!ss(n)&&!vc(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Je(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function nW(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!ss(r)&&!vc(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Je(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Aa.call(e.anchorMap,n)||Je(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],rr(e,!0,-1),!0}function Jc(e,t,n,r,s){var i,a,l,c=1,d=!1,f=!1,u,p,h,g,v,k;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=a=l=sm===n||oI===n,r&&rr(e,!0,-1)&&(d=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;eW(e)||tW(e);)rr(e,!0,-1)?(d=!0,l=i,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):l=!1;if(l&&(l=d||s),(c===1||sm===n)&&(rm===n||iI===n?v=t:v=t+1,k=e.position-e.lineStart,c===1?l&&(LN(e,k)||ZV(e,k,v))||JV(e,v)?f=!0:(a&&QV(e,v)||GV(e,v)||XV(e,v)?f=!0:nW(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&Je(e,"alias node should not have any properties")):YV(e,v,rm===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(f=l&&LN(e,k))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&Je(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(g=e.implicitTypes[u],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Aa.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,h=e.typeMap.multi[e.kind||"fallback"],u=0,p=h.length;u<p;u+=1)if(e.tag.slice(0,h[u].tag.length)===h[u].tag){g=h[u];break}g||Je(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&Je(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Je(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function rW(e){var t=e.position,n,r,s,i=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(rr(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(i=!0,a=e.input.charCodeAt(++e.position),n=e.position;a!==0&&!ss(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),s=[],r.length<1&&Je(e,"directive name must not be less than one character in length");a!==0;){for(;ml(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!Ji(a));break}if(Ji(a))break;for(n=e.position;a!==0&&!ss(a);)a=e.input.charCodeAt(++e.position);s.push(e.input.slice(n,e.position))}a!==0&&Sv(e),Aa.call(TN,r)?TN[r](e,r,s):im(e,'unknown document directive "'+r+'"')}if(rr(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,rr(e,!0,-1)):i&&Je(e,"directives end mark is expected"),Jc(e,e.lineIndent-1,sm,!1,!0),rr(e,!0,-1),e.checkLineBreaks&&BV.test(e.input.slice(t,e.position))&&im(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&rg(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,rr(e,!0,-1));return}if(e.position<e.length-1)Je(e,"end of the stream or a document separator is expected");else return}function pI(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
95
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new qV(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,Je(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)rW(n);return n.documents}function sW(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=pI(e,n);if(typeof t!="function")return r;for(var s=0,i=r.length;s<i;s+=1)t(r[s])}function iW(e,t){var n=pI(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Wr("expected a single document in the stream, but found more")}}var oW=sW,aW=iW,hI={loadAll:oW,load:aW},mI=Object.prototype.toString,gI=Object.prototype.hasOwnProperty,jv=65279,lW=9,ef=10,cW=13,uW=32,dW=33,fW=34,_w=35,pW=37,hW=38,mW=39,gW=42,yI=44,yW=45,om=58,xW=61,wW=62,bW=63,vW=64,xI=91,wI=93,kW=96,bI=123,SW=124,vI=125,Dr={};Dr[0]="\\0";Dr[7]="\\a";Dr[8]="\\b";Dr[9]="\\t";Dr[10]="\\n";Dr[11]="\\v";Dr[12]="\\f";Dr[13]="\\r";Dr[27]="\\e";Dr[34]='\\"';Dr[92]="\\\\";Dr[133]="\\N";Dr[160]="\\_";Dr[8232]="\\L";Dr[8233]="\\P";var NW=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],jW=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function CW(e,t){var n,r,s,i,a,l,c;if(t===null)return{};for(n={},r=Object.keys(t),s=0,i=r.length;s<i;s+=1)a=r[s],l=String(t[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),c=e.compiledTypeMap.fallback[a],c&&gI.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[a]=l;return n}function EW(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new Wr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+dr.repeat("0",r-t.length)+t}var _W=1,tf=2;function PW(e){this.schema=e.schema||kv,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=dr.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=CW(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?tf:_W,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ON(e,t){for(var n=dr.repeat(" ",t),r=0,s=-1,i="",a,l=e.length;r<l;)s=e.indexOf(`
|
|
96
|
-
`,r),s===-1?(a=e.slice(r),r=l):(a=e.slice(r,s+1),r=s+1),a.length&&a!==`
|
|
97
|
-
`&&(i+=n),i+=a;return i}function Pw(e,t){return`
|
|
98
|
-
`+dr.repeat(" ",e.indent*t)}function AW(e,t){var n,r,s;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(s=e.implicitTypes[n],s.resolve(t))return!0;return!1}function am(e){return e===uW||e===lW}function nf(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==jv||65536<=e&&e<=1114111}function MN(e){return nf(e)&&e!==jv&&e!==cW&&e!==ef}function $N(e,t,n){var r=MN(e),s=r&&!am(e);return(n?r:r&&e!==yI&&e!==xI&&e!==wI&&e!==bI&&e!==vI)&&e!==_w&&!(t===om&&!s)||MN(t)&&!am(t)&&e===_w||t===om&&s}function IW(e){return nf(e)&&e!==jv&&!am(e)&&e!==yW&&e!==bW&&e!==om&&e!==yI&&e!==xI&&e!==wI&&e!==bI&&e!==vI&&e!==_w&&e!==hW&&e!==gW&&e!==dW&&e!==SW&&e!==xW&&e!==wW&&e!==mW&&e!==fW&&e!==pW&&e!==vW&&e!==kW}function TW(e){return!am(e)&&e!==om}function Zu(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function kI(e){var t=/^\n* /;return t.test(e)}var SI=1,Aw=2,NI=3,jI=4,rc=5;function RW(e,t,n,r,s,i,a,l){var c,d=0,f=null,u=!1,p=!1,h=r!==-1,g=-1,v=IW(Zu(e,0))&&TW(Zu(e,e.length-1));if(t||a)for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Zu(e,c),!nf(d))return rc;v=v&&$N(d,f,l),f=d}else{for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Zu(e,c),d===ef)u=!0,h&&(p=p||c-g-1>r&&e[g+1]!==" ",g=c);else if(!nf(d))return rc;v=v&&$N(d,f,l),f=d}p=p||h&&c-g-1>r&&e[g+1]!==" "}return!u&&!p?v&&!a&&!s(e)?SI:i===tf?rc:Aw:n>9&&kI(e)?rc:a?i===tf?rc:Aw:p?jI:NI}function LW(e,t,n,r,s){e.dump=function(){if(t.length===0)return e.quotingType===tf?'""':"''";if(!e.noCompatMode&&(NW.indexOf(t)!==-1||jW.test(t)))return e.quotingType===tf?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),l=r||e.flowLevel>-1&&n>=e.flowLevel;function c(d){return AW(e,d)}switch(RW(t,l,e.indent,a,c,e.quotingType,e.forceQuotes&&!r,s)){case SI:return t;case Aw:return"'"+t.replace(/'/g,"''")+"'";case NI:return"|"+DN(t,e.indent)+FN(ON(t,i));case jI:return">"+DN(t,e.indent)+FN(ON(OW(t,a),i));case rc:return'"'+MW(t)+'"';default:throw new Wr("impossible error: invalid scalar style")}}()}function DN(e,t){var n=kI(e)?String(t):"",r=e[e.length-1]===`
|
|
99
|
-
`,s=r&&(e[e.length-2]===`
|
|
100
|
-
`||e===`
|
|
101
|
-
`),i=s?"+":r?"":"-";return n+i+`
|
|
102
|
-
`}function FN(e){return e[e.length-1]===`
|
|
103
|
-
`?e.slice(0,-1):e}function OW(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var d=e.indexOf(`
|
|
104
|
-
`);return d=d!==-1?d:e.length,n.lastIndex=d,zN(e.slice(0,d),t)}(),s=e[0]===`
|
|
105
|
-
`||e[0]===" ",i,a;a=n.exec(e);){var l=a[1],c=a[2];i=c[0]===" ",r+=l+(!s&&!i&&c!==""?`
|
|
106
|
-
`:"")+zN(c,t),s=i}return r}function zN(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,s=0,i,a=0,l=0,c="";r=n.exec(e);)l=r.index,l-s>t&&(i=a>s?a:l,c+=`
|
|
107
|
-
`+e.slice(s,i),s=i+1),a=l;return c+=`
|
|
108
|
-
`,e.length-s>t&&a>s?c+=e.slice(s,a)+`
|
|
109
|
-
`+e.slice(a+1):c+=e.slice(s),c.slice(1)}function MW(e){for(var t="",n=0,r,s=0;s<e.length;n>=65536?s+=2:s++)n=Zu(e,s),r=Dr[n],!r&&nf(n)?(t+=e[s],n>=65536&&(t+=e[s+1])):t+=r||EW(n);return t}function $W(e,t,n){var r="",s=e.tag,i,a,l;for(i=0,a=n.length;i<a;i+=1)l=n[i],e.replacer&&(l=e.replacer.call(n,String(i),l)),(Oo(e,t,l,!1,!1)||typeof l>"u"&&Oo(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=s,e.dump="["+r+"]"}function BN(e,t,n,r){var s="",i=e.tag,a,l,c;for(a=0,l=n.length;a<l;a+=1)c=n[a],e.replacer&&(c=e.replacer.call(n,String(a),c)),(Oo(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&Oo(e,t+1,null,!0,!0,!1,!0))&&((!r||s!=="")&&(s+=Pw(e,t)),e.dump&&ef===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}function DW(e,t,n){var r="",s=e.tag,i=Object.keys(n),a,l,c,d,f;for(a=0,l=i.length;a<l;a+=1)f="",r!==""&&(f+=", "),e.condenseFlow&&(f+='"'),c=i[a],d=n[c],e.replacer&&(d=e.replacer.call(n,c,d)),Oo(e,t,c,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Oo(e,t,d,!1,!1)&&(f+=e.dump,r+=f));e.tag=s,e.dump="{"+r+"}"}function FW(e,t,n,r){var s="",i=e.tag,a=Object.keys(n),l,c,d,f,u,p;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new Wr("sortKeys must be a boolean or a function");for(l=0,c=a.length;l<c;l+=1)p="",(!r||s!=="")&&(p+=Pw(e,t)),d=a[l],f=n[d],e.replacer&&(f=e.replacer.call(n,d,f)),Oo(e,t+1,d,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&ef===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=Pw(e,t)),Oo(e,t+1,f,!0,u)&&(e.dump&&ef===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,s+=p));e.tag=i,e.dump=s||"{}"}function HN(e,t,n){var r,s,i,a,l,c;for(s=n?e.explicitTypes:e.implicitTypes,i=0,a=s.length;i<a;i+=1)if(l=s[i],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof t=="object"&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(n?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(c=e.styleMap[l.tag]||l.defaultStyle,mI.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(gI.call(l.represent,c))r=l.represent[c](t,c);else throw new Wr("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function Oo(e,t,n,r,s,i,a){e.tag=null,e.dump=n,HN(e,n,!1)||HN(e,n,!0);var l=mI.call(e.dump),c=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var f=l==="[object Object]"||l==="[object Array]",u,p;if(f&&(u=e.duplicates.indexOf(n),p=u!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(s=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(FW(e,t,e.dump,s),p&&(e.dump="&ref_"+u+e.dump)):(DW(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?BN(e,t-1,e.dump,s):BN(e,t,e.dump,s),p&&(e.dump="&ref_"+u+e.dump)):($W(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&LW(e,e.dump,t,i,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Wr("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(d=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",e.dump=d+" "+e.dump)}return!0}function zW(e,t){var n=[],r=[],s,i;for(Iw(e,n,r),s=0,i=r.length;s<i;s+=1)t.duplicates.push(n[r[s]]);t.usedDuplicates=new Array(i)}function Iw(e,t,n){var r,s,i;if(e!==null&&typeof e=="object")if(s=t.indexOf(e),s!==-1)n.indexOf(s)===-1&&n.push(s);else if(t.push(e),Array.isArray(e))for(s=0,i=e.length;s<i;s+=1)Iw(e[s],t,n);else for(r=Object.keys(e),s=0,i=r.length;s<i;s+=1)Iw(e[r[s]],t,n)}function BW(e,t){t=t||{};var n=new PW(t);n.noRefs||zW(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),Oo(n,0,r,!0,!0)?n.dump+`
|
|
110
|
-
`:""}var HW=BW,VW={dump:HW};function Cv(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var WW=Cr,UW=zA,KW=WA,qW=GA,YW=XA,GW=kv,XW=hI.load,JW=hI.loadAll,QW=VW.dump,ZW=Wr,eU={binary:tI,float:YA,map:VA,null:UA,pairs:rI,set:sI,timestamp:ZA,bool:KA,int:qA,merge:eI,omap:nI,seq:HA,str:BA},tU=Cv("safeLoad","load"),nU=Cv("safeLoadAll","loadAll"),rU=Cv("safeDump","dump"),CI={Type:WW,Schema:UW,FAILSAFE_SCHEMA:KW,JSON_SCHEMA:qW,CORE_SCHEMA:YW,DEFAULT_SCHEMA:GW,load:XW,loadAll:JW,dump:QW,YAMLException:ZW,types:eU,safeLoad:tU,safeLoadAll:nU,safeDump:rU};const Ia=["requirement","planning","code","test","normal"],Tw={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},sU=["agent","control","provide","condition","jump","condition_jump","start","end"];function iU(e){return sU.includes(e)?e:"agent"}function oU(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function aU(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=CI.load(e);if(!n||typeof n!="object")return{error:"flow.yaml 格式无效:根内容不是对象"};const r=n,s=r.instances&&typeof r.instances=="object"?r.instances:{},i=Array.isArray(r.edges)?r.edges:Array.isArray((t=r.flow)==null?void 0:t.edges)?r.flow.edges:[],a=r.ui&&typeof r.ui=="object"?r.ui:{},l=a.nodePositions&&typeof a.nodePositions=="object"?a.nodePositions:{},c=a.nodeSizes&&typeof a.nodeSizes=="object"?a.nodeSizes:{},d=typeof a.description=="string"&&a.description.trim()?a.description.trim():void 0,f=new Set(Object.keys(s));for(const h of i)h!=null&&h.source&&f.add(String(h.source)),h!=null&&h.target&&f.add(String(h.target));const u=Array.from(f).map(h=>{const g=s[h],v=l[h]&&typeof l[h].x=="number"&&typeof l[h].y=="number"?{x:l[h].x,y:l[h].y}:{x:0,y:0},k=c[h]&&typeof c[h].width=="number"&&typeof c[h].height=="number"?{width:c[h].width,height:c[h].height}:null,y=(g==null?void 0:g.definitionId)??h,b=oU(y),w=(g==null?void 0:g.label)!=null?String(g.label):h,N=(g==null?void 0:g.role)!=null?String(g.role).trim():"",C=Tw[N]||N,j=Ia.includes(C)?C:"normal",T=(g==null?void 0:g.model)!=null?String(g.model).trim():void 0,$=(g==null?void 0:g.body)!=null?String(g.body):"",L=(g==null?void 0:g.script)!=null?String(g.script):"",F=Array.isArray(g==null?void 0:g.images)?g.images:[];return{id:h,type:iU(b),position:v,...k?{width:k.width,height:k.height}:{},data:{label:w,definitionId:y,schemaType:b,role:j,model:T||void 0,body:$,images:F,...k?{displaySize:k}:{},...L.trim()!==""?{script:L}:{}}}}),p=i.filter(h=>(h==null?void 0:h.source)&&(h==null?void 0:h.target)).map((h,g)=>({id:`e-${h.source}-${h.target}-${g}`,source:String(h.source),target:String(h.target),sourceHandle:h.sourceHandle??void 0,targetHandle:h.targetHandle??void 0,markerEnd:{type:us.ArrowClosed}}));return{nodes:u,edges:p,instances:s,description:d}}catch(n){const r=n instanceof Error?n.message:String(n);let s="";if(/bad indentation of a mapping entry|expected.*scalar|mapping values are not allowed/i.test(r)){const i=r.match(/\((\d+):/);s=`
|
|
111
|
-
|
|
112
|
-
💡 提示:通常由 ${i?`第 ${i[1]} 行附近`:""}的 \`script\` / \`body\` / \`value\` 字段裸写命令字符串引起。
|
|
113
|
-
YAML 中含 \`: \`、\`"\`、\`'\` 等特殊字符的多行字符串必须使用 \`|\` 块标量。
|
|
114
|
-
|
|
115
|
-
✅ 正确写法:
|
|
116
|
-
\`\`\`yaml
|
|
117
|
-
script: |
|
|
118
|
-
node -e "console.log('TODO: scripts/x.mjs')"
|
|
119
|
-
\`\`\`
|
|
120
|
-
❌ 错误写法(当前文件):
|
|
121
|
-
\`\`\`yaml
|
|
122
|
-
script: node -e "console.log('TODO: scripts/x.mjs')"
|
|
123
|
-
\`\`\``}return{error:`flow.yaml 解析失败:${r}${s}`}}}function jf(e,t){var s,i,a,l,c,d,f,u,p,h,g,v;const n=k=>{const y={type:(k==null?void 0:k.type)??"node",name:(k==null?void 0:k.name)??"",value:(k==null?void 0:k.value)??(k==null?void 0:k.default)??""};return(k==null?void 0:k.required)===!0&&(y.required=!0),(k==null?void 0:k.showOnNode)!=null&&(y.showOnNode=!!k.showOnNode),y},r={};for(const k of e){const y=t[k.id]&&typeof t[k.id]=="object"?{...t[k.id]}:{},b=((s=k.data)==null?void 0:s.definitionId)||k.id,w=((i=k.data)==null?void 0:i.inputs)??[],N=((a=k.data)==null?void 0:a.outputs)??[],C=((l=k.data)==null?void 0:l.role)!=null?String(k.data.role).trim():"",j=y.role!=null?String(y.role).trim():"",T=Tw[C]||C,$=Tw[j]||j,L=Ia.includes(T)?T:Ia.includes($)?$:"normal",F=Array.isArray(w)?w.map(n):Array.isArray(y.input)?y.input.map(K=>n(K)):[],A=Array.isArray(N)?N.map(n):Array.isArray(y.output)?y.output.map(K=>n(K)):[],R=((c=k.data)==null?void 0:c.label)!=null?String(k.data.label):y.label!=null?String(y.label):k.id,V=(d=k.data)==null?void 0:d.body,M=V!=null?String(V):y.body!=null?String(y.body):"";let D=((f=k.data)==null?void 0:f.model)!=null&&String(k.data.model).trim()!==""?String(k.data.model).trim():y.model!=null&&String(y.model).trim()!==""?String(y.model).trim():void 0;(D===""||D==="default")&&(D=void 0);const I={...y,definitionId:b,label:R,role:L,model:D,input:F,output:A},B=((u=k.data)==null?void 0:u.marketplaceRef)||y.marketplaceRef;B?I.marketplaceRef=String(B):delete I.marketplaceRef;const P=((p=k.data)==null?void 0:p.marketplacePackageId)||y.marketplacePackageId;P?I.marketplacePackageId=String(P):delete I.marketplacePackageId;const O=((h=k.data)==null?void 0:h.marketplaceVersion)||y.marketplaceVersion;O?I.marketplaceVersion=String(O):delete I.marketplaceVersion,b.startsWith("provide_")||M.trim()===""?delete I.body:I.body=M;const _=Array.isArray((g=k.data)==null?void 0:g.images)?k.data.images:Array.isArray(y.images)?y.images:[];_.length>0?I.images=_:delete I.images;const Y=(v=k.data)==null?void 0:v.script,Q=Y!=null?String(Y):y.script!=null?String(y.script):"";Q.trim()===""?delete I.script:I.script=Q,delete I.temperature,delete I.maxTokens,delete I.description,r[k.id]=I}return r}function wd(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function lU(e,t){const n=String(e||"node").replace(/_copy(?:_\d+)?$/i,"");let r=`${n}_copy`,s=2;for(;t.has(r);)r=`${n}_copy_${s}`,s+=1;return t.add(r),r}function EI(e,t,n){const r=(e||[]).filter(a=>a==null?void 0:a.selected);if(r.length===0)return null;const s=new Set(r.map(a=>a.id)),i=(t||[]).filter(a=>s.has(a.source)&&s.has(a.target));return{version:1,nodes:r.map(a=>wd(a)),edges:i.map(a=>wd(a)),instances:jf(r,n||{})}}function _I(e,t,n,r,s={}){var u;if(!e||!Array.isArray(e.nodes)||e.nodes.length===0)return null;const i=s.offset||{x:48,y:48},a=new Set((t||[]).map(p=>p.id)),l=new Map;for(const p of e.nodes)l.set(p.id,lU(p.id,a));const c=e.nodes.map(p=>{var g,v;const h=l.get(p.id);return{...wd(p),id:h,selected:!0,dragging:!1,position:{x:Number(((g=p.position)==null?void 0:g.x)||0)+i.x,y:Number(((v=p.position)==null?void 0:v.y)||0)+i.y}}}),d=(e.edges||[]).filter(p=>l.has(p.source)&&l.has(p.target)).map((p,h)=>{const g=l.get(p.source),v=l.get(p.target);return{...wd(p),id:`e-${g}-${v}-${Date.now()}-${h}`,source:g,target:v,selected:!1}}),f={...r||{}};for(const[p,h]of l.entries()){const g=(u=e.instances)==null?void 0:u[p];g&&(f[h]={...wd(g),label:g.label!=null?String(g.label):h})}return{nodes:[...(t||[]).map(p=>({...p,selected:!1})),...c],edges:[...(n||[]).map(p=>({...p,selected:!1})),...d],instances:f,pastedNodeIds:c.map(p=>p.id)}}function VN(e,t,n,r){var f,u,p,h;const s=jf(e,n),i=t.map(g=>({source:g.source,target:g.target,sourceHandle:g.sourceHandle??null,targetHandle:g.targetHandle??null})),a={},l={};for(const g of e){const v=g.position??{x:0,y:0};a[g.id]={x:v.x,y:v.y};const k=Number(((u=(f=g.data)==null?void 0:f.displaySize)==null?void 0:u.width)||g.width||0),y=Number(((h=(p=g.data)==null?void 0:p.displaySize)==null?void 0:h.height)||g.height||0);k>0&&y>0&&(l[g.id]={width:Math.round(k),height:Math.round(y)})}const c={nodePositions:a};Object.keys(l).length>0&&(c.nodeSizes=l),(r==null?void 0:r.description)!=null&&String(r.description).trim()!==""&&(c.description=String(r.description).trim());const d={instances:s,edges:i,ui:c};return CI.dump(d,{lineWidth:-1})}function cU(e){var s,i;const t={inputNames:[],outputNames:[]},n=Array.isArray((s=e.data)==null?void 0:s.inputs)?e.data.inputs:[],r=Array.isArray((i=e.data)==null?void 0:i.outputs)?e.data.outputs:[];for(let a=0;a<n.length;a++){const l=n[a],c=(l&&l.name!=null?String(l.name).trim():"")||`input-${a}`;t.inputNames.push(c)}for(let a=0;a<r.length;a++){const l=r[a],c=(l&&l.name!=null?String(l.name).trim():"")||`output-${a}`;t.outputNames.push(c)}return t}function uU(e,t,n){var c,d,f;const r=new Set(e.map(u=>u.id)),s={};for(const u of e)s[u.id]=cU(u);const i=new Map,a=new Map;for(const u of t)u.target&&r.has(u.target)&&(i.has(u.target)||i.set(u.target,new Set),u.targetHandle&&i.get(u.target).add(u.targetHandle)),u.source&&r.has(u.source)&&(a.has(u.source)||a.set(u.source,new Set),u.sourceHandle&&a.get(u.source).add(u.sourceHandle));const l=[];for(const u of e){const p=((c=u.data)==null?void 0:c.definitionId)!=null?String(u.data.definitionId):"",h=s[u.id]||{inputNames:[],outputNames:[]},g=h.inputNames.length,v=h.outputNames.length;if(!(p==="control_start"||p.startsWith("provide_"))&&g>0)for(let b=0;b<g;b++){const w=`input-${b}`;if(!((d=i.get(u.id))==null?void 0:d.has(w))){const C=h.inputNames[b]||w;l.push({nodeId:u.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:C,handle:w}),key:`${u.id}-${w}-in`})}}if(!(p==="control_end")&&v>0)for(let b=0;b<v;b++){const w=`output-${b}`;if(!((f=a.get(u.id))==null?void 0:f.has(w))){const C=h.outputNames[b]||w;l.push({nodeId:u.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:C,handle:w}),key:`${u.id}-${w}-out`})}}}return l}const lm=/\[image\s+(\d+)\]/gi;function is(e){return Array.isArray(e)?e.filter(t=>t&&typeof t=="object").map((t,n)=>({id:String(t.id||`image-${n+1}`),label:String(t.label||`image ${n+1}`),name:String(t.name||`image-${n+1}`),mimeType:String(t.mimeType||t.type||"image/png"),dataUrl:String(t.dataUrl||t.data||"")})).filter(t=>t.dataUrl.startsWith("data:image/")):[]}function dU(e){return`image ${is(e).length+1}`}function fU(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function pU(e,t){const n=is(e),r=String(t||""),s=new Set;lm.lastIndex=0;let i;for(;i=lm.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function hU(e){return new Promise((t,n)=>{if(!e||!String(e.type||"").startsWith("image/")){n(new Error("Only image files are supported"));return}const r=new FileReader;r.onload=()=>{t({name:e.name||"image",mimeType:e.type||"image/png",dataUrl:String(r.result||"")})},r.onerror=()=>n(r.error||new Error("Failed to read image")),r.readAsDataURL(e)})}function PI(e){var n;return Array.from(((n=e==null?void 0:e.clipboardData)==null?void 0:n.items)||[]).filter(r=>r.kind==="file"&&String(r.type||"").startsWith("image/")).map(r=>r.getAsFile()).filter(Boolean)}function cm(e){var t;return Array.from(((t=e==null?void 0:e.dataTransfer)==null?void 0:t.files)||[]).filter(n=>String(n.type||"").startsWith("image/"))}async function AI({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=is(n);for(const a of r){const l=await hU(a),c=dU(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=fU(s,c)}return{body:s,images:i}}function Rw(e){const t=e.type||"node",n=e.showOnNode!=null,r={type:t,name:e.name||"",default:e.value!==void 0&&e.value!==null?String(e.value):e.default!==void 0?String(e.default):""};return e.required!=null&&(r.required=!!e.required),r.showOnNode=n?!!e.showOnNode:!!r.required||String(t).trim().toLowerCase()==="node",r._showOnNodeExplicit=n,r}const mU={agent_subAgent:["SubAgent"],control_start:["Start"],control_end:["End"],control_agent_toBool:["Agent ToBool"],control_anyOne:["Any One"],control_cancelled:["Cancelled","Cancel Check"],control_cd_workspace:["CD Workspace"],control_delay:["Delay"],control_if:["If Branch"],control_interval_loop:["Interval Loop"],control_load_skills:["Load Skills"],control_load_mcp:["Load MCP"],control_user_workspace:["User Workspace"],control_toBool:["To Bool","Code ToBool"],control_wait_until:["Wait Until"],tool_git_checkout:["Git Checkout"],tool_get_env:["Get Env"],tool_load_key:["Load Key"],tool_nodejs:["Node.js Script"],tool_print:["Print"],tool_save_key:["Save Key"],tool_user_ask:["UserAsk"],tool_user_check:["User Confirm"],provide_file:["File"],provide_bool:["Boolean"],provide_text:["Text"],provide_str:["Text"],display_markdown:["Markdown Display"],display_mermaid:["Mermaid Display"],display_ascii:["ASCII Display"],display_chart:["Chart Display"],display_table:["Table Display"]};function gU(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(mU[e]||[]).includes(s)?r:s}const yU={tool_git_checkout:new Set(["targetDir","pullIfExists","includeSubmodules","workspaceContext","commit","changed"]),control_load_skills:new Set(["mergeMode","workspaceContext","skillsContext","loadedCount","summary"]),control_load_mcp:new Set(["workspaceContext","mcpContext","loadedCount","summary"]),agent_subAgent:new Set(["workspaceContext","skillsContext","mcpContext"])},xU={control_cd_workspace:new Set(["mode","label","cwd","previous"]),control_user_workspace:new Set(["cwd"]),tool_git_checkout:new Set(["branch","targetDir","pullIfExists","includeSubmodules","repoPath","commit","changed"]),tool_gitlab_create_mr:new Set(["repoPath","workspaceContext","sourceBranch","targetBranch","title","description","draft","labels","push","remote","tokenEnv","gitlabApiBase","removeSourceBranch","squash","created","mrIid","projectId","message"])};function wU(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function bU(e,t){const n=String((e==null?void 0:e.baseDefinitionId)||"").trim();if(!n)return t;const r=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{};return!!(r.entry||r.command)&&n==="tool_nodejs"?t:n}function WN(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var d,f;const i=n[s],l=n.find(u=>(u==null?void 0:u.name)&&u.name===r.name)||i;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((d=yU[e])==null?void 0:d.has(r.name));return{...r,...r.required==null&&l.required!=null?{required:!!l.required}:{},...c?{showOnNode:!0}:{},...!r._showOnNodeExplicit&&l.showOnNode!=null?{showOnNode:!!l.showOnNode}:{},...!r._showOnNodeExplicit&&l.showOnNode==null?{showOnNode:!!r.required||String(r.type||"").trim().toLowerCase()==="node"}:{},...(f=xU[e])!=null&&f.has(r.name)?{showOnNode:!1}:{}}})}function II(e){var s,i;const t=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.inputs)?e.data.inputs:[],n=Array.isArray((i=e==null?void 0:e.data)==null?void 0:i.outputs)?e.data.outputs:[],r=a=>a.map(l=>{const c=Rw(l);return{type:String(c.type||"node"),name:String(c.name??""),default:String(c.default??""),required:!!c.required,showOnNode:c.showOnNode!=null?c.showOnNode!==!1:!!c.required||String(c.type||"").trim().toLowerCase()==="node"}});return{inputs:r(t),outputs:r(n)}}function rf(e,t,n,r,s){var B,P,O,_,Y,Q,K,ie,fe,ye,we,ae,ge,_e,Ae,Ce,Ne,Ye,Ze,Ge,It;const i=((B=e.data)==null?void 0:B.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(qe=>qe.id===i),l=t[e.id];let c=[],d=[],f=((P=e.data)==null?void 0:P.label)??e.id,u,p,h,g,v;const k=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(Rw)),Array.isArray(l.output)&&(d=l.output.map(Rw)),l.label&&(f=String(l.label)),l.role&&typeof l.role=="string"&&(u=l.role),l.model!=null&&(p=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(g=l.images),l.script!=null&&(v=String(l.script)));const y=u??(typeof((O=e.data)==null?void 0:O.role)=="string"?e.data.role:"普通"),b=p??((_=e.data)==null?void 0:_.model)??void 0,w=(a==null?void 0:a.description)!=null?String(a.description).trim():"",N=w!==""?w:void 0,C=h??((Y=e.data)==null?void 0:Y.body)??"",j=Array.isArray(g)?g:Array.isArray((Q=e.data)==null?void 0:Q.images)?e.data.images:[],T=v!==void 0?v:((K=e.data)==null?void 0:K.script)!=null?String(e.data.script):"",$=String(e.id),L=(ie=r==null?void 0:r[s])==null?void 0:ie[$],F=(fe=L==null?void 0:L.label)==null?void 0:fe.label,A=L==null?void 0:L.body,R=L==null?void 0:L.description;k||(c.length===0&&((ye=a==null?void 0:a.inputs)!=null&&ye.length)&&(c=a.inputs.map(qe=>({...qe}))),d.length===0&&((we=a==null?void 0:a.outputs)!=null&&we.length)&&(d=a.outputs.map(qe=>({...qe}))));const V=bU(a,(a==null?void 0:a.id)??i),M=(l==null?void 0:l.marketplaceRef)||((ae=e.data)==null?void 0:ae.marketplaceRef)||wU(a);if(V==="agent_subAgent"&&!d.some(qe=>(qe==null?void 0:qe.name)==="result")){const qe=(ge=a==null?void 0:a.outputs)==null?void 0:ge.find(ct=>(ct==null?void 0:ct.name)==="result");d=[...d,qe?{...qe}:{type:"text",name:"result",default:""}]}if((V==="display_markdown"||V==="display_mermaid"||V==="display_ascii"||V==="display_chart"||V==="display_table")&&!d.some(qe=>(qe==null?void 0:qe.name)==="next")){const qe=(_e=a==null?void 0:a.outputs)==null?void 0:_e.find(ct=>(ct==null?void 0:ct.name)==="next");d=[...d,qe?{...qe}:{type:"node",name:"next",default:""}]}if(V==="workspace_run"){if(!c.some(qe=>(qe==null?void 0:qe.name)==="prev")){const qe=(Ae=a==null?void 0:a.inputs)==null?void 0:Ae.find(ct=>(ct==null?void 0:ct.name)==="prev");c=[qe?{...qe}:{type:"node",name:"prev",default:""},...c]}if(!d.some(qe=>(qe==null?void 0:qe.name)==="next")){const qe=(Ce=a==null?void 0:a.outputs)==null?void 0:Ce.find(ct=>(ct==null?void 0:ct.name)==="next");d=[...d,qe?{...qe}:{type:"node",name:"next",default:""}]}}c=WN(V,c,a==null?void 0:a.inputs),d=WN(V,d,a==null?void 0:a.outputs),V.startsWith("provide_")&&d[0]&&String(d[0].default??d[0].value??"").trim()===""&&String(C).trim()!==""&&(d=d.map((qe,ct)=>ct===0?{...qe,default:C,value:C}:qe));const D=gU(V,F||f,a),I=V==="tool_nodejs"||String(T).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:F||f,displayLabel:D,definitionDisplayName:a==null?void 0:a.displayName,definitionId:V,...M?{marketplaceRef:M}:{},...l!=null&&l.marketplacePackageId||(Ne=e.data)!=null&&Ne.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((Ye=e.data)==null?void 0:Ye.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(Ze=e.data)!=null&&Ze.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((Ge=e.data)==null?void 0:Ge.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((It=e.data)==null?void 0:It.schemaType)??e.type??"agent",role:y,model:b,body:A||C,images:j,script:T,inputs:c,outputs:d,description:R||N,originalLabel:f,originalBody:C,...I?{script:T}:{}}}}function TI(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var f,u,p,h;const s=n.get(r.source),i=n.get(r.target),a=((u=(f=s==null?void 0:s.data)==null?void 0:f.outputs)==null?void 0:u.length)??0,l=((h=(p=i==null?void 0:i.data)==null?void 0:p.inputs)==null?void 0:h.length)??0,c=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,d=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return s&&i&&c>=0&&c<a&&d>=0&&d<l})}function UN(e,t){const n=new RegExp(`^${t}-(\\d+)$`).exec(String(e||""));if(!n)return 0;const r=Number.parseInt(n[1],10);return Number.isFinite(r)&&r>=0?r:0}function KN(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function um(e,t){const n=String((t==null?void 0:t.source)||""),r=String((t==null?void 0:t.target)||"");if(!n||!r)return e;const s=UN(t==null?void 0:t.sourceHandle,"output"),i=UN(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var d,f,u,p;if(c.id===n){const h=KN((d=c.data)==null?void 0:d.outputs,s);if(h!==((f=c.data)==null?void 0:f.outputs))return a=!0,{...c,data:{...c.data,outputs:h}}}if(c.id===r){const h=KN((u=c.data)==null?void 0:u.inputs,i);if(h!==((p=c.data)==null?void 0:p.inputs))return a=!0,{...c,data:{...c.data,inputs:h}}}return c});return a?l:e}const qN=80,vU=220;function kU(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:i,measured:a,internals:l,...c}=e;return c}function SU(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function Mp(e,t,n){const r={nodes:Array.isArray(e)?e.map(kU):[],edges:Array.isArray(t)?t.map(SU):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function Ly(e,t){const n=[...e,t];return n.length>qN?n.slice(n.length-qN):n}function RI({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[i,a]=m.useState(0),l=m.useRef([]),c=m.useRef([]),d=m.useRef(null),f=m.useRef(null),u=m.useRef(null),p=m.useRef(null),h=m.useRef(!1),g=m.useCallback(()=>a(C=>C+1),[]),v=m.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),k=m.useCallback(()=>{v();const C=f.current,j=u.current;return f.current=null,u.current=null,!C||!j||C.signature===j.signature?(j&&(d.current=j),!1):(l.current=Ly(l.current,C),c.current=[],d.current=j,g(),!0)},[g,v]),y=m.useCallback((C=[],j=[],T={})=>{v(),l.current=[],c.current=[],f.current=null,u.current=null,d.current=Mp(C,j,T),h.current=!1,g()},[g,v]),b=m.useCallback(C=>{h.current=!0,d.current=C,f.current=null,u.current=null,v(),s==null||s(C.value),g()},[g,v,s]),w=m.useCallback(()=>{k();const C=d.current||Mp(e,t,n),j=l.current.pop();return j?(c.current=Ly(c.current,C),b(j),!0):(g(),!1)},[g,t,n,k,e,b]),N=m.useCallback(()=>{k();const C=d.current||Mp(e,t,n),j=c.current.pop();return j?(l.current=Ly(l.current,C),b(j),!0):(g(),!1)},[g,t,n,k,e,b]);return m.useEffect(()=>()=>v(),[v]),m.useEffect(()=>{if(!r)return;const C=Mp(e,t,n);if(!d.current){d.current=C;return}if(h.current){h.current=!1,d.current=C;return}C.signature!==d.current.signature&&(f.current||(f.current=d.current),u.current=C,v(),p.current=window.setTimeout(()=>{k()},vU))},[v,t,r,n,k,e]),{canUndo:l.current.length>0||!!f.current,canRedo:c.current.length>0,resetHistory:y,undo:w,redo:N,version:i}}function Un(e){switch(dm(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function dm(e){const t=String(e??"").trim().toLowerCase();return t==="文本"||t==="str"||t==="string"?"text":t==="文件"||t==="path"?"file":t==="节点"||t==="flow"||t==="control"?"node":t==="boolean"||t==="布尔"?"bool":t||"node"}function NU(e,t){const n=dm(e),r=dm(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const jU=new Set(["workspaceContext","skillsContext","mcpContext"]);function Lw(e){const t=dm(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&jU.has(n)?`${t}+${n}`:t}function LI(e){return Lw(e)}function Qc(e,t){if(!e||!t||!NU(e.type,t.type))return!1;const n=Lw(e),r=Lw(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function CU(e,t){const n=new RegExp(`^${t}-(\\d+)$`).exec(String(e||""));if(!n)return-1;const r=Number.parseInt(n[1],10);return Number.isFinite(r)?r:-1}function Zc(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=CU(t,n==="source"?"output":"input");return i<0?null:(Array.isArray((l=e==null?void 0:e.data)==null?void 0:l[r])?e.data[r]:[])[i]||null}function wo(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function EU(e){var r;const t=(r=e==null?void 0:e.definitionId)==null?void 0:r.trim();if(t&&t!=="普通")return t;const n=((e==null?void 0:e.schemaType)??"agent").toLowerCase();return n&&n!=="普通"?n:"agent"}function _U(e){const t=String(e||"").trim();return t?t.match(/^marketplace:/i)?"MARKETPLACE":t:""}function PU(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function er(e){e.stopPropagation()}function AU(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function IU(e,t){const n=`\\[${AU(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
124
|
-
`).replace(/\n{3,}/g,`
|
|
125
|
-
|
|
126
|
-
`).trimEnd()}function Oy(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function TU(e){const t=String(e||"");let n="",r=0;lm.lastIndex=0;let s;for(;s=lm.exec(t);)n+=Oy(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${Oy(s[0])}</span>`,r=s.index+s[0].length;return n+=Oy(t.slice(r)),n||" "}function RU(e,t){const n=window.getComputedStyle(e),r=Number.parseFloat(n.lineHeight)||18,s=Number.parseFloat(n.paddingTop)||0,i=Number.parseFloat(n.paddingBottom)||0,a=Number.parseFloat(n.borderTopWidth)||0,l=Number.parseFloat(n.borderBottomWidth)||0,c=String(t||"").split(/\r\n|\r|\n/).length,d=Math.min(Math.max(c,2),8);return Math.ceil(d*r+s+i+a+l)}function OI({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:d}){var xn,Dn;const{t:f}=hn(),u=(e==null?void 0:e.inputs)??[],p=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),g=EU(e),v=_U(g),k=(e==null?void 0:e.isRunMode)??!1,y=(e==null?void 0:e.isExecuting)??!1,b=(e==null?void 0:e.isDim)??!1,w=(e==null?void 0:e.nodeStatus)??null,N=(e==null?void 0:e.nodeElapsed)??null,C=(e==null?void 0:e.definitionId)||"",j=C.startsWith("provide_"),T=C==="provide_bool",$=C==="provide_str",L=C==="provide_file",F=C==="agent_subAgent",A=F&&!k,R=T?PU(p[0]):!1,V=j?String(((xn=p[0])==null?void 0:xn.value)??((Dn=p[0])==null?void 0:Dn.default)??(e==null?void 0:e.body)??""):"",M=String((e==null?void 0:e.body)||""),D=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||f("flow:node.fallbackLabel"),I=!j&&!A&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",B=is(e==null?void 0:e.images),P=m.useRef(!1),O=m.useRef(!1),_=m.useRef(null),Y=m.useRef(null),[Q,K]=m.useState(V),[ie,fe]=m.useState(M);m.useEffect(()=>{P.current||K(V)},[n,V]),m.useEffect(()=>{O.current||fe(M)},[n,M]),m.useEffect(()=>{const xe=_.current;if(!xe)return;const De=RU(xe,ie);xe.style.minHeight=`${De}px`,xe.style.height="",Y.current&&(Y.current.style.minHeight=`${De}px`,Y.current.style.height="")},[ie]);const ye=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],we=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],ae=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],ge=((e==null?void 0:e.model)??"").trim(),_e=h==="agent"&&!C.startsWith("tool_nodejs"),Ae=new Set(ye.map(wo)),Ce=new Set(we.map(wo)),Ne=new Set(ae.map(wo)),Ye=ge?ge.startsWith("cursor:")||ge.startsWith("opencode:")||ge.startsWith("claude-code:")?ge:Ne.has(ge)?`claude-code:${ge}`:Ce.has(ge)?`opencode:${ge}`:Ae.has(ge)?`cursor:${ge}`:ge:"",Ze=ge&&!Ye.startsWith("cursor:")&&!Ye.startsWith("opencode:")&&!Ye.startsWith("claude-code:")&&!Ae.has(ge)&&!Ce.has(ge)&&!Ne.has(ge),Ge=ge.startsWith("cursor:")?ge.slice(7):ge.startsWith("opencode:")?ge.slice(9):ge.startsWith("claude-code:")?ge.slice(12):ge,It=xe=>{const De=xe.target.value;d&&d(n,De)},qe=xe=>{xe.stopPropagation(),r&&r(n)},ct=xe=>{xe.stopPropagation(),s&&s()},Ht=xe=>{xe.stopPropagation(),i==null||i(n,xe.target.value==="true"?"true":"false")},Le=xe=>{xe.stopPropagation();const De=xe.target.value;K(De),P.current||i==null||i(n,De)},Jt=xe=>{xe.stopPropagation(),P.current=!0},Qt=xe=>{xe.stopPropagation(),P.current=!1;const De=xe.currentTarget.value;K(De),i==null||i(n,De)},Nn=()=>{i==null||i(n,Q)},ce=xe=>{xe.stopPropagation();const De=window.prompt("文件路径",Q);De!=null&&(K(De),i==null||i(n,De))},ee=xe=>{if(fe(xe),a==null||a(n,xe),l){const De=pU(B,xe);(De.length!==B.length||De.some((tn,Fn)=>{var st;return tn.id!==((st=B[Fn])==null?void 0:st.id)}))&&l(n,De)}},he=xe=>{xe.stopPropagation();const De=xe.target.value;O.current?fe(De):ee(De)},Me=xe=>{xe.stopPropagation(),O.current=!0},We=xe=>{xe.stopPropagation(),O.current=!1;const De=xe.currentTarget.value;ee(De)},Qe=()=>{ee(ie)},Gt=async xe=>{const De=await AI({files:xe,body:ie,images:B});De&&(fe(De.body),a==null||a(n,De.body),l==null||l(n,De.images))},mn=(xe,De)=>{xe.stopPropagation();const tn=B.filter(st=>st.id!==De.id),Fn=IU(ie,De.label);fe(Fn),a==null||a(n,Fn),l==null||l(n,tn)},gn=xe=>{const De=PI(xe);De.length!==0&&(xe.preventDefault(),xe.stopPropagation(),Gt(De).catch(()=>{}))},yn=xe=>{const De=cm(xe);De.length!==0&&(xe.preventDefault(),xe.stopPropagation(),Gt(De).catch(()=>{}))},Pr=()=>{const xe=_.current,De=Y.current;!xe||!De||(De.scrollTop=xe.scrollTop,De.scrollLeft=xe.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(y?" af-flow-node--executing":"")+(w==="success"?" af-flow-node--done":"")+(w==="failed"?" af-flow-node--failed":"")+(w==="running"&&!y?" af-flow-node--running-disk":"")+(b?" af-flow-node--dim":"")+(A?" af-flow-node--inline-body-editor":"")+" af-flow-node--"+h.replace(/[^a-z0-9_-]/g,""),"data-schema":h,children:[o.jsxs("div",{className:"af-flow-node__chrome",children:[o.jsx("span",{className:"af-flow-node__type",title:g,children:v}),!k&&_e&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:er,onMouseDown:er,onClick:er,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:Ye,onChange:It,onPointerDown:er,onMouseDown:er,onClick:er,"aria-label":f("flow:node.model"),title:Ge||f("flow:node.defaultModel"),children:[o.jsx("option",{value:"",children:f("flow:node.defaultModel")}),Ze&&o.jsx("option",{value:ge,children:ge}),ye.length>0&&o.jsx("optgroup",{label:"Cursor",children:ye.map(xe=>o.jsx("option",{value:`cursor:${wo(xe)}`,children:wo(xe)},`c-${xe}`))}),we.length>0&&o.jsx("optgroup",{label:"OpenCode",children:we.map(xe=>o.jsx("option",{value:`opencode:${wo(xe)}`,children:wo(xe)},`o-${xe}`))}),ae.length>0&&o.jsx("optgroup",{label:"Claude Code",children:ae.map(xe=>o.jsx("option",{value:`claude-code:${wo(xe)}`,children:wo(xe)},`cc-${xe}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),y&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),w==="running"&&!y&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:f("flow:node.diskRunning"),children:"RUNNING"}),w==="success"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:N!=null&&String(N).trim()!==""?N:"--"}),w==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!k&&j&&!T&&!$&&!L&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:ct,"aria-label":f("flow:node.expandProvide"),title:f("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!k&&o.jsx("button",{type:"button",className:"af-flow-node__delete",onClick:qe,"aria-label":f("flow:node.deleteNode"),title:f("flow:node.deleteNode"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-node__body",children:[o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:u.map((xe,De)=>{if(xe.showOnNode===!1)return null;const tn=f("flow:node.inputTooltip",{name:xe.name||`#${De}`,type:xe.type})+(xe.default!=null&&xe.default!==""?f("flow:node.defaultSuffix",{value:xe.default}):""),Fn=xe.name||`#${De+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:tn,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[Fn,xe.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(fs,{type:"target",position:Ke.Left,id:`input-${De}`,className:"af-flow-node__handle",style:{background:Un(xe.type)},title:tn})]},`in-${De}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[o.jsx("span",{className:"af-flow-node__title",children:D}),n?o.jsx("span",{className:"af-flow-node__subtitle",title:n,children:n}):null,T?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(R?" af-flow-node__bool-select--true":""),value:R?"true":"false",onChange:Ht,onPointerDown:er,onMouseDown:er,onClick:er,"aria-label":"Boolean value",title:R?"true":"false",children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):$?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:Q,onChange:Le,onCompositionStart:Jt,onCompositionEnd:Qt,onBlur:Nn,onPointerDown:er,onMouseDown:er,onClick:er,placeholder:"输入文本",rows:2}):L?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:er,onMouseDown:er,onClick:er,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:Q,onChange:Le,onCompositionStart:Jt,onCompositionEnd:Qt,onBlur:Nn,placeholder:"选择或输入文件路径",title:Q||"选择或输入文件路径"}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",onClick:ce,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):F&&!k?o.jsxs("div",{className:"af-flow-node__prompt-stack nodrag",onPointerDown:er,onMouseDown:er,onClick:er,children:[o.jsx("pre",{ref:Y,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:TU(ie)+`
|
|
127
|
-
`}}),o.jsx("textarea",{ref:_,className:"af-flow-node__prompt-editor nodrag",value:ie,onChange:he,onCompositionStart:Me,onCompositionEnd:We,onBlur:Qe,onPaste:gn,onDrop:yn,onScroll:Pr,onDragOver:xe=>{cm(xe).length>0&&xe.preventDefault()},placeholder:"输入 prompt",rows:2})]}):null,F&&B.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:B.map((xe,De)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:xe.name,children:[o.jsx("img",{src:xe.dataUrl,alt:""}),o.jsxs("span",{children:["[",xe.label||`image ${De+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",onClick:tn=>mn(tn,xe),onPointerDown:er,onMouseDown:er,"aria-label":`删除 ${xe.label||`image ${De+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},xe.id||De))}):null,I?o.jsx("span",{className:"af-flow-node__prompt-preview",title:I,children:I}):null]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:p.map((xe,De)=>{if(xe.showOnNode===!1)return null;const tn=f("flow:node.outputTooltip",{name:xe.name||`#${De}`,type:xe.type})+(xe.default!=null&&xe.default!==""?f("flow:node.defaultSuffix",{value:xe.default}):""),Fn=xe.name||`#${De+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:tn,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[Fn,xe.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(fs,{type:"source",position:Ke.Right,id:`output-${De}`,className:"af-flow-node__handle",style:{background:Un(xe.type)},title:tn})]},`out-${De}`)})})]})]})}const Cf="flowNode";function MI(e){if(!e||!(e instanceof Element))return!1;if(e.closest('[contenteditable="true"]'))return!0;const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function fm(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function LU(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function OU({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=hn(),a=m.useId(),l=m.useRef(null),[c,d]=m.useState(""),[f,u]=m.useState(!1),[p,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;d(""),h(""),u(!1);const y=requestAnimationFrame(()=>{var b;return(b=l.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(y)},[e,n]),!e)return null;const g=c.trim(),v=g===n;async function k(y){if(y.preventDefault(),!(!v||f)){u(!0),h("");try{const b=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:g})}),w=await b.json().catch(()=>({}));if(!b.ok){h(typeof w.error=="string"?w.error:i("project:archiveModal.archiveFailed"));return}s()}catch(b){h(String((b==null?void 0:b.message)||b))}finally{u(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:i("project:archiveModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":i("project:archiveModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:k,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:i("project:archiveModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:i("project:archiveModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:y=>d(y.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!v})]}),p?o.jsx("p",{className:"af-err af-new-pipeline-err",children:p}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:f,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!v||f,children:i(f?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function YN({open:e,title:t,message:n,confirmLabel:r,cancelLabel:s,destructive:i=!1,secondaryLabel:a,secondaryDestructive:l=!1,onSecondary:c,onConfirm:d,onCancel:f}){const{t:u}=hn(),p=m.useId(),h=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const y=requestAnimationFrame(()=>{var w;return(w=h.current)==null?void 0:w.focus()});function b(w){w.key==="Escape"&&f(),w.key==="Enter"&&d()}return window.addEventListener("keydown",b),()=>{cancelAnimationFrame(y),window.removeEventListener("keydown",b)}},[e,f,d]),!e)return null;const g=r??u("common:common.confirm","确定"),v=s??u("common:common.cancel","取消"),k=t??u("common:common.confirmTitle","请确认");return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&f()},children:o.jsxs("div",{ref:h,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":p,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:p,className:"af-shortcuts-panel__title",children:k}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:f,"aria-label":v,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-shortcuts-panel__body af-new-pipeline-form",children:[o.jsx("p",{className:"af-new-pipeline-lead",children:n}),o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:f,children:v}),a&&c?o.jsx("button",{type:"button",className:l?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:c,children:a}):null,o.jsx("button",{type:"button",className:i?"af-btn-primary af-btn-destructive":"af-btn-primary",onClick:d,autoFocus:!0,children:g})]})]})]})})}function MU({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=hn(),l=m.useId(),c=m.useRef(null),[d,f]=m.useState(""),[u,p]=m.useState(!1),[h,g]=m.useState("");if(m.useEffect(()=>{if(!e)return;f(""),g(""),p(!1);const b=requestAnimationFrame(()=>{var w;return(w=c.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(b)},[e,n]),!e)return null;const v=d.trim(),k=v===n;async function y(b){if(b.preventDefault(),!k||u)return;p(!0),g("");let w=null;try{const N=new AbortController;w=setTimeout(()=>N.abort(),15e3);const C=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:v,flowArchived:s}),signal:N.signal}),j=await C.json().catch(()=>({}));if(!C.ok){g(typeof j.error=="string"?j.error:a("project:deleteModal.deleteFailed"));return}try{for(let T=localStorage.length-1;T>=0;T--){const $=localStorage.key(T);$&&($.startsWith(`af:composer-sessions:${n}:${r}`)||$.startsWith(`af:composer-active-session:${n}:${r}`)||$.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem($)}}catch{}await i()}catch(N){if((N==null?void 0:N.name)==="AbortError"){g(a("project:deleteModal.deleteTimeout"));return}g(String((N==null?void 0:N.message)||N))}finally{w&&clearTimeout(w),p(!1)}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&t()},children:o.jsxs("div",{ref:c,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:l,className:"af-shortcuts-panel__title",children:a("project:deleteModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":a("project:deleteModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:y,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:a("project:deleteModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:a("project:deleteModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:d,onChange:b=>f(b.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":v.length>0&&!k})]}),h?o.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:u,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!k||u,children:a(u?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function $U({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Di({keys:e}){return o.jsx("span",{className:"af-shortcuts-keys",children:e.map((t,n)=>o.jsxs("span",{children:[n>0?o.jsx("span",{className:"af-shortcuts-keys__plus",children:"+"}):null,o.jsx($U,{children:t})]},n))})}function $I({open:e,onClose:t}){const{t:n}=hn(),r=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const a=requestAnimationFrame(()=>{var l;return(l=r.current)==null?void 0:l.focus()});return()=>cancelAnimationFrame(a)},[e]),!e)return null;const i=LU()?"⌘":"Ctrl";return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:a=>{a.target===a.currentTarget&&t()},children:o.jsxs("div",{ref:r,className:"af-shortcuts-panel",role:"dialog","aria-modal":"true","aria-labelledby":"af-shortcuts-title",tabIndex:-1,onMouseDown:a=>a.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:"af-shortcuts-title",className:"af-shortcuts-panel__title",children:n("flow:shortcuts.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":n("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-shortcuts-panel__body",children:[o.jsxs("section",{className:"af-shortcuts-section",children:[o.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.general")}),o.jsxs("ul",{className:"af-shortcuts-list",children:[o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveDesc")}),o.jsx(Di,{keys:[i,"S"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),o.jsx(Di,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Di,{keys:[i,"K"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.openNodePalette")}),o.jsx(Di,{keys:["A"]})]})]})]}),o.jsxs("section",{className:"af-shortcuts-section",children:[o.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.canvas")}),o.jsxs("ul",{className:"af-shortcuts-list",children:[o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectTool")}),o.jsx(Di,{keys:["V"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.panTool")}),o.jsx(Di,{keys:["H"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.holdSpacePan")}),o.jsx(Di,{keys:["Space"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),o.jsx(Di,{keys:[i,"A"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.undo")}),o.jsx(Di,{keys:[i,"Z"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.redo")}),o.jsx(Di,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function DU(e,t){if(!t)return 1;const n=t.toLowerCase(),r=(e.id||"").toLowerCase(),s=(e.label||"").toLowerCase(),i=(e.definitionId||"").toLowerCase();return r===n?100:r.startsWith(n)?80:r.includes(n)?60:s.startsWith(n)?40:s.includes(n)?30:i.includes(n)?15:0}function FU({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=hn(),[i,a]=m.useState(""),[l,c]=m.useState(0),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(!e)return;a(""),c(0);const g=requestAnimationFrame(()=>{var v;return(v=d.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(g)},[e]);const u=m.useMemo(()=>{const g=(r||[]).map(y=>{var b,w,N;return{id:y.id,label:((b=y.data)==null?void 0:b.label)||"",definitionId:((w=y.data)==null?void 0:w.definitionId)||"",schemaType:((N=y.data)==null?void 0:N.schemaType)||""}}),v=i.trim(),k=g.map(y=>({e:y,s:DU(y,v)})).filter(y=>y.s>0);return k.sort((y,b)=>b.s-y.s||y.e.id.localeCompare(b.e.id)),k.slice(0,50).map(y=>y.e)},[r,i]);if(m.useEffect(()=>{l>=u.length&&c(0)},[u.length,l]),m.useEffect(()=>{var v;const g=(v=f.current)==null?void 0:v.querySelector(`[data-idx="${l}"]`);g&&g.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=g=>{const v=u[g];v&&(n(v.id),t())},h=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),c(v=>Math.min(u.length-1,v+1));return}if(g.key==="ArrowUp"){g.preventDefault(),c(v=>Math.max(0,v-1));return}g.key==="Enter"&&(g.preventDefault(),p(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"af-jump-panel__input-wrap",children:[o.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:d,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:i,onChange:g=>{a(g.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:u.length})]}),u.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:f,className:"af-jump-panel__list",role:"listbox",children:u.map((g,v)=>o.jsxs("li",{"data-idx":v,role:"option","aria-selected":v===l,className:"af-jump-panel__item"+(v===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(v),onMouseDown:k=>{k.preventDefault(),p(v)},children:[o.jsx("span",{className:"af-jump-panel__id",children:g.id}),g.label&&g.label!==g.id&&o.jsx("span",{className:"af-jump-panel__label",children:g.label}),g.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:g.definitionId})]},g.id))}),o.jsxs("div",{className:"af-jump-panel__hint",children:[o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"↑"}),o.jsx("kbd",{className:"af-kbd",children:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function zU({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,filePath:i,fileName:a,onSaved:l,onAiEdit:c}){const{t:d}=hn(),f=m.useId(),u=m.useRef(null),p=m.useRef(null),[h,g]=m.useState(""),[v,k]=m.useState(""),[y,b]=m.useState(!1),[w,N]=m.useState(!1),[C,j]=m.useState(!1),[T,$]=m.useState(""),[L,F]=m.useState("");if(m.useEffect(()=>{if(!e||!i)return;g(""),k(""),$(""),F(""),b(!0),N(!1),j(!1);const I=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i});(async()=>{try{const P=await fetch(`/api/pipeline-file-content?${I}`),O=await P.json();if(!P.ok)throw new Error(O.error||"HTTP "+P.status);g(O.content||""),k(O.content||"")}catch(P){$(P.message||String(P))}finally{b(!1)}})();const B=requestAnimationFrame(()=>{var P;return(P=u.current)==null?void 0:P.focus()});return()=>cancelAnimationFrame(B)},[e,i,n,r,s]),!e)return null;const A=h!==v;async function R(I){if(I.preventDefault(),!w){N(!0),$(""),F("");try{const B=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i}),P=await fetch(`/api/pipeline-file-save?${B}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),O=await P.json();if(!P.ok)throw new Error(O.error||"HTTP "+P.status);k(h),F(d("flow:fileEdit.saved")),l&&l()}catch(B){$(B.message||String(B))}finally{N(!1)}}}async function V(){if(!(!c||C||!h)){j(!0),$("");try{const I=await c(h);typeof I=="string"&&I&&g(I)}catch(I){$(I.message||String(I))}finally{j(!1)}}}function M(){g(v),$(""),F("")}const D=h.length>1e5;return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:I=>{I.target===I.currentTarget&&t()},children:o.jsxs("div",{ref:u,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":f,tabIndex:-1,onMouseDown:I=>I.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:f,className:"af-shortcuts-panel__title",children:a||i}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":d("flow:fileEdit.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-file-edit-body",children:y?o.jsx("div",{className:"af-file-edit-loading",children:d("flow:fileEdit.loading")}):T&&!h?o.jsx("div",{className:"af-file-edit-error",children:T}):o.jsxs(o.Fragment,{children:[D&&o.jsx("div",{className:"af-file-edit-warning",children:d("flow:fileEdit.largeFileWarning")}),o.jsx("textarea",{ref:p,className:"af-file-edit-textarea",value:h,onChange:I=>g(I.target.value),spellCheck:!1,placeholder:d("flow:fileEdit.placeholder")})]})}),(T||L)&&!y&&o.jsx("div",{className:`af-file-edit-status${L?" af-file-edit-status--success":""}`,children:L||T}),o.jsxs("div",{className:"af-file-edit-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:M,disabled:!A||w||C,children:d("flow:fileEdit.reset")}),c&&o.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:V,disabled:C||w||!h,children:d(C?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),o.jsx("button",{type:"button",className:"af-btn-primary",onClick:R,disabled:!A||w||C,children:d(w?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const DI=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),BU=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function HU(e,t){const n=e.slice(0,t),r=n.lastIndexOf("${");if(r<0)return null;const s=n.slice(r+2);return s.includes("}")?null:{atIndex:r,query:s}}function VU(e){const t=/\$\{([^}]*)\}/g,n=[];let r;for(;(r=t.exec(e))!==null;)n.push({start:r.index,end:r.index+r[0].length,key:r[1]});return n}function GN(e){const t=new Set;if(!Array.isArray(e))return t;for(const n of e){const r=(n==null?void 0:n.name)!=null?String(n.name).trim():"";r&&t.add(r)}return t}function FI(e,{inputNames:t,outputNames:n}){const r=e.trim();if(!r)return!1;if(r.startsWith("input.")){const s=r.slice(6).trim();return s!==""&&t.has(s)}if(r.startsWith("output.")){const s=r.slice(7).trim();return s!==""&&n.has(s)}if(DI.has(r)||t.has(r)||n.has(r))return!0;if(!r.includes(".")){const s=`${r}.md`;if(t.has(s)||n.has(s))return!0}return!1}function zI(e){return{inputNames:GN(e==null?void 0:e.inputs),outputNames:GN(e==null?void 0:e.outputs)}}function WU(e,t,n){const r=zI(t),s=VU(e),i=[];for(const a of s)if(!FI(a.key,r)){const l=a.key.trim()===""?n("flow:placeholder.empty"):a.key.trim();i.push({start:a.start,end:a.end,message:n("flow:placeholder.invalidPlaceholder",{hint:l})})}return i}function UU(e,t){const n=zI(t),r=/\$\{([^}]*)\}/g,s=[];let i=0,a;for(;(a=r.exec(e))!==null;){a.index>i&&s.push({kind:"plain",text:e.slice(i,a.index)});const l=a[0],c=FI(a[1],n);s.push({kind:c?"ph-valid":"ph-invalid",text:l}),i=a.index+l.length}return i<e.length&&s.push({kind:"plain",text:e.slice(i)}),s}function KU(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function qU(e){return e.map(t=>{const n=KU(t.text);return t.kind==="ph-invalid"?`<span class="af-body-ph-invalid">${n}</span>`:t.kind==="ph-valid"?`<span class="af-body-ph-valid">${n}</span>`:n}).join("")}function YU(e,t){const n=[];for(const r of(e==null?void 0:e.inputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"input",insert:`input.${s}`,label:s,subtitle:i?t("flow:placeholder.inputSubtitle",{type:i}):t("flow:placeholder.inputSubtitleNoType")})}for(const r of(e==null?void 0:e.outputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"output",insert:`output.${s}`,label:s,subtitle:i?t("flow:placeholder.outputSubtitle",{type:i}):t("flow:placeholder.outputSubtitleNoType")})}for(const r of BU)DI.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function GU(e,t){const n=t.toLowerCase();return n?e.filter(r=>[r.insert,r.label,r.subtitle??""].map(i=>String(i).toLowerCase()).some(i=>i.includes(n))):e}function XU(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),s=document.createElement("div");s.setAttribute("aria-hidden","true"),s.style.visibility="hidden",s.style.position="fixed",s.style.top="0",s.style.left="-99999px",s.style.whiteSpace="pre-wrap",s.style.wordWrap="break-word",s.style.overflow="hidden";const i=e.clientWidth;if(i<=0)return null;s.style.width=`${i}px`,s.style.font=r.font,s.style.lineHeight=r.lineHeight,s.style.padding=r.padding,s.style.border=r.border,s.style.boxSizing=r.boxSizing,s.style.letterSpacing=r.letterSpacing,s.style.textIndent=r.textIndent,s.style.tabSize=r.tabSize||"8",s.textContent=e.value.slice(0,n);const a=document.createElement("span");a.textContent="",s.appendChild(a),document.body.appendChild(s);const l=a.getBoundingClientRect(),c=parseFloat(r.lineHeight),d=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:d}}function $p({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:c,onImagesChange:d}){const{t:f}=hn(),u=m.useId(),p=m.useRef(null),h=m.useRef(null),[g,v]=m.useState(0),[k,y]=m.useState(0),[b,w]=m.useState(null),N=m.useMemo(()=>is(c),[c]),C=m.useMemo(()=>WU(e,a,f),[e,a,f]),j=C.length>0,T=m.useMemo(()=>UU(e,a),[e,a]),$=m.useMemo(()=>qU(T),[T]),L=m.useMemo(()=>n?null:HU(e,g),[e,g,n]),F=m.useMemo(()=>{if(!L)return[];const I=YU(a,f);return GU(I,L.query)},[L,a,f]);m.useEffect(()=>{y(I=>{const B=Math.max(0,F.length-1);return Math.min(Math.max(0,I),B)})},[F.length]);const A=m.useCallback(()=>{const I=p.current;if(!I||!L||F.length===0){w(null);return}const B=XU(I,g);if(!B){w(null);return}const P=4,O=44,_=13.5*16,Y=Math.min(F.length*O+8,_);let Q=B.bottom+P;Q+Y>window.innerHeight-8&&(Q=Math.max(8,B.top-Y-P));const K=288;let ie=B.left;ie=Math.max(8,Math.min(ie,window.innerWidth-K-8)),w({top:Q,left:ie})},[L,F.length,g]);m.useLayoutEffect(()=>{if(!L||F.length===0){w(null);return}const I=requestAnimationFrame(()=>A());return()=>cancelAnimationFrame(I)},[L,F.length,g,e,A]),m.useEffect(()=>{if(!L||F.length===0)return;const I=()=>A();return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[L,F.length,A]);const R=m.useCallback(I=>{if(!L)return;const{atIndex:B}=L,P=e.slice(0,B)+"${"+I+"}"+e.slice(g);t(P);const O=B+I.length+3;queueMicrotask(()=>{const _=p.current;_&&(_.focus(),_.setSelectionRange(O,O)),v(O)})},[L,e,g,t]),V=m.useCallback(()=>{const I=p.current,B=h.current;!I||!B||(B.scrollTop=I.scrollTop,B.scrollLeft=I.scrollLeft,L&&F.length>0&&queueMicrotask(()=>A()))},[L,F.length,A]),M=m.useCallback(I=>{if(!n&&L&&F.length>0&&(I.key==="ArrowDown"||I.key==="ArrowUp"||I.key==="Enter")){if(I.key==="ArrowDown")I.preventDefault(),y(B=>(B+1)%F.length);else if(I.key==="ArrowUp")I.preventDefault(),y(B=>(B-1+F.length)%F.length);else if(I.key==="Enter"&&!I.shiftKey){I.preventDefault();const B=F[k];B&&R(B.insert)}}},[n,L,F,k,R]),D=m.useCallback(async I=>{if(n||typeof d!="function")return!1;const B=await AI({files:I,body:e,images:N});return B?(t(B.body),d(B.images),queueMicrotask(()=>{const P=p.current;if(!P)return;P.focus();const O=B.body.length;P.setSelectionRange(O,O),v(O)}),!0):!1},[n,N,t,d,e]);return o.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[N.length>0?o.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:N.map((I,B)=>o.jsxs("span",{className:"af-body-image-chip",title:I.name,children:[o.jsx("img",{src:I.dataUrl,alt:""}),o.jsxs("span",{children:["[",I.label||`image ${B+1}`,"]"]})]},I.id||B))}):null,o.jsxs("div",{className:"af-body-prompt-stack",children:[o.jsx("pre",{ref:h,className:"af-body-prompt-backdrop "+i,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:$+`
|
|
128
|
-
`}}),o.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":j,"aria-describedby":j?u:void 0,onChange:I=>{t(I.target.value),v(I.target.selectionStart??I.target.value.length)},onSelect:I=>{const B=I.target;B instanceof HTMLTextAreaElement&&v(B.selectionStart??0)},onClick:I=>{const B=I.target;B instanceof HTMLTextAreaElement&&v(B.selectionStart??0)},onKeyUp:I=>{const B=I.target;B instanceof HTMLTextAreaElement&&v(B.selectionStart??B.value.length)},onKeyDown:M,onPaste:I=>{const B=PI(I);B.length!==0&&(I.preventDefault(),D(B).catch(()=>{}))},onDragOver:I=>{cm(I).length>0&&I.preventDefault()},onDrop:I=>{const B=cm(I);B.length!==0&&(I.preventDefault(),D(B).catch(()=>{}))},onScroll:V})]}),L&&F.length>0&&b?ts.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":f("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:b.top,left:b.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:F.map((I,B)=>o.jsx("li",{role:"option","aria-selected":B===k,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(B===k?" af-composer-mention-item--active":""),onMouseDown:P=>P.preventDefault(),onMouseEnter:()=>y(B),onClick:()=>R(I.insert),children:[o.jsx("span",{className:"af-composer-mention-id",children:`\${${I.insert}}`}),I.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:I.subtitle}):null]})},`${I.section}-${I.insert}`))}),document.body):null,j?o.jsx("p",{id:u,className:"af-body-ph-issues",role:"status",children:C.map(I=>I.message).join(" · ")}):null]})}const BI=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Dp(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function XN({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=hn(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=u=>r(n.filter((p,h)=>h!==u)),d=(u,p,h)=>{const g=n.map((v,k)=>{if(k!==u)return v;const y={...v,[p]:h};return p==="required"&&h===!0&&(y.showOnNode=!0),y});r(g)},f=e==="input"?"input":"output";return o.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[o.jsxs("div",{className:"af-node-props-io-head",children:[o.jsx("span",{className:"af-node-props-label",children:t}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:s,"aria-label":a("flow:nodeProps.addPinAriaLabel",{label:t}),children:a("flow:nodeProps.addPin")})]}),o.jsx("p",{className:"af-node-props-io-hint",children:a("flow:nodeProps.handleHint",{prefix:f})}),n.length===0?o.jsx("p",{className:"af-node-props-io-empty",children:a(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?o.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[o.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[o.jsx("span",{children:a("flow:nodeProps.handle")}),o.jsx("span",{children:a("flow:nodeProps.type")}),o.jsx("span",{children:a("flow:nodeProps.name")}),o.jsx("span",{children:a("flow:nodeProps.defaultValue")}),o.jsx("span",{children:a("flow:nodeProps.required")}),o.jsx("span",{children:a("flow:nodeProps.showOnNode")}),o.jsx("span",{})]}),n.map((u,p)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${f}-${p}`,children:[f,"-",p]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:u.type,onChange:h=>d(p,"type",h.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:p}),children:["node","text","file","bool"].map(h=>o.jsx("option",{value:h,children:h},h))}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:u.name,onChange:h=>d(p,"name",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:p})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:u.default,onChange:h=>d(p,"default",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:p})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!u.required,onChange:h=>{i||d(p,"required",h.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:p})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:u.showOnNode!==!1,onChange:h=>d(p,"showOnNode",h.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:p})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(p),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:p}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${f}-${p}`))]}):null]})}function HI({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:d=!1,error:f,ioSlots:u}){const{t:p}=hn(),[h,g]=m.useState(!1),[v,k]=m.useState(!1),[y,b]=m.useState({status:"idle",message:""}),w=m.useCallback(R=>{t(V=>V&&{...V,...R})},[t]),{cursorList:N,opencodeList:C,claudeCodeList:j,currentNotInLists:T}=m.useMemo(()=>{const R=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],V=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],M=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],D=new Set([...R,...V,...M].map(Dp)),I=((e==null?void 0:e.model)??"").trim(),B=I.startsWith("cursor:")?I.slice(7):I.startsWith("opencode:")?I.slice(9):I.startsWith("claude-code:")?I.slice(12):I,P=I&&!D.has(B)?I:"";return{cursorList:R,opencodeList:V,claudeCodeList:M,currentNotInLists:P}},[s,e==null?void 0:e.model]);if(!e)return null;const $=String(e.script??""),L=n==="tool_nodejs"||$.trim()!=="",F=typeof c=="function"&&!i&&(e==null?void 0:e.newId),A=async()=>{if(F){b({status:"running",message:p("flow:nodeProps.publishRunning")});try{const R=await c(e,n);b({status:"success",message:R!=null&&R.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:R.definitionId}):p("flow:nodeProps.publishSuccess")})}catch(R){b({status:"error",message:String((R==null?void 0:R.message)||R)})}}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:p("flow:nodeProps.title")}),o.jsxs("div",{className:"af-node-props-head-actions",children:[o.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:A,disabled:!F||y.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),y.status==="running"?p("flow:nodeProps.publishing"):p("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:p("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[f?o.jsx("p",{className:"af-err af-node-props-err",children:f}):null,y.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${y.status}`,children:y.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.nodeType")}),o.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:R=>w({newId:R.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":p("flow:nodeProps.instanceId")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:R=>w({label:R.target.value}),disabled:i,spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:Ia.includes(e.role)?e.role:p("flow:roles.normal"),onChange:R=>w({role:R.target.value}),disabled:i,children:Ia.map(R=>o.jsx("option",{value:R,children:R},R))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:p("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const R=(e.model||"").trim();return R?T||R:""})(),onChange:R=>w({model:R.target.value}),disabled:i,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),T?o.jsxs("option",{value:T,children:[T,p("flow:nodeProps.yamlValueNotInList")]}):null,N.length>0?o.jsx("optgroup",{label:"Cursor",children:N.map(R=>o.jsx("option",{value:Dp(R),children:R},`c-${R}`))}):null,C.length>0?o.jsx("optgroup",{label:"OpenCode",children:C.map(R=>o.jsx("option",{value:Dp(R),children:R},`o-${R}`))}):null,j.length>0?o.jsx("optgroup",{label:"Claude Code",children:j.map(R=>o.jsx("option",{value:`claude-code:${Dp(R)}`,children:R},`cc-${R}`))}):null]})]}),o.jsx(XN,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:R=>w({inputs:R}),disabled:i,requiredReadonly:!d}),o.jsx(XN,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:R=>w({outputs:R}),disabled:i,requiredReadonly:!d}),L?o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>k(!0),"aria-label":p("flow:nodeProps.expandEditScript"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx($p,{value:$,onChange:R=>w({script:R}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:u,variant:"drawer"})]}):null,o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>g(!0),"aria-label":p("flow:nodeProps.expandEdit"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx($p,{value:e.body,onChange:R=>w({body:R}),images:e.images,onImagesChange:R=>w({images:R}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:u,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||p("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),v?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:R=>{R.target===R.currentTarget&&k(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>k(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx($p,{value:$,onChange:R=>w({script:R}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null,h?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editUserPrompt"),onMouseDown:R=>{R.target===R.currentTarget&&g(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>g(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx($p,{value:e.body,onChange:R=>w({body:R}),images:e.images,onImagesChange:R=>w({images:R}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null]})}function Ev(e){var n;if(e.displayKind==="image"||e.encoding==="base64"&&((n=e.mimeType)!=null&&n.startsWith("image/")))return"image";if(e.displayKind==="json"||e.mimeType==="application/json")return"json";if(e.displayKind==="markdown"||e.mimeType==="text/markdown")return"markdown";if(e.displayKind==="text")return"text";const t=(e.content||"").trim();if(t&&(t.startsWith("{")||t.startsWith("[")))try{return JSON.parse(t),"json"}catch{}return"text"}function JU(e){const t=Ev(e);if(t==="image"){const n=(e.mimeType||"image/png").split("/")[1];return n?n.toUpperCase():"IMAGE"}return t==="json"?"JSON":t==="markdown"?"MD":null}function VI(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function JN({text:e}){const{t}=hn(),n=e||"";return n.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(Nf,{children:n})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function QN({o:e}){var r;const{t}=hn(),n=Ev(e);if(n==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/"))){const i=`data:${e.mimeType||"image/png"};base64,${e.content||""}`;return o.jsxs("div",{className:"af-run-ctx-media",children:[o.jsx("img",{className:"af-run-ctx-img",src:i,alt:e.slot||"output",loading:"lazy"}),e.truncated?o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.imageTruncated")}):null]})}if(n==="json")return o.jsx("pre",{className:"af-run-ctx-pre",children:VI(e.content||"")});if(n==="markdown"){const s=e.content||"";return s.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(Nf,{children:s})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}return o.jsx("pre",{className:"af-run-ctx-pre",children:e.content!=null&&e.content!==""?e.content:t("flow:runContext.empty")})}function ZN(e){return JU(e)}function ej(e){var r;if(!e)return null;const t=Ev(e);if(t==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/")))return null;const n=e.content;return n==null||n===""?null:t==="json"?VI(String(n)):String(n)}function tj({text:e,title:t,copiedLabel:n}){const[r,s]=m.useState(!1);if(!e)return null;const i=async()=>{try{await navigator.clipboard.writeText(e),s(!0),window.setTimeout(()=>s(!1),1400)}catch{}};return o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-copy-btn",onClick:i,title:r?n:t,"aria-label":r?n:t,children:o.jsx("span",{className:"material-symbols-outlined",children:r?"check":"content_copy"})})}const nj=2e4,WI="af:run-node-ctx-width";function hh(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function pa(e){const n=Math.max(280,Math.min(Math.floor(window.innerWidth*.92),1200));return Number.isFinite(e)?Math.min(Math.max(Math.round(e),200),n):pa(hh())}function QU(){try{const e=localStorage.getItem(WI);if(e==null)return pa(hh());const t=parseInt(e,10);return Number.isFinite(t)?pa(t):pa(hh())}catch{return pa(hh())}}async function rj(e,t,n,r){const s=new URLSearchParams({flowId:e,instanceId:t});n&&String(n).trim()&&s.set("runId",String(n).trim());const i=await fetch(`/api/node-exec-context?${s.toString()}`,{signal:r}),a=await i.text();let l;try{l=JSON.parse(a)}catch{throw new Error(a.startsWith("<!")||a.startsWith("<html")?"apiConnectError":"invalidJson")}if(!i.ok)throw new Error(l.error||"HTTP "+i.status);return l}function ZU(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function e7({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:s}){const{t:i}=hn(),[a,l]=m.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,d]=m.useState(QU),f=m.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[u,p]=m.useState(!0),[h,g]=m.useState(""),[v,k]=m.useState([]),[y,b]=m.useState(null),[w,N]=m.useState(null),C=m.useRef(null),j=m.useRef(null),T=m.useRef(0),$=m.useRef(0);m.useLayoutEffect(()=>{const P=window.matchMedia("(max-width: 960px)"),O=()=>l(P.matches);return P.addEventListener("change",O),()=>P.removeEventListener("change",O)},[]),m.useEffect(()=>{function P(){d(O=>pa(O))}return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const L=m.useCallback(()=>{d(P=>{const O=pa(P);try{localStorage.setItem(WI,String(O))}catch{}return O})},[]),F=m.useCallback(P=>{if(a||P.button!==0)return;P.preventDefault();const O=P.currentTarget;f.current={active:!0,pointerId:P.pointerId,startX:P.clientX,startW:c},O.setPointerCapture(P.pointerId)},[a,c]),A=m.useCallback(P=>{const O=f.current;if(!O.active||P.pointerId!==O.pointerId)return;const _=O.startX-P.clientX;d(pa(O.startW+_))},[]),R=m.useCallback(P=>{const O=f.current;if(!(!O.active||P.pointerId!==O.pointerId)){O.active=!1;try{P.currentTarget.releasePointerCapture(P.pointerId)}catch{}L()}},[L]),V=m.useCallback(()=>{const P=f.current;P.active&&(P.active=!1,L())},[L]),M=m.useCallback(P=>{const O=Array.isArray(P)?P:[];k(O),b(_=>_&&O.some(Y=>Y.execId===_)?_:O.length>0?O[O.length-1].execId:null)},[]),D=m.useCallback(()=>{if(!e||!t)return;const P=++T.current,O=new AbortController,_=window.setTimeout(()=>O.abort(),nj);(async()=>{try{const Y=await rj(t,e,n,O.signal);if(P!==T.current)return;M(Array.isArray(Y.rounds)?Y.rounds:[])}catch{}finally{window.clearTimeout(_)}})()},[e,t,n,M]);m.useEffect(()=>{if(!e||!t){p(!1),g(""),k([]);return}const P=++$.current;p(!0),g(""),k([]),b(null);const O=new AbortController,_=window.setTimeout(()=>O.abort(),nj);return(async()=>{try{const Y=await rj(t,e,n,O.signal);if(P!==$.current)return;M(Array.isArray(Y.rounds)?Y.rounds:[])}catch(Y){if(P!==$.current)return;const Q=(Y==null?void 0:Y.name)==="AbortError"?"requestTimeout":Y.message||String(Y);g(Q)}finally{window.clearTimeout(_),P===$.current&&p(!1)}})(),()=>{O.abort(),$.current++,T.current++}},[e,t,n,M]),m.useEffect(()=>{r&&D()},[r,D]),m.useEffect(()=>{clearInterval(j.current);const P=v.length>0?v[v.length-1]:null;return(r==="running"&&v.length===0||!!(P&&P.status==="running"))&&e&&t&&(j.current=setInterval(()=>D(),2e3)),()=>clearInterval(j.current)},[v,e,t,n,r,D]),m.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[y]);const I=v.find(P=>P.execId===y),B=a?void 0:{width:`${c}px`};return o.jsxs("aside",{className:"af-run-ctx-panel",style:B,"aria-label":i("flow:runContext.title"),children:[a?null:o.jsx("div",{className:"af-run-ctx-resize",role:"separator","aria-orientation":"vertical","aria-label":i("flow:runContext.resizeHandle"),onPointerDown:F,onPointerMove:A,onPointerUp:R,onPointerCancel:R,onLostPointerCapture:V}),o.jsxs("div",{className:"af-run-ctx-panel__main",children:[o.jsxs("div",{className:"af-run-ctx-head",children:[o.jsx("h2",{className:"af-run-ctx-title",title:e,children:e}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:s,"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),u&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("common:common.loading")}),h&&o.jsx("div",{className:"af-run-ctx-error",children:ZU(i,h)}),!u&&!h&&v.length===0&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),v.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+n7((I==null?void 0:I.status)||""),children:[o.jsx("span",{className:"af-run-ctx-round-dot","aria-hidden":!0}),o.jsx("select",{className:"af-run-ctx-round-select",value:String(y??""),onChange:P=>{const O=P.target.value;b(O==="latest"?"latest":Number(O))},children:[...v].reverse().map(P=>{const O=P.execId==="latest"?i("flow:runContext.latest"):`#${P.execId}`,_=r7(i,P.status),Y=P.finishedAt?` · ${t7(P.finishedAt)}`:"";return o.jsx("option",{value:String(P.execId),children:`${O} · ${_}${Y}`},P.execId)})})]}),I&&o.jsxs("div",{className:"af-run-ctx-body",ref:C,children:[I.inputs&&I.inputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"input"}),"Inputs"]}),I.inputs.map((P,O)=>o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsx("div",{className:"af-run-ctx-slot-head",children:o.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot})}),o.jsx("pre",{className:"af-run-ctx-slot-text",children:P.value})]},`${P.slot}-${O}`))]}),I.prompt!=null&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>N("prompt"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(JN,{text:I.prompt})]}),I.outputs&&I.outputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>N("output"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),I.outputs.map((P,O)=>{const _=ZN(P),Y=ej(P);return o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot}),_?o.jsx("span",{className:"af-run-ctx-format-badge",title:i("flow:runContext.detectedContentType"),children:_}):null,o.jsx(tj,{text:Y,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(QN,{o:P})]},`${P.slot}-${O}`)})]}),!I.prompt&&(!I.outputs||I.outputs.length===0)&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("flow:runContext.roundNoContent")})]})]})]}),w&&I&&o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:P=>{P.target===P.currentTarget&&N(null)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:w==="prompt"?"Prompt":"Outputs"}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>N(null),"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[w==="prompt"&&I.prompt!=null&&o.jsx(JN,{text:I.prompt}),w==="output"&&I.outputs&&I.outputs.map((P,O)=>{const _=ZN(P),Y=ej(P);return o.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot}),_?o.jsx("span",{className:"af-run-ctx-format-badge",children:_}):null,o.jsx(tj,{text:Y,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(QN,{o:P})]},`${P.slot}-${O}`)})]})]})})]})}function t7(e){try{const t=new Date(e);if(isNaN(t.getTime()))return e;const n=r=>String(r).padStart(2,"0");return`${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}catch{return e}}function n7(e){const t=String(e||"").toLowerCase();return t==="success"||t==="completed"||t==="done"?"success":t==="failed"||t==="error"?"failed":t==="running"||t==="executing"?"running":t==="cache_not_met"?"cache":t?"unknown":"pending"}function r7(e,t){const n=String(t||"").toLowerCase();return n?n==="success"||n==="completed"||n==="done"?e("flow:runContext.statusSuccess",{defaultValue:"成功"}):n==="failed"||n==="error"?e("flow:runContext.statusFailed",{defaultValue:"失败"}):n==="running"||n==="executing"?e("flow:runContext.statusRunning",{defaultValue:"运行中"}):n==="cache_not_met"?e("flow:runContext.statusCacheMiss",{defaultValue:"缓存失效"}):t:e("flow:runContext.statusPending",{defaultValue:"等待"})}function s7({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:s,nodes:i,onCliInputsChange:a,onBackToEdit:l}){const{t:c}=hn(),[d,f]=m.useState({}),[u,p]=m.useState(null),[h,g]=m.useState({}),[v,k]=m.useState(!0),[y,b]=m.useState(!1),[w,N]=m.useState(""),[C,j]=m.useState(!1),[T,$]=m.useState(null),L=m.useRef(null),F=m.useRef(!0),A=m.useRef({});m.useMemo(()=>{var _,Y,Q;const O={};for(const K of r){const ie=(Q=(Y=(_=K.data)==null?void 0:_.outputs)==null?void 0:Y[0])==null?void 0:Q.default;ie!=null&&ie!==""&&(O[K.id]=String(ie))}return A.current=O,O},[r]);const R=m.useMemo(()=>{var _;const O={};for(const Y of i){if(!((_=Y.data)!=null&&_.inputs))continue;const Q=Y.data.inputs;for(let K=0;K<Q.length;K++){const ie=Q[K];if(!(ie!=null&&ie.name))continue;const fe=s.find(we=>we.target===Y.id&&we.targetHandle===`input-${K}`);if(!(fe!=null&&fe.source))continue;r.find(we=>we.id===fe.source)&&(O[fe.source]=ie.name)}}return O},[i,s,r]);m.useEffect(()=>(F.current=!0,()=>{F.current=!1}),[]),m.useEffect(()=>{if(!e){k(!1);return}k(!0);const O=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&O.set("archived","1"),fetch(`/api/flow/run-config?${O.toString()}`).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.json()}).then(_=>{var Q;if(!F.current)return;f(_.presets||{}),p(_.activePreset||null);const Y=_.activePreset&&((Q=_.presets)!=null&&Q[_.activePreset])?_.presets[_.activePreset]:{};g({...A.current,...Y}),k(!1)}).catch(()=>{F.current&&(g(A.current),k(!1))})},[e,t,n]),m.useEffect(()=>{var _;if(!a)return;const O={};for(const[Y,Q]of Object.entries(h)){const K=R[Y];if(!K)continue;const ie=r.find(ye=>ye.id===Y);if(!ie)continue;(((_=ie.data)==null?void 0:_.definitionId)||"").startsWith("provide_file")?O[K]={type:"file",path:Q}:O[K]={type:"str",value:Q}}a(O)},[h,R,r,a]);const V=m.useCallback((O,_)=>{g(Y=>({...Y,[O]:_}))},[]),M=m.useCallback(O=>{O!==u&&(p(O),O&&d[O]?g({...A.current,...d[O]}):g(A.current))},[u,d]),D=m.useCallback(async()=>{if(w.trim()){b(!0);try{const O={...d,[w.trim()]:h},_={flowId:e,flowSource:t,archived:n,presets:O,activePreset:w.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)})).ok&&(f(O),p(w.trim()),N(""),j(!1))}finally{b(!1)}}},[e,t,n,d,h,w]),I=m.useCallback(async()=>{if(u){b(!0);try{const O={...d};delete O[u];const _=Object.keys(O)[0]||null;(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:O,activePreset:_})})).ok&&(f(O),p(_),_&&O[_]?g({...A.current,...O[_]}):g(A.current))}finally{b(!1)}}},[e,t,n,d,u]),B=m.useCallback(async()=>{if(u){b(!0);try{const O={...d,[u]:h};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:O,activePreset:u})})).ok&&f(O)}finally{b(!1)}}},[e,t,n,d,u,h]),P=Object.keys(d);return P.length>0,v?o.jsx("aside",{className:"af-run-config-panel",children:o.jsx("div",{className:"af-run-config-loading",children:c("common.loading")})}):o.jsxs("aside",{className:"af-run-config-panel",children:[o.jsxs("div",{className:"af-run-config-preset",children:[o.jsx("label",{className:"af-run-config-preset-label",children:c("flow:runConfig.preset")}),o.jsxs("div",{className:"af-run-config-preset-row",children:[o.jsxs("select",{className:"af-run-config-preset-select",value:u||"",onChange:O=>M(O.target.value||null),disabled:y,children:[o.jsx("option",{value:"",children:c("flow:runConfig.default")}),P.map(O=>o.jsx("option",{value:O,children:O},O))]}),o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>j(!0),disabled:y,title:c("flow:runConfig.newPreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:B,disabled:y,title:c("flow:runConfig.savePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:I,disabled:y,title:c("flow:runConfig.deletePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),C&&o.jsxs("div",{className:"af-run-config-save-dialog",children:[o.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:c("flow:runConfig.presetNamePlaceholder"),value:w,onChange:O=>N(O.target.value),disabled:y}),o.jsxs("div",{className:"af-run-config-save-actions",children:[o.jsx("button",{type:"button",className:"af-btn-primary",onClick:D,disabled:y||!w.trim(),children:c(y?"common.saving":"common.save")}),o.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{j(!1),N("")},disabled:y,children:c("common.cancel")})]})]}),o.jsxs("div",{className:"af-run-config-inputs",children:[o.jsx("div",{className:"af-run-config-inputs-header",children:c("flow:runConfig.inputParams")}),r.length===0?o.jsx("div",{className:"af-run-config-empty",children:c("flow:runConfig.noProvideNodes")}):o.jsx("div",{className:"af-run-config-input-list",children:r.map(O=>{var we,ae;const _=((we=O.data)==null?void 0:we.definitionId)||"",Y=_.startsWith("provide_file"),Q=_==="provide_bool",K=((ae=O.data)==null?void 0:ae.label)||O.id,ie=O.id,fe=h[ie]||"",ye=["true","1","yes","on"].includes(String(fe).trim().toLowerCase());return o.jsxs("div",{className:"af-run-config-input-item",children:[o.jsxs("div",{className:"af-run-config-input-head",children:[o.jsx("span",{className:"af-run-config-input-icon material-symbols-outlined"+(Y?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:Y?"description":Q?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-config-input-label",children:K}),Q?null:o.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>$({instanceId:ie,label:K,content:fe}),"aria-label":c("flow:runConfig.expandInput"),title:c("flow:runConfig.expandInput"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx("div",{className:"af-run-config-input-id",children:ie}),Q?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ye?" af-run-config-bool-toggle--true":""),onClick:()=>V(ie,ye?"false":"true"),"aria-pressed":ye,children:ye?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-config-input-field",value:fe,onChange:ge=>V(ie,ge.target.value),placeholder:c(Y?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},ie)})})]}),T&&ts.createPortal(o.jsx("div",{className:"af-provide-edit-overlay",children:o.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-provide-edit-modal__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),o.jsx("span",{className:"af-provide-edit-modal__title",children:T.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>$(null),"aria-label":c("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-provide-edit-modal__body",children:o.jsx("textarea",{ref:L,className:"af-provide-edit-modal__textarea",defaultValue:T.content,autoFocus:!0})}),o.jsxs("div",{className:"af-provide-edit-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:()=>{!T||!L.current||(V(T.instanceId,L.current.value),$(null))},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),c("flow:provideEdit.save")]}),o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>$(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),c("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const UI={ai:["planner-system","planner-user","planner-response","agent-step-prompt","repair-prompt","ai-thinking","ai-assistant","ai-result","ai-tool"],flow:["composer-start","classify","plan","phase-plan","phase-complete","phase-auto-continue","composer-done"],step:["step-start","step-progress","step-done","validation"],output:["natural","status"],error:["error"]},i7={"planner-system":"#9ecaff","planner-user":"#9ecaff","planner-response":"#7c4dff","agent-step-prompt":"#7c4dff","repair-prompt":"#ff6b6b","ai-thinking":"#a8b9d4","ai-assistant":"#e8deff","ai-result":"#00e475","ai-tool":"#9ecaff","composer-start":"#00e475","composer-done":"#00e475","step-start":"#e8deff","step-done":"#e8deff","step-progress":"#e8deff",natural:"#a8a8a8",status:"#a8a8a8",error:"#ff6b6b","phase-plan":"#00e475","phase-complete":"#00e475"};function o7(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function a7(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`}function l7(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getMonth()+1}/${t.getDate()} ${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}`}function sj(e,t){if(e==="natural"&&t&&typeof t=="object"){const n=t.kind;if(n==="thinking"||n==="assistant"||n==="result"||n==="tool")return"ai";if(n==="error")return"error"}for(const[n,r]of Object.entries(UI))if(r.includes(e))return n;return"other"}function c7({event:e,defaultExpanded:t}){const[n,r]=m.useState(!!t),s=i7[e.tag]||"#a8a8a8",i=e.payload,a=i&&typeof i=="object",l=a?typeof i.text=="string"?i.text:"":String(i||""),c=a?i.meta:null,d=m.useMemo(()=>l?l.slice(0,140).replace(/\s+/g," "):a?Object.keys(i).filter(h=>h!=="text"&&h!=="meta").slice(0,3).map(h=>{const g=i[h];return g==null?`${h}:null`:typeof g=="object"?`${h}:{…}`:`${h}:${String(g).slice(0,30)}`}).join(" "):"",[i,l,a]),f=m.useCallback(u=>{u.stopPropagation();const p=a?JSON.stringify(i,null,2):String(i);try{navigator.clipboard.writeText(p)}catch{}},[i,a]);return o.jsxs("div",{style:{borderLeft:`3px solid ${s}`,background:n?"#1c1b1b":"#131313",marginBottom:4,borderRadius:4,cursor:"pointer",transition:"background 120ms"},onClick:()=>r(u=>!u),children:[o.jsxs("div",{style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:10,fontSize:12},children:[o.jsx("span",{style:{color:"#9a9a9a",fontFamily:"monospace",flexShrink:0},children:a7(e.ts)}),o.jsx("span",{style:{color:s,fontWeight:600,fontFamily:"monospace",flexShrink:0,padding:"1px 6px",background:"rgba(255,255,255,0.04)",borderRadius:3},children:e.tag}),o.jsx("span",{style:{color:"#c5c2c1",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace"},children:d}),n&&o.jsx("button",{type:"button",onClick:f,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:3,padding:"2px 8px",fontSize:11,cursor:"pointer"},children:"Copy"})]}),n&&o.jsxs("div",{style:{padding:"0 10px 10px 10px",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[c&&Object.keys(c).length>0&&o.jsx("div",{style:{marginTop:8,padding:8,background:"#0e0e0e",borderRadius:4,fontSize:11,fontFamily:"monospace",color:"#9ecaff",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:JSON.stringify(c,null,2)}),l?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:600,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:l}):a?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:400,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:JSON.stringify(i,null,2)}):null]})]})}function u7({open:e,onClose:t,flowId:n}){var $;const[r,s]=m.useState([]),[i,a]=m.useState(!1),[l,c]=m.useState(null),[d,f]=m.useState(null),[u,p]=m.useState(!1),[h,g]=m.useState(!0),[v,k]=m.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[y,b]=m.useState(""),w=m.useRef(null),N=m.useCallback(async()=>{a(!0);try{const L=h&&n?`?flowId=${encodeURIComponent(n)}`:"",A=await(await fetch(`/api/composer-logs${L}`)).json();s(Array.isArray(A.sessions)?A.sessions:[])}catch{s([])}finally{a(!1)}},[n,h]),C=m.useCallback(async L=>{if(!L){f(null);return}p(!0);try{const A=await(await fetch(`/api/composer-logs/${encodeURIComponent(L)}`)).json();f(A)}catch{f(null)}finally{p(!1)}},[]);m.useEffect(()=>{e&&N()},[e,N]),m.useEffect(()=>{if(!(!e||!l))return C(l),w.current=setInterval(()=>C(l),2e3),()=>{w.current&&clearInterval(w.current),w.current=null}},[e,l,C]);const j=m.useMemo(()=>{const L=(d==null?void 0:d.events)||[],F=y.trim().toLowerCase();return L.filter(A=>{const R=sj(A.tag,A.payload);return!v[R]&&R!=="other"?!1:F?[A.tag,JSON.stringify(A.payload||"")].join(" ").toLowerCase().includes(F):!0})},[d,v,y]),T=m.useMemo(()=>{const L=(d==null?void 0:d.events)||[],F={};for(const A of L){const R=sj(A.tag,A.payload);F[R]=(F[R]||0)+1}return F},[d]);return e?o.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,width:"min(1100px, 80vw)",background:"#131313",borderLeft:"1px solid rgba(255,255,255,0.08)",display:"flex",flexDirection:"column",zIndex:9999,boxShadow:"-8px 0 32px rgba(0,0,0,0.5)",color:"#e5e2e1",fontFamily:"Inter, system-ui, sans-serif"},children:[o.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:12,flexShrink:0,background:"#1c1b1b"},children:[o.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Composer Logs"}),o.jsx("span",{style:{fontSize:11,color:"#9a9a9a"},children:n?`flowId: ${n}`:"no flow selected"}),o.jsxs("label",{style:{fontSize:11,color:"#9a9a9a",display:"flex",alignItems:"center",gap:4,cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:h,onChange:L=>g(L.target.checked),disabled:!n}),"仅显示当前 flow"]}),o.jsx("button",{type:"button",onClick:N,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),o.jsx("span",{style:{flex:1}}),o.jsx("button",{type:"button",onClick:t,style:{background:"transparent",color:"#e5e2e1",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,padding:"4px 12px",fontSize:12,cursor:"pointer"},children:"Close"})]}),o.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[i&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!i&&r.length===0&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:h&&n?"no sessions for this flow":"no sessions"}),r.map(L=>{const F=l===L.sessionId;return o.jsxs("div",{onClick:()=>c(L.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:F?"rgba(124,77,255,0.18)":"transparent",borderLeft:F?"3px solid #7c4dff":"3px solid transparent"},children:[o.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:l7(L.mtime)}),o.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:L.flowId||"(no flow)"}),L.promptPreview&&o.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:L.promptPreview}),o.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[o7(L.size)," · ",L.model||"default"]})]},L.sessionId)})]}),o.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",flexShrink:0,background:"#1c1b1b"},children:[Object.keys(UI).map(L=>o.jsxs("button",{type:"button",onClick:()=>k(F=>({...F,[L]:!F[L]})),style:{background:v[L]?"rgba(124,77,255,0.25)":"transparent",color:v[L]?"#e8deff":"#6a6a6a",border:`1px solid ${v[L]?"rgba(124,77,255,0.4)":"rgba(255,255,255,0.08)"}`,borderRadius:999,padding:"3px 12px",fontSize:11,cursor:"pointer",fontFamily:"monospace",textTransform:"uppercase"},children:[L," ",T[L]!=null?`(${T[L]})`:""]},L)),o.jsx("input",{type:"text",placeholder:"search…",value:y,onChange:L=>b(L.target.value),style:{marginLeft:8,flex:1,minWidth:120,background:"#0e0e0e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:4,color:"#e5e2e1",padding:"4px 8px",fontSize:12}})]}),o.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!l&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),u&&!d&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&j.length===0&&o.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",(($=d.events)==null?void 0:$.length)||0," total)"]}),j.map((L,F)=>o.jsx(c7,{event:L,defaultExpanded:L.tag==="error"},`${L.ts}_${F}`))]})]})]})]}):null}const d7="0.1.43";function ij(e){const t=Math.max(0,Number(e)||0),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),s=Math.floor(t%6e4/1e3);return`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(s).padStart(2,"0")}`}function My(e,t){return t==="running"?ij(e):e==null||!Number.isFinite(e)||e<=0?"--":ij(e)}const KI=m.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function f7(e){const{setNodes:t}=Al(),{modelLists:n,onModelChange:r}=m.useContext(KI),s=m.useCallback(d=>{t(f=>f.filter(u=>u.id!==d))},[t]),i=m.useCallback(()=>{var p,h,g,v,k,y,b,w;const d=((p=e.data)==null?void 0:p.definitionId)||"",f=((h=e.data)==null?void 0:h.label)||e.id,u=((k=(v=(g=e.data)==null?void 0:g.outputs)==null?void 0:v[0])==null?void 0:k.value)||((w=(b=(y=e.data)==null?void 0:y.outputs)==null?void 0:b[0])==null?void 0:w.default)||"";window.__provideEditContent={instanceId:e.id,label:f,definitionId:d,content:u},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),a=m.useCallback((d,f)=>{t(u=>u.map(p=>{var g;if(p.id!==d)return p;const h=Array.isArray((g=p.data)==null?void 0:g.outputs)&&p.data.outputs.length?p.data.outputs.map((v,k)=>k===0?{...v,default:f,value:f}:v):[{type:"bool",name:"value",default:f,value:f}];return{...p,data:{...p.data,body:"",outputs:h}}}))},[t]),l=m.useCallback((d,f)=>{t(u=>u.map(p=>p.id===d?{...p,data:{...p.data,body:f}}:p))},[t]),c=m.useCallback((d,f)=>{t(u=>u.map(p=>p.id===d?{...p,data:{...p.data,images:is(f)}}:p))},[t]);return o.jsx(OI,{...e,deleteNode:s,onProvideExpand:i,onProvideValueChange:a,onNodeBodyChange:l,onNodeImagesChange:c,modelLists:n,onModelChange:r})}const p7={[Cf]:f7},ed=["CONTROL","TOOL","PROVIDE","AGENT"],h7=1200,oj="af-flow-node--sync-flash",aj="af-flow-edge--sync-flash";function lj(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function cj(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function _v(e){const t=((e==null?void 0:e.id)??"").trim();return/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function m7(e){const t=_v(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function Fp(e){return(Array.isArray(e)?e:[]).map(n=>{const r=String((n==null?void 0:n.name)||(n==null?void 0:n.id)||"").trim(),s=String((n==null?void 0:n.type)||"").trim();return!r&&!s?"":s?`${r||"-"}: ${s}`:r}).filter(Boolean)}function qI(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function YI(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function $y(e,t){const n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim(),r=String((e==null?void 0:e.type)||"").trim();return n||r||`#${t+1}`}function uj(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function dj(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),s=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:s,kind:t}}function g7(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function y7(e,t){return t?[e==null?void 0:e.id,e==null?void 0:e.label,e==null?void 0:e.description].filter(Boolean).some(r=>String(r).toLowerCase().includes(t)):!0}function GI(e,t,n,r,s){const i=m7(e),a={id:t,type:Cf,position:n,data:{label:e.label??e.id,definitionId:e.id,schemaType:i,inputs:Array.isArray(e.inputs)?e.inputs.map(l=>({...l})):[],outputs:Array.isArray(e.outputs)?e.outputs.map(l=>({...l})):[]}};return rf(a,r,s)}function x7(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function fj(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(d=>[d.id,d])),i=s.get(n),a=s.get(r),l=Zc(i,e.sourceHandle||"output-0","source"),c=Zc(a,e.targetHandle||"input-0","target");return!l||!c?!1:Qc(l,c)}function w7(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),s=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!s)return null;const i=t.find(l=>l.id===n),a=Zc(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:LI(a)}:null}function b7(e,t,n){var a;const r=GI(e,`__candidate_${e.id}`,{x:0,y:0},{},t),s=n.handleType==="source"?"inputs":"outputs",i=Array.isArray((a=r.data)==null?void 0:a[s])?r.data[s]:[];for(let l=0;l<i.length;l+=1){const c=i[l];if(n.handleType==="source"?Qc(n.slot,c):Qc(c,n.slot))return{slot:c,slotIndex:l,hydrated:r}}return null}function v7(e,t){return t?e.map((n,r)=>{const s=b7(n,e,t);if(!s)return null;const i=_v(n);return{def:n,order:r,category:i,categoryRank:ed.indexOf(i),slot:s.slot,slotIndex:s.slotIndex,displayLabel:qI(s.hydrated.data||n),description:YI(n)}}).filter(Boolean).sort((n,r)=>{var a,l;const s=(a=n.slot)!=null&&a.required?0:1,i=(l=r.slot)!=null&&l.required?0:1;return s-i||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}const k7=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function S7(e){const t=new Set,n=[];let r;const s=new RegExp(k7.source,"g");for(;(r=s.exec(e))!==null;){const i=r[1];t.has(i)||(t.add(i),n.push(i))}return n}function pj(e,t){const n=e.slice(0,t),r=n.lastIndexOf("@");if(r<0)return null;const s=n.slice(r+1);return/[\s\n]/.test(s)?null:{atIndex:r,query:s}}function ko(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function zp(e,t,n,r){const s=(e||"").trim();if(!s)return"";if(s.startsWith("opencode:")||s.startsWith("claude-code:"))return s;const i=Array.isArray(t)?t:[],a=Array.isArray(n)?n:[],l=Array.isArray(r)?r:[],c=i.map(ko),d=a.map(ko);return l.map(ko).includes(s)&&!c.includes(s)&&!d.includes(s)?`claude-code:${s}`:d.includes(s)&&!c.includes(s)?`opencode:${s}`:s}function N7(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function Dy(e){if(!Array.isArray(e)||e.length===0)return 0;let t=0;for(const n of e){const r=/^(?:对话|Conversation|Chat)\s*(\d+)\s*$/.exec(String((n==null?void 0:n.label)??"").trim());r&&(t=Math.max(t,parseInt(r[1],10)))}return t}function j7({steps:e}){const{t}=hn();return!e||e.length===0?null:o.jsx("div",{className:"af-composer-steps-track",role:"list","aria-label":t("flow:composer.stepsAriaLabel"),children:e.map(n=>{const r=String(n.description||n.type||"").trim(),s=n.model||n.executorModel,i=[`${n.index+1}. ${r||"—"}`,n.nodeRole?t("flow:composer.stepRoleLabel",{role:n.nodeRole}):"",n.instanceId?t("flow:composer.stepInstanceLabel",{instanceId:n.instanceId}):"",s?`${t("flow:palette.model")}:${s}`:""].filter(Boolean).join(`
|
|
129
|
-
`),a=n.status||"pending";return o.jsxs("div",{className:"af-composer-step-chip"+(a==="done"?" af-composer-step-chip--done":"")+(a==="running"?" af-composer-step-chip--running":"")+(a==="error"?" af-composer-step-chip--error":"")+(a==="pending"?" af-composer-step-chip--pending":""),role:"listitem",title:i,children:[o.jsx("span",{className:"af-composer-step-chip-idx",children:n.index+1}),o.jsx("span",{className:"af-composer-step-chip-main",children:n.nodeRole||s?o.jsxs("span",{className:"af-composer-step-chip-meta",children:[n.nodeRole?o.jsx("span",{className:"af-composer-step-chip-role",children:n.nodeRole}):null,s?o.jsx("span",{className:"af-composer-step-chip-model",children:N7(s)}):null]}):null})]},n.index)})})}function C7(e,t){const n=e.trim(),r=t.trim();return r?n?!!(n===r||n.endsWith(r)||r.length>=8&&n.includes(r)):!1:!0}function E7(e){const t=[];for(const n of e){if(!n||typeof n.text!="string"||!n.text.trim())continue;const s=typeof n.kind=="string"&&n.kind?n.kind:"assistant",i=t[t.length-1];i&&i.kind===s?i.text+=s==="error"||s==="result"?`
|
|
130
|
-
${n.text}`:n.text:t.push({kind:s,text:n.text})}return t}function _7(e,t){return e==="thinking"?t("flow:composer.thinking"):e==="result"?t("flow:composer.result"):e==="assistant"?t("flow:composer.reply"):e==="error"?t("flow:composer.error"):String(e)}function P7(e){return e==="thinking"?"af-composer-ai-block af-composer-ai-block--thinking":e==="result"?"af-composer-ai-block af-composer-ai-block--result":e==="assistant"?"af-composer-ai-block af-composer-ai-block--reply":e==="error"?"af-composer-ai-block af-composer-ai-block--error":"af-composer-ai-block af-composer-ai-block--reply"}function hj({thread:e,liveSegments:t,running:n,className:r="",autoScroll:s=!0}){const{t:i}=hn(),a=m.useRef(null),l=["af-composer-ai-stack","af-composer-ai-stack--in-panel","af-composer-thread-stack",r].filter(Boolean).join(" ");return m.useEffect(()=>{if(!s||!a.current)return;const c=a.current;requestAnimationFrame(()=>{c.scrollTop=c.scrollHeight})},[e,t,s]),o.jsxs("div",{ref:a,className:l,children:[e.map((c,d)=>c.type==="user"?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--user-msg",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:i("flow:composer.yourQuestion")}),o.jsx("div",{className:"af-composer-ai-block-body",children:c.text})]},`composer-u-${d}-${c.text.slice(0,48)}`):o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(mj,{segments:c.segments,running:!1})},`composer-a-${d}`)),o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(mj,{segments:t,running:n})})]})}function mj({segments:e,running:t=!1}){const{t:n}=hn(),r=e.filter(u=>u.kind==="assistant").map(u=>u.text).join(""),s=e.filter(u=>u.kind==="result").map(u=>u.text).join(""),i=C7(r,s),a=e.filter(u=>u.kind==="error").map(u=>u.text).join(`
|
|
131
|
-
`),l=e.filter(u=>u.kind!=="error"),c=i?l.filter(u=>u.kind!=="result"):l,d=E7(c),f=!!(d.length>0||a);return o.jsxs(o.Fragment,{children:[d.map((u,p)=>o.jsxs("section",{className:P7(u.kind),children:[o.jsx("div",{className:"af-composer-ai-block-label",children:_7(u.kind,n)}),o.jsx("div",{className:"af-composer-ai-block-body",children:u.text})]},`${u.kind}-${p}`)),t&&!f?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.reply")}),o.jsx("div",{className:"af-composer-ai-block-body",children:n("flow:composer.waiting")})]}):null,a?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--error",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.error")}),o.jsx("div",{className:"af-composer-ai-block-body",children:a})]}):null]})}function A7({fitViewEpoch:e}){const{fitView:t}=Al(),n=m.useRef(t);return n.current=t,m.useEffect(()=>{if(e>0){const r=requestAnimationFrame(()=>n.current({padding:.2,duration:200,maxZoom:1}));return()=>cancelAnimationFrame(r)}},[e]),null}function I7({onReady:e}){const t=GP();return m.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function gj(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}const mh=1500,yj=500,T7=262144,R7=2e3;function Fy(e){return typeof e!="string"?"":e.length<=R7?e:`[log line truncated, ${e.length} chars]`}const L7=mh;function O7(e){const t=e.match(/^\[([^\]]+)\]\s+\[([^\]]+)\]\s+([\s\S]*)$/);if(!t)return null;const[,n,r,s]=t;if(r==="cli")try{const i=JSON.parse(s);return i&&i.event==="node-start"?{ts:n,type:"node-start",text:`节点 ${i.instanceId||""}${i.label?` · ${i.label}`:""} 开始`}:i&&i.event==="node-done"?{ts:n,type:"node-done",text:`节点 ${i.instanceId||""} 完成${i.elapsed?` (${i.elapsed})`:""}`}:i&&i.event==="node-failed"?{ts:n,type:"node-failed",text:`节点 ${i.instanceId||""} 失败${i.error?`: ${i.error}`:""}`}:i&&i.event==="apply-start"?{ts:n,type:"info",text:`[apply-start] uuid=${i.uuid||""}`}:{ts:n,type:"info",text:Fy(s)}}catch{return{ts:n,type:"info",text:Fy(s)}}return{ts:n,type:"log",text:Fy(`[${r}] ${s}`)}}function xj(e){if(!e)return[];const t=[],n=e.split(`
|
|
132
|
-
`);for(let r=n.length-1;r>=0&&t.length<L7;r--){const s=n[r];if(!s)continue;const i=O7(s);i&&t.push(i)}return t.reverse(),t}function M7(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){const i=e[s],a=t[s];if(!a)return!1;if(i!==a&&(i.status!==a.status||(i.elapsed??null)!==(a.elapsed??null)))return!1}return!0}function $7(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function D7({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:s,onEdgesChange:i,onConnect:a,onConnectStart:l,onConnectEnd:c,isValidConnection:d,onNodesDelete:f,onNodeClick:u,onNodeDoubleClick:p,onEdgeClick:h,onFlowInit:g,onDrop:v,onDragOver:k,hideMinimapAndControls:y,bottomSlot:b}){const{t:w}=hn(),N=!s,C=N||t==="pan"?!0:[1,2],j=N?!1:t==="select",T="af-flow-canvas"+(N?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),$=m.useCallback(()=>{},[]),L=m.useMemo(()=>{const F=new Map(n.map(D=>[D.id,D])),A=new Set(n.filter(D=>D.selected).map(D=>D.id)),R=A.size>0,V=(D,I)=>{const B=/^#([0-9a-f]{6})$/i.exec(D);if(!B)return D;const P=parseInt(B[1],16);return`rgba(${P>>16&255}, ${P>>8&255}, ${P&255}, ${I})`},M="#ff5169";return r.map(D=>{var Ae,Ce,Ne,Ye;const I=F.get(D.source),B=F.get(D.target),P=/^output-(\d+)$/.exec(D.sourceHandle||""),O=/^input-(\d+)$/.exec(D.targetHandle||""),_=I&&P?(Ce=(Ae=I.data)==null?void 0:Ae.outputs)==null?void 0:Ce[parseInt(P[1],10)]:null,Y=B&&O?(Ye=(Ne=B.data)==null?void 0:Ne.inputs)==null?void 0:Ye[parseInt(O[1],10)]:null,Q=_!=null&&_.type?Un(_.type):null,K=Y!=null&&Y.type?Un(Y.type):null,ie=Q&&K&&Q!==K,fe=R&&(A.has(D.source)||A.has(D.target)),ye=D.style||{};if(ie){const Ze=D.selected?.95:fe?.85:.78,Ge=V(M,Ze);return{...D,className:((D.className||"")+" af-flow-edge--type-mismatch"+(fe?" af-flow-edge--adjacent":"")).trim(),style:{...ye,stroke:Ge,strokeWidth:fe?2.75:2.5,strokeDasharray:"6 4"},markerEnd:D.markerEnd&&typeof D.markerEnd=="object"?{...D.markerEnd,color:Ge}:{type:us.ArrowClosed,color:Ge}}}const we=Q||K;if(!we)return fe?{...D,className:((D.className||"")+" af-flow-edge--adjacent").trim(),style:{...ye,strokeWidth:2.5}}:D;const ae=fe||D.selected?.7:.38,ge=V(we,ae),_e=fe?2.5:ye.strokeWidth??2;return{...D,className:((D.className||"")+(fe?" af-flow-edge--adjacent":"")).trim(),style:{...ye,stroke:ge,strokeWidth:_e},markerEnd:D.markerEnd&&typeof D.markerEnd=="object"?{...D.markerEnd,color:ge}:{type:us.ArrowClosed,color:ge}}})},[n,r]);return o.jsxs(YP,{className:T,nodes:n,edges:L,onNodesChange:s||$,onEdgesChange:i||$,onConnect:N?void 0:a,onConnectStart:N?void 0:l,onConnectEnd:N?void 0:c,isValidConnection:N?void 0:d,onNodesDelete:N?void 0:f,onNodeClick:u,onNodeDoubleClick:N?void 0:p,onEdgeClick:N?void 0:h,onInit:g,onDrop:N?void 0:v,onDragOver:N?void 0:k,nodeTypes:p7,selectionOnDrag:j,panOnDrag:C,nodesDraggable:!N,nodesConnectable:!N,elementsSelectable:!N,edgesFocusable:!N,panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,defaultEdgeOptions:{style:{stroke:"rgba(205, 189, 255, 0.45)",strokeWidth:2}},connectionLineStyle:{stroke:"rgba(205, 189, 255, 0.65)",strokeWidth:2},children:[o.jsx(ZP,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),o.jsx(Xc,{position:"bottom-center",className:"af-flow-bottom-unified-panel"+(y?" af-flow-bottom-unified-panel--solo":""),children:o.jsxs("div",{className:"af-flow-bottom-unified-row"+(y?" af-flow-bottom-unified-row--solo":""),children:[y?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--minimap",children:o.jsx(KB,{zoomable:!0,pannable:!0,position:"bottom-left",className:"af-flow-bottom-minimap",style:{width:152,height:104},maskColor:"rgba(14, 14, 14, 0.85)",nodeColor:F=>{var R;const A=(((R=F.data)==null?void 0:R.schemaType)??"agent").toLowerCase();return A==="control"?"rgba(237, 108, 2, 0.85)":A==="provide"?"rgba(0, 228, 117, 0.35)":A==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),o.jsx("div",{className:"af-flow-bottom-unified__center",children:b}),y?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:o.jsx(RB,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!y&&o.jsx(Xc,{position:"bottom-left",className:"af-pin-legend",children:[{type:"node",color:"#ff9800"},{type:"text",color:"#2196f3"},{type:"file",color:"#4caf50"},{type:"bool",color:"#9c27b0"}].map(({type:F,color:A})=>o.jsxs("span",{className:"af-pin-legend__item",children:[o.jsx("span",{className:"af-pin-legend__dot",style:{background:A}}),o.jsx("span",{className:"af-pin-legend__label",children:F})]},F))}),o.jsx(A7,{fitViewEpoch:e}),!N&&n.length===0?o.jsxs("div",{className:"af-flow-empty-hint",children:[o.jsx("span",{className:"af-flow-empty-hint-icon material-symbols-outlined",children:"account_tree"}),o.jsx("p",{className:"af-flow-empty-hint-text",children:w("flow:emptyCanvas.composerHint")}),o.jsx("p",{className:"af-flow-empty-hint-sub",dangerouslySetInnerHTML:{__html:w("flow:emptyCanvas.composerSub")}})]}):null]})}function wj(e){if(!window.location.pathname.startsWith("/flow"))return;if(!e){window.history.replaceState({},"","/flow");return}const t=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});e.archived&&t.set("flowArchived","1"),window.history.replaceState({},"","/flow?"+t.toString())}function F7(e){return e==="builtin"||e==="admin"?"workspace":e??"user"}function Hs(e){return e==="builtin"||e==="admin"}function ec(e,t){return t(e==="builtin"||e==="admin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}function z7(e){var r,s,i,a;const t=Number(((s=(r=e==null?void 0:e.data)==null?void 0:r.displaySize)==null?void 0:s.width)||(e==null?void 0:e.width)||0),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.height)||(e==null?void 0:e.height)||0);return t>0&&n>0?{width:Math.round(t),height:Math.round(n)}:null}const XI="af:run-console-height",bd=230,Hu={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},Bp={};function gh(e){if(!Number.isFinite(e))return bd;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function B7(){try{const e=localStorage.getItem(XI);if(e==null)return bd;const t=parseInt(e,10);return Number.isFinite(t)?gh(t):bd}catch{return bd}}function H7(){var d0,f0;const{t:e,i18n:t}=hn(),{navigate:n,path:r}=Da(),s=m.useRef(null),i=m.useRef(new Map),a=m.useCallback(x=>{s.current=typeof x=="function"?x:null},[]),[l,c]=m.useState([]),[d,f]=m.useState(""),[u,p]=m.useState(null),[h,g]=m.useState(0),[v,k]=m.useState(""),[y,b]=m.useState(""),[w,N]=m.useState(""),[C,j]=m.useState(""),[T,$]=m.useState(!1),[L,F]=m.useState(""),[A,R]=m.useState(!1),[V,M]=m.useState(""),[D,I]=m.useState(!1),[B,P]=m.useState(!1),[O,_]=m.useState(!1),[Y,Q]=m.useState(null),[K,ie]=m.useState(!1),[fe,ye]=m.useState(!1),we=m.useRef(!1),[ae,ge]=m.useState([]),[_e,Ae]=m.useState(""),[Ce,Ne]=m.useState("nodes"),Ye=m.useRef(null),[Ze,Ge]=m.useState([]),[It,qe]=m.useState(!1),[ct,Ht]=m.useState(""),[Le,Jt]=m.useState(!1),[Qt,Nn]=m.useState({name:"",id:"",description:""}),[ce,ee]=m.useState(!1),[he,Me]=m.useState(""),[We,Qe]=m.useState(""),Gt=m.useRef(null),[mn,gn]=m.useState([]),[yn,Pr]=m.useState(!1),[xn,Dn]=m.useState(""),[xe,De]=m.useState(""),[tn,Fn]=m.useState(null),[st,zn]=m.useState(null),[Rs,Ar]=m.useState([]),[Pn,hs]=m.useState(""),[Ls,zo]=m.useState(!1),so=m.useCallback(x=>{Gt.current&&window.clearTimeout(Gt.current),Qe(x),Gt.current=window.setTimeout(()=>{Qe(""),Gt.current=null},3800)},[]),ji=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const z=()=>{var U;return(U=s.current)==null?void 0:U.call(s,S)};window.requestAnimationFrame(z),window.setTimeout(z,80)},[]);m.useEffect(()=>()=>{Gt.current&&window.clearTimeout(Gt.current)},[]);const[ms,io]=m.useState(!1),[Jn,gs]=m.useState({files:[]}),[Qs,Bo]=m.useState(!1),[oo,An]=m.useState(!0);m.useEffect(()=>{let x=!1;const S=()=>{fetch("/api/flows",{method:"HEAD"}).then(U=>{x||An(U.ok)}).catch(()=>{x||An(!1)})};S();const z=window.setInterval(S,5e3);return()=>{x=!0,window.clearInterval(z)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/dev-info").then(S=>S.json()).then(S=>{x||ei(!!(S!=null&&S.isDev))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{u!=null&&u.id&&JE(u.id,u.source??"user","pipeline",!!u.archived)},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const[Pe,qt]=m.useState("edit"),[ir,ut]=m.useState([]),Zs=m.useRef(0),[Kn,Bn]=m.useState(new Set),[xr,tt]=m.useState({}),[Ct,Vt]=m.useState(null),[Fr,Be]=m.useState(0),[Qn,Hn]=m.useState(!1),[Ci,ei]=m.useState(!1),[Ei,Os]=m.useState(!1),[ao,ti]=m.useState(B7),Ms=m.useRef({active:!1,pointerId:-1,startY:0,startH:bd}),[en,wr]=m.useState(null),[zr,ys]=m.useState(null),[Yr,W]=m.useState({}),de=m.useRef(Yr);m.useEffect(()=>{de.current=Yr},[Yr]);const[Ie,Ee]=m.useState(!1),[Re,Ft]=m.useState(!1),[St,In]=m.useState({}),[Tn,Ir]=m.useState({}),[lo,$s]=m.useState(null),[qn,xs]=m.useState(Hu),[Tf,dt]=m.useState(!1),[or,fu]=m.useState(!1),[za,Yn]=m.useState(""),[co,Zn]=m.useState(""),[Xt,pu]=m.useState(Bp),[Rn,Tl]=m.useState(null),Ba=m.useRef(0),ni=m.useRef(null),ri=m.useRef(null),hu=m.useRef(!0),Ho=m.useRef(!1),[ar,Ha]=m.useState(null),[_i,uo]=m.useState(null),[mu,Vo]=m.useState(!1),[Va,Wa]=m.useState(""),[Pi,Ua]=m.useState(!1),Rf=m.useRef(null),[Ds,Rl]=m.useState(null),[gu,si]=m.useState(!1),[Mt,Ll]=m.useState(null),[Ol,Ml]=m.useState(!1),[Wo,Uo]=m.useState(null),fo=m.useRef(null),[pr,Ka]=m.useState(""),[$l,po]=m.useState(0),[Fs,Ln]=m.useState(0),[Dl,yu]=m.useState("pan"),[Ko,Ai]=m.useState(!1),[Fl,xu]=m.useState(!1),ho=m.useRef(null),wu=m.useRef(null),qa=m.useRef(null),[dg,qo]=m.useState(0),[gt,Ii]=m.useState(null),[zl,Gr]=m.useState(""),[ft,fg]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[mo,Lf]=m.useState(""),[bu,pg]=m.useState(""),[zs,hg]=m.useState([]),[go,Ya]=m.useState([]),[Ga,mg]=m.useState(!1),[Bl,gg]=m.useState([]),[vu,Of]=m.useState(!1),[yg,Mf]=m.useState(()=>new Set),[lr,ku]=m.useState(!1),Hl=m.useRef(null),$f=m.useRef(null),[Df,Ff]=m.useState({}),E=m.useCallback(x=>{if(!x)return null;const S=x.id,z=x.source??"user",U=x.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${S}:${z}${U?":"+U:""}`,activeKey:`af:composer-active-session:${S}:${z}${U?":"+U:""}`}},[]),H=m.useCallback(x=>{if(!x)return"";const S=x.id,z=x.source??"user",U=x.archived?"archived":"";return`af:composer-skills:pipeline:${S}:${z}${U?":"+U:""}`},[]),G=m.useCallback(x=>{const S=E(x);if(!S)return{sessions:[],activeSessionId:null};try{const z=localStorage.getItem(S.sessionsKey);if(!z)return{sessions:[],activeSessionId:null};const U=JSON.parse(z);if(!Array.isArray(U))return{sessions:[],activeSessionId:null};const q=U.filter(te=>te&&typeof te.id=="string").map(te=>({...te,running:!1,statusLine:te.running?e("flow:composer.pageRefreshReset"):te.statusLine,steps:[]}));let X=null;try{X=localStorage.getItem(S.activeKey),X&&!q.some(te=>te.id===X)&&(X=null)}catch{X=null}return{sessions:q,activeSessionId:X}}catch{return{sessions:[],activeSessionId:null}}},[E]),J=m.useCallback((x,S,z)=>{const U=E(x);if(U)try{localStorage.setItem(U.sessionsKey,JSON.stringify(S)),z?localStorage.setItem(U.activeKey,z):localStorage.removeItem(U.activeKey)}catch{}},[E]),Z=m.useRef(0),se=m.useRef({sessions:[],activeSessionId:null,flowKey:null}),[re,oe]=m.useState([]),[ue,je]=m.useState(null),rt=m.useMemo(()=>H(u),[H,u]),[Nt,bt]=m.useState(""),Ut=m.useMemo(()=>{if(!u)return null;const x=u.id,S=u.source??"user",z=u.archived?"archived":"";return`${x}:${S}${z?":"+z:""}`},[u]),jn=m.useRef(!1);m.useEffect(()=>{if(!Ut){oe([]),je(null),se.current={sessions:[],activeSessionId:null,flowKey:null};return}const x=se.current;if(x.flowKey===Ut)return;x.flowKey=Ut,jn.current&&x.sessions.length>0&&J(u,x.sessions,x.activeSessionId);const{sessions:S,activeSessionId:z}=G(u);if(S.length===0){const U=`session-1-${Date.now()}`,q={id:U,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};x.sessions=[q],x.activeSessionId=U,oe([q]),je(U)}else{const U=S[S.length-1];if(U&&(!U.thread||U.thread.length===0))Z.current=Dy(S),x.sessions=S,x.activeSessionId=U.id,oe(S),je(U.id);else{const X=Dy(S)+1;Z.current=X;const te=`session-${X}-${Date.now()}`,ne={id:te,label:e("flow:composer.conversationLabel",{n:X}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},pe=[...S,ne];x.sessions=pe,x.activeSessionId=te,oe(pe),je(te)}}jn.current=!0},[Ut,u,G,J]);const yt=m.useMemo(()=>re.find(x=>x.id===ue)||null,[re,ue]),Tt=(yt==null?void 0:yt.running)??!1,xt=(yt==null?void 0:yt.statusLine)??"",Rt=(yt==null?void 0:yt.segments)??[],Et=(yt==null?void 0:yt.thread)??[],cn=(yt==null?void 0:yt.steps)??[];yt==null||yt.outputDismissed;const et=(yt==null?void 0:yt.phaseContext)??null,me=m.useRef([]),[Ue,Xe]=m.useState(!1),it=m.useRef(null),$e=m.useRef(null);m.useEffect(()=>{const x=$e.current;x&&requestAnimationFrame(()=>{x.scrollTop=x.scrollHeight})},[Et,Rt]);const $t=m.useRef(null),nn=m.useRef(!1),Lt=m.useRef(null),wt=m.useCallback(x=>{const S=++Z.current,z=`session-${S}-${Date.now()}`,U={id:z,label:x||e("flow:composer.conversationLabel",{n:S}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return oe(q=>[...q,U]),je(z),z},[]);m.useEffect(()=>{!u||!jn.current||(se.current.sessions=re,se.current.activeSessionId=ue,J(u,re,ue))},[re,ue,u,J]),m.useEffect(()=>{Z.current=Math.max(Z.current,Dy(re))},[re]);const _t=m.useCallback(x=>{var S;$t.current===x&&((S=it.current)==null||S.abort()),oe(z=>{const U=z.filter(X=>X.id!==x);if(z.some((X,te)=>X.id===x&&z.findIndex(ne=>ne.id===ue)===te)||ue===x){const X=U;X.length>0?je(X[X.length-1].id):setTimeout(()=>{Z.current=0;const te=++Z.current,ne=`session-${te}-${Date.now()}`,pe={id:ne,label:e("flow:composer.conversationLabel",{n:te}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};oe(be=>[...be,pe]),je(ne)},0)}return U})},[ue]),jt=m.useCallback(x=>{oe(S=>{const z=S.findIndex(X=>X.id===ue);if(z<0)return S;const U={...S[z]};x(U);const q=[...S];return q[z]=U,q})},[ue]),br=m.useCallback(x=>{jt(S=>{S.running=x})},[jt]),cr=m.useCallback(x=>{jt(S=>{S.statusLine=x})},[jt]),vr=m.useCallback(x=>{jt(S=>{typeof x=="function"?S.segments=x(S.segments):S.segments=x})},[jt]),Yo=m.useCallback(x=>{jt(S=>{typeof x=="function"?S.thread=x(S.thread):S.thread=x})},[jt]),ws=m.useCallback(x=>{jt(S=>{typeof x=="function"?S.steps=x(S.steps):S.steps=x})},[jt]),zf=m.useCallback(x=>{jt(S=>{S.outputDismissed=x})},[jt]),Xa=m.useCallback(x=>{jt(S=>{S.phaseContext=typeof x=="function"?x(S.phaseContext):x})},[jt]),Hv=m.useCallback(x=>{je(x),oe(S=>{const z=S.findIndex(q=>q.id===x);if(z<0||!S[z].outputDismissed)return S;const U=[...S];return U[z]={...S[z],outputDismissed:!1},U})},[]);m.useEffect(()=>{me.current=Rt},[Rt]);const kr=m.useRef({}),Vv=m.useRef(!1),Ja=m.useRef(null),Go=m.useRef(null),Vl=m.useRef(!1),xg=m.useRef(0),Bf=m.useRef(""),[Pt,mt,UT]=XP([]),[wn,rn,KT]=JP([]),Ti=m.useRef(Pt),Wl=m.useRef(wn),Wv=m.useRef(null),wg=m.useRef(null),Uv=m.useRef(null),Hf=m.useRef(null),[Xr,yo]=m.useState(null),qT=m.useCallback(x=>{var S;kr.current=(S=x==null?void 0:x.extra)!=null&&S.instances&&typeof x.extra.instances=="object"?x.extra.instances:{},mt(Array.isArray(x==null?void 0:x.nodes)?x.nodes:[]),rn(Array.isArray(x==null?void 0:x.edges)?x.edges:[]),yo(null)},[rn,mt]),YT=m.useMemo(()=>({instances:kr.current}),[wn,Pt]),{resetHistory:Kv,undo:qv,redo:Yv}=RI({nodes:Pt,edges:wn,extra:YT,enabled:!!u&&Vl.current&&Pe==="edit",onRestore:qT}),ii=m.useMemo(()=>Pt.filter(x=>{var S;return(((S=x.data)==null?void 0:S.definitionId)||"").startsWith("provide_")}),[Pt]),Ul=m.useMemo(()=>{var S;const x={};for(const z of Pt){if(!((S=z.data)!=null&&S.inputs))continue;const U=z.data.inputs;for(let q=0;q<U.length;q++){const X=U[q];if(!(X!=null&&X.name))continue;const te=wn.find(pe=>pe.target===z.id&&pe.targetHandle===`input-${q}`);if(!(te!=null&&te.source))continue;ii.find(pe=>pe.id===te.source)&&(x[te.source]=X.name)}}return x},[Pt,wn,ii]),Su=m.useMemo(()=>{if(Pe==="edit"||Kn.size===0)return null;const x=new Set(Kn);for(const S of wn)Kn.has(S.source)&&x.add(S.target),Kn.has(S.target)&&x.add(S.source);return x},[Pe,Kn,wn]),GT=m.useMemo(()=>Pe==="edit"?Pt:Pt.map(x=>{var S,z;return{...x,draggable:!1,connectable:!1,data:{...x.data,isRunMode:!0,isExecuting:Kn.has(x.id),nodeStatus:((S=xr[x.id])==null?void 0:S.status)??null,nodeElapsed:((z=xr[x.id])==null?void 0:z.elapsed)??null,isDim:Su?!Su.has(x.id):!1}}}),[Pe,Pt,Kn,xr,Su]),XT=m.useMemo(()=>Su?wn.map(x=>{const S=Kn.has(x.source)||Kn.has(x.target),z=x.className?x.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",U=S?"af-flow-edge--focus":"af-flow-edge--dim";return{...x,className:(z?z+" ":"")+U}}):wn,[wn,Kn,Su]);m.useEffect(()=>{if(!u){Ir({}),$s(null),xs(Hu),pu(Bp),Tl(null),Yn(""),Zn("");return}const x=new URLSearchParams({flowId:u.id,flowSource:u.source||"user"});u.archived&&x.set("archived","1"),fetch(`/api/flow/run-config?${x.toString()}`).then(S=>S.json()).then(S=>{Ir(S.presets||{}),$s(S.activePreset||null)}).catch(()=>{Ir({}),$s(null)})},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const Xo=m.useCallback(x=>{Ba.current+=1,xs(x)},[]),Jo=m.useCallback(async(x,S={})=>{if(!x)return;const z=!!S.quiet,U=!!S.force,q=Ba.current;z||(dt(!0),Yn(""),Zn(""));const X=new URLSearchParams({flowId:x.id,flowSource:x.source||"user"});x.archived&&X.set("archived","1");try{const te=await fetch(`/api/flow/schedule?${X.toString()}`),ne=await te.json().catch(()=>({}));if(!te.ok)throw new Error(ne.error||`HTTP ${te.status}`);if(!U&&Ba.current!==q)return;xs({...Hu,...ne.schedule||{}}),pu(ne.state&&typeof ne.state=="object"?ne.state:Bp),Tl(ne.status||null)}catch(te){if(!U&&Ba.current!==q)return;xs(Hu),pu(Bp),Tl(null),Yn(String(te.message||te))}finally{dt(!1)}},[]);m.useEffect(()=>{if(!u)return;let x=!1;return(async()=>{await Jo(u)})(),()=>{x=!0}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,Jo]),m.useEffect(()=>{var z,U,q,X;if(!lo||!Tn[lo]||ii.length===0)return;const x=Tn[lo],S={};for(const te of ii){const ne=Ul[te.id];if(!ne)continue;const pe=((z=te.data)==null?void 0:z.definitionId)||"",be=x[te.id]??((X=(q=(U=te.data)==null?void 0:U.outputs)==null?void 0:q[0])==null?void 0:X.default)??"";pe.startsWith("provide_file")?S[ne]={type:"file",path:be}:S[ne]={type:"str",value:be}}Object.keys(S).length>0&&W(S)},[lo,Tn,ii,Ul]);const JT=m.useCallback(()=>{if(!Wo||!fo.current)return;const x=fo.current.value;mt(S=>S.map(z=>{var U,q;return z.id!==Wo.instanceId?z:{...z,data:{...z.data,outputs:((q=(U=z.data)==null?void 0:U.outputs)==null?void 0:q.map((X,te)=>te===0?{...X,default:x}:X))||[{type:"text",name:"value",default:x}]}}})),Uo(null)},[Wo,mt]),ot=m.useMemo(()=>{const x=Pt.filter(S=>S.selected);return x.length===1?x[0]:null},[Pt]),Ri=m.useMemo(()=>u?uU(Pt,wn,e):[],[u,Pt,wn,e]),QT=m.useMemo(()=>Ri.map(x=>x.key).join("|"),[Ri]),Gv=m.useMemo(()=>Ri.some(x=>String((x==null?void 0:x.level)||"warning").toLowerCase()==="error"),[Ri]);m.useLayoutEffect(()=>{ie(Ri.length>0&&!Gv)},[QT,u==null?void 0:u.id,u==null?void 0:u.source,Ri.length,Gv]),qa.current=ot,m.useEffect(()=>{Ti.current=Pt},[Pt]),m.useEffect(()=>{const x=i.current,S=new Map,z=[];for(const te of Pt){const ne=x7(te);S.set(te.id,ne),x.get(te.id)!==ne&&z.push(te.id)}if(i.current=S,z.length===0)return;const U=()=>z.forEach(te=>{var ne;return(ne=s.current)==null?void 0:ne.call(s,te)}),q=window.requestAnimationFrame(U),X=window.setTimeout(U,80);return()=>{window.cancelAnimationFrame(q),window.clearTimeout(X)}},[Pt]),m.useEffect(()=>{Wl.current=wn},[wn]),m.useEffect(()=>{Uv.current=Xr},[Xr]),m.useEffect(()=>{if(!Xr)return;const x=z=>{z.key==="Escape"&&yo(null)},S=z=>{var U,q;(q=(U=z.target)==null?void 0:U.closest)!=null&&q.call(U,".af-connect-node-menu")||yo(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",S),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",S)}},[Xr]),m.useEffect(()=>()=>{Go.current!=null&&(clearTimeout(Go.current),Go.current=null)},[]);const bg=m.useMemo(()=>{var S;if(!ot)return null;const x=(S=ot.data)==null?void 0:S.definitionId;return ae.find(z=>z.id===x)??null},[ot,ae]),vg=m.useMemo(()=>{const x={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const S of ae){const z=_v(S);x[z].push(S)}for(const S of ed)x[S].sort((z,U)=>z.id.localeCompare(U.id));return x},[ae]),Vf=m.useMemo(()=>{const x=_e.trim().toLowerCase();if(!x)return vg;const S={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const z of ed)S[z]=vg[z].filter(U=>y7(U,x));return S},[vg,_e]),ZT=m.useMemo(()=>ed.reduce((x,S)=>x+Vf[S].length,0),[Vf]),Wf=m.useMemo(()=>ae.filter(x=>{const S=String(x.id??""),z=String(x.source??"");return S.startsWith("marketplace:")||z==="marketplace"||z==="collection"}),[ae]),Xv=m.useMemo(()=>{const x=new Set;for(const S of Wf){const z=String(S.id??"");if(z&&(x.add(z),z.startsWith("marketplace:"))){const U=z.slice(12),[q]=U.split("@");q&&x.add(`marketplace:${q}`)}}return x},[Wf]),Uf=m.useCallback(async()=>{f("");try{const x=await fetch("/api/flows");if(!x.ok)throw new Error("HTTP "+x.status);c(await x.json())}catch(x){f(String(x.message||x))}},[]);m.useEffect(()=>{Uf()},[Uf]),m.useEffect(()=>{if(r!=="/flow")return;const x=new URLSearchParams(window.location.search);x.get("new")==="1"&&!x.get("flowId")&&n("/projects?new=1")},[r,n]),m.useEffect(()=>{let x=!1;const S=()=>{fetch("/api/model-lists").then(U=>U.json()).then(U=>{x||fg({cursor:Array.isArray(U.cursor)?U.cursor.map(String):[],opencode:Array.isArray(U.opencode)?U.opencode.map(String):[],claudeCode:Array.isArray(U.claudeCode)?U.claudeCode.map(String):[]})}).catch(()=>{})};S();const z=setTimeout(S,4e3);return()=>{x=!0,clearTimeout(z)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skills").then(S=>S.json()).then(S=>{if(x)return;const z=Array.isArray(S.skills)?S.skills.filter(U=>U&&typeof U.key=="string"&&U.key.trim()).map(U=>({key:String(U.key),name:String(U.name||U.id||U.key),description:U.description?String(U.description):"",sourceLabel:U.sourceLabel?String(U.sourceLabel):""})):[];hg(z),mg(!0)}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skill-collections").then(S=>S.json()).then(S=>{x||(gg(Sa(S)),Of(!0))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{if(bt(""),!(!Ga||!vu)){if(!rt){Ya([]);return}Ya(t_(rt,"pipeline",zs,Bl)),bt(rt)}},[Bl,vu,zs,Ga,rt]),m.useEffect(()=>{if(!(Nt!==rt||!rt))try{localStorage.setItem(rt,JSON.stringify(go))}catch{}},[go,rt,Nt]);const Jv=m.useCallback(async x=>{const S=x.source??"user",z=!!x.archived,U=new URLSearchParams({flowId:x.id,flowSource:S});z&&U.set("archived","1");const q=new URLSearchParams({flowId:x.id,flowSource:S});z&&q.set("archived","1"),q.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[X,te]=await Promise.all([fetch("/api/flow?"+U.toString()),fetch("/api/nodes?"+q.toString())]),ne=await X.json();if(!X.ok||ne.error)throw new Error(ne.error||e("flow:nodePropsError.loadFlowFailed"));const pe=await te.json();if(!te.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const be=Array.isArray(pe)?pe:Array.isArray(pe==null?void 0:pe.nodes)?pe.nodes:[],Oe=!Array.isArray(pe)&&(pe==null?void 0:pe.pipelineTranslations)||{},le=aU(ne.flowYaml||"");if(le.error)throw new Error(le.error);const Te={...le.instances||{}},ve=le.nodes.map(sn=>rf(sn,Te,be,Oe,x.id)),at=TI(le.edges,ve);return{flowSource:S,paletteList:be,instances:Te,flowDescriptionText:le.description??"",nodes:ve,edges:at}},[t.language,e]),Bs=m.useCallback(async(x,S={})=>{const z=!!S.preserveComposer,U=z&&!!S.incrementalSync;Vl.current=!1,xg.current+=1,p(x),b(""),z||(N(""),Ae(""),zn(null),k(""),F(""),M(""),Ka(""),Yo([]),vr([]),ws([]),zf(!1),Xa(null),yu("pan")),U||(kr.current={},mt([]),rn([])),wj(x);try{const q=await Jv(x);if(ge(q.paletteList),kr.current=q.instances,k(q.flowDescriptionText),F(x.id||""),U){const X=Ti.current,te=Wl.current;try{const ne=D9(X,te,q.nodes,q.edges),pe=new Set([...ne.changes.addedNodeIds,...ne.changes.updatedNodeIds]),be=new Set([...ne.changes.addedEdgeKeys,...ne.changes.updatedEdgeKeys]),Oe=pe.size>0?ne.nodes.map(Te=>pe.has(Te.id)?{...Te,className:lj(Te.className,oj)}:Te):ne.nodes,le=be.size>0?ne.edges.map(Te=>be.has(Qd(Te))?{...Te,className:lj(Te.className,aj)}:Te):ne.edges;mt(Oe),rn(le),Go.current!=null&&(clearTimeout(Go.current),Go.current=null),(pe.size>0||be.size>0)&&(Go.current=window.setTimeout(()=>{Go.current=null,pe.size>0&&mt(Te=>Te.map(ve=>{if(!pe.has(ve.id))return ve;const at=cj(ve.className,oj);return at===String(ve.className||"")?ve:{...ve,className:at}})),be.size>0&&rn(Te=>Te.map(ve=>{if(!be.has(Qd(ve)))return ve;const at=cj(ve.className,aj);return at===String(ve.className||"")?ve:{...ve,className:at}}))},h7))}catch{mt(q.nodes),rn(q.edges)}}else mt(q.nodes),rn(q.edges),g(X=>X+1);vp(x.id,q.flowSource),qo(X=>X+1),Kv(q.nodes,q.edges,{instances:q.instances});try{Bf.current=VN(q.nodes,q.edges,q.instances,{description:q.flowDescriptionText})}catch{Bf.current=""}Vl.current=!0}catch(q){b(String(q.message||q))}},[Jv,Kv,mt,rn]),Kf=m.useCallback(async()=>{if(!(u!=null&&u.id))return;const x=u.source??"user",S=new URLSearchParams({flowId:u.id,flowSource:x});u.archived&&S.set("archived","1"),S.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const z=await fetch("/api/nodes?"+S.toString()),U=await z.json();if(!z.ok)throw new Error((U==null?void 0:U.error)||e("flow:nodePropsError.loadNodesFailed"));const q=Array.isArray(U)?U:Array.isArray(U==null?void 0:U.nodes)?U.nodes:[];ge(q)},[u,e,t.language]),kg=m.useCallback(async()=>{Pr(!0),Dn("");try{const x=await fetch("/api/marketplace/nodes"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error((S==null?void 0:S.error)||"Failed to load marketplace nodes");gn(Array.isArray(S==null?void 0:S.nodes)?S.nodes:[])}catch(x){Dn(String(x.message||x)),gn([])}finally{Pr(!1)}},[]),qf=m.useCallback(async()=>{qe(!0),Ht("");try{const x=await fetch("/api/marketplace/flow-snippets"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error((S==null?void 0:S.error)||"Failed to load flow snippets");Ge(Array.isArray(S==null?void 0:S.snippets)?S.snippets:[])}catch(x){Ht(String(x.message||x)),Ge([])}finally{qe(!1)}},[]);m.useEffect(()=>{u&&(kg(),qf())},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,kg,qf]);const e2=m.useCallback(async x=>{if(!u||!x)return;const S=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`;if(S){De(S),Dn("");try{const z=await fetch("/api/marketplace/install-node",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",archived:!!u.archived,nodeSpec:S})}),U=await z.json().catch(()=>({}));if(!z.ok||(U==null?void 0:U.ok)===!1)throw new Error((U==null?void 0:U.error)||"Failed to install marketplace node");await Kf()}catch(z){Dn(String(z.message||z))}finally{De("")}}},[u,Kf]),t2=m.useCallback(async(x,S)=>{const z={packageId:(x==null?void 0:x.newId)||(x==null?void 0:x.id)||(x==null?void 0:x.label),label:(x==null?void 0:x.label)||(x==null?void 0:x.newId)||(x==null?void 0:x.id),version:"1.0.0",definitionId:S,body:(x==null?void 0:x.body)||"",script:(x==null?void 0:x.script)||"",inputs:Array.isArray(x==null?void 0:x.inputs)?x.inputs:[],outputs:Array.isArray(x==null?void 0:x.outputs)?x.outputs:[],flowId:u==null?void 0:u.id,flowSource:(u==null?void 0:u.source)||"user"},U=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)}),q=await U.json();if(!U.ok||(q==null?void 0:q.ok)===!1)throw new Error((q==null?void 0:q.error)||"Publish failed");return await Kf(),q},[Kf,u]),Qv=m.useCallback(async()=>{var U;if(!u||we.current)return;const x=u.id,S=u.source??"user",z=((U=qa.current)==null?void 0:U.id)??null;we.current=!0,ye(!0);try{await Bs({id:x,source:S,archived:u.archived},{preserveComposer:!0,incrementalSync:!0}),z&&mt(q=>q.map(X=>({...X,selected:X.id===z})))}finally{we.current=!1,ye(!1)}},[u,u==null?void 0:u.archived,Bs,mt]);m.useEffect(()=>{if(Vv.current||l.length===0)return;const x=new URLSearchParams(window.location.search),S=x.get("flowId");if(!S)return;const z=x.get("flowSource")??"user",U=x.get("flowArchived")==="1",q=l.find(X=>X.id===S&&(X.source??"user")===z&&!!X.archived===U);q&&(Vv.current=!0,Bs(q))},[l,Bs]);const Yf=m.useRef(0);m.useEffect(()=>{if(!u)return;const x=u.id,S=u.source??"user",z=!!u.archived;Yf.current=0;let U=!1;const q=async()=>{var ne;if(U)return;const te=new URLSearchParams({flowId:x,flowSource:S,v:String(Yf.current)});z&&te.set("archived","1");try{const pe=await fetch("/api/flow-editor-sync-poll?"+te.toString());if(!pe.ok||U)return;const be=await pe.json();if(U)return;if(be.changed){Yf.current=be.version;const Oe=((ne=qa.current)==null?void 0:ne.id)??null;await Bs({id:x,source:S,archived:z},{preserveComposer:!0,incrementalSync:!0}),await Jo({id:x,source:S,archived:z},{quiet:!0,force:!0}),Oe&&mt(le=>le.map(Te=>({...Te,selected:Te.id===Oe})))}else Yf.current=be.version}catch{}},X=window.setInterval(q,2e3);return q(),()=>{U=!0,window.clearInterval(X)}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,Bs,Jo,mt]);const n2=m.useMemo(()=>w?w.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":w===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[w]);m.useEffect(()=>{if(!w)return;w===e("flow:status.saved")||w.startsWith(e("flow:status.runInTerminal"));const x=w.startsWith(e("flow:status.runInTerminal"))?5200:2800,S=window.setTimeout(()=>N(""),x);return()=>clearTimeout(S)},[w,e]),m.useEffect(()=>{j("")},[u==null?void 0:u.id,u==null?void 0:u.source]),m.useEffect(()=>{const x=()=>{window.__provideEditContent&&(Uo(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",x),()=>window.removeEventListener("provide-expand",x)},[]),m.useEffect(()=>{var ne,pe,be,Oe,le,Te,ve;if(!ot){Ii(null);return}const x=kr.current[ot.id]||{},{inputs:S,outputs:z}=II(ot),U=String(((ne=ot.data)==null?void 0:ne.definitionId)??ot.id??""),q=((pe=ot.data)==null?void 0:pe.script)!=null?String(ot.data.script):void 0,X=x.script!=null?String(x.script):void 0,te=U==="tool_nodejs"||q&&q.trim()!==""||X&&X.trim()!==""?String(q??X??""):"";Ii({id:ot.id,newId:ot.id,label:String(((be=ot.data)==null?void 0:be.label)??ot.id),role:((Oe=ot.data)==null?void 0:Oe.role)??"普通",model:String(((le=ot.data)==null?void 0:le.model)??x.model??""),body:String(((Te=ot.data)==null?void 0:Te.body)??x.body??""),images:is(((ve=ot.data)==null?void 0:ve.images)??x.images),script:te,inputs:S,outputs:z})},[ot==null?void 0:ot.id,dg]),m.useEffect(()=>{u&&(ot||(wu.current=null,zn(x=>x==="node"?null:x)))},[u,ot==null?void 0:ot.id]);const Gf=m.useCallback(()=>{wu.current=null,zn(x=>x==="settings"||x==="history"?x:"node")},[]),r2=m.useCallback((x,S)=>{x.metaKey||x.ctrlKey||x.shiftKey||Pe!=="edit"&&ys((S==null?void 0:S.id)??null)},[Pe]),s2=m.useCallback((x,S)=>{Pe==="edit"&&(x.preventDefault(),mt(z=>z.map(U=>({...U,selected:U.id===S.id}))),rn(z=>z.map(U=>({...U,selected:!1}))),Gf())},[Gf,Pe,rn,mt]),i2=m.useCallback((x,S)=>{if(Pe!=="edit")return;const z=x.metaKey||x.ctrlKey||x.shiftKey;rn(U=>U.map(q=>q.id===S.id?{...q,selected:!q.selected||!z}:z?q:{...q,selected:!1})),z||mt(U=>U.map(q=>({...q,selected:!1})))},[Pe,rn,mt]),o2=m.useCallback(x=>fj(x,Ti.current),[]),a2=m.useCallback(x=>{if(!fj(x,Ti.current)){N("端口类型不匹配,已取消连线");return}yo(null),mt(S=>um(S,x)),rn(S=>{const z=S.filter(U=>!(U.target===x.target&&U.targetHandle===x.targetHandle));return Gd({...x,markerEnd:{type:us.ArrowClosed}},z)})},[rn,mt]),l2=m.useCallback((x,S)=>{wg.current=w7(S,Ti.current),yo(null)},[]),c2=m.useCallback((x,S)=>{var ve,at,sn,on;const z=wg.current;if(wg.current=null,!u||!z||S!=null&&S.toNode)return;const U=v7(ae,z);if(U.length===0){N(`没有匹配 ${z.slotType} 端口的节点`);return}const q=((at=(ve=x==null?void 0:x.changedTouches)==null?void 0:ve[0])==null?void 0:at.clientX)??(x==null?void 0:x.clientX),X=((on=(sn=x==null?void 0:x.changedTouches)==null?void 0:sn[0])==null?void 0:on.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(q)||!Number.isFinite(X))return;const te=Ja.current,ne=document.querySelector(".af-pipeline-flow .react-flow");if(!te||!ne)return;const pe=ne.getBoundingClientRect(),be=320,Oe=Math.min(440,104+U.length*58),le=Math.max(12,Math.min(q-pe.left,pe.width-be-12)),Te=Math.max(12,Math.min(X-pe.top,pe.height-Oe-12));yo({left:le,top:Te,flowPosition:te.screenToFlowPosition({x:q,y:X}),draft:z,candidates:U,query:""})},[ae,u]),u2=m.useCallback(x=>{for(const S of x)delete kr.current[S.id]},[]),d2=m.useCallback(x=>{Ja.current=x},[]),f2=m.useCallback(x=>{mt(z=>z.map(U=>({...U,selected:U.id===x}))),rn(z=>z.map(U=>({...U,selected:!1}))),Gf();const S=()=>{var pe,be,Oe;const z=Ja.current;if(!(z!=null&&z.getNode))return;const U=z.getNode(x);if(!U)return;const q=(pe=z.getInternalNode)==null?void 0:pe.call(z,x),X=((be=q==null?void 0:q.measured)==null?void 0:be.width)??(q==null?void 0:q.width)??U.width??200,te=((Oe=q==null?void 0:q.measured)==null?void 0:Oe.height)??(q==null?void 0:q.height)??U.height??88,{zoom:ne}=z.getViewport();z.setCenter(U.position.x+X/2,U.position.y+te/2,{zoom:gj(ne),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(S))},[mt,rn,Gf]),p2=m.useCallback(x=>{mt(z=>z.map(U=>({...U,selected:U.id===x}))),rn(z=>z.map(U=>({...U,selected:!1})));const S=()=>{var be,Oe,le;const z=Ja.current;if(!(z!=null&&z.getNode))return;const U=z.getNode(x);if(!U)return;const q=(be=z.getInternalNode)==null?void 0:be.call(z,x),X=((Oe=q==null?void 0:q.measured)==null?void 0:Oe.width)??(q==null?void 0:q.width)??U.width??200,te=((le=q==null?void 0:q.measured)==null?void 0:le.height)??(q==null?void 0:q.height)??U.height??88,{zoom:ne}=z.getViewport(),pe=gj(ne);z.setCenter(U.position.x+X/2,U.position.y+te/2,{zoom:pe,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(S))},[mt,rn]),Kl=m.useCallback((x,S)=>{const z=`node-${Date.now()}`;return GI(x,z,S,kr.current,ae)},[ae]),Zv=m.useCallback(x=>{if(!u||!x)return;let S={x:180,y:160};const z=Ja.current,U=document.querySelector(".af-pipeline-flow .react-flow");if(z&&U){const q=U.getBoundingClientRect();S=z.screenToFlowPosition({x:q.left+q.width*.45,y:q.top+q.height*.38})}mt(q=>[...q,Kl(x,S)])},[u,mt,Kl]),h2=m.useCallback(x=>{const S=Uv.current;if(!u||!S||!(x!=null&&x.def))return;const z=Kl(x.def,S.flowPosition),U=S.draft.handleType==="source"?{source:S.draft.nodeId,sourceHandle:S.draft.handleId,target:z.id,targetHandle:`input-${x.slotIndex}`}:{source:z.id,sourceHandle:`output-${x.slotIndex}`,target:S.draft.nodeId,targetHandle:S.draft.handleId};mt(q=>um([...q,z],U)),rn(q=>{const X=q.filter(te=>!(te.target===U.target&&te.targetHandle===U.targetHandle));return Gd({...U,markerEnd:{type:us.ArrowClosed}},X)}),yo(null)},[u,Kl,mt,rn]),m2=m.useCallback(x=>{x.preventDefault(),x.dataTransfer.dropEffect="move"},[]),g2=m.useCallback(x=>{var te;if(x.preventDefault(),!u)return;const S=Ja.current;if(!S)return;const z=S.screenToFlowPosition({x:x.clientX,y:x.clientY}),U=x.dataTransfer.getData("application/agentflow-snippet");if(U){const ne=Ze.find(pe=>`${pe.id}@${pe.version}`===U);ne&&((te=Hf.current)==null||te.call(Hf,ne,z));return}const q=x.dataTransfer.getData("application/agentflow-node");if(!q)return;const X=ae.find(ne=>ne.id===q);X&&mt(ne=>[...ne,Kl(X,z)])},[u,ae,Ze,mt,Kl]),Li=m.useCallback(async(x,S)=>{if(!u)return;const z=VN(x,S,kr.current,{description:v});if(z!==Bf.current){N(e("flow:status.saving"));try{const U=F7(u.source),q=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:U,flowYaml:z,...u.archived?{flowArchived:!0}:{}})}),X=await q.json();if(!q.ok||!X.success)throw new Error(X.error||e("flow:status.saveFailed"));if(Bf.current=z,N(e("flow:status.saved")),Hs(u.source)&&U==="workspace"){const te={id:u.id,source:"workspace",path:void 0};p(te),wj(te),vp(u.id,"workspace")}}catch(U){N(e("flow:status.saveFailed")+": "+(U.message||U))}}},[u,v]);m.useEffect(()=>{if(!u||!Vl.current||Pe!=="edit"||u.archived)return;const x=xg.current,S=setTimeout(()=>{x===xg.current&&Vl.current&&Li(Ti.current,Wl.current)},400);return()=>clearTimeout(S)},[Pt,wn,v,Pe,u,Li]);const Xf=m.useCallback(async x=>{if(!u||u.archived)return;const S=u.source??"user";if(!(S!=="user"&&S!=="workspace")&&S!==x){$(!0),j("");try{const z=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,fromSource:S,toSource:x})}),U=await z.json().catch(()=>({}));if(!z.ok)throw new Error(typeof U.error=="string"?U.error:e("flow:composer.requestFailed"));const q=U.flowSource==="workspace"||U.flowSource==="user"?U.flowSource:x;let X={id:u.id,source:q,archived:u.archived};try{const te=await fetch("/api/flows");if(te.ok){const ne=await te.json(),pe=Array.isArray(ne)?ne.find(be=>be.id===u.id&&(be.source??"user")===q&&!!be.archived==!!u.archived):null;pe&&(X=pe)}}catch{}await Bs(X,{preserveComposer:!0}),vp(u.id,q)}catch(z){j(String(z.message||z))}finally{$(!1)}}},[u,Bs]),Sg=m.useCallback(async()=>{if(u){fu(!0),Yn(""),Zn("");try{const x=await fetch("/api/flow/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",archived:!!u.archived,schedule:qn})}),S=await x.json().catch(()=>({}));if(!x.ok||!S.success)throw new Error(S.error||"Failed to save schedule");xs({...Hu,...S.schedule||{}}),Zn(e("flow:schedule.saved")),await Jo(u,{quiet:!0,force:!0})}catch(x){Yn(String(x.message||x))}finally{fu(!1)}}},[u,qn,Jo,e]),y2=m.useCallback(async()=>{u&&(await Li(Ti.current,Wl.current),!u.archived&&u.source!=="builtin"&&await Sg())},[u,Li,Sg]),Jf=m.useCallback(async()=>{if(!u||!L.trim())return;const x=L.trim();if(x===u.id){M("");return}R(!0),M("");try{const S=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",newFlowId:x})}),z=await S.json().catch(()=>({}));if(!S.ok)throw new Error(typeof z.error=="string"?z.error:e("flow:composer.requestFailed"));let U={id:z.flowId,source:z.flowSource??u.source,archived:u.archived};try{const q=await fetch("/api/flows");if(q.ok){const X=await q.json(),te=Array.isArray(X)?X.find(ne=>ne.id===z.flowId&&(ne.source??"user")===(z.flowSource??u.source)):null;te&&(U=te)}}catch{}await Bs(U,{preserveComposer:!0}),vp(z.flowId,z.flowSource??u.source)}catch(S){M(String(S.message||S))}finally{R(!1)}},[u,L,Bs]),e0=m.useCallback(x=>{navigator.clipboard.writeText(x).then(()=>{I(!0),setTimeout(()=>I(!1),2e3)}).catch(()=>{})},[]),Ng=m.useCallback(()=>{Li(Pt,wn)},[Li,Pt,wn]),x2=m.useCallback((x,S)=>{const z=S.trim()===""||S==="default"?void 0:S.trim(),U=Pt.map(q=>q.id===x?{...q,data:{...q.data,model:z}}:q);mt(U),Li(U,wn)},[Pt,wn,mt,Li]),Qf=m.useCallback(()=>{var at,sn;if(!gt||!u||!ot)return!1;const x=ot.id,S=gt.newId.trim();if(Gr(""),!BI.test(S))return Gr(e("flow:nodePropsError.invalidInstanceId")),!1;if(Pt.some(on=>on.id===S&&on.id!==x))return Gr(e("flow:nodePropsError.duplicateInstanceId")),!1;const z=gt.role.trim(),U=Ia.includes(z)?z:"普通",q=gt.model.trim(),X=on=>(Array.isArray(on)?on:[]).map(zt=>({type:String((zt==null?void 0:zt.type)??"节点").trim()||"节点",name:String((zt==null?void 0:zt.name)??""),default:String((zt==null?void 0:zt.default)??""),required:!!(zt!=null&&zt.required),showOnNode:(zt==null?void 0:zt.showOnNode)!=null?zt.showOnNode!==!1:!!(zt!=null&&zt.required)||String((zt==null?void 0:zt.type)??"节点").trim().toLowerCase()==="node"})),te=X(gt.inputs),ne=X(gt.outputs),pe=String(((at=ot.data)==null?void 0:at.definitionId)??S),be=pe.startsWith("provide_"),Oe={...ot.data,label:gt.label.trim()||S,role:U,model:q===""||q==="default"?void 0:q,body:be?"":gt.body,images:be?[]:is(gt.images),inputs:te,outputs:be&&Array.isArray((sn=ot.data)==null?void 0:sn.outputs)?ot.data.outputs:ne},le=String(gt.script??"").trim();pe==="tool_nodejs"||le!==""?Oe.script=String(gt.script??""):delete Oe.script;let Te,ve=wn;if(S!==x){const on={...kr.current},zt={...on[x]||{}};delete on[x],on[S]=zt,kr.current=on,Te=Pt.map(pt=>pt.id!==x?pt:{...pt,id:S,selected:!0,data:Oe}),ve=wn.map((pt,Kt)=>({...pt,source:pt.source===x?S:pt.source,target:pt.target===x?S:pt.target,id:`e-${pt.source===x?S:pt.source}-${pt.target===x?S:pt.target}-${Kt}`}))}else Te=Pt.map(on=>on.id===x?{...on,data:Oe}:on);return mt(Te),rn(ve),ji(S),Li(Te,ve),!0},[gt,u,ot,Pt,wn,mt,rn,ji,Li]),jg=m.useCallback(()=>{var sn,on;if(!gt||!u||!ot)return!1;const x=ot.id,S=gt.role.trim(),z=Ia.includes(S)?S:"普通",U=gt.model.trim(),q=zt=>(Array.isArray(zt)?zt:[]).map(pt=>({type:String((pt==null?void 0:pt.type)??"节点").trim()||"节点",name:String((pt==null?void 0:pt.name)??""),default:String((pt==null?void 0:pt.default)??""),required:!!(pt!=null&&pt.required),showOnNode:(pt==null?void 0:pt.showOnNode)!=null?pt.showOnNode!==!1:!!(pt!=null&&pt.required)||String((pt==null?void 0:pt.type)??"节点").trim().toLowerCase()==="node"})),X=q(gt.inputs),te=q(gt.outputs),ne=String(((sn=ot.data)==null?void 0:sn.definitionId)??x),pe=ne.startsWith("provide_"),be=gt.label.trim()||x,Oe=U===""||U==="default"?void 0:U,le={...ot.data,label:be,role:z,model:Oe,body:pe?"":gt.body,images:pe?[]:is(gt.images),inputs:X,outputs:pe&&Array.isArray((on=ot.data)==null?void 0:on.outputs)?ot.data.outputs:te},Te=String(gt.script??"").trim();ne==="tool_nodejs"||Te!==""?le.script=String(gt.script??""):delete le.script;const ve=ot.data||{};return(ve.label!==le.label||ve.role!==le.role||ve.model!==le.model||ve.body!==le.body||JSON.stringify(is(ve.images))!==JSON.stringify(le.images)||(ve.script??void 0)!==(le.script??void 0)||JSON.stringify(ve.inputs||[])!==JSON.stringify(X)||JSON.stringify(ve.outputs||[])!==JSON.stringify(te))&&(mt(zt=>zt.map(pt=>pt.id===x?{...pt,data:le}:pt)),ji(x)),!0},[gt,u,ot,mt,ji]),t0=m.useRef(jg);m.useEffect(()=>{t0.current=jg},[jg]),m.useEffect(()=>{if(!gt||!u||!Vl.current||Pe!=="edit")return;const x=setTimeout(()=>{t0.current()},400);return()=>clearTimeout(x)},[gt,u,Pe]);const w2=m.useCallback(()=>{if(!(!gt||!ot)){if(gt.newId.trim()===ot.id){Gr("");return}Qf()}},[gt,ot,Qf]);m.useEffect(()=>{const x=S=>{var te,ne,pe;if(Pe!=="edit")return;const z=MI(S.target);if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="s"){if(st==="node"&&ot&>){S.preventDefault(),S.stopPropagation(),Qf()||Ng();return}if(z)return;S.preventDefault(),S.stopPropagation(),Ng();return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="k"){S.preventDefault(),S.stopPropagation(),xu(be=>!be);return}if(Fl)return;if(Ko){if(S.key==="Escape"){S.preventDefault(),Ai(!1);return}if(fm(S)&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Ai(!1);return}(S.key==="v"||S.key==="V"||S.key==="h"||S.key==="H")&&!S.metaKey&&!S.ctrlKey&&!S.altKey&&S.preventDefault();return}if(z)return;const U=S.key.toLowerCase(),q=(S.metaKey||S.ctrlKey)&&!S.shiftKey&&U==="z",X=(S.metaKey||S.ctrlKey)&&(S.shiftKey&&U==="z"||U==="y");if(q||X){S.preventDefault(),S.stopPropagation();const be=q?qv():Yv();N(be?q?"Undo canvas change":"Redo canvas change":q?"Nothing to undo":"Nothing to redo");return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="c"){const be=EI(Ti.current,Wl.current,kr.current);be&&(S.preventDefault(),S.stopPropagation(),Wv.current=be,N(`Copied ${be.nodes.length} node${be.nodes.length>1?"s":""}`));return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="v"){const be=_I(Wv.current,Ti.current,Wl.current,kr.current);be&&(S.preventDefault(),S.stopPropagation(),kr.current=be.instances,mt(be.nodes),rn(be.edges),N(`Pasted ${be.pastedNodeIds.length} node${be.pastedNodeIds.length>1?"s":""}`));return}if((S.key==="a"||S.key==="A")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),S.stopPropagation(),(te=Ye.current)==null||te.focus(),(pe=(ne=Ye.current)==null?void 0:ne.select)==null||pe.call(ne);return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="a"){S.preventDefault(),S.stopPropagation(),mt(be=>be.map(Oe=>({...Oe,selected:!0}))),rn(be=>be.map(Oe=>({...Oe,selected:!1})));return}if(fm(S)&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Ai(be=>!be);return}if((S.key==="v"||S.key==="V")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),yu("select");return}if((S.key==="h"||S.key==="H")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),yu("pan");return}};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[Ng,Ko,Fl,st,ot,gt,Qf,Pe,qv,Yv]),m.useEffect(()=>{if(Pe!=="running"||Ct==null)return;let x=Math.floor((Date.now()-Ct)/1e3);const S=setInterval(()=>{const z=Date.now()-Ct,U=Math.floor(z/1e3);U!==x&&(x=U,Be(z))},500);return()=>clearInterval(S)},[Pe,Ct]),m.useEffect(()=>{const x=ri.current;!x||!x.parentElement||hu.current&&(Ho.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Ho.current=!1}))},[ir]),m.useEffect(()=>{const x=ri.current;if(!x)return;const S=x.parentElement;if(!S)return;const z=()=>{if(Ho.current)return;const U=S.scrollHeight-S.scrollTop-S.clientHeight;hu.current=U<40};return S.addEventListener("scroll",z,{passive:!0}),()=>S.removeEventListener("scroll",z)},[Qn,Pe]),m.useEffect(()=>{if(Pe==="edit"||!Qn)return;hu.current=!0;const x=ri.current;x&&(Ho.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Ho.current=!1}))},[Pe,Qn]),m.useEffect(()=>{ir.length>mh+yj&&ut(x=>x.length>mh+yj?x.slice(-mh):x)},[ir]);const b2=m.useCallback(x=>{if(x.button!==0)return;x.preventDefault();const S=x.currentTarget;Ms.current={active:!0,pointerId:x.pointerId,startY:x.clientY,startH:ao},S.setPointerCapture(x.pointerId)},[ao]),v2=m.useCallback(x=>{const S=Ms.current;if(!S.active||x.pointerId!==S.pointerId)return;const z=S.startY-x.clientY;ti(gh(S.startH+z))},[]),Zf=m.useCallback(()=>{ti(x=>{const S=gh(x);try{localStorage.setItem(XI,String(S))}catch{}return S})},[]),n0=m.useCallback(x=>{const S=Ms.current;if(!(!S.active||x.pointerId!==S.pointerId)){S.active=!1;try{x.currentTarget.releasePointerCapture(x.pointerId)}catch{}Zf()}},[Zf]),k2=m.useCallback(()=>{const x=Ms.current;x.active&&(x.active=!1,Zf())},[Zf]);m.useEffect(()=>{function x(){ti(S=>gh(S))}return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const Oi=m.useCallback(async(x={})=>{if(!u)return;const S=x.runUuid!=null&&String(x.runUuid).trim()?String(x.runUuid).trim():null,z=x.cliInputsOverride??de.current,U=!!x.prepareOnly;if(qt(U?"ready":"running"),ut(U?[]:[{ts:new Date().toISOString(),type:"info",text:S?e("flow:run.connectingApiResume",{uuid:S}):e("flow:run.connectingApi")}]),Bn(new Set),tt({}),Hn(!U),zn(null),S||wr(null),U)return;if(!S){const X=Date.now();Vt(X),Be(0)}const q=new AbortController;ni.current=q;try{const X=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",...S?{uuid:S}:{},cliInputs:z}),signal:q.signal});if(!X.ok){const le=await X.json().catch(()=>({error:e("flow:composer.requestFailed")}));ut(Te=>[...Te,{ts:new Date().toISOString(),type:"error",text:le.error||e("flow:composer.requestFailed")}]),qt("error");return}if(ut(le=>[...le,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!X.body){ut(le=>[...le,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),qt("error");return}const te=X.body.getReader(),ne=new TextDecoder;let pe="";const be=le=>{const Te=le.ts||new Date().toISOString();if(le.type==="event")if(le.event==="node-start")Bn(ve=>new Set(ve).add(le.instanceId)),tt(ve=>({...ve,[le.instanceId]:{status:"running",startMs:Date.now()}})),ut(ve=>[...ve,{ts:Te,type:"node-start",text:le.label?e("flow:run.nodeStartWithLabel",{instanceId:le.instanceId,label:le.label}):e("flow:run.nodeStart",{instanceId:le.instanceId})}]);else if(le.event==="node-done"){Bn(at=>{const sn=new Set(at);return sn.delete(le.instanceId),sn});const ve=le.elapsed??null;tt(at=>({...at,[le.instanceId]:{status:"success",elapsed:ve}})),ut(at=>[...at,{ts:Te,type:"node-done",text:ve?e("flow:run.nodeDoneWithElapsed",{instanceId:le.instanceId,elapsed:ve}):e("flow:run.nodeDone",{instanceId:le.instanceId})}])}else if(le.event==="node-failed")Bn(ve=>{const at=new Set(ve);return at.delete(le.instanceId),at}),tt(ve=>({...ve,[le.instanceId]:{status:"failed",elapsed:le.elapsed??null}})),ut(ve=>[...ve,{ts:Te,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:le.instanceId})}]);else if(le.event==="apply-start"){if(le.uuid&&wr(String(le.uuid)),typeof le.runStartTime=="number"&&le.runStartTime>0)Vt(le.runStartTime),Be(Math.max(0,Date.now()-le.runStartTime));else if(typeof le.totalExecutedMs=="number"&&le.totalExecutedMs>0){const ve=Date.now()-le.totalExecutedMs;Vt(ve),Be(le.totalExecutedMs)}ut(ve=>[...ve,{ts:Te,type:"info",text:e("flow:run.pipelineStart",{uuid:le.uuid||"?"})}])}else le.event==="apply-done"?ut(ve=>[...ve,{ts:Te,type:"info",text:le.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:le.totalElapsed}):e("flow:run.pipelineDone")}]):le.event==="apply-paused"?ut(ve=>[...ve,{ts:Te,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(le.pendingNodes||[]).join(", ")})}]):ut(ve=>[...ve,{ts:Te,type:"event",text:`[${le.event}] ${JSON.stringify(le)}`}]);else le.type==="user-check-content"?(Ha({instanceId:le.instanceId,execId:le.execId??1,inputPath:le.inputPath,outputPath:le.outputPath,content:le.content||""}),uo(le.content||""),Vo(!1),Wa(""),Ua(!1),ut(ve=>[...ve,{ts:Te,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:le.instanceId})}])):le.type==="user-ask-prompt"?(Rl({instanceId:le.instanceId,execId:le.execId??1,question:le.question||"",options:Array.isArray(le.options)?le.options:[]}),si(!1),ut(ve=>[...ve,{ts:Te,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:le.instanceId,defaultValue:`等待用户选择 (${le.instanceId})`})}])):le.type==="tool-print-content"?(Ll({instanceId:le.instanceId,execId:le.execId??1,content:le.content||"",createdAt:Date.now()}),Ml(!1)):le.type==="log"?ut(ve=>[...ve,{ts:Te,type:"log",text:le.text!=null?String(le.text):""}]):le.type==="error"?ut(ve=>[...ve,{ts:Te,type:"error",text:le.message||e("flow:run.unknownError")}]):le.type==="done"?ut(ve=>[...ve,{ts:Te,type:"done",text:e("flow:run.executionEnd",{exitCode:le.exitCode??"?"})}]):ut(ve=>[...ve,{ts:Te,type:"log",text:JSON.stringify(le)}])},Oe=le=>{if(le.trim())try{be(JSON.parse(le))}catch{ut(Te=>[...Te,{ts:new Date().toISOString(),type:"log",text:le}])}};for(;;){const{done:le,value:Te}=await te.read();pe+=ne.decode(Te??new Uint8Array,{stream:!le});const ve=pe.split(`
|
|
133
|
-
`);pe=ve.pop()??"";for(const at of ve)Oe(at);if(le)break}pe.trim()&&Oe(pe),qt("done")}catch(X){X.name==="AbortError"?(ut(te=>[...te,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),qt("stopped")):(ut(te=>[...te,{ts:new Date().toISOString(),type:"error",text:X.message||e("flow:run.unknownError")}]),qt("error"))}finally{ni.current=null,Bn(new Set)}},[u]),[S2,Cg]=m.useState(!1),N2=m.useCallback(()=>{Cg(!0)},[]),j2=m.useCallback(async()=>{if(Cg(!1),ni.current&&(ni.current.abort(),ni.current=null),u)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user"})})}catch{}qt("stopped"),Bn(new Set)},[u]),Qa=m.useCallback(()=>{qt("edit"),Bn(new Set),tt({}),ys(null),wr(null)},[]),[C2,ep]=m.useState(!1),E2=m.useCallback(async()=>{if(ep(!1),ni.current&&(ni.current.abort(),ni.current=null),u)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user"})})}catch{}Qa()},[u,Qa]),_2=m.useCallback(()=>{ep(!1),n("/projects")},[n]),P2=m.useCallback(x=>{const S=x.runId!=null&&String(x.runId).trim()?String(x.runId).trim():null,z=x.flowId!=null&&String(x.flowId).trim()?String(x.flowId).trim():(u==null?void 0:u.id)!=null?String(u.id):null;wr(S);const U=x.status||"unknown";let q="stopped";U==="success"?q="done":U==="failed"?q="error":U==="running"?q="running":q="stopped",qt(q);const X=typeof x.at=="number"?x.at:null;if(q==="running"&&X!=null?(Vt(X),Be(Math.max(0,Date.now()-X))):X!=null&&typeof x.endedAt=="number"&&x.endedAt>X?(Vt(null),Be(x.endedAt-X)):(Vt(null),Be(Math.max(0,x.durationMs??0))),ut([]),Bn(new Set),tt({}),ys(null),zn(null),Hn(!1),S&&z){const te=new URLSearchParams({flowId:z,runId:S});fetch(`/api/run-node-statuses?${te}`).then(ne=>ne.json()).then(ne=>{const pe=ne.statuses&&typeof ne.statuses=="object"?ne.statuses:{},be={};for(const[Oe,le]of Object.entries(pe))le&&typeof le=="object"&&typeof le.status=="string"&&(be[Oe]={status:le.status,...le.elapsed!=null&&String(le.elapsed).trim()!==""?{elapsed:String(le.elapsed)}:{}});tt(be)}).catch(()=>{})}},[u==null?void 0:u.id]);m.useEffect(()=>{if(!(u!=null&&u.id)||Pe!=="edit")return;let x=!1;return(async()=>{try{const S=await fetch("/api/pipeline-recent-runs"),z=await S.json();if(x||!S.ok)return;const q=(Array.isArray(z.runs)?z.runs:[]).find(ne=>ne.flowId===u.id&&ne.status==="running");if(!q||x)return;const X=q.runId||null;wr(X),qt("running"),Hn(!0),Vt(q.at||Date.now()),Zs.current=0;const te=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${X},已恢复运行视图`}];if(X){const ne=new URLSearchParams({flowId:u.id,runId:X}),be=await(await fetch(`/api/run-node-statuses?${ne}`)).json();if(x)return;const Oe=be.statuses&&typeof be.statuses=="object"?be.statuses:{},le={},Te=new Set;for(const[ve,at]of Object.entries(Oe))at&&typeof at=="object"&&typeof at.status=="string"&&(le[ve]={status:at.status,...at.elapsed!=null&&String(at.elapsed).trim()!==""?{elapsed:String(at.elapsed)}:{}},at.status==="running"&&Te.add(ve));tt(le),Bn(Te);try{const ve=new URLSearchParams({flowId:u.id,runId:X,sinceBytes:"0",tailBytes:"262144"}),at=await fetch(`/api/run-log?${ve}`);if(at.ok){const sn=await at.json();if(!x){Zs.current=Number(sn.bytes||0);const on=xj(typeof sn.text=="string"?sn.text:"");ut([...on,...te]);return}}}catch{}}ut(te)}catch{}})(),()=>{x=!0}},[u==null?void 0:u.id]),m.useEffect(()=>{if(Pe==="edit"||!(u!=null&&u.id)||!en)return;let x=!1,S=null;const z=async()=>{try{const U=new URLSearchParams({flowId:u.id,runId:en}),q=await fetch(`/api/run-node-statuses?${U}`);if(!q.ok)return;const X=await q.json();if(x)return;const te=X.statuses&&typeof X.statuses=="object"?X.statuses:{},ne={},pe=new Set;for(const[be,Oe]of Object.entries(te))Oe&&typeof Oe=="object"&&typeof Oe.status=="string"&&(ne[be]={status:Oe.status,...Oe.elapsed!=null&&String(Oe.elapsed).trim()!==""?{elapsed:String(Oe.elapsed)}:{}},Oe.status==="running"&&pe.add(be));tt(be=>M7(be,ne)?be:ne),Bn(be=>$7(be,pe)?be:pe);try{const be=new URLSearchParams({flowId:u.id,runId:en,sinceBytes:String(Zs.current||0),tailBytes:String(T7)}),Oe=await fetch(`/api/run-log?${be}`);if(Oe.ok){const le=await Oe.json();if(x)return;const Te=Number(le.bytes||0),ve=typeof le.text=="string"?le.text:"";if(ve){const at=xj(ve);at.length>0&&ut(sn=>[...sn,...at])}Zs.current=Te}}catch{}try{const be=await fetch("/api/pipeline-recent-runs");if(!be.ok)return;const Oe=await be.json();if(x)return;const Te=(Array.isArray(Oe.runs)?Oe.runs:[]).find(ve=>ve.flowId===u.id&&ve.runId===en);if(Te&&Te.status){const ve=Te.status;ve==="running"?qt(at=>at==="running"?at:"running"):ve==="success"?qt("done"):ve==="failed"?qt("error"):(ve==="stopped"||ve==="interrupted")&&qt("stopped")}}catch{}}catch{}};return z(),S=window.setInterval(z,2500),()=>{x=!0,S&&window.clearInterval(S)}},[Pe,u==null?void 0:u.id,en]),m.useEffect(()=>{if(st!=="history"||!u)return;let x=!1;return(async()=>{zo(!0),hs("");try{const S=await fetch("/api/pipeline-recent-runs"),z=await S.json();if(!S.ok)throw new Error(z.error||"HTTP "+S.status);x||Ar(Array.isArray(z.runs)?z.runs:[])}catch(S){x||(hs(String(S.message||S)),Ar([]))}finally{x||zo(!1)}})(),()=>{x=!0}},[st,u]),m.useEffect(()=>{if(!u){gs({files:[]});return}let x=!1;return(async()=>{Bo(!0);try{const S=new URLSearchParams({flowId:u.id,flowSource:u.source||"user",archived:u.archived?"1":"0"}),z=await fetch(`/api/pipeline-files?${S}`),U=await z.json();if(!z.ok)throw new Error(U.error||"HTTP "+z.status);x||gs({files:Array.isArray(U.files)?U.files:[],path:U.path,error:U.error})}catch(S){x||gs({files:[],error:S.message||String(S)})}finally{x||Bo(!1)}})(),()=>{x=!0}},[u]);const Nu=m.useMemo(()=>u?Rs.filter(x=>x&&x.flowId===u.id).sort((x,S)=>S.at-x.at):[],[Rs,u]),Br=m.useMemo(()=>{let x=0,S=0,z=0,U=0,q=0;for(const X of Nu){const te=X.status||"unknown";te==="success"?x+=1:te==="failed"?S+=1:te==="running"?z+=1:te==="stopped"?U+=1:te==="interrupted"&&(q+=1)}return{success:x,failed:S,running:z,stopped:U,interrupted:q}},[Nu]),ju=m.useMemo(()=>u?pj(pr,$l):null,[u,pr,$l]),oi=m.useMemo(()=>{if(!ju||!u)return[];const x=ju.query.toLowerCase(),S=q=>x?q.some(X=>X&&String(X).toLowerCase().includes(x)):!0,z=Pt.map(q=>{var be,Oe;const X=q.id,te=String(((be=q.data)==null?void 0:be.label)??X),ne=(Oe=q.data)!=null&&Oe.definitionId?String(q.data.definitionId):"",pe=[te!==X?te:"",ne&&ne!==X?ne:""].filter(Boolean);return{id:X,label:te,defId:ne,subs:pe}}).filter(({id:q,label:X,defId:te})=>S([q,X,te])).sort((q,X)=>q.id.localeCompare(X.id)).slice(0,18).map(({id:q,label:X,defId:te})=>{const ne=[X!==q?X:null,te||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:q,title:q,subtitle:ne}}),U=ae.filter(q=>q&&q.id&&S([q.id,q.label,q.description])).sort((q,X)=>q.id.localeCompare(X.id)).slice(0,22).map(q=>({kind:"definition",id:q.id,title:q.id,subtitle:q.label&&q.label!==q.id?String(q.label):String(q.type||"")}));return[...z,...U]},[ju,Pt,ae,u]),Cu=m.useMemo(()=>{const x=oi.filter(z=>z.kind==="instance"),S=oi.filter(z=>z.kind==="definition");return{instances:x,definitions:S}},[oi]);m.useEffect(()=>{Ln(x=>{const S=Math.max(0,oi.length-1);return Math.min(Math.max(0,x),S)})},[oi]);const r0=m.useMemo(()=>S7(pr),[pr]),Sr=m.useMemo(()=>Pt.filter(x=>x.selected),[Pt]),Eg=m.useMemo(()=>new Set(Sr.map(x=>x.id)),[Sr]),tp=m.useMemo(()=>wn.filter(x=>Eg.has(x.source)&&Eg.has(x.target)),[wn,Eg]),s0=m.useMemo(()=>{const x=_e.trim().toLowerCase();return x?Ze.filter(S=>[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].filter(Boolean).some(z=>String(z).toLowerCase().includes(x))):Ze},[Ze,_e]),i0=m.useCallback((x,S)=>{const z=String(x||"snippet-node").trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"snippet-node",U=Date.now().toString(36);let q=`${z}-${U}`,X=2;for(;S.has(q);)q=`${z}-${U}-${X}`,X+=1;return S.add(q),q},[]),o0=m.useCallback((x,S)=>{var Kt,Hr;if(!u||!x)return;const z=x.snippet&&typeof x.snippet=="object"?x.snippet:{},U=z.instances&&typeof z.instances=="object"?z.instances:{},q=Object.keys(U);if(q.length===0)return;const X=new Set(Ti.current.map(He=>He.id)),te={};for(const He of q)te[He]=i0(He,X);const ne=(Kt=z.ui)!=null&&Kt.nodePositions&&typeof z.ui.nodePositions=="object"?z.ui.nodePositions:{},pe=(Hr=z.ui)!=null&&Hr.nodeSizes&&typeof z.ui.nodeSizes=="object"?z.ui.nodeSizes:{},be=q.map(He=>{const an=ne[He];return{id:He,x:typeof(an==null?void 0:an.x)=="number"?an.x:0,y:typeof(an==null?void 0:an.y)=="number"?an.y:0}}),Oe=Math.min(...be.map(He=>He.x)),le=Math.min(...be.map(He=>He.y));let Te=S||{x:180,y:160};const ve=Ja.current,at=document.querySelector(".af-pipeline-flow .react-flow");if(!S&&ve&&at){const He=at.getBoundingClientRect();Te=ve.screenToFlowPosition({x:He.left+He.width*.48,y:He.top+He.height*.32})}const sn={};for(const He of q)sn[te[He]]={...U[He]||{}};kr.current={...kr.current,...sn};const on=q.map(He=>{const an=U[He]||{},Mi=be.find(_u=>_u.id===He)||{x:0,y:0},ai=pe[He]&&typeof pe[He].width=="number"&&typeof pe[He].height=="number"?{width:pe[He].width,height:pe[He].height}:null,el={id:te[He],type:"flowNode",selected:!0,position:{x:Te.x+(Mi.x-Oe),y:Te.y+(Mi.y-le)},...ai?{width:ai.width,height:ai.height}:{},data:{label:an.label||te[He],definitionId:an.definitionId||He,role:an.role||"normal",body:an.body||"",script:an.script||"",...ai?{displaySize:ai}:{}}};return rf(el,kr.current,ae,{},u.id)}),zt=new Set(q),pt=(Array.isArray(z.edges)?z.edges:[]).filter(He=>zt.has(He==null?void 0:He.source)&&zt.has(He==null?void 0:He.target)).map((He,an)=>({id:`e-${te[He.source]}-${te[He.target]}-${Date.now()}-${an}`,source:te[He.source],target:te[He.target],sourceHandle:He.sourceHandle??void 0,targetHandle:He.targetHandle??void 0,markerEnd:{type:us.ArrowClosed}}));mt(He=>[...He.map(an=>({...an,selected:!1})),...on]),rn(He=>[...He.map(an=>({...an,selected:!1})),...pt]),N(`已添加流程片段:${x.displayName||x.id}`)},[i0,ae,u,rn,mt]);Hf.current=o0;const A2=m.useCallback(()=>{var z,U;if(Sr.length<2){Ht("请先在画布上选择至少两个节点。"),Ne("flows");return}const x=Sr[0],S=Sr.length===2?`${((z=x.data)==null?void 0:z.label)||x.id} 片段`:`${((U=x.data)==null?void 0:U.label)||x.id} 等 ${Sr.length} 个节点`;Nn({name:S,id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),Me(""),Jt(!0),Ne("flows")},[Sr]),I2=m.useCallback(async()=>{var X,te;if(!u||Sr.length<2)return;const x=Qt.name.trim();if(!x){Me("请填写片段名称。");return}const S=jf(Sr,kr.current),z={},U={};for(const ne of Sr){z[ne.id]={x:((X=ne.position)==null?void 0:X.x)||0,y:((te=ne.position)==null?void 0:te.y)||0};const pe=z7(ne);pe&&(U[ne.id]=pe)}const q=tp.map(ne=>({source:ne.source,target:ne.target,sourceHandle:ne.sourceHandle??null,targetHandle:ne.targetHandle??null}));ee(!0),Me("");try{const ne=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Qt.id,name:x,displayName:x,version:"1.0.0",description:Qt.description,snippet:{instances:S,edges:q,ui:{nodePositions:z,nodeSizes:U}}})}),pe=await ne.json().catch(()=>({}));if(!ne.ok||(pe==null?void 0:pe.ok)===!1)throw new Error((pe==null?void 0:pe.error)||"Publish failed");Jt(!1),N(`流程片段已发布:${pe.id||x}`),so(`流程片段已发布:${pe.id||x}`),await qf(),Ne("flows")}catch(ne){Me(String(ne.message||ne))}finally{ee(!1)}},[u,Sr,tp,Qt,qf,so]),np=m.useMemo(()=>{const x=[],S=new Set;for(const q of Sr)S.add(q.id),x.push({node:q,kind:"canvas"});const z=new Map(Pt.map(q=>[q.id,q])),U=new Map(ae.map(q=>[q.id,q]));for(const q of r0){if(S.has(q))continue;const X=z.get(q);if(X){S.add(q),x.push({node:X,kind:"mention"});continue}const te=U.get(q);te&&(S.add(q),x.push({definition:te,kind:"definition"}))}return x},[Sr,r0,Pt,ae]),Jr=m.useMemo(()=>{const x=Array.isArray(ft==null?void 0:ft.cursor)?ft.cursor:[],S=Array.isArray(ft==null?void 0:ft.opencode)?ft.opencode:[],z=Array.isArray(ft==null?void 0:ft.claudeCode)?ft.claudeCode:[],U=S.map(be=>`opencode:${ko(be)}`),q=z.map(be=>`claude-code:${ko(be)}`),X=new Set([...x,...S,...z].map(ko).concat(U).concat(q)),te=(mo||"").trim(),ne=zp(mo,x,S,z),pe=ne&&!X.has(ne)&&!X.has(te)?te:"";return{cursorList:x,opencodeList:S,claudeCodeList:z,currentNotInLists:pe}},[ft,mo]),_g=m.useMemo(()=>new Set(go),[go]),Pg=go.length,rp=m.useMemo(()=>{const x=new Map(zs.map(X=>[X.key,X])),S=new Set,z=new Set,U=Bl.map(X=>{const te=Pa(X,zs).map(ne=>x.get(ne)).filter(Boolean);for(const ne of te)S.add(ne.key),z.add(String(ne.name||ne.id||ne.key||"").trim());return{...X,skills:te}}).filter(X=>X.skills.length>0),q=zs.filter(X=>{const te=String(X.name||X.id||X.key||"").trim();return!S.has(X.key)&&!z.has(te)});return{groups:U,ungrouped:q}},[Bl,zs]),ql=m.useCallback(()=>{const x=Hl.current;if(!x)return;const S=x.getBoundingClientRect(),z=Math.min(400,Math.max(300,window.innerWidth-24)),U=Math.min(Math.max(12,S.right-z),window.innerWidth-z-12),q=Math.max(140,S.top-22),X=Math.min(360,q);Ff({position:"fixed",left:`${U}px`,top:`${Math.max(12,S.top-X-10)}px`,width:`${z}px`,maxHeight:`${X}px`})},[]);m.useEffect(()=>{const x=Array.isArray(ft==null?void 0:ft.cursor)?ft.cursor:[],S=Array.isArray(ft==null?void 0:ft.opencode)?ft.opencode:[],z=Array.isArray(ft==null?void 0:ft.claudeCode)?ft.claudeCode:[];Lf(U=>{const q=zp(U,x,S,z);return q===U?U:q})},[ft.cursor,ft.opencode,ft.claudeCode]),m.useEffect(()=>{if(!lr)return;ql();const x=z=>{var q,X;const U=z.target;(q=Hl.current)!=null&&q.contains(U)||(X=$f.current)!=null&&X.contains(U)||ku(!1)},S=z=>{z.key==="Escape"&&ku(!1)};return window.addEventListener("resize",ql),window.addEventListener("scroll",ql,!0),document.addEventListener("pointerdown",x),document.addEventListener("keydown",S),()=>{window.removeEventListener("resize",ql),window.removeEventListener("scroll",ql,!0),document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",S)}},[lr,ql]);const Za=m.useCallback(async(x,S={})=>{var pt;if(!u||nn.current)return;const z=S.phaseContextSnapshot,U=(typeof x=="string"?x:pr).trim();if(!U)return;const q=me.current;nn.current=!0,br(!0),cr(e("flow:composer.connecting")),zn(Kt=>Kt!=="composer"?"composer":Kt);const X=[...Et];if(q.length>0&&X.push({type:"assistant",segments:[...q]}),Yo([...X,{type:"user",text:U}]),X.filter(Kt=>Kt.type==="user").length===0){const Kt=U.replace(/\s+/g," ").slice(0,30)+(U.length>30?"…":"");oe(Hr=>Hr.map(He=>He.id===ue?{...He,label:Kt}:He))}const te=X.map(Kt=>Kt.type==="user"?{role:"user",text:Kt.text}:{role:"assistant",text:(Kt.segments||[]).filter(He=>He.kind==="assistant"||He.kind==="result").map(He=>He.text).join(`
|
|
134
|
-
`)}).filter(Kt=>Kt.text),ne=z??et;Ka(""),vr([]),ws([]),zf(!1);const pe=new AbortController;it.current=pe,$t.current=ue;let be=null;const Oe=Array.isArray(ft==null?void 0:ft.cursor)?ft.cursor:[],le=Array.isArray(ft==null?void 0:ft.opencode)?ft.opencode:[],Te=Array.isArray(ft==null?void 0:ft.claudeCode)?ft.claudeCode:[],ve=zp(mo,Oe,le,Te),at=np.filter(Kt=>Kt.kind!=="definition"&&Kt.node).map(Kt=>Kt.node.id),sn=u;let on=!1,zt=!1;try{be=setTimeout(()=>pe.abort(),12e4);const Kt={prompt:U,model:ve,flowId:u.id,flowSource:u.source??"user",...u.archived?{flowArchived:!0}:{},contextInstanceIds:at,thread:te,selectedSkills:go};ne&&ne.nextPhase&&!ne.isLastPhase&&(Kt.phaseContext={phaseIndex:ne.nextPhase.index,phases:ne.phases,userPromptOriginal:ne.userPromptOriginal||U}),bu&&(Kt.phaseRole=bu);const Hr=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Kt),signal:pe.signal});if(be&&(clearTimeout(be),be=null),!Hr.ok){let ai=Hr.statusText||e("flow:composer.requestFailed");try{const el=await Hr.json();el&&el.error&&(ai=String(el.error))}catch{}cr(ai),vr([{kind:"error",text:ai}]);return}const He=(pt=Hr.body)==null?void 0:pt.getReader();if(!He){cr(e("flow:composer.cannotReadStream"));return}const an=new TextDecoder;let Mi="";for(;;){const{done:ai,value:el}=await He.read();if(ai)break;for(Mi+=an.decode(el,{stream:!0});;){const _u=Mi.indexOf(`
|
|
135
|
-
`);if(_u<0)break;const p0=Mi.slice(0,_u).trim();if(Mi=Mi.slice(_u+1),!p0)continue;let Ve;try{Ve=JSON.parse(p0)}catch{continue}if(Ve.type==="status"&&typeof Ve.line=="string"&&cr(Ve.line),Ve.type==="natural"&&typeof Ve.text=="string"&&Ve.text){const un=typeof Ve.kind=="string"&&Ve.kind?Ve.kind:"assistant";vr(ln=>[...ln,{kind:un,text:Ve.text}])}if(Ve.type==="error"&&Ve.message){zt=!0;const un=Ve.code?` [${Ve.code}]`:"",ln=String(Ve.message)+un;cr(ln),vr(Qr=>[...Qr,{kind:"error",text:ln}])}if(Ve.type==="plan"&&Array.isArray(Ve.steps)){ws(Ve.steps.map(ln=>({...ln,status:"pending"})));const un=Ve.steps.map((ln,Qr)=>`${Qr+1}. ${ln.description||ln.type}`).join(`
|
|
136
|
-
`);vr(ln=>[...ln,{kind:"assistant",text:e("flow:composer.taskPlan",{count:Ve.steps.length,summary:un})}])}if(Ve.type==="step-start"){const un=Ve.index??0,ln=Ve.total??0,Qr=Ve.tier?` [${Ve.tier}]`:"",$2=Ve.model?` (${Ve.model})`:"";cr(e("flow:composer.step",{current:un+1,total:ln,description:(Ve.description||"")+Qr+$2})),ws(D2=>D2.map(Yl=>Yl.index===un?{...Yl,status:"running",model:Ve.model,tier:Ve.tier,nodeRole:Ve.nodeRole??Yl.nodeRole,instanceId:Ve.instanceId??Yl.instanceId,instanceLabel:Ve.instanceLabel??Yl.instanceLabel}:Yl))}if(Ve.type==="step-progress"){const un=Ve.index??0,ln=Ve.total??0;cr(e("flow:composer.step",{current:un+1,total:ln,description:Ve.description||""}))}if(Ve.type==="step-done"){const un=Ve.index??0;ws(ln=>ln.map(Qr=>Qr.index===un?{...Qr,status:Ve.success?"done":"error"}:Qr))}if(Ve.type==="phase-plan"&&Array.isArray(Ve.phases)){Xa(ln=>({...ln||{},phases:Ve.phases,currentPhase:Ve.currentPhase??0,phaseTotal:Ve.phaseTotal??Ve.phases.length,phaseName:Ve.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(ln==null?void 0:ln.userPromptOriginal)||U}));const un=Ve.phases.map((ln,Qr)=>`${Qr+1}. ${ln.label}`).join(" → ");vr(ln=>[...ln,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:Ve.phases.length,labels:un,current:Ve.phaseName||""})}])}Ve.type==="phase-complete"&&(Xa(un=>{var Qr;return{...un||{},phases:Ve.phases||(un==null?void 0:un.phases)||[],currentPhase:Ve.phaseIndex??0,phaseTotal:Ve.phaseTotal??((Qr=Ve.phases)==null?void 0:Qr.length)??0,phaseName:Ve.phaseName||"",isLastPhase:!!Ve.isLastPhase,nextPhase:Ve.nextPhase||null,userPromptOriginal:Ve.userPromptOriginal||(un==null?void 0:un.userPromptOriginal)||U}}),!Ve.isLastPhase&&Ve.nextPhase&&vr(un=>[...un,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:Ve.phaseName||e("flow:composer.nextPhase"),nextPhase:Ve.nextPhase.label})}])),Ve.type==="done"&&(on=!0,cr(un=>un||e("flow:composer.done")))}}}catch(Kt){const Hr=Kt;if(Hr.name==="AbortError"){const He=e(be?"flow:composer.connectTimeout":"flow:composer.aborted");cr(He),vr(an=>[...an,{kind:"error",text:He}])}else{const He=Hr.code||Hr.name||"UNKNOWN",an=`${Hr.message||String(Kt)} [${He}]`;cr(an),vr(Mi=>[...Mi,{kind:"error",text:an}])}}finally{if(nn.current=!1,br(!1),it.current=null,$t.current=null,be&&clearTimeout(be),on&&sn){const Kt={id:sn.id,source:sn.source??"user",archived:sn.archived};(async()=>(await Bs(Kt,{preserveComposer:!0,incrementalSync:!0}),await Jo(Kt,{quiet:!0,force:!0})))()}}},[u,pr,mo,ft,np,Bs,Jo,Et,ue,et,bu,go]);Lt.current=Za;const a0=m.useCallback(()=>{!et||et.isLastPhase||(Xa(null),Za(e("flow:composer.skipRemainingPhases")))},[et,Za]),l0=m.useCallback(()=>{if(!et||et.isLastPhase||!et.nextPhase)return;const x=String(et.nextPhase.label||"").trim()||e("flow:composer.nextPhase");Za(e("flow:composer.continuePhase",{label:x}),{phaseContextSnapshot:et})},[et,Za]);m.useEffect(()=>{if(!Ue)return;const x=S=>{S.key==="Escape"&&Xe(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[Ue]),m.useEffect(()=>{Pe!=="edit"&&Xe(!1)},[Pe]),m.useLayoutEffect(()=>{const x=ho.current;if(!x)return;if(!u){x.style.height="";return}x.style.height="0px";const S=getComputedStyle(x),z=parseFloat(S.lineHeight),U=(parseFloat(S.paddingTop)||0)+(parseFloat(S.paddingBottom)||0),q=Number.isFinite(z)&&z>0?z:13*1.45,X=U+q*2,te=U+q*10,ne=Math.min(Math.max(x.scrollHeight,X),te);x.style.height=`${ne}px`},[pr,u]);const Ag=m.useCallback(x=>{const S=pr,z=$l,U=pj(S,z);if(!U)return;const q=S.slice(0,U.atIndex)+`@${x} `+S.slice(z);Ka(q);const X=U.atIndex+x.length+2;queueMicrotask(()=>{const te=ho.current;te&&(te.focus(),te.setSelectionRange(X,X)),po(X)})},[pr,$l]),Ig=m.useCallback(x=>{Ka(S=>{const z=`@${x}`,U=S.indexOf(z);return U<0?S:S.slice(0,U)+S.slice(U+z.length)})},[]),c0=m.useCallback(x=>{x.kind==="canvas"?mt(S=>S.map(z=>z.id===x.node.id?{...z,selected:!1}:z)):x.kind==="mention"?Ig(x.node.id):Ig(x.definition.id)},[mt,Ig]),T2=m.useCallback(()=>{zn(x=>x==="history"?null:"history")},[]),R2=m.useCallback(()=>{zn(x=>x==="settings"?null:"settings")},[]),L2=m.useCallback(()=>{zn(x=>x==="composer"?null:"composer")},[]),Eu=m.useCallback(()=>{zn(x=>(x==="node"&&qa.current&&(wu.current=qa.current.id),null))},[]),u0=m.useCallback(()=>{Ai(x=>!x)},[]),O2=()=>{if(!u)return null;const x=or||u.archived||Hs(u.source),S=Rn!=null&&Rn.running?e("flow:schedule.running"):qn.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),z=Rn!=null&&Rn.running?"running":qn.enabled?"waiting":"disabled",U=mn.slice(0,12),q=u.archived||Hs(u.source);return o.jsxs("section",{className:"af-pipeline-settings-page","aria-label":e("flow:settings.title"),children:[o.jsxs("aside",{className:"af-pipeline-settings-nav","aria-label":e("flow:settings.sectionNav"),children:[o.jsx("div",{className:"af-pipeline-settings-nav-title",children:e("flow:settings.title")}),o.jsxs("a",{href:"#pipeline-basic",className:"af-pipeline-settings-nav-item af-pipeline-settings-nav-item--active",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"badge"}),e("flow:settings.basicInfo")]}),o.jsxs("a",{href:"#pipeline-storage",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),e("flow:settings.storageAndPath")]}),o.jsxs("a",{href:"#pipeline-marketplace",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"deployed_code"}),e("flow:settings.nodeMarketplace")]}),o.jsxs("a",{href:"#pipeline-schedule",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"schedule"}),e("flow:schedule.title")]}),o.jsxs("a",{href:"#pipeline-metadata",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"dataset"}),e("flow:pipeline.metadata")]}),o.jsxs("button",{type:"button",className:"af-pipeline-settings-nav-link",onClick:()=>n("/settings"),children:[e("flow:settings.globalSettings"),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]})]}),o.jsxs("main",{className:"af-pipeline-settings-main",children:[o.jsxs("div",{className:"af-pipeline-settings-main-head",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"af-pipeline-settings-title",children:e("flow:settings.title")}),o.jsx("p",{className:"af-pipeline-settings-subtitle",children:e("flow:settings.subtitle")})]}),o.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:Eu,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),o.jsxs("section",{id:"pipeline-basic",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"1."}),o.jsx("h2",{children:e("flow:settings.basicInfo")})]}),o.jsxs("div",{className:"af-pipeline-settings-grid af-pipeline-settings-grid--two",children:[o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(u.source==="user"||u.source==="workspace")&&!u.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:L,onChange:X=>{F(X.target.value),M("")},onKeyDown:X=>{X.key==="Enter"&&(X.preventDefault(),Jf())},onBlur:()=>{L.trim()&&L.trim()!==u.id&&Jf()},placeholder:u.id,disabled:A,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:ec(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:ec(u.source??"user",e)}),u.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),V?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:V}):null]}),o.jsxs("div",{className:"af-pipeline-settings-kv-block",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.owner")}),o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"person"}),u.owner||"bigo"]})]})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-pipeline-settings-textarea",value:v,onChange:X=>k(X.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:4,spellCheck:!1})]})]}),o.jsxs("section",{id:"pipeline-storage",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"2."}),o.jsx("h2",{children:e("flow:settings.storageAndPath")})]}),typeof u.path=="string"&&u.path?o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),o.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[o.jsx("span",{className:"af-pipeline-path-text",children:u.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>e0(u.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:D?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.archived?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),o.jsx("div",{className:"af-pipeline-move-actions",children:u.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>Xf("workspace"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>Xf("user"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),C?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:C}):null]}):o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")})]}),o.jsxs("section",{id:"pipeline-marketplace",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"3."}),o.jsx("h2",{children:e("flow:settings.nodeMarketplace")})]}),o.jsxs("div",{className:"af-pipeline-market-row",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"af-pipeline-market-count",children:[mn.length," ",e("flow:settings.marketNodesUnit")]}),o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.marketplaceHint")})]}),o.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:kg,disabled:yn,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(yn?"common:common.loading":"common:common.refresh")]})]}),xn?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:xn}):null,yn?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):U.length>0?o.jsx("div",{className:"af-pipeline-market-list",children:U.map(X=>{const te=X.definitionId||`marketplace:${X.id}${X.version?`@${X.version}`:""}`,ne=Xv.has(te)||Xv.has(`marketplace:${X.id}`),pe=Wf.find(Te=>String(Te.id)===te||String(Te.id)===`marketplace:${X.id}`),be=xe===te,Oe=Fp(X.inputs||X.input),le=Fp(X.outputs||X.output);return o.jsxs("div",{className:"af-pipeline-market-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:ne?"check_circle":"extension"}),o.jsxs("div",{className:"af-pipeline-market-main",children:[o.jsxs("div",{className:"af-pipeline-market-title-row",children:[o.jsx("strong",{children:X.displayName||X.label||X.id}),o.jsx("span",{children:X.version?`v${X.version}`:te})]}),o.jsx("p",{className:"af-pipeline-market-purpose",children:X.description||e("flow:settings.marketplaceNoDescription")}),o.jsxs("div",{className:"af-pipeline-market-io",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-pipeline-market-io-label",children:"Inputs"}),o.jsx("div",{className:"af-pipeline-market-chips",children:Oe.length>0?Oe.map(Te=>o.jsx("span",{className:"af-pipeline-market-chip",children:Te},`in-${te}-${Te}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),o.jsxs("div",{children:[o.jsx("span",{className:"af-pipeline-market-io-label",children:"Outputs"}),o.jsx("div",{className:"af-pipeline-market-chips",children:le.length>0?le.map(Te=>o.jsx("span",{className:"af-pipeline-market-chip",children:Te},`out-${te}-${Te}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]})]}),o.jsxs("div",{className:"af-pipeline-market-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary af-pipeline-market-action",onClick:()=>Fn(X),children:e("flow:settings.previewNode")}),o.jsx("button",{type:"button",className:ne?"af-btn-secondary af-pipeline-market-action":"af-btn-primary af-pipeline-market-action",disabled:q||be,onClick:()=>{ne&&pe?(Zv(pe),zn(null)):e2(X)},children:e(be?"flow:settings.installingNode":ne?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},te)})}):o.jsx("div",{className:"af-pipeline-settings-empty",children:e("flow:settings.marketplaceEmpty")})]}),o.jsxs("section",{id:"pipeline-schedule",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"4."}),o.jsx("h2",{children:e("flow:schedule.title")})]}),Tf?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-settings-schedule-grid",children:[o.jsxs("label",{className:"af-new-pipeline-radio af-pipeline-settings-checkbox",children:[o.jsx("input",{type:"checkbox",checked:!!qn.enabled,disabled:x,onChange:X=>Xo(te=>({...te,enabled:X.target.checked}))}),o.jsx("span",{children:e("flow:schedule.enabled")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:qn.cron||"",disabled:x,onChange:X=>Xo(te=>({...te,cron:X.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:qn.timezone||"",disabled:x,onChange:X=>Xo(te=>({...te,timezone:X.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),o.jsxs("select",{className:"af-pipeline-flow-select",value:qn.preset||"",disabled:x,onChange:X=>Xo(te=>({...te,preset:X.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Tn).map(X=>o.jsx("option",{value:X,children:X},X))]})]})]}),o.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[o.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${z}`}),o.jsx("span",{children:qn.nextRunAt?e("flow:schedule.nextRun",{time:new Date(qn.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),o.jsxs("span",{children:[e("flow:schedule.runtime"),":",S]})]}),o.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[Xt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Xt.lastTriggeredAt).toLocaleString()})]}):null,Xt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Xt.lastSkippedAt).toLocaleString(),Xt.lastSkipReason?` · ${Xt.lastSkipReason}`:""]})]}):null,Xt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Xt.lastRunUuid})]}):null,Xt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Xt.lastExitCode)})]}):null,Xt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Xt.lastFinishedAt).toLocaleString()})]}):null]}),Rn!=null&&Rn.lastError||Xt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Rn==null?void 0:Rn.lastError)||Xt.lastError}):null,u.archived||Hs(u.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,za?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:za}):null,co?o.jsx("p",{className:"af-pipeline-drawer-muted",children:co}):null]})]}),o.jsxs("section",{id:"pipeline-metadata",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"5."}),o.jsx("h2",{children:e("flow:pipeline.metadata")})]}),o.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:pipeline.nodeCount")}),o.jsxs("dd",{children:[Pt.length," ",e("flow:pipeline.nodesUnit")]})]}),o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:settings.marketplaceNodes")}),o.jsx("dd",{children:Wf.length})]}),o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:ec(u.source??"user",e)})]})]})]})]}),o.jsxs("aside",{className:"af-pipeline-settings-side","aria-label":e("flow:settings.overview"),children:[o.jsxs("section",{className:"af-pipeline-settings-side-card",children:[o.jsxs("div",{className:"af-pipeline-settings-overview-head",children:[o.jsx("span",{className:"af-pipeline-settings-overview-icon material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),o.jsxs("div",{children:[o.jsx("h2",{children:u.id}),o.jsx("span",{className:`af-pipeline-settings-status af-pipeline-settings-status--${z}`,children:S})]})]}),o.jsxs("dl",{className:"af-pipeline-settings-side-dl",children:[o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:pipeline.nodeCount")}),o.jsx("dd",{children:Pt.length})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.owner")}),o.jsx("dd",{children:u.owner||"bigo"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:ec(u.source??"user",e)})]})]})]}),o.jsxs("section",{className:"af-pipeline-settings-side-card",children:[o.jsx("h2",{children:e("flow:settings.quickActions")}),o.jsxs("button",{type:"button",className:"af-btn-primary af-pipeline-settings-side-action",onClick:()=>void y2(),disabled:or,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(or?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:Eu,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),o.jsxs("section",{className:"af-pipeline-settings-side-card",children:[o.jsx("h2",{children:e("flow:settings.help")}),o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.helpText")}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]})]})]})},M2=()=>{const x=tn;if(!x)return null;const S=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`,z=x.displayName||x.label||x.id,U=Fp(x.inputs||x.input),q=Fp(x.outputs||x.output);return ts.createPortal(o.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:X=>{X.target===X.currentTarget&&Fn(null)},children:o.jsxs("div",{className:"af-market-preview-dialog",children:[o.jsxs("div",{className:"af-market-preview-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.nodePreviewTitle")}),o.jsx("h2",{children:z})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Fn(null),"aria-label":e("flow:settings.closePreview"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-market-preview-body",children:[o.jsx("section",{className:"af-market-preview-visual","aria-label":e("flow:settings.nodeStylePreview"),children:o.jsxs("div",{className:"af-market-preview-node",children:[o.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--left",children:(U.length>0?U:[""]).slice(0,4).map((X,te)=>o.jsx("span",{title:X},`preview-in-${te}`))}),o.jsxs("div",{className:"af-market-preview-node-main",children:[o.jsx("span",{className:"af-market-preview-node-icon material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("strong",{children:z}),o.jsx("span",{children:S})]}),o.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(q.length>0?q:[""]).slice(0,4).map((X,te)=>o.jsx("span",{title:X},`preview-out-${te}`))})]})}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:e("flow:settings.nodeFunction")}),o.jsx("p",{children:x.description||e("flow:settings.marketplaceNoDescription")})]}),o.jsxs("div",{className:"af-market-preview-io-grid",children:[o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:"Inputs"}),o.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:U.length>0?U.map(X=>o.jsx("span",{className:"af-pipeline-market-chip",children:X},`preview-input-${X}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:"Outputs"}),o.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:q.length>0?q.map(X=>o.jsx("span",{className:"af-pipeline-market-chip",children:X},`preview-output-${X}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:e("flow:settings.nodePackageInfo")}),o.jsxs("dl",{className:"af-market-preview-dl",children:[o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.definitionId")}),o.jsx("dd",{children:S})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.version")}),o.jsx("dd",{children:x.version||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagePath")}),o.jsx("dd",{children:x.packageDir||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagedFiles")}),o.jsx("dd",{children:Array.isArray(x.packagedFiles)&&x.packagedFiles.length>0?x.packagedFiles.map(X=>X.to||X).join(", "):"-"})]})]})]})]})]})}),document.body)};return o.jsxs(iv,{children:[o.jsx(I7,{onReady:a}),o.jsxs(KI.Provider,{value:{modelLists:ft,onModelChange:x2},children:[o.jsxs("div",{className:"af-pipeline-page"+(Pe!=="edit"?" af-pipeline-page--run-mode":""),children:[o.jsxs("header",{className:"af-pipeline-top",children:[o.jsxs("div",{className:"af-pipeline-top-left",children:[o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>{Pe==="running"?ep(!0):Pe!=="edit"?Qa():n("/projects")},"aria-label":e(Pe!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(Pe!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:"PIPELINE"}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",d7,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",className:"af-view-switch__active",children:"Pipeline"}),o.jsx("button",{type:"button",onClick:()=>n(zb(u,"workspace")),children:"Workspace"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[Ci&&o.jsx("button",{type:"button",className:"af-icon-btn"+(Ei?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>Os(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"description"})}),Pe==="running"&&o.jsxs("div",{className:"af-run-timer",children:[o.jsx("span",{className:"af-run-timer__dot"}),o.jsx("span",{className:"af-run-timer__label",children:"RUNTIME"}),o.jsx("span",{className:"af-run-timer__value",children:My(Fr,"running")})]}),Pe==="stopped"&&o.jsxs("div",{className:"af-run-timer af-run-timer--stopped",children:[o.jsx("span",{className:"af-run-timer__label",children:"PAUSED"}),o.jsx("span",{className:"af-run-timer__value",children:My(Fr,"stopped")})]}),(Pe==="done"||Pe==="error")&&o.jsxs("div",{className:"af-run-timer"+(Pe==="error"?" af-run-timer--error":" af-run-timer--done"),children:[o.jsx("span",{className:"af-run-timer__label",children:Pe==="error"?"FAILED":"COMPLETED"}),o.jsx("span",{className:"af-run-timer__value",children:My(Fr,Pe)})]}),Pe!=="edit"&&o.jsx("button",{type:"button",className:"af-icon-btn"+(Qn?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>Hn(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),Pe==="edit"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(st==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!u,onClick:T2,children:o.jsx("span",{className:"material-symbols-outlined",children:"history"})}),o.jsx("button",{type:"button",className:"af-icon-btn"+(st==="settings"?" af-icon-btn--active":""),onClick:R2,"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),disabled:!u,children:o.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(st==="composer"?" af-composer-topbar-btn--active":"")+(Tt?" af-composer-topbar-btn--running":""),onClick:L2,"aria-label":"AI Composer",title:"AI Composer",disabled:!u,children:"AI"}),o.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(Ko?" af-icon-btn--active":""),onClick:u0,"aria-label":e("flow:topbar.shortcutsLabel"),title:e("flow:topbar.shortcutsTitle"),disabled:!u,children:o.jsx("span",{className:"af-shortcuts-trigger__mark","aria-hidden":!0,children:"?"})}),o.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger","aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),disabled:!u||Hs(u.source)||u.source!=="user"&&u.source!=="workspace",onClick:()=>_(!0),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!u||Hs(u.source)||u.archived||u.source!=="user"&&u.source!=="workspace",onClick:()=>P(!0),children:"Archive"})]}),Pe==="running"?o.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:N2,title:e("flow:run.pauseRun"),children:[o.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):Pe==="ready"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void Oi(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Qa,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Pe==="stopped"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void Oi({runUuid:en}),title:en?e("flow:topbar.resumeTitle",{uuid:en}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Qa,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Pe==="done"||Pe==="error"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void Oi(),title:e("flow:topbar.rerunTitle"),children:"Run"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Qa,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):o.jsxs("div",{className:"af-run-btn-group",children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg af-run-btn-main",disabled:!u,onClick:()=>void Oi(),children:"Run"}),o.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!u,onClick:()=>Ee(x=>!x),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":Ie,children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),Ie&&u&&o.jsxs("div",{className:"af-run-dropdown-menu",children:[o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var S,z,U,q,X;Ee(!1);const x={};for(const te of ii){const ne=Ul[te.id];ne&&(x[ne]=((S=Yr[ne])==null?void 0:S.value)??((z=Yr[ne])==null?void 0:z.path)??((X=(q=(U=te.data)==null?void 0:U.outputs)==null?void 0:q[0])==null?void 0:X.default)??"")}In(x),Ft(!0)},children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),e("flow:topbar.runWithParams")]}),o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Ee(!1),Oi({prepareOnly:!0})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"tune"}),e("flow:topbar.editRun")]}),o.jsx("div",{className:"af-run-dropdown-divider"}),o.jsxs("div",{className:"af-run-dropdown-section",children:[o.jsx("span",{className:"af-run-dropdown-section-label",children:e("flow:topbar.runWithPreset")}),o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Ee(!1),Oi()},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys(Tn).map(x=>o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var U;Ee(!1);const S=Tn[x]||{},z={};for(const q of ii){const X=Ul[q.id];if(!X)continue;const te=((U=q.data)==null?void 0:U.definitionId)||"",ne=S[q.id]??"";te.startsWith("provide_file")?z[X]={type:"file",path:ne}:z[X]={type:"str",value:ne}}Oi({cliInputsOverride:z})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),x]},x))]})]})]})]})]}),We?o.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsx("span",{children:We}),o.jsx("button",{type:"button",onClick:()=>Qe(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-pipeline-body"+(Pe!=="edit"?" af-pipeline-body--run-mode":""),children:[Pe==="edit"&&st!=="settings"?o.jsxs("aside",{className:"af-node-palette af-flow-left-panel",id:"af-node-palette","aria-label":e("flow:palette2.nodePalette"),children:[o.jsxs("div",{className:`af-palette-workspace${ms?" af-palette-workspace--expanded":""}`,children:[o.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>io(x=>!x),"aria-expanded":ms,children:[o.jsx("span",{className:"af-palette-workspace-icon material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),o.jsx("span",{className:"af-palette-workspace-label",children:e("flow:palette.workspace")}),o.jsx("span",{className:"af-palette-workspace-chevron material-symbols-outlined","aria-hidden":!0,children:ms?"expand_less":"expand_more"})]}),o.jsx("div",{className:"af-palette-workspace-path",title:u&&(u.path||Jn.path)||"",children:u?u.id:e("flow:palette2.noPipelineSelected")}),ms&&o.jsx("div",{className:"af-palette-workspace-tree",children:Qs?o.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):Jn.error?o.jsx("div",{className:"af-palette-workspace-empty",children:Jn.error}):u?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-palette-workspace-group",children:[o.jsxs("div",{className:"af-palette-workspace-group-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"}),o.jsx("span",{children:u.id}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",Jn.files.length,")"]})]}),Jn.files.length>0?o.jsx("ul",{className:"af-palette-workspace-list",children:Jn.files.filter(x=>x.type==="file").map(x=>o.jsxs("li",{className:"af-palette-workspace-item af-palette-workspace-item--clickable",title:x.path,onClick:()=>Q({filePath:x.path,fileName:x.name}),children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:x.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:x.name}),x.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:x.size<1024?`${x.size}B`:x.size<1024*1024?`${(x.size/1024).toFixed(1)}KB`:`${(x.size/1024/1024).toFixed(1)}MB`})]},x.path))}):Jn.files.filter(x=>x.type==="directory").length===0?o.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),Jn.files.filter(x=>{var S;return x.type==="directory"&&((S=x.children)==null?void 0:S.length)>0}).map(x=>o.jsxs("div",{className:"af-palette-workspace-group af-palette-workspace-group--sub",children:[o.jsxs("div",{className:"af-palette-workspace-group-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:x.icon}),o.jsxs("span",{children:[x.name,"/"]}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",x.children.length,")"]})]}),o.jsx("ul",{className:"af-palette-workspace-list",children:x.children.map(S=>o.jsxs("li",{className:`af-palette-workspace-item${S.type==="file"?" af-palette-workspace-item--clickable":""}`,title:S.path,onClick:S.type==="file"?()=>Q({filePath:S.path,fileName:S.name}):void 0,children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:S.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:S.name}),S.type==="file"&&S.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:S.size<1024?`${S.size}B`:S.size<1024*1024?`${(S.size/1024).toFixed(1)}KB`:`${(S.size/1024/1024).toFixed(1)}MB`})]},S.path))})]},x.path))]}):o.jsx("div",{className:"af-palette-workspace-empty",children:e("flow:palette2.noPipelineSelected")})})]}),o.jsxs("div",{className:"af-node-palette-head",children:[o.jsxs("h2",{className:"af-node-palette-title",children:[o.jsx("span",{children:"Palette"}),o.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),o.jsxs("label",{className:"af-palette-search-wrap",children:[o.jsx("span",{className:"af-visually-hidden",children:Ce==="flows"?"搜索流程片段":e("flow:palette.searchNodes")}),o.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:Ye,type:"search",className:"af-palette-search-input",value:_e,onChange:x=>Ae(x.target.value),placeholder:(Ce==="flows"?"搜索流程片段":e("flow:palette.searchNodes"))+"…","aria-label":Ce==="flows"?"搜索流程片段":e("flow:palette.searchNodes")})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":Ce==="nodes",className:"af-palette-tab"+(Ce==="nodes"?" af-palette-tab--active":""),onClick:()=>Ne("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":Ce==="flows",className:"af-palette-tab"+(Ce==="flows"?" af-palette-tab--active":""),onClick:()=>Ne("flows"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),d?o.jsx("p",{className:"af-err af-palette-list-err",children:d}):null,o.jsx("div",{className:"af-node-palette-scroll",children:Ce==="flows"?o.jsxs(o.Fragment,{children:[o.jsx("section",{className:"af-palette-section af-flow-palette-section--snippets",children:o.jsxs("div",{className:"af-flow-snippet-actions",children:[o.jsxs("button",{type:"button",className:"af-flow-snippet-publish-btn",onClick:A2,disabled:!u||Sr.length<2,title:Sr.length<2?"选择至少两个节点后发布流程片段":"发布选中的流程片段",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布选中片段"]}),o.jsxs("span",{className:"af-flow-snippet-selection",children:["已选 ",Sr.length," 节点 / ",tp.length," 连线"]})]})}),ct?o.jsx("p",{className:"af-err af-palette-list-err",children:ct}):null,It?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段…"}):s0.length>0?o.jsxs("section",{className:"af-palette-section af-flow-palette-section--snippets",children:[o.jsx("h3",{className:"af-palette-cat",children:"FLOW SNIPPETS"}),o.jsx("div",{className:"af-palette-cards",children:s0.map(x=>{const S=`${x.id}@${x.version}`,z=x.displayName||x.name||x.id,U=x.description||`${x.nodeCount||0} 个节点,${x.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",onClick:()=>o0(x),draggable:!!u,onDragStart:q=>{q.dataTransfer.setData("application/agentflow-snippet",S),q.dataTransfer.effectAllowed="move"},disabled:!u,title:U,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:z}),o.jsxs("span",{className:"af-palette-card-id",children:[x.id,"@",x.version]})]})]}),U?o.jsx("span",{className:"af-palette-card-desc",children:U}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[x.nodeCount||0," nodes"]}),o.jsxs("span",{children:[x.edgeCount||0," edges"]})]})]},S)})})]}):o.jsx("p",{className:"af-palette-empty",children:_e.trim()?"无匹配流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[ed.filter(x=>Vf[x].length>0).map(x=>o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${x}`,children:[o.jsx("h3",{className:"af-palette-cat",children:x}),o.jsx("div",{className:"af-palette-cards",children:Vf[x].map(S=>{const z=dj(S.inputs,"input"),U=dj(S.outputs,"output"),X=S.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":YI(S),te=qI(S);return o.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>Zv(S),draggable:!!u,onDragStart:ne=>{ne.dataTransfer.setData("application/agentflow-node",S.id),ne.dataTransfer.effectAllowed="move"},disabled:!u,title:X||S.id,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:g7(x)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:te}),te!==S.id?o.jsx("span",{className:"af-palette-card-id",children:S.id}):null]})]}),X?o.jsx("span",{className:"af-palette-card-desc",children:X}):null,o.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[z.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[z.shown.map((ne,pe)=>o.jsxs("span",{className:"af-palette-card-port",title:uj("input",ne,pe),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Un(ne==null?void 0:ne.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:$y(ne,pe)})]},`in-${pe}`)),z.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",z.hidden]}):null]})]}),o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[U.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[U.shown.map((ne,pe)=>o.jsxs("span",{className:"af-palette-card-port",title:uj("output",ne,pe),children:[o.jsx("span",{className:"af-palette-card-port-name",children:$y(ne,pe)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Un(ne==null?void 0:ne.type)}})]},`out-${pe}`)),U.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",U.hidden]}):null]})]})]})]},S.id)})})]},x)),u&&ae.length===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,u&&ae.length>0&&_e.trim()&&ZT===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noMatch")}):null,u?null:o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.selectPipeline")})]})}),o.jsxs("footer",{className:"af-palette-engine",children:[o.jsxs("div",{className:"af-palette-engine-head",children:[o.jsx("span",{className:"af-palette-engine-dot"+(oo?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),o.jsx("span",{className:"af-palette-engine-label",children:e(oo?"common:engine.online":"common:engine.offline")})]}),w?o.jsx("div",{className:"af-palette-tip"+n2,role:"status","aria-live":"polite",children:w}):null]})]}):Pe!=="edit"&&u?o.jsx(s7,{flowId:u.id,flowSource:u.source||"user",flowArchived:u.archived,provideNodes:ii,edges:wn,nodes:Pt,onCliInputsChange:W,onBackToEdit:Qa}):null,o.jsxs("div",{className:"af-pipeline-main-stack",children:[o.jsxs("div",{className:"af-pipeline-canvas-col",children:[y?o.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:y}):null,u&&Ri.length>0&&!K?o.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings",role:"region","aria-label":e("flow:validation.flowWarningAriaLabel"),children:[o.jsxs("div",{className:"af-flow-slot-warnings-head",children:[o.jsx("div",{className:"af-flow-slot-warnings-title",children:e("flow:palette.validationWarnings")}),o.jsxs("div",{className:"af-flow-slot-warnings-head-actions",children:[o.jsx("button",{type:"button",className:"af-icon-btn",disabled:fe,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void Qv(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"})}),o.jsx("button",{type:"button",className:"af-icon-btn","aria-label":e("flow:validation.closeBanner"),title:e("common:common.close"),onClick:()=>ie(!0),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),o.jsx("ul",{className:"af-flow-slot-warnings-list",children:Ri.map(x=>o.jsxs("li",{children:[e("flow:validation.nodePrefix"),' "',o.jsx("a",{href:"#",className:"af-flow-slot-warning-node-link","aria-label":e("flow:validation.focusNodeAriaLabel",{nodeId:x.nodeId}),onClick:S=>{S.preventDefault(),f2(x.nodeId)},children:x.nodeId}),'"',x.suffix]},x.key))})]}):null,u&&Ri.length>0&&K?o.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings af-flow-slot-warnings--collapsed",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"af-flow-slot-warnings-collapsed-text",children:e("flow:validation.slotWarningCount",{count:Ri.length})}),o.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:u0,title:e("flow:validation.shortcutHint"),children:[o.jsx("kbd",{children:"?"})," ",e("flow:validation.shortcutHintLabel")]}),o.jsxs("div",{className:"af-flow-slot-warnings-collapsed-actions",children:[o.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",onClick:()=>ie(!1),children:e("flow:validation.show")}),o.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",disabled:fe,onClick:()=>void Qv(),children:e("common:common.refresh")})]})]}):null,st==="settings"&&u&&Pe==="edit"?O2():o.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:u?o.jsxs(o.Fragment,{children:[o.jsx(D7,{fitViewEpoch:h,canvasTool:Dl,nodes:GT,edges:XT,onNodesChange:Pe!=="edit"?void 0:UT,onEdgesChange:Pe!=="edit"?void 0:KT,onConnect:Pe!=="edit"?void 0:a2,onConnectStart:Pe!=="edit"?void 0:l2,onConnectEnd:Pe!=="edit"?void 0:c2,isValidConnection:Pe!=="edit"?void 0:o2,onNodesDelete:Pe!=="edit"?void 0:u2,onNodeClick:r2,onNodeDoubleClick:s2,onEdgeClick:i2,onFlowInit:d2,onDrop:g2,onDragOver:m2,hideMinimapAndControls:!!(u&&st),bottomSlot:Pe==="edit"?o.jsx("div",{className:"af-bottom-composer-stack af-flow-bottom-composer",children:o.jsxs("div",{className:"af-pipeline-composer-inner",children:[o.jsx("div",{className:"af-composer-selected","aria-label":e("flow:composer.selectedNodesAriaLabel"),children:np.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):np.map((x,S)=>{var pe,be;if(x.kind==="definition"){const Oe=x.definition,le=String(Oe.label??Oe.id),Te=[Oe.id,Oe.description?String(Oe.description).slice(0,120):""].filter(Boolean).join(" — ");return o.jsxs("div",{className:"af-composer-node-chip af-composer-node-chip--definition",title:Te,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:le}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>c0(x),"aria-label":e("flow:composer.removeFromInput",{id:Oe.id}),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${Oe.id}`)}const z=x.node,U=x.kind,q=String(((pe=z.data)==null?void 0:pe.label)??z.id),X=(be=z.data)!=null&&be.definitionId?String(z.data.definitionId):"",te=X&&X!==q?`${q} · ${z.id} · ${X}`:`${q} · ${z.id}`,ne=U==="canvas"?e("flow:composer.deselectNode",{id:z.id}):e("flow:composer.removeFromInput",{id:z.id});return o.jsxs("div",{className:"af-composer-node-chip"+(U==="mention"?" af-composer-node-chip--mention":""),title:te,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:q}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>c0(x),"aria-label":ne,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},z.id)})}),o.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[o.jsxs("div",{className:"af-composer-input-wrap",children:[o.jsx("textarea",{ref:ho,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!u,value:pr,rows:2,onChange:x=>{Ka(x.target.value),po(x.target.selectionStart??x.target.value.length)},onSelect:x=>{const S=x.target;S instanceof HTMLTextAreaElement&&po(S.selectionStart??0)},onKeyDown:x=>{if((x.metaKey||x.ctrlKey)&&x.key==="Enter"){x.preventDefault(),Za();return}if(ju&&oi.length>0&&(x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="Enter")){if(x.key==="ArrowDown")x.preventDefault(),Ln(S=>(S+1)%oi.length);else if(x.key==="ArrowUp")x.preventDefault(),Ln(S=>(S-1+oi.length)%oi.length);else if(x.key==="Enter"){x.preventDefault();const S=oi[Fs];S&&Ag(S.id)}}},onKeyUp:x=>{const S=x.target;S instanceof HTMLTextAreaElement&&po(S.selectionStart??S.value.length)},onClick:x=>{const S=x.target;S instanceof HTMLTextAreaElement&&po(S.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),ju&&u&&oi.length>0?o.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[Cu.instances.length>0?o.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:o.jsx("div",{className:"af-composer-mention-section-title",children:"Instances"})}):null,Cu.instances.map((x,S)=>{const z=S;return o.jsx("li",{role:"option","aria-selected":z===Fs,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(z===Fs?" af-composer-mention-item--active":""),onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>Ln(z),onClick:()=>Ag(x.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`i-${x.id}`)}),Cu.definitions.length>0?o.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:o.jsx("div",{className:"af-composer-mention-section-title",children:"Node"})}):null,Cu.definitions.map((x,S)=>{const z=Cu.instances.length+S;return o.jsx("li",{role:"option","aria-selected":z===Fs,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(z===Fs?" af-composer-mention-item--active":""),onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>Ln(z),onClick:()=>Ag(x.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`d-${x.id}`)})]}):null]}),o.jsxs("div",{className:"af-composer-toolbar",children:[re.length>0&&o.jsx("label",{className:"af-composer-session-field",children:o.jsxs("select",{className:"af-composer-session-select",value:ue||"",onChange:x=>{x.target.value==="__new__"?wt():Hv(x.target.value)},disabled:Tt,"aria-label":e("flow:composer.switchConversation"),children:[re.map(x=>o.jsxs("option",{value:x.id,children:[x.label,x.running?" ⏳":""]},x.id)),o.jsxs("option",{value:"__new__",children:["+ ",e("flow:composer.newConversation")]})]})}),o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:Hl,type:"button",className:"af-composer-skills-button"+(Pg>0?" af-composer-skills-button--active":""),disabled:!u||Tt,"aria-haspopup":"listbox","aria-expanded":lr,onClick:()=>ku(x=>!x),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:Pg>0?`Skills ${Pg}`:"Skills"})]}),lr&&!Tt?ts.createPortal(o.jsx("div",{ref:$f,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:Df,children:zs.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[rp.groups.map(x=>{const S=Pa(x,zs),z=e_(x,_g,zs),U=yg.has(x.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(U?" af-composer-skill-group--collapsed":""),children:[o.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[o.jsxs("label",{className:"af-composer-skill-group-check",children:[o.jsx("input",{type:"checkbox",checked:z==="all",disabled:S.length===0,onChange:q=>{const X=q.target.checked;Ya(te=>X?QE(te,S):ZE(te,S))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:x.name}),x.builtin?o.jsx("em",{children:"built-in"}):null,z==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":U?`展开 ${x.name}`:`收起 ${x.name}`,onClick:()=>{Mf(q=>{const X=new Set(q);return X.has(x.id)?X.delete(x.id):X.add(x.id),X})},children:[o.jsx("span",{children:x.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:U?"expand_more":"expand_less"})]})]}),U?null:o.jsx("div",{className:"af-composer-skill-group-items",children:x.skills.map(q=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:_g.has(q.key),onChange:X=>{const te=X.target.checked;Ya(ne=>te?ne.includes(q.key)?ne:[...ne,q.key]:ne.filter(pe=>pe!==q.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:q.name}),q.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:q.description}):null]})]},`${x.id}:${q.key}`))})]},x.id)}),rp.ungrouped.length>0?o.jsxs("div",{className:"af-composer-skill-group",children:[o.jsxs("div",{className:"af-composer-skill-group-title",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("span",{children:rp.ungrouped.length})]}),rp.ungrouped.map(x=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:_g.has(x.key),onChange:S=>{const z=S.target.checked;Ya(U=>z?U.includes(x.key)?U:[...U,x.key]:U.filter(q=>q!==x.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:x.name}),x.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:x.description}):null]})]},`ungrouped:${x.key}`))]}):null]})}),document.body):null]}),o.jsxs("label",{className:"af-composer-model-field",children:[o.jsx("span",{className:"af-visually-hidden",children:e("flow:composer.modelLabel")}),o.jsxs("select",{className:"af-composer-model-select",value:(mo||"").trim()?Jr.currentNotInLists?Jr.currentNotInLists:zp(mo,Jr.cursorList,Jr.opencodeList,Jr.claudeCodeList):"",onChange:x=>Lf(x.target.value),disabled:!u||Tt,"aria-label":e("flow:composer.modelAriaLabel"),children:[o.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),Jr.currentNotInLists?o.jsxs("option",{value:Jr.currentNotInLists,children:[Jr.currentNotInLists,e("flow:composer.modelNotInList")]}):null,Jr.cursorList.length>0?o.jsx("optgroup",{label:"Cursor",children:Jr.cursorList.map(x=>o.jsx("option",{value:ko(x),children:x},`composer-c-${x}`))}):null,Jr.opencodeList.length>0?o.jsx("optgroup",{label:"OpenCode",children:Jr.opencodeList.map(x=>o.jsx("option",{value:`opencode:${ko(x)}`,children:x},`composer-o-${x}`))}):null,Jr.claudeCodeList.length>0?o.jsx("optgroup",{label:"Claude Code",children:Jr.claudeCodeList.map(x=>o.jsx("option",{value:`claude-code:${ko(x)}`,children:x},`composer-cc-${x}`))}):null]})]}),o.jsx("button",{type:"button",className:"af-composer-send"+(u&&pr.trim()&&!Tt?" af-composer-send--active":"")+(Tt?" af-composer-send--stop":""),disabled:!u||!Tt&&!pr.trim(),"aria-label":e(Tt?"flow:composer.stopGeneration":"flow:composer.send"),title:Tt?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var x;if(Tt){(x=it.current)==null||x.abort();return}Za()},children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Tt?"stop":"arrow_upward"})})]})]}),Ue?ts.createPortal(o.jsx("div",{className:"af-node-props-expand-overlay af-composer-thread-dialog-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:composer.conversationOutput"),onMouseDown:x=>{x.target===x.currentTarget&&Xe(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel af-composer-thread-dialog-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head af-composer-thread-dialog-head",children:[o.jsxs("div",{className:"af-composer-thread-dialog-head-main",children:[o.jsx("span",{className:"af-node-props-expand-title",children:e("flow:nodeProps.conversationOutput")}),o.jsx("div",{className:"af-composer-thread-dialog-status"+(Tt?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:xt||void 0,children:Tt&&!xt?e("flow:composer.executing"):xt||e("flow:composer.ready")})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Xe(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),cn.length>1&&!(et&&Array.isArray(et.phases)&&et.phases.length>1)?o.jsx("div",{className:"af-composer-steps-track-wrap",children:o.jsx(j7,{steps:cn})}):null,et&&Array.isArray(et.phases)&&et.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:et.phases.map((x,S)=>{const z=x.status||(S<(et.currentPhase??0)?"done":S===(et.currentPhase??0)?Tt?"running":et.nextPhase||et.isLastPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(z==="done"?" af-composer-phase-item--done":"")+(z==="running"?" af-composer-phase-item--running":"")+(z==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:z==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:S+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||S)})}):null,o.jsx("div",{className:"af-composer-thread-dialog-scroll",children:o.jsx(hj,{thread:Et,liveSegments:Rt,running:Tt})}),et&&!et.isLastPhase&&et.nextPhase&&!Tt?o.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[o.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:et.nextPhase.label})}),o.jsxs("div",{className:"af-composer-phase-review-buttons",children:[o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:l0,children:e("flow:composer.phaseReviewContinue",{label:et.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:a0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),Xr&&Pe==="edit"?(()=>{var U;const x=String(Xr.query||"").trim().toLowerCase(),S=x?Xr.candidates.filter(q=>{var X,te,ne;return[(X=q.def)==null?void 0:X.id,q.displayLabel,q.description,(te=q.slot)==null?void 0:te.name,(ne=q.slot)==null?void 0:ne.type].filter(Boolean).some(pe=>String(pe).toLowerCase().includes(x))}):Xr.candidates,z=Xr.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:Xr.left,top:Xr.top},role:"dialog","aria-label":"选择匹配节点",children:[o.jsxs("div",{className:"af-connect-node-menu__head",children:[o.jsxs("div",{className:"af-connect-node-menu__title",children:[o.jsx("span",{className:"af-connect-node-menu__dot",style:{background:Un((U=Xr.draft.slot)==null?void 0:U.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",Xr.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>yo(null),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("label",{className:"af-connect-node-menu__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:Xr.query,onChange:q=>yo(X=>X&&{...X,query:q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[S.map(q=>{var ne,pe;const X=q.displayLabel||((ne=q.def)==null?void 0:ne.id),te=$y(q.slot,q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>h2(q),title:q.description||q.def.id,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:X}),X!==q.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:q.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:z}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Un((pe=q.slot)==null?void 0:pe.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:te})]})]},`${q.def.id}-${q.slotIndex}`)}),S.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null]}):o.jsx("div",{className:"af-placeholder af-pipeline-placeholder",children:e("flow:pipeline.selectPipeline")})})]}),Pe!=="edit"&&Qn&&o.jsxs("div",{className:"af-run-console",style:{height:ao},children:[o.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:b2,onPointerMove:v2,onPointerUp:n0,onPointerCancel:n0,onLostPointerCapture:k2}),o.jsxs("div",{className:"af-run-console__head",children:[o.jsxs("span",{className:"af-run-console__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"terminal"}),"EXECUTION CONSOLE"]}),o.jsxs("div",{className:"af-run-console__head-right",children:[Pe==="running"&&o.jsx("span",{className:"af-run-console__live-badge",children:"LIVE"}),o.jsx("button",{type:"button",className:"af-icon-btn af-run-console__close",onClick:()=>Hn(!1),"aria-label":e("flow:run.closeLog"),children:o.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})})]})]}),o.jsxs("div",{className:"af-run-console__body",children:[ir.map((x,S)=>o.jsxs("div",{className:"af-run-console__line"+(x.type==="error"?" af-run-console__line--error":"")+(x.type==="warn"?" af-run-console__line--warn":"")+(x.type==="node-start"?" af-run-console__line--start":"")+(x.type==="node-done"?" af-run-console__line--done":"")+(x.type==="node-failed"?" af-run-console__line--error":"")+(x.type==="done"?" af-run-console__line--done":""),children:[o.jsxs("span",{className:"af-run-console__ts",children:["[",x.ts?new Date(x.ts).toLocaleTimeString():"--:--:--","]"]}),o.jsx("span",{className:"af-run-console__text",children:x.text!=null?String(x.text):""})]},S)),o.jsx("div",{ref:ri})]})]})]}),Pe!=="edit"&&zr&&u?o.jsx(e7,{instanceId:zr,flowId:u.id,runId:en,nodeStatus:((d0=xr[zr])==null?void 0:d0.status)??null,onClose:()=>ys(null)}):null,st&&st!=="settings"&&u&&Pe==="edit"?o.jsx("aside",{className:"af-pipeline-drawer"+(st==="node"?" af-pipeline-drawer--wide":"")+(st==="composer"?" af-pipeline-drawer--wide":""),"aria-label":st==="settings"?e("flow:settings.title"):st==="history"?e("flow:history.title"):st==="composer"?"AI Composer":e("flow:nodeProps.title"),children:st==="composer"?o.jsxs("div",{className:"af-composer-sidebar",children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Eu,"aria-label":e("flow:composer.closeSidebar"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),re.length>0&&o.jsxs("div",{className:"af-composer-session-tabs",children:[re.map(x=>o.jsxs("button",{type:"button",ref:S=>{S&&x.id===ue&&S.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",x.id===ue?"af-composer-session-tab--active":"",x.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>Hv(x.id),title:x.label,children:[o.jsx("span",{className:"af-composer-session-label",children:x.label}),o.jsx("span",{className:"af-composer-session-close",role:"button",tabIndex:0,onClick:S=>{S.stopPropagation(),_t(x.id)},onKeyDown:S=>{S.key!=="Enter"&&S.key!==" "||(S.preventDefault(),S.stopPropagation(),_t(x.id))},title:x.running?e("flow:composer.endConversation"):e("flow:composer.closeConversation"),children:o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.75rem"},children:"close"})})]},x.id)),o.jsx("button",{type:"button",className:"af-composer-session-add",onClick:()=>wt(),title:e("flow:composer.newConversation"),children:o.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),o.jsx("div",{className:"af-composer-sidebar-status"+(Tt?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Tt&&!xt?e("flow:composer.executing"):xt||e("flow:composer.ready")}),et&&Array.isArray(et.phases)&&et.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:et.phases.map((x,S)=>{const z=x.status||(S<(et.currentPhase??0)?"done":S===(et.currentPhase??0)?Tt?"running":et.isLastPhase&&S===et.phases.length-1||et.nextPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(z==="done"?" af-composer-phase-item--done":"")+(z==="running"?" af-composer-phase-item--running":"")+(z==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:z==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:S+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||S)})}):null,o.jsx("div",{className:"af-composer-sidebar-thread",ref:$e,children:o.jsx(hj,{thread:Et,liveSegments:Rt,running:Tt})}),et&&!et.isLastPhase&&et.nextPhase&&!Tt?o.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[o.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:et.nextPhase.label})}),o.jsxs("div",{className:"af-composer-phase-review-buttons",children:[o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:l0,children:e("flow:composer.phaseReviewContinue",{label:et.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:a0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):st==="node"&&ot?gt?o.jsx(HI,{draft:gt,setDraft:Ii,definitionId:String(((f0=ot.data)==null?void 0:f0.definitionId)??ot.id),systemPromptReadonly:String((bg==null?void 0:bg.description)??""),modelLists:ft,disabled:!u,onIdBlur:w2,onClose:Eu,onPublishToMarketplace:t2,error:zl,ioSlots:{inputs:Array.isArray(gt==null?void 0:gt.inputs)?gt.inputs:[],outputs:Array.isArray(gt==null?void 0:gt.outputs)?gt.outputs:[]}}):o.jsx("div",{className:"af-pipeline-drawer-body",children:o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.loadingProps")})}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:e(st==="settings"?"flow:settings.title":"flow:history.title")}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Eu,"aria-label":e("flow:composer.closeSidebar"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-pipeline-drawer-body",children:st==="settings"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(u.source==="user"||u.source==="workspace")&&!u.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:L,onChange:x=>{F(x.target.value),M("")},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),Jf())},onBlur:()=>{L.trim()&&L.trim()!==u.id&&Jf()},placeholder:u.id,disabled:A,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:ec(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:ec(u.source??"user",e)}),u.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),V?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:V}):null]}),typeof u.path=="string"&&u.path?o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),o.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[o.jsx("span",{className:"af-pipeline-path-text",children:u.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>e0(u.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:D?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.archived?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),o.jsx("div",{className:"af-pipeline-move-actions",children:u.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>Xf("workspace"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>Xf("user"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),C?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:C}):null]}):o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea",value:v,onChange:x=>k(x.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:5,spellCheck:!1})]}),o.jsxs("div",{className:"af-pipeline-meta-card",children:[o.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:schedule.title")}),Tf?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"af-new-pipeline-radio",children:[o.jsx("input",{type:"checkbox",checked:!!qn.enabled,disabled:or||u.archived||Hs(u.source),onChange:x=>Xo(S=>({...S,enabled:x.target.checked}))}),o.jsx("span",{children:e("flow:schedule.enabled")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:qn.cron||"",disabled:or||u.archived||Hs(u.source),onChange:x=>Xo(S=>({...S,cron:x.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:qn.timezone||"",disabled:or||u.archived||Hs(u.source),onChange:x=>Xo(S=>({...S,timezone:x.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),o.jsxs("select",{className:"af-pipeline-flow-select",value:qn.preset||"",disabled:or||u.archived||Hs(u.source),onChange:x=>Xo(S=>({...S,preset:x.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Tn).map(x=>o.jsx("option",{value:x,children:x},x))]})]}),o.jsx("div",{className:"af-pipeline-drawer-readonly",children:o.jsx("span",{children:e("flow:schedule.overlapSkip")})}),qn.nextRunAt?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(qn.nextRunAt).toLocaleString()})}):o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.noNextRun")}),o.jsxs("dl",{className:"af-pipeline-meta-dl",children:[o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.runtime")}),o.jsx("dd",{children:Rn!=null&&Rn.running?e("flow:schedule.running"):qn.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),Xt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Xt.lastTriggeredAt).toLocaleString()})]}):null,Xt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Xt.lastSkippedAt).toLocaleString(),Xt.lastSkipReason?` · ${Xt.lastSkipReason}`:""]})]}):null,Xt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Xt.lastRunUuid})]}):null,Xt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Xt.lastExitCode)})]}):null,Xt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Xt.lastFinishedAt).toLocaleString()})]}):null]}),Rn!=null&&Rn.lastError||Xt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Rn==null?void 0:Rn.lastError)||Xt.lastError}):null,u.archived||Hs(u.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,za?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:za}):null,co?o.jsx("p",{className:"af-pipeline-drawer-muted",children:co}):null,o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:or||u.archived||Hs(u.source),onClick:Sg,children:e(or?"flow:schedule.saving":"flow:schedule.save")})]})]}),o.jsxs("div",{className:"af-pipeline-meta-card",children:[o.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:pipeline.metadata")}),o.jsx("dl",{className:"af-pipeline-meta-dl",children:o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:pipeline.nodeCount")}),o.jsxs("dd",{children:[Pt.length," ",e("flow:pipeline.nodesUnit")]})]})})]}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"af-pipeline-drawer-lead",children:[e("flow:settings.currentPipeline"),o.jsx("strong",{children:u.id})]}),Ls?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):Pn?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Pn}):Nu.length===0?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):o.jsxs(o.Fragment,{children:[Br.success+Br.failed+Br.running+Br.stopped+Br.interrupted>0?o.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[Br.success>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:Br.success})}):null,Br.failed>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:Br.failed})}):null,Br.stopped>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:Br.stopped})}):null,Br.interrupted>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:Br.interrupted})}):null,Br.running>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:Br.running})}):null]}):null,o.jsx("ul",{className:"af-exec-history-list",children:Nu.map((x,S)=>{const z=x.status||"unknown",U=z==="success"?"af-exec-history-card--success":z==="failed"?"af-exec-history-card--failed":z==="stopped"?"af-exec-history-card--stopped":z==="interrupted"?"af-exec-history-card--interrupted":z==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",q=e(z==="success"?"flow:history.success":z==="failed"?"flow:history.failed":z==="stopped"?"flow:history.stopped":z==="interrupted"?"flow:history.interrupted":z==="running"?"flow:history.running":"flow:history.unknown"),X=z==="success"?"check_circle":z==="failed"?"error":z==="stopped"?"stop_circle":z==="interrupted"?"sync_disabled":z==="running"?"progress_activity":"help",te=x.runId||`${x.at}-${S}`,ne=x.runId!=null&&x.runId.length>=6?e("flow:history.runLabel",{id:x.runId.length>8?x.runId.slice(-8):x.runId}):e("flow:history.runLabel",{id:Nu.length-S});return o.jsx("li",{className:"af-exec-history-list-item",children:o.jsxs("button",{type:"button",className:`af-exec-history-card ${U}`,onClick:()=>P2(x),title:e("flow:history.enterRunView"),children:[o.jsxs("div",{className:"af-exec-history-card-top",children:[o.jsx("span",{className:"af-exec-history-card-title",children:ne}),o.jsx("span",{className:"af-exec-history-card-time",children:Yx(x.at,e)})]}),o.jsxs("div",{className:"af-exec-history-card-bottom",children:[o.jsxs("span",{className:"af-exec-history-card-status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:X}),q]}),o.jsxs("span",{className:"af-exec-history-card-duration",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),$O(x.durationMs,e)]})]})]})},`${u.id}-${te}`)})})]})]})})]})}):null]}),o.jsx(YN,{open:S2,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:j2,onCancel:()=>Cg(!1)}),o.jsx(YN,{open:C2,title:e("flow:run.backPromptTitle",{defaultValue:"返回项目列表"}),message:e("flow:run.backPromptMessage",{defaultValue:"流水线仍在运行,请选择处理方式:后台继续运行并退出,或停止后返回编辑。"}),confirmLabel:e("flow:run.backBackground",{defaultValue:"后台运行并退出"}),secondaryLabel:e("flow:run.backStopEdit",{defaultValue:"停止并进入编辑"}),secondaryDestructive:!0,onConfirm:_2,onSecondary:E2,onCancel:()=>ep(!1)}),o.jsx($I,{open:Ko,onClose:()=>Ai(!1)}),M2(),o.jsx(FU,{open:Fl,onClose:()=>xu(!1),onJump:p2,nodes:Pt}),o.jsx(u7,{open:Ei,onClose:()=>Os(!1),flowId:(u==null?void 0:u.id)??""}),o.jsx(OU,{open:B,onClose:()=>P(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",onArchived:async()=>{P(!1),await Uf(),n("/projects?tab=archived")}}),o.jsx(MU,{open:O&&!!(u!=null&&u.id),onClose:()=>_(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),onDeleted:async()=>{_(!1),p(null),mt([]),rn([]),Xa(null),await Uf(),n("/projects")}}),Le&&ts.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Jt(!1),"aria-label":e("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"名称"}),o.jsx("input",{type:"text",value:Qt.name,onChange:x=>{const S=x.target.value;Nn(z=>({...z,name:S,id:z.id?z.id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:PR 检查片段",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"ID"}),o.jsx("input",{type:"text",value:Qt.id,onChange:x=>Nn(S=>({...S,id:x.target.value})),placeholder:"pr-check-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:Qt.description,onChange:x=>Nn(S=>({...S,description:x.target.value})),placeholder:"这段流程适合什么场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Sr.length," 个节点和 ",tp.length," 条内部连线。"]}),he?o.jsx("div",{className:"af-flow-snippet-error",children:he}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Jt(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:ce||!Qt.name.trim(),onClick:()=>void I2(),children:ce?"发布中…":"发布"})]})]})}),document.body),o.jsx(zU,{open:!!Y,onClose:()=>Q(null),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),filePath:(Y==null?void 0:Y.filePath)??"",fileName:(Y==null?void 0:Y.fileName)??"",onSaved:()=>{gs(x=>({...x}))}})]}),ar&&Pe!=="edit"&&ts.createPortal(o.jsx("div",{className:"af-user-check-modal-overlay",children:o.jsxs("div",{className:"af-user-check-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-user-check-modal__head",children:[o.jsxs("span",{className:"af-user-check-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),e("flow:userCheck.title",{instanceId:ar.instanceId})]}),o.jsx("div",{className:"af-user-check-modal__actions",children:mu?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--save",onClick:async()=>{if(!ar||!u||!en)return;const x=_i||ar.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"save-user-check-content",runUuid:en,instanceId:ar.instanceId,content:x})})).ok?(Ha(z=>z&&{...z,content:x}),Vo(!1),ut(z=>[...z,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):ut(z=>[...z,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{ut(S=>[...S,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:userCheck.save")]}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>{uo(ar.content),Vo(!1)},children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:userCheck.cancel")]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>Vo(!0),children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),e("flow:userCheck.edit")]}),o.jsx("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>Ha(null),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),o.jsx("div",{className:"af-user-check-modal__body",children:mu?o.jsx("textarea",{ref:Rf,className:"af-user-check-modal__textarea",value:_i||ar.content,onChange:x=>uo(x.target.value)}):o.jsx("div",{className:"af-user-check-modal__preview",children:o.jsx("pre",{children:_i||ar.content})})}),o.jsxs("div",{className:"af-user-check-modal__ai-bar",children:[o.jsx("input",{type:"text",className:"af-user-check-modal__ai-input",placeholder:e("flow:userCheck.aiEditPlaceholder"),value:Va,onChange:x=>Wa(x.target.value),disabled:Pi}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:Pi||!Va.trim(),onClick:()=>{!ar||!u||!en||!Va.trim()||(Ua(!0),ut(x=>[...x,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditStarted")}]),fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"ai-edit-user-check-content",runUuid:en,instanceId:ar.instanceId,content:_i||ar.content,prompt:Va})}).then(x=>x.json()).then(x=>{Ua(!1),x.ok&&x.content?(uo(x.content),Vo(!0),Wa(""),ut(S=>[...S,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):ut(S=>[...S,{ts:new Date().toISOString(),type:"error",text:x.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{Ua(!1),ut(x=>[...x,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[Pi?o.jsx("span",{className:"material-symbols-outlined af-spin",children:"sync"}):o.jsx("span",{className:"material-symbols-outlined",children:"auto_fix_high"}),e("flow:userCheck.aiEditBtn")]})]}),o.jsxs("div",{className:"af-user-check-modal__foot",children:[o.jsx("span",{className:"af-user-check-modal__hint",children:e("flow:userCheck.hint")}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--continue",onClick:async()=>{if(!ar||!u||!en)return;const x=_i||ar.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"save-user-check-content",runUuid:en,instanceId:ar.instanceId,content:x})})).ok?(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"confirm-user-check",runUuid:en,instanceId:ar.instanceId,execId:ar.execId})}),Ha(null),Wa(""),Oi({runUuid:en})):ut(z=>[...z,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{ut(S=>[...S,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:userCheck.continue")]})]})]})}),document.body),Ds&&Pe!=="edit"&&ts.createPortal(o.jsx("div",{className:"af-user-ask-modal-overlay",children:o.jsxs("div",{className:"af-user-ask-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-user-ask-modal__head",children:[o.jsxs("span",{className:"af-user-ask-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"help"}),e("flow:userAsk.title",{instanceId:Ds.instanceId})]}),o.jsx("div",{className:"af-user-ask-modal__actions",children:o.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>Rl(null),"aria-label":e("flow:userAsk.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})})]}),o.jsxs("div",{className:"af-user-ask-modal__body",children:[Ds.question.trim()?o.jsx("div",{className:"af-user-ask-modal__question",children:o.jsx("pre",{children:Ds.question})}):null,Ds.options.length===0?o.jsx("div",{className:"af-user-ask-modal__empty",children:e("flow:userAsk.noOptions")}):o.jsx("div",{className:"af-user-ask-modal__options",children:Ds.options.map(x=>o.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:gu,onClick:async()=>{if(!(!Ds||!u||!en)){si(!0);try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"confirm-user-ask",runUuid:en,instanceId:Ds.instanceId,execId:Ds.execId,branch:x.name,selectedIndex:x.index,selectedLabel:x.label})})).ok?(Rl(null),si(!1),Oi({runUuid:en})):(si(!1),ut(z=>[...z,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{si(!1),ut(S=>[...S,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}])}}},children:[o.jsxs("span",{className:"af-user-ask-option__index",children:["[",x.index,"]"]}),o.jsx("span",{className:"af-user-ask-option__label",children:x.label})]},x.name))})]}),o.jsx("div",{className:"af-user-ask-modal__foot",children:o.jsx("span",{className:"af-user-ask-modal__hint",children:e(gu?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),Mt&&Pe!=="edit"&&o.jsxs("div",{className:"af-tool-print-toast"+(Ol?" af-tool-print-toast--expanded":""),role:"status","aria-live":"polite",children:[o.jsxs("div",{className:"af-tool-print-toast__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"print"}),o.jsx("span",{className:"af-tool-print-toast__title",children:e("flow:toolPrint.title",{instanceId:Mt.instanceId})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Ml(x=>!x),"aria-label":e(Ol?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(Ol?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:Ol?"close_fullscreen":"open_in_full"})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Ll(null),"aria-label":e("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-tool-print-toast__body",children:o.jsx("div",{className:"af-tool-print-toast__markdown",children:o.jsx(Nf,{children:Mt.content})})})]}),Wo&&o.jsx("div",{className:"af-provide-edit-overlay",children:o.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-provide-edit-modal__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),o.jsx("span",{className:"af-provide-edit-modal__title",children:Wo.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>Uo(null),"aria-label":e("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-provide-edit-modal__body",children:o.jsx("textarea",{ref:fo,className:"af-provide-edit-modal__textarea",defaultValue:Wo.content,autoFocus:!0})}),o.jsxs("div",{className:"af-provide-edit-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:JT,children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:provideEdit.save")]}),o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>Uo(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),Re&&o.jsx("div",{className:"af-run-params-overlay",children:o.jsxs("div",{className:"af-run-params-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-run-params-modal__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),o.jsx("span",{className:"af-run-params-modal__title",children:e("flow:runParams.title")}),o.jsx("button",{type:"button",className:"af-run-params-modal__close",onClick:()=>Ft(!1),"aria-label":e("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-run-params-modal__body",children:ii.length===0?o.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):o.jsx("div",{className:"af-run-params-list",children:ii.map(x=>{var pe,be;const S=Ul[x.id];if(!S)return null;const z=((pe=x.data)==null?void 0:pe.definitionId)||"",U=z.startsWith("provide_file"),q=z==="provide_bool",X=((be=x.data)==null?void 0:be.label)||x.id,te=St[S]??"",ne=["true","1","yes","on"].includes(String(te).trim().toLowerCase());return o.jsxs("div",{className:"af-run-params-item",children:[o.jsxs("div",{className:"af-run-params-item__head",children:[o.jsx("span",{className:"af-run-params-item__icon material-symbols-outlined"+(U?" af-run-params-item__icon--file":""),children:U?"description":q?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-params-item__label",children:X}),o.jsx("span",{className:"af-run-params-item__slot",children:S})]}),q?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ne?" af-run-config-bool-toggle--true":""),onClick:()=>In(Oe=>({...Oe,[S]:ne?"false":"true"})),"aria-pressed":ne,children:ne?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-params-item__input",value:te,onChange:Oe=>In(le=>({...le,[S]:Oe.target.value})),placeholder:e(U?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},x.id)})})}),o.jsxs("div",{className:"af-run-params-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-run-params-modal__btn af-run-params-modal__btn--run",onClick:()=>{var S;const x={};for(const z of ii){const U=Ul[z.id];if(!U)continue;const q=((S=z.data)==null?void 0:S.definitionId)||"",X=St[U]??"";q.startsWith("provide_file")?x[U]={type:"file",path:X}:x[U]={type:"str",value:X}}Ft(!1),Ee(!1),Oi({cliInputsOverride:x})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runParams.run")]}),o.jsxs("button",{type:"button",className:"af-run-params-modal__btn",onClick:()=>Ft(!1),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})]})}const V7="modulepreload",W7=function(e){return"/"+e},bj={},U7=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=W7(c),c in bj)return;bj[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":V7,d||(u.as="script"),u.crossOrigin="",u.href=c,l&&u.setAttribute("nonce",l),document.head.appendChild(u),d)return new Promise((p,h)=>{u.addEventListener("load",p),u.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},K7=new Set(["echarts"]),q7=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),Y7=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),G7=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function Ca(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Cl(e,t){if(!Ca(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:Ca(n[r])&&Ca(s)&&(n[r]=Cl(n[r],s));return n}function sg(e,t){return e==null?e:Array.isArray(e)?e.map(n=>Ca(n)?Cl(n,t):n):Ca(e)?Cl(e,t):e}function X7(e){let t=String(e||"").trim();if(!t)return"";const n=t.match(/```(?:json|chart|echarts)?\s*\n?([\s\S]*?)```/i);if(n!=null&&n[1])t=n[1].trim();else{const r=t.indexOf("{"),s=t.lastIndexOf("}");r>=0&&s>r&&(t=t.slice(r,s+1).trim())}return t.replace(/^json\s*\n/i,"").trim()}function Ow(e,t="$"){if(e!=null){if(typeof e=="string"){if(/<\s*(script|iframe|object|embed|link|meta)\b/i.test(e))throw new Error(`${t} contains unsafe HTML`);if(/\bjavascript\s*:/i.test(e)||/\bdata\s*:\s*text\/html/i.test(e))throw new Error(`${t} contains unsafe URL text`);return}if(Array.isArray(e)){e.forEach((n,r)=>Ow(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||Y7.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);Ow(r,`${t}.${n}`)}}}function J7(e){const t=Array.isArray(e)?e:[e].filter(Boolean);if(!t.length)throw new Error("option.series is required");for(const n of t){const r=String((n==null?void 0:n.type)||"").trim();if(!q7.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function Q7(e){const t={trigger:"item",renderMode:"richText",backgroundColor:"rgba(20, 22, 28, 0.96)",borderColor:"rgba(124, 156, 255, 0.28)",textStyle:{color:"rgba(255, 255, 255, 0.92)"}};return!e||typeof e!="object"||Array.isArray(e)?t:Cl(e,t)}function Z7(e,t){const n={left:"center",top:12,textStyle:{color:"rgba(255, 255, 255, 0.9)",fontSize:15,fontWeight:700},subtextStyle:{color:"rgba(255, 255, 255, 0.52)"}};return Array.isArray(e)?e.map((r,s)=>{if(!Ca(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return Cl(i,n)}):Ca(e)?Cl(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function eK(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:sg(e,n)}function vj(e,t="rgba(255, 255, 255, 0.62)"){return sg(e,{nameTextStyle:{color:t},axisLabel:{color:"rgba(255, 255, 255, 0.58)"},axisLine:{lineStyle:{color:"rgba(255, 255, 255, 0.22)"}},axisTick:{lineStyle:{color:"rgba(255, 255, 255, 0.18)"}},splitLine:{lineStyle:{color:"rgba(255, 255, 255, 0.12)"}}})}function tK(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:sg(e,n)}function nK(e){const t={axisName:{color:"rgba(255, 255, 255, 0.68)"},splitLine:{lineStyle:{color:"rgba(255, 255, 255, 0.12)"}},splitArea:{areaStyle:{color:["rgba(255, 255, 255, 0.025)","rgba(255, 255, 255, 0.045)"]}},axisLine:{lineStyle:{color:"rgba(255, 255, 255, 0.16)"}}};return e==null?e:sg(e,t)}function rK(e,t,n){const r=Z7(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>Ca(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??G7,textStyle:Cl(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:Q7(e.tooltip),legend:eK(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?tK(e.grid,s||i):e.grid,xAxis:vj(e.xAxis),yAxis:vj(e.yAxis),radar:nK(e.radar),series:t}}function sK(e){const t=X7(e);if(!t)return{ok:!1,error:"No chart content"};try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("ChartSpec must be a JSON object");if(n.type!=="chart")throw new Error('type must be "chart"');if(n.version!=="1.0")throw new Error('version must be "1.0"');if(!K7.has(n.renderer))throw new Error('renderer must be "echarts"');if(!n.option||typeof n.option!="object"||Array.isArray(n.option))throw new Error("option must be an ECharts option object");Ow(n);const r=J7(n.option.series),s=n.title==null?"":String(n.title),i=rK(n.option,r,s);return{ok:!0,spec:{...n,title:s,option:i}}}catch(n){return{ok:!1,error:String((n==null?void 0:n.message)||n)}}}const iK="af:workspace-graph:v2",sc=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],oK=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),aK={id:"workspace_run",displayName:"Run",label:"Run",description:"Run the downstream workspace subgraph connected from this node.",type:"control",inputs:[{type:"node",name:"prev",default:""}],outputs:[{type:"node",name:"next",default:""}]},lK={id:"control_load_skills",displayName:"Load Skills",label:"Load Skills",description:"Load the currently selected Workspace skill collection for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"skillKeys",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"skillsContext",default:"",showOnNode:!0}]},cK={id:"control_load_mcp",displayName:"Load MCP",label:"Load MCP",description:"Load selected Cursor MCP server tool manifests for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"serverNames",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"mcpContext",default:"",showOnNode:!0}]},uK=new Set(["png","jpg","jpeg","gif","webp","svg"]),dK="0.1.43";function fK(){const e=new URLSearchParams(window.location.search);return{flowId:e.get("flowId")||"",flowSource:e.get("flowSource")||"user",archived:e.get("archived")==="1"||e.get("flowArchived")==="1"}}function ic(e){const t=new URLSearchParams;return e.flowId&&t.set("flowId",e.flowId),e.flowSource&&t.set("flowSource",e.flowSource),e.archived&&t.set("archived","1"),t}function Mw(e){if(!e)return!1;const t=String(e.type||"");if(t&&/^image\//i.test(t))return!0;const n=String(e.name||"").toLowerCase().split(".").pop();return uK.has(n)}function pK(e,t){const n=String(e||"").trim();if(!n)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(n)||n.startsWith("/"))return n;const r=ic(t||{});return r.set("path",n),`/api/workspace/file/raw?${r.toString()}`}function hK(e){const t=String((e==null?void 0:e.flowId)||"").trim();if(!t)return"";const n=String((e==null?void 0:e.flowSource)||"user").trim()||"user";return`af:composer-skills:workspace:${t}:${n}${e!=null&&e.archived?":archived":""}`}function mK(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function gK(e){const t=String(e||"").trim();if(!t)return"";if(/^思考中/.test(t))return"模型正在思考";if(/^生成回复中/.test(t))return"模型正在生成回复";if(/^Timing\s+(.+?):\s+(\d+)ms/i.test(t)){const n=t.match(/^Timing\s+(.+?):\s+(\d+)ms/i);return`耗时:${(n==null?void 0:n[1])||"step"} ${(n==null?void 0:n[2])||"0"}ms`}if(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i.test(t)){const n=t.match(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i),r=String((n==null?void 0:n[1])||"tool").trim(),s=String((n==null?void 0:n[2])||"").toLowerCase();if(r==="thinking")return"模型正在思考";const i=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${i}`:`执行:${i}`}return/^\[stderr\]/.test(t)?t:""}function kj(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=String((e==null?void 0:e.text)||"").trim();if(!t)return"";try{const n=JSON.parse(t);if((n==null?void 0:n.type)!=="thinking")return"";const r=String((n==null?void 0:n.subtype)||"");return r&&r!=="delta"?"":String((n==null?void 0:n.text)||(n==null?void 0:n.delta)||(n==null?void 0:n.thinking)||"").trim()}catch{return""}}function JI(e,t){const n=String(e||(t==null?void 0:t.id)||"").toLowerCase();return n.startsWith("control_")?"control":n.startsWith("provide_")?"provide":n.startsWith("tool_")?"agent":(t==null?void 0:t.type)||"agent"}function QI(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function Pv(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();if(!t)return String(e.id||"").trim();const n=e.runtime&&typeof e.runtime=="object"?e.runtime:{};return!!(n.entry||n.command)&&t==="tool_nodejs"?String(e.id||"").trim():t}function td(e){const t=String(Pv(e)||(e==null?void 0:e.id)||"");return t==="workspace_run"?"CONTROL":t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function Sj(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function pm(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function nd(e){return pm(e)}function $w(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function zy(e,t){const n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim(),r=String((e==null?void 0:e.type)||"").trim();return n||r||`#${t+1}`}function Nj(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function jj(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),s=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:s,kind:t}}function Cj(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(l=>[l.id,l])),i=Zc(s.get(n),e.sourceHandle||"output-0","source"),a=Zc(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&Qc(i,a))}function yK(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),s=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!s)return null;const i=t.find(l=>l.id===n),a=Zc(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:LI(a)}:null}function xK(e,t){return t?e.map((n,r)=>{const s=Array.isArray(t.handleType==="source"?n.inputs:n.outputs)?t.handleType==="source"?n.inputs:n.outputs:[];for(let i=0;i<s.length;i+=1){const a=s[i];if(!(t.handleType==="source"?Qc(t.slot,a):Qc(a,t.slot)))continue;const c=td(n);return{def:n,order:r,category:c,categoryRank:sc.indexOf(c),slot:a,slotIndex:i,displayLabel:nd(n),description:$w(n)}}return null}).filter(Boolean).sort((n,r)=>{var a,l;const s=(a=n.slot)!=null&&a.required?0:1,i=(l=r.slot)!=null&&l.required?0:1;return s-i||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function rd(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":n==="html"?"web":["csv","tsv"].includes(n)?"table":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function wK(e,t){const n=String(e||"node").replace(/^(agent|control|provide|tool|display)_/i,"").replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"node",r=new Set(t.map(s=>s.id));for(let s=1;s<1e4;s++){const i=`${n}_${s}`;if(!r.has(i))return i}return`${n}_${Date.now().toString(36)}`}function bK(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Hp(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:bK(t),required:!!(t!=null&&t.required),showOnNode:(t==null?void 0:t.showOnNode)!=null?t.showOnNode!==!1:!!(t!=null&&t.required)||String((t==null?void 0:t.type)||"node").trim().toLowerCase()==="node"}))}function ZI(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function vK(e){var s,i;const t=(e==null?void 0:e.data)||{},n=t!=null&&t.displaySize&&typeof t.displaySize=="object"?t.displaySize:{},r=t!=null&&t.nodeSize&&typeof t.nodeSize=="object"?t.nodeSize:{};return[ZI(e),Number((e==null?void 0:e.width)||0)||"",Number((e==null?void 0:e.height)||0)||"",Number(((s=e==null?void 0:e.measured)==null?void 0:s.width)||0)||"",Number(((i=e==null?void 0:e.measured)==null?void 0:i.height)||0)||"",Number(r.width||0)||"",Number(r.height||0)||"",Number(n.width||0)||"",Number(n.height||0)||"",t!=null&&t.isExecuting?"executing":"",(t==null?void 0:t.nodeStatus)||"",(t==null?void 0:t.runningRunNodeId)||""].join("::")}function By(e,t){var u,p;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=tT(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(u=e==null?void 0:e.ui)!=null&&u.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(p=e==null?void 0:e.ui)!=null&&p.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const h of s)h!=null&&h.source&&l.add(String(h.source)),h!=null&&h.target&&l.add(String(h.target));const d=Array.from(l).map(h=>{const g=r[h]||{},v=g.definitionId||h,k=t.find(T=>T.id===v),y=Pv(k)||v,b=t.find(T=>T.id===y)||k,w=g.marketplaceRef||QI(k),N=i[h]&&typeof i[h].x=="number"&&typeof i[h].y=="number"?i[h]:{x:320+l.size*20,y:180+l.size*12},C=a[h]&&typeof a[h].width=="number"&&typeof a[h].height=="number"?{width:a[h].width,height:a[h].height}:null,j=!!Ns(y);return{id:h,type:Cf,position:N,...C?{width:C.width,height:C.height}:{},data:{label:g.label||pm(k)||pm(b)||h,definitionId:y,...w?{marketplaceRef:w}:{},...k!=null&&k.packageId?{marketplacePackageId:k.packageId}:{},...k!=null&&k.version?{marketplaceVersion:k.version}:{},schemaType:JI(y,b||k),role:g.role||"normal",model:g.model||void 0,body:g.body||"",script:g.script||"",...C?{nodeSize:C}:{},...j&&C?{displaySize:C}:{}}}}).map(h=>rf(h,r,t)),f=s.filter(h=>(h==null?void 0:h.source)&&(h==null?void 0:h.target)).map((h,g)=>({id:h.id||`we-${h.source}-${h.target}-${g}`,source:String(h.source),target:String(h.target),sourceHandle:h.sourceHandle??void 0,targetHandle:h.targetHandle??void 0,markerEnd:{type:us.ArrowClosed}}));return{nodes:d,edges:TI(f,d),instances:r}}function eT(e){var s,i,a,l,c,d,f,u,p,h,g;const t=!!Ns((s=e==null?void 0:e.data)==null?void 0:s.definitionId),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.width)||((c=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:c.width)||(e==null?void 0:e.width)||(t?(d=e==null?void 0:e.measured)==null?void 0:d.width:0)||0),r=Number(((u=(f=e==null?void 0:e.data)==null?void 0:f.displaySize)==null?void 0:u.height)||((h=(p=e==null?void 0:e.data)==null?void 0:p.nodeSize)==null?void 0:h.height)||(e==null?void 0:e.height)||(t?(g=e==null?void 0:e.measured)==null?void 0:g.height:0)||0);return n>0&&r>0?{width:Math.round(n),height:Math.round(r)}:null}function Vp(e,t,n){var l,c;const r=tT(jf(e,n||{})),s=t.map(d=>({source:d.source,target:d.target,sourceHandle:d.sourceHandle??null,targetHandle:d.targetHandle??null})),i={},a={};for(const d of e){i[d.id]={x:((l=d.position)==null?void 0:l.x)||0,y:((c=d.position)==null?void 0:c.y)||0};const f=eT(d);f&&(a[d.id]=f)}return{version:1,instances:r,edges:s,ui:{nodePositions:i,nodeSizes:a}}}function tT(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!Ns(s)||s.startsWith("provide_")||!Array.isArray(r==null?void 0:r.output)){t[n]=r;continue}t[n]={...r,output:r.output.map(a=>({...a,value:"",default:""}))}}return t}function Ns(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":t==="display_html"?"html":t==="display_image"?"image":t==="display_chart"?"chart":t==="display_table"?"table":""}function vd(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=Ns(e==null?void 0:e.definitionId)==="image"?"src":"content",s=l=>String((l==null?void 0:l.value)??(l==null?void 0:l.default)??""),i=l=>s(l).trim(),a=t.find(l=>(l==null?void 0:l.name)===r&&i(l))||t.find(l=>(l==null?void 0:l.name)==="filePath"&&i(l))||t.find(l=>(l==null?void 0:l.type)==="text"&&i(l));return String((e==null?void 0:e.body)||(a?s(a):""))}function nT(e){let t=String(e||"").trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,a)=>{const l=a.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function kK(e){const n=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]].find(r=>(r==null?void 0:r.name)==="alt");return String((n==null?void 0:n.value)||(n==null?void 0:n.default)||(e==null?void 0:e.label)||"Image preview")}function SK(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function Eo(e){let t=String(e||"").trim();return t.includes("|")?(t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(n=>n.trim())):[]}function rT(e){const t=Eo(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function sT(e){return Eo(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function NK(e){const t=String(e||"").replace(/\r\n/g,`
|
|
137
|
-
`).split(`
|
|
138
|
-
`),n=[];let r=[],s=!1;const i=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
|
|
139
|
-
`)}),r=[])};for(let a=0;a<t.length;){const l=t[a]||"";if(/^\s*```/.test(l)){s=!s,r.push(l),a++;continue}if(!s&&a+1<t.length&&Eo(l).length>1&&rT(t[a+1])){i();const c=Eo(l),d=sT(t[a+1]),f=[];for(a+=2;a<t.length&&t[a].trim()&&Eo(t[a]).length>1;)f.push(Eo(t[a])),a++;n.push({type:"table",headers:c,align:d,rows:f});continue}r.push(l),a++}return i(),n}function Ej({children:e}){return o.jsx(Nf,{components:{p:({children:t})=>o.jsx(o.Fragment,{children:t})},children:String(e||"")})}function jK({content:e}){const t=m.useMemo(()=>NK(e),[e]);return o.jsx(o.Fragment,{children:t.map((n,r)=>n.type!=="table"?o.jsx(Nf,{children:n.text},`md-${r}`):o.jsx("div",{className:"af-work-display-table-wrap",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:n.headers.map((s,i)=>o.jsx("th",{style:{textAlign:n.align[i]||"left"},children:o.jsx(Ej,{children:s})},i))})}),o.jsx("tbody",{children:n.rows.map((s,i)=>o.jsx("tr",{children:n.headers.map((a,l)=>o.jsx("td",{style:{textAlign:n.align[l]||"left"},children:o.jsx(Ej,{children:s[l]||""})},l))},i))})]})},`table-${r}`))})}function CK(e,t=","){const n=[];let r=[],s="",i=!1;const a=String(e||"").replace(/\r\n/g,`
|
|
140
|
-
`);for(let l=0;l<a.length;l+=1){const c=a[l],d=a[l+1];if(i){c==='"'&&d==='"'?(s+='"',l+=1):c==='"'?i=!1:s+=c;continue}c==='"'?i=!0:c===t?(r.push(s.trim()),s=""):c===`
|
|
141
|
-
`?(r.push(s.trim()),n.push(r),r=[],s=""):s+=c}return(s||r.length)&&(r.push(s.trim()),n.push(r)),n.filter(l=>l.some(c=>String(c||"").trim()))}function Fi(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function EK(e){if(Array.isArray(e)){if(e.every(s=>s&&typeof s=="object"&&!Array.isArray(s))){const s=Array.from(new Set(e.flatMap(i=>Object.keys(i))));return{columns:s.map(i=>({key:i,label:i,align:"left"})),rows:e.map(i=>s.map(a=>Fi(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>Fi(i)||`Column ${a+1}`);return{columns:s.map((i,a)=>({key:String(a),label:i,align:"left"})),rows:e.slice(1).map(i=>s.map((a,l)=>Fi(i[l])))}}}if(!e||typeof e!="object")return null;const t=Array.isArray(e.columns)?e.columns:Array.isArray(e.headers)?e.headers:[],n=Array.isArray(e.rows)?e.rows:Array.isArray(e.data)?e.data:[];let r=t.map((s,i)=>s&&typeof s=="object"?{key:String(s.key||s.name||s.field||i),label:String(s.label||s.title||s.name||s.key||`Column ${i+1}`),align:["left","center","right"].includes(s.align)?s.align:"left"}:{key:String(i),label:Fi(s)||`Column ${i+1}`,align:"left"});return r.length===0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s))&&(r=Array.from(new Set(n.flatMap(s=>Object.keys(s)))).map(s=>({key:s,label:s,align:"left"}))),r.length===0&&n.every(Array.isArray)&&n.length>0?(r=n[0].map((s,i)=>({key:String(i),label:Fi(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>Fi(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>Fi(s[a])):s&&typeof s=="object"?r.map(i=>Fi(s[i.key])):r.map((i,a)=>a===0?Fi(s):""))}}function _K(e){const t=String(e||"").trim();if(!t)return{columns:[],rows:[],error:""};const n=t.match(/^```(?:json|table|csv|tsv|markdown|md)?\s*\n?([\s\S]*?)```\s*$/i),r=n?n[1].trim():t;try{const l=EK(JSON.parse(r));if(l&&l.columns.length)return{...l,error:""}}catch{}const s=r.replace(/\r\n/g,`
|
|
142
|
-
`).split(`
|
|
143
|
-
`).filter(l=>l.trim());if(s.length>=2&&Eo(s[0]).length>1&&rT(s[1])){const l=Eo(s[0]),c=sT(s[1]);return{columns:l.map((d,f)=>({key:String(f),label:d,align:c[f]||"left"})),rows:s.slice(2).map(d=>Eo(d)),error:""}}const i=r.includes(" ")?" ":",",a=CK(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((c,d)=>c||`Column ${d+1}`).map((c,d)=>({key:String(d),label:c,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function PK({content:e}){const t=m.useMemo(()=>_K(e),[e]);return t.error||t.columns.length===0?o.jsxs("div",{className:"af-work-display-table-empty",children:[o.jsx("strong",{children:"Table data error"}),o.jsx("span",{children:t.error||"No columns found"})]}):o.jsx("div",{className:"af-work-display-table-wrap af-work-display-table-wrap--standalone",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:t.columns.map((n,r)=>o.jsx("th",{style:{textAlign:n.align||"left"},children:n.label},`${n.key}-${r}`))})}),o.jsx("tbody",{children:t.rows.map((n,r)=>o.jsx("tr",{children:t.columns.map((s,i)=>o.jsx("td",{style:{textAlign:s.align||"left"},children:Fi(n[i])},`${s.key}-${i}`))},r))})]})})}function AK(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const d=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(d)?c&&(n.get(d).label=c):n.set(d,{id:d,label:c||d}),d},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),d=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return d?i(d[1],d[2]||d[3]||d[4]||d[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const d=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(d){r.push({from:a(d[1]),to:a(d[2])});continue}a(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function IK({code:e}){const t=m.useMemo(()=>AK(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,s=44,i=n?96:32,a=n?30:68,l=new Map;t.nodes.forEach((f,u)=>{l.set(f.id,{x:24+(n?u*(r+i):u%3*(r+i)),y:24+(n?u%3*(s+a):u*(s+a))})});const c=Math.max(360,...Array.from(l.values()).map(f=>f.x+r+24)),d=Math.max(180,...Array.from(l.values()).map(f=>f.y+s+24));return o.jsx("div",{className:"af-work-node__mermaid-preview",children:o.jsxs("svg",{viewBox:`0 0 ${c} ${d}`,role:"img","aria-label":"Mermaid preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((f,u)=>{const p=l.get(f.from),h=l.get(f.to);if(!p||!h)return null;const g=n?`M ${p.x+r} ${p.y+s/2} C ${(p.x+h.x+r)/2} ${p.y+s/2}, ${(p.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${p.x+r/2} ${p.y+s} C ${p.x+r/2} ${p.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return o.jsx("path",{className:"af-work-node__mermaid-edge",d:g,markerEnd:"url(#af-work-arrow)"},`${f.from}-${f.to}-${u}`)}),t.nodes.map(f=>{const u=l.get(f.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:u.x,y:u.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:u.x+r/2,y:u.y+s/2+5,textAnchor:"middle",children:f.label.slice(0,22)})]},f.id)})]})})}function sa({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const f=n.current;if(!f)return;const u=Math.max(1,f.scrollHeight),p=Math.max(1,f.clientHeight),h=u>p+1,g=h?Math.max(12,p/u*100):100,v=Math.max(0,100-g),k=h?Math.min(v,f.scrollTop/Math.max(1,u-p)*v):0;i({visible:h,top:k,height:g})},[]);m.useEffect(()=>{const f=requestAnimationFrame(a),u=n.current;if(!u||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(f);const p=new ResizeObserver(a);p.observe(u);for(const h of Array.from(u.children))p.observe(h);return()=>{cancelAnimationFrame(f),p.disconnect()}},[t,a]);const l=m.useCallback(f=>{const u=n.current;if(!u)return;const p=Math.max(0,u.scrollHeight-u.clientHeight);u.scrollTop=Math.min(1,Math.max(0,f))*p,a()},[a]),c=m.useCallback((f,u=0)=>{const p=r.current;if(!p)return 0;const h=p.getBoundingClientRect(),g=s.height/100*h.height,v=Math.max(1,h.height-g);return(f-h.top-u)/v},[s.height]),d=m.useCallback(f=>{var N,C;if(!s.visible)return;f.preventDefault(),f.stopPropagation();const u=r.current;if(!u)return;const p=u.getBoundingClientRect(),h=s.top/100*p.height,g=s.height/100*p.height,k=f.clientY>=p.top+h&&f.clientY<=p.top+h+g?f.clientY-p.top-h:g/2;l(c(f.clientY,k));const y=f.pointerId;(C=(N=f.currentTarget).setPointerCapture)==null||C.call(N,y);const b=j=>{j.preventDefault(),l(c(j.clientY,k))},w=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w)};window.addEventListener("pointermove",b),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w)},[c,l,s.height,s.top,s.visible]);return o.jsxs("div",{className:`af-visible-scroll-frame ${e}`,children:[o.jsx("div",{ref:n,className:`af-visible-scroll-frame__scroller ${e}`,onScroll:a,children:t}),o.jsx("div",{ref:r,className:"af-visible-scrollbar"+(s.visible?" af-visible-scrollbar--visible":""),onPointerDown:d,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function TK({content:e}){const t=m.useRef(null),n=m.useMemo(()=>sK(e),[e]),[r,s]=m.useState({loading:!1,error:""});return m.useEffect(()=>{if(!n.ok){s({loading:!1,error:n.error||"Invalid chart spec"});return}let i=!1,a=null,l=null,c=null;return s({loading:!0,error:""}),U7(()=>import("./index-DgQRkS4v.js"),[]).then(d=>{i||!t.current||(a=d.init(t.current,"dark",{renderer:"canvas"}),a.setOption(n.spec.option,!0),c=()=>a==null?void 0:a.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(c),l.observe(t.current)),window.addEventListener("resize",c),window.requestAnimationFrame(c),i||s({loading:!1,error:""}))}).catch(d=>{i||s({loading:!1,error:String((d==null?void 0:d.message)||d)})}),()=>{var d,f;i=!0,c&&window.removeEventListener("resize",c),(d=l==null?void 0:l.disconnect)==null||d.call(l),(f=a==null?void 0:a.dispose)==null||f.call(a)}},[n]),!n.ok||r.error?o.jsxs("div",{className:"af-work-display-chart-error",children:[o.jsx("strong",{children:"Chart configuration error"}),o.jsx("span",{children:r.error||n.error})]}):o.jsxs("div",{className:"af-work-display-chart",children:[o.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?o.jsx("div",{className:"af-work-display-chart__loading",children:"Loading chart..."}):null]})}function RK({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=Ns(e==null?void 0:e.definitionId);if(!s)return null;const i=vd(e),a=s==="html"?nT(i):i;if(!a.trim())return o.jsx(sa,{className:"af-work-display-empty",children:"No display content"});if(s==="html")return o.jsx(sa,{className:"af-work-display-body af-work-display-body--html",children:o.jsx("iframe",{ref:n,className:"af-work-display-html-frame",title:(e==null?void 0:e.label)||"HTML preview",sandbox:"allow-scripts allow-forms allow-modals",srcDoc:a},r)});if(s==="image"){const l=pK(a,t);return o.jsx(sa,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:l,alt:kK(e),loading:"lazy"})})}return s==="markdown"?o.jsx(sa,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(jK,{content:a})}):s==="chart"?o.jsx(sa,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx(TK,{content:a})}):s==="table"?o.jsx(sa,{className:"af-work-display-body af-work-display-body--table",children:o.jsx(PK,{content:a})}):s==="mermaid"?o.jsxs(sa,{className:"af-work-display-body",children:[o.jsx(IK,{code:a}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:a})]}):o.jsx(sa,{className:"af-work-display-body af-work-display-body--ascii",children:o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--ascii",children:a})})}function LK({value:e,onChange:t}){return o.jsx("div",{className:"af-work-display-editor nodrag nopan",onClick:n=>n.stopPropagation(),children:o.jsx("textarea",{className:"af-work-display-editor__textarea",value:e,onChange:n=>t==null?void 0:t(n.target.value),onKeyDown:n=>{n.key==="Escape"&&n.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1})})}function OK({nodeId:e,data:t}){const n=t==null?void 0:t.nodeChatActive,r=!!(t!=null&&t.selected),s=(t==null?void 0:t.nodeChat)||{},i=Array.isArray(s.messages)?s.messages:[],a=String(s.draft||""),[l,c]=m.useState(a),d=m.useRef(!1),f=String(s.candidateContent||""),u=!!s.running,p=String(s.error||"");return m.useEffect(()=>{d.current||c(a)},[a]),!n&&!r?null:n?o.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:h=>h.stopPropagation(),children:[o.jsxs("div",{className:"af-work-node-chat__head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"继续微调"}),o.jsx("span",{children:(t==null?void 0:t.label)||e})]}),o.jsx("button",{type:"button",onClick:()=>{var h;return(h=t==null?void 0:t.onCloseNodeChat)==null?void 0:h.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||u||p||f.trim()?o.jsxs("div",{className:"af-work-node-chat__messages",children:[i.slice(-4).map((h,g)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${h.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:h.role==="assistant"?"AI":"你"}),o.jsx("p",{children:h.text})]},`${h.at||g}-${g}`)),u?o.jsx("div",{className:"af-work-node-chat__pending",children:"生成中..."}):null,p?o.jsx("div",{className:"af-work-node-chat__error",children:p}):null]}):null,o.jsxs("div",{className:"af-work-node-chat__composer",children:[o.jsx("button",{type:"button",className:"af-work-node-chat__add",disabled:u,"aria-label":"添加上下文",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),o.jsx("textarea",{className:"af-work-node-chat__input",rows:2,value:l,disabled:u,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{d.current=!0},onCompositionEnd:h=>{var v;d.current=!1;const g=h.currentTarget.value;c(g),(v=t==null?void 0:t.onUpdateNodeChatDraft)==null||v.call(t,e,g)},onChange:h=>{var v;const g=h.target.value;c(g),d.current||(v=t==null?void 0:t.onUpdateNodeChatDraft)==null||v.call(t,e,g)},onKeyDown:h=>{var g,v;h.isComposing||(g=h.nativeEvent)!=null&&g.isComposing||h.keyCode===229||(h.metaKey||h.ctrlKey)&&h.key==="Enter"&&(h.preventDefault(),(v=t==null?void 0:t.onSendNodeChat)==null||v.call(t,e,l))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:u||!l.trim(),onClick:()=>{var h;return(h=t==null?void 0:t.onSendNodeChat)==null?void 0:h.call(t,e,l)},"aria-label":"发送",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]}),o.jsxs("div",{className:"af-work-node-chat__actions",children:[o.jsx("button",{type:"button",disabled:u||!f.trim(),onClick:()=>{var h;return(h=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:h.call(t,e,"replace")},children:"替换当前内容"}),o.jsx("button",{type:"button",disabled:u||!f.trim(),onClick:()=>{var h;return(h=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:h.call(t,e,"append")},children:"追加"})]})]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:h=>{var g;h.stopPropagation(),(g=t==null?void 0:t.onToggleNodeChat)==null||g.call(t,e)},title:"微调这个节点","aria-label":"微调这个节点",children:[o.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__plus","aria-hidden":!0,children:"add"}),o.jsx("span",{className:"af-work-node-chat-anchor__label",children:"继续微调这个展示"}),o.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__expand","aria-hidden":!0,children:"open_in_full"})]})}function MK(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function $K(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function DK(e,t){const n=Ns(t==null?void 0:t.definitionId)||"markdown";return`outputs/${$K((t==null?void 0:t.label)||e||n)}.${MK(n)}`}function FK({id:e,data:t,selected:n,deleteNode:r}){const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((A,R)=>({slot:A,idx:R})).sort((A,R)=>{var B,P,O,_;const V=String(((B=A.slot)==null?void 0:B.name)||"").trim(),M=String(((P=R.slot)==null?void 0:P.name)||"").trim();if(V==="next"&&M!=="next")return-1;if(M==="next"&&V!=="next")return 1;const D=String(((O=A.slot)==null?void 0:O.type)||"").trim(),I=String(((_=R.slot)==null?void 0:_.type)||"").trim();return D==="node"&&I!=="node"?-1:I==="node"&&D!=="node"?1:A.idx-R.idx}),l=Ns(t==null?void 0:t.definitionId),c=m.useRef(null),[d,f]=m.useState(0),[u,p]=m.useState(!1),[h,g]=m.useState(!1),[v,k]=m.useState(""),[y,b]=m.useState(!1),w=m.useRef(null),N=l==="markdown"?vd(t):"";m.useEffect(()=>{if(!u)return;const A=()=>p(!1);return window.addEventListener("pointerup",A,!0),window.addEventListener("pointercancel",A,!0),window.addEventListener("mouseup",A,!0),window.addEventListener("blur",A),()=>{window.removeEventListener("pointerup",A,!0),window.removeEventListener("pointercancel",A,!0),window.removeEventListener("mouseup",A,!0),window.removeEventListener("blur",A)}},[u]),m.useEffect(()=>{h||k(String(N||""))},[N,h]);const C=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="image"?"Image":l==="chart"?"Chart":l==="table"?"Table":"Markdown"),j=t!=null&&t.displaySize&&Number(t.displaySize.width)>0&&Number(t.displaySize.height)>0?{width:Number(t.displaySize.width),height:Number(t.displaySize.height)}:null,T=m.useCallback(A=>{var R;!A||l!=="image"||(R=t==null?void 0:t.onUploadImageToDisplayNode)==null||R.call(t,e,A)},[t,e,l]),$=m.useCallback(A=>{var M,D;l!=="image"||!(Array.from(((M=A.dataTransfer)==null?void 0:M.files)||[]).some(Mw)||Array.from(((D=A.dataTransfer)==null?void 0:D.items)||[]).some(I=>String((I==null?void 0:I.type)||"").startsWith("image/")))||(A.preventDefault(),A.stopPropagation(),A.dataTransfer.dropEffect="copy",b(!0))},[l]),L=m.useCallback(A=>{l==="image"&&(A.currentTarget.contains(A.relatedTarget)||b(!1))},[l]),F=m.useCallback(A=>{var V;if(l!=="image")return;const R=Array.from(((V=A.dataTransfer)==null?void 0:V.files)||[]).find(Mw);R&&(A.preventDefault(),A.stopPropagation(),b(!1),T(R))},[l,T]);return o.jsxs("div",{className:"af-work-display-card"+(j?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(u?" af-work-display-card--resizing":"")+(y?" af-work-display-card--image-drop":"")+(t!=null&&t.isExecuting?" af-work-display-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-display-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-display-card--failed":""),style:j?{width:j.width,height:j.height}:void 0,onDragOver:$,onDragLeave:L,onDrop:F,children:[o.jsx(XB,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,maxWidth:1200,maxHeight:1e3,onResizeStart:()=>p(!0),onResizeEnd:()=>p(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((A,R)=>{if(A.showOnNode===!1)return null;const V=`${4.15+R*1.75}rem`,M=A.name||`#${R+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:V},children:M}),o.jsx(fs,{type:"target",position:Ke.Left,id:`input-${R}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:V,background:Un(A.type)},title:`${M} · ${A.type}`})]},`in-${R}`)}),a.map(({slot:A,idx:R},V)=>{if(A.showOnNode===!1)return null;const M=`${4.15+V*1.75}rem`,D=A.name||`#${R+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:M},children:D}),o.jsx(fs,{type:"source",position:Ke.Right,id:`output-${R}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:M,background:Un(A.type)},title:`${D} · ${A.type}`})]},`out-${R}`)}),o.jsxs("div",{className:"af-work-display-card__head",children:[o.jsxs("div",{className:"af-work-display-card__title",children:[o.jsx("span",{className:"material-symbols-outlined",children:SK(l)}),o.jsx("strong",{children:C}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"display"})]}),l==="html"?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:A=>A.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var A,R,V,M;try{(M=(V=(R=(A=c.current)==null?void 0:A.contentWindow)==null?void 0:R.history)==null?void 0:V.back)==null||M.call(V)}catch{}},"aria-label":"后退",title:"后退",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var A,R,V,M;try{(M=(V=(R=(A=c.current)==null?void 0:A.contentWindow)==null?void 0:R.history)==null?void 0:V.forward)==null||M.call(V)}catch{}},"aria-label":"前进",title:"前进",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_forward"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>f(A=>A+1),"aria-label":"刷新",title:"刷新",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}):null,l==="markdown"?h?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:A=>A.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var A;(A=t==null?void 0:t.onSetDisplayNodeContent)==null||A.call(t,e,v,"replace",{logChat:!1,statusMessage:"已更新 Markdown 内容"}),g(!1)},"aria-label":"保存并预览",title:"保存并预览",children:o.jsx("span",{className:"material-symbols-outlined",children:"done"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{k(String(N||"")),g(!1)},"aria-label":"取消编辑",title:"取消编辑",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}):o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:A=>{A.stopPropagation(),k(String(N||"")),g(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:o.jsx("span",{className:"material-symbols-outlined",children:"edit"})}):null,l==="image"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:w,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:A=>{var V;const R=(V=A.target.files)==null?void 0:V[0];A.target.value="",R&&T(R)}}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:A=>{var R;A.stopPropagation(),(R=w.current)==null||R.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"upload"})})]}):null,o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:()=>{var A;return(A=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:A.call(t,e,t)},"aria-label":"另存为文件",title:"另存为文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"save"})}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&h?o.jsx(LK,{value:v,onChange:k}):o.jsx(RK,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:c,htmlFrameVersion:d}),o.jsx(OK,{nodeId:e,data:t})]})}function zK({id:e,data:t,selected:n,deleteNode:r}){const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=(t==null?void 0:t.runningRunNodeId)===e,l=(t==null?void 0:t.nodeStatus)==="stopped";return o.jsxs("div",{className:"af-work-run-card"+(n?" af-work-run-card--selected":"")+(a?" af-work-run-card--running":"")+(t!=null&&t.isExecuting?" af-work-run-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-run-card--failed":"")+(l?" af-work-run-card--stopped":""),children:[s.map((c,d)=>{if(c.showOnNode===!1)return null;const f=`${2.25+d*1.75}rem`,u=c.name||`#${d+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:f},children:u}),o.jsx(fs,{type:"target",position:Ke.Left,id:`input-${d}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:f,background:Un(c.type)},title:`${u} · ${c.type}`})]},`in-${d}`)}),i.map((c,d)=>{if(c.showOnNode===!1)return null;const f=`${2.25+d*1.75}rem`,u=c.name||`#${d+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:f},children:u}),o.jsx(fs,{type:"source",position:Ke.Right,id:`output-${d}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:f,background:Un(c.type)},title:`${u} · ${c.type}`})]},`out-${d}`)}),o.jsxs("div",{className:"af-work-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_circle"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Run"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_run"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("button",{type:"button",className:"af-work-run-card__button nodrag"+(a?" af-work-run-card__button--stop":""),onClick:c=>{var d,f;c.stopPropagation(),a?(d=t==null?void 0:t.onStopWorkspaceNode)==null||d.call(t,e):(f=t==null?void 0:t.onRunWorkspaceNode)==null||f.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:a?"stop_circle":"play_arrow"}),o.jsx("span",{children:a?"Stop":"Run line"})]})]})}function BK(e){var f,u,p,h,g,v,k,y,b,w,N,C;const{setEdges:t,setNodes:n}=Al(),r=(f=e.data)==null?void 0:f.onSyncNodePropDraft,s=(u=e.data)!=null&&u.nodeSize&&Number(e.data.nodeSize.width)>0&&Number(e.data.nodeSize.height)>0?{width:Number(e.data.nodeSize.width),height:Number(e.data.nodeSize.height)}:null,i=m.useCallback(j=>{n(T=>T.filter($=>$.id!==j)),t(T=>T.filter($=>$.source!==j&&$.target!==j))},[t,n]),a=m.useCallback((j,T)=>{n($=>$.map(L=>L.id===j?{...L,data:{...L.data,model:T}}:L)),r==null||r(j,{model:T})},[n,r]),l=m.useCallback((j,T)=>{n($=>$.map(L=>{var A;if(L.id!==j)return L;const F=Array.isArray((A=L.data)==null?void 0:A.outputs)&&L.data.outputs.length?L.data.outputs.map((R,V)=>V===0?{...R,default:T,value:T}:R):[{type:"bool",name:"value",default:T,value:T}];return{...L,data:{...L.data,body:"",outputs:F}}})),r==null||r(j,$=>({body:"",outputs:Array.isArray($==null?void 0:$.outputs)&&$.outputs.length?$.outputs.map((F,A)=>A===0?{...F,default:T,value:T}:F):[{type:"bool",name:"value",default:T,value:T}]}))},[n,r]),c=m.useCallback((j,T)=>{n($=>$.map(L=>L.id===j?{...L,data:{...L.data,body:T}}:L)),r==null||r(j,{body:T})},[n,r]),d=m.useCallback((j,T)=>{const $=is(T);n(L=>L.map(F=>F.id===j?{...F,data:{...F.data,images:$}}:F)),r==null||r(j,{images:$})},[n,r]);return Ns((p=e.data)==null?void 0:p.definitionId)?o.jsx(FK,{...e,deleteNode:i}):((h=e.data)==null?void 0:h.definitionId)==="workspace_run"?o.jsx(zK,{...e,deleteNode:i}):((g=e.data)==null?void 0:g.definitionId)==="control_load_skills"?o.jsx(QK,{...e,deleteNode:i,skills:(v=e.data)==null?void 0:v.skills,skillCollections:(k=e.data)==null?void 0:k.skillCollections,onChangeSkillKeys:(y=e.data)==null?void 0:y.onChangeLoadSkillKeys}):((b=e.data)==null?void 0:b.definitionId)==="control_load_mcp"?o.jsx(ZK,{...e,deleteNode:i,servers:(w=e.data)==null?void 0:w.mcpServers,onChangeMcpNames:(N=e.data)==null?void 0:N.onChangeLoadMcpNames}):o.jsx("div",{className:"af-work-flow-node",style:s?{width:s.width,height:s.height}:void 0,children:o.jsx(OI,{...e,deleteNode:i,modelLists:(C=e.data)==null?void 0:C.modelLists,onModelChange:a,onProvideValueChange:l,onNodeBodyChange:c,onNodeImagesChange:d})})}const HK={[Cf]:BK};function iT(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&iT(n.children,t);return t}function oT(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&oT(n.children,t));return t}function Wp(e){const t=String(e||"").replace(/\\/g,"/").split("/").filter(Boolean),n=[];for(let r=1;r<t.length;r++)n.push(t.slice(0,r).join("/"));return n}function VK(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function WK(e,t,n=0){const r=String(t||"").replace(/\\/g,"/").split("/").filter(Boolean);if(r.length===0)return e;const s=(i,a,l)=>{const c=r[a],d=l?`${l}/${c}`:c,f=a===r.length-1;let u=!1;const p=(Array.isArray(i)?i:[]).map(h=>h.name!==c?h:(u=!0,f?{...h,type:"file",name:c,path:d,icon:rd(c),size:n}:{...h,type:"directory",name:c,path:d,icon:rd(c,!0),children:s(h.children||[],a+1,d)}));return u||p.push(f?{type:"file",name:c,path:d,icon:rd(c),size:n}:{type:"directory",name:c,path:d,icon:rd(c,!0),children:s([],a+1,d)}),VK(p)};return s(e||[],0,"")}function aT({items:e,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:s,onCreateFolder:i,onDelete:a,onFileDragStart:l}){return o.jsx("ul",{className:"af-work-files",children:(e||[]).map(c=>{var u;const d=c.type==="directory",f=d&&(n==null?void 0:n.has(c.path));return o.jsxs("li",{children:[o.jsxs("div",{className:"af-work-file-row",children:[o.jsxs("button",{type:"button",className:"af-work-file af-work-file--"+c.type,draggable:!d,onDragStart:p=>{d||l==null||l(p,c)},onClick:()=>d?r==null?void 0:r(c.path):t(c),title:c.path,children:[d?o.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:f?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:c.icon||rd(c.name,d)}),o.jsx("span",{children:c.name})]}),d?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>s==null?void 0:s(c.path),title:"新增文件","aria-label":`在 ${c.name} 新增文件`,children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>i==null?void 0:i(c.path),title:"新增文件夹","aria-label":`在 ${c.name} 新增文件夹`,children:o.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})})]}):null,o.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:()=>a==null?void 0:a(c),title:"删除","aria-label":`删除 ${c.name}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]}),d&&!f&&((u=c.children)!=null&&u.length)?o.jsx(aT,{items:c.children,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:s,onCreateFolder:i,onDelete:a,onFileDragStart:l}):null]},c.path)})})}function UK({messages:e,running:t,showRunningIndicator:n=!0}){const r=e.length>0;return o.jsxs("div",{className:"af-composer-ai-stack af-composer-ai-stack--in-panel af-composer-thread-stack",children:[e.map((s,i)=>{const a=s.kind==="run-log"||s.kind==="run-summary"||s.kind==="activity"||s.kind==="prompt"||s.kind==="raw"||s.kind==="thinking"||s.kind==="result"||s.kind==="assistant"?"reply":s.role==="user"?"user-msg":s.error?"error":"reply",l=s.kind==="run-summary"?"Steps":s.kind==="run-log"?"Run":s.kind==="activity"?"Activity":s.kind==="prompt"?"Prompt":s.kind==="raw"?"Raw Trace":s.kind==="thinking"?"Thinking":s.kind==="result"?"Result":s.kind==="assistant"?"Response":s.role==="user"?"You":s.error?"Error":"Reply";return o.jsxs("section",{className:`af-composer-ai-block af-composer-ai-block--${a}${s.kind?` af-composer-ai-block--kind-${s.kind}`:""}`,children:[o.jsx("div",{className:"af-composer-ai-block-label",children:l}),o.jsx("div",{className:"af-composer-ai-block-body",children:s.text})]},`${i}-${s.role}-${String(s.text||"").slice(0,24)}`)}),n&&t&&!r?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:"Reply"}),o.jsx("div",{className:"af-composer-ai-block-body",children:"Waiting..."})]}):null,n&&t&&r?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--thinking",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:"Thinking"}),o.jsx("div",{className:"af-composer-ai-block-body",children:"Workspace agent is running..."})]}):null]})}function hm(e){const t=String(e||"").trim();if(!t)return[];try{const n=JSON.parse(t);if(Array.isArray(n))return n.map(String).filter(Boolean)}catch{}return t.split(/[\n,]+/).map(n=>n.trim()).filter(Boolean)}function KK(e){const t=hm((e==null?void 0:e.body)||"");if(t.length>0)return t;const r=(Array.isArray(e==null?void 0:e.inputs)?e.inputs:[]).find(s=>(s==null?void 0:s.name)==="skillsContext"||(s==null?void 0:s.name)==="skillKeys"||(s==null?void 0:s.type)==="text");return hm((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function qK(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function YK(e){const t=hm((e==null?void 0:e.body)||"");if(t.length>0)return t;const r=(Array.isArray(e==null?void 0:e.inputs)?e.inputs:[]).find(s=>(s==null?void 0:s.name)==="mcpContext"||(s==null?void 0:s.name)==="serverNames"||(s==null?void 0:s.type)==="text");return hm((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function GK(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function _j(e){var r,s,i,a,l,c;if(!e)return null;const{inputs:t,outputs:n}=II(e);return{id:e.id,newId:e.id,label:String(((r=e.data)==null?void 0:r.label)??e.id),role:String(((s=e.data)==null?void 0:s.role)??"normal"),model:String(((i=e.data)==null?void 0:i.model)??""),body:String(((a=e.data)==null?void 0:a.body)??""),images:is((l=e.data)==null?void 0:l.images),script:String(((c=e.data)==null?void 0:c.script)??""),inputs:t,outputs:n}}function XK(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function JK(e,t,n){if(!e||!t||!n)return n;const r={...e};for(const s of["newId","label","role","model","body","images","script","inputs","outputs"])XK(e[s],t[s])&&(r[s]=n[s]);return r}function QK({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,onChangeSkillKeys:a}){const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],d=Array.isArray(s)?s:[],f=Array.isArray(i)?i:[],[u,p]=m.useState(!1),[h,g]=m.useState(""),[v,k]=m.useState(()=>new Set),y=m.useRef(null),b=m.useRef(null),[w,N]=m.useState({visible:!1,top:0,height:100}),C=m.useMemo(()=>new Set(KK(t)),[t]),j=m.useMemo(()=>new Map(d.map(D=>[D.key,D])),[d]),T=m.useMemo(()=>{const D=new Set,I=f.map(P=>{const O=Pa(P,d).map(_=>j.get(_)).filter(Boolean);for(const _ of O)D.add(_.key);return{...P,skills:O}}).filter(P=>P.skills.length>0),B=d.filter(P=>!D.has(P.key));return{collectionGroups:I,ungrouped:B}},[j,f,d]);m.useEffect(()=>{k(D=>{let I=!1;const B=new Set(D);for(const P of T.collectionGroups)B.has(P.id)||(B.add(P.id),I=!0);return I?B:D})},[T.collectionGroups]);const $=m.useMemo(()=>{const D=h.trim().toLowerCase();if(!D)return T;const I=P=>[P==null?void 0:P.key,P==null?void 0:P.name,P==null?void 0:P.description].map(_=>String(_||"").toLowerCase()).join(" ").includes(D);return{collectionGroups:T.collectionGroups.map(P=>{const _=[P==null?void 0:P.id,P==null?void 0:P.name,P==null?void 0:P.description].map(Y=>String(Y||"").toLowerCase()).join(" ").includes(D)?P.skills:P.skills.filter(I);return{...P,skills:_}}).filter(P=>P.skills.length>0),ungrouped:T.ungrouped.filter(I)}},[T,h]),L=m.useCallback((D,I)=>{const B=new Set(C);for(const P of D)I?B.add(P):B.delete(P);a==null||a(e,Array.from(B))},[e,C,a]),F=m.useCallback(D=>{k(I=>{const B=new Set(I);return B.has(D)?B.delete(D):B.add(D),B})},[]),A=m.useCallback(()=>{const D=y.current;if(!D)return;const I=Math.max(1,D.scrollHeight),B=Math.max(1,D.clientHeight),P=I>B+1,O=P?Math.max(12,B/I*100):100,_=Math.max(0,100-O),Y=P?Math.min(_,D.scrollTop/Math.max(1,I-B)*_):0;N({visible:P,top:Y,height:O})},[]);m.useEffect(()=>{if(!u)return;const D=requestAnimationFrame(A);return()=>cancelAnimationFrame(D)},[v,$,C.size,u,A]);const R=m.useCallback(D=>{const I=y.current;if(!I)return;const B=Math.max(0,I.scrollHeight-I.clientHeight);I.scrollTop=Math.min(1,Math.max(0,D))*B,A()},[A]),V=m.useCallback((D,I=0)=>{const B=b.current;if(!B)return 0;const P=B.getBoundingClientRect(),O=w.height/100*P.height,_=Math.max(1,P.height-O);return(D-P.top-I)/_},[w.height]),M=m.useCallback(D=>{var fe,ye;if(!w.visible)return;D.preventDefault(),D.stopPropagation();const I=b.current;if(!I)return;const B=I.getBoundingClientRect(),P=w.top/100*B.height,O=w.height/100*B.height,Y=D.clientY>=B.top+P&&D.clientY<=B.top+P+O?D.clientY-B.top-P:O/2;R(V(D.clientY,Y));const Q=D.pointerId;(ye=(fe=D.currentTarget).setPointerCapture)==null||ye.call(fe,Q);const K=we=>{we.preventDefault(),R(V(we.clientY,Y))},ie=()=>{window.removeEventListener("pointermove",K),window.removeEventListener("pointerup",ie),window.removeEventListener("pointercancel",ie)};window.addEventListener("pointermove",K),window.addEventListener("pointerup",ie),window.addEventListener("pointercancel",ie)},[V,R,w.height,w.top,w.visible]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[l.map((D,I)=>{if(D.showOnNode===!1)return null;const B=`${2.6+I*1.7}rem`,P=D.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:B},children:P}),o.jsx(fs,{type:"target",position:Ke.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:B,background:Un(D.type)},title:`${P} · ${D.type}`})]},`in-${I}`)}),c.map((D,I)=>{if(D.showOnNode===!1)return null;const B=`${2.6+I*1.7}rem`,P=D.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:B},children:P}),o.jsx(fs,{type:"source",position:Ke.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:B,background:Un(D.type)},title:`${P} · ${D.type}`})]},`out-${I}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load Skills"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_skills"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:D=>{var I;D.stopPropagation(),u||(I=t==null?void 0:t.onRefreshSkills)==null||I.call(t),p(B=>!B)},children:[o.jsx("span",{children:C.size>0?`${C.size} skills selected`:"选择 Skills"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:u?"expand_less":"expand_more"})]}),u?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:D=>D.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:h,onChange:D=>g(D.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?o.jsx("button",{type:"button",onClick:()=>g(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:y,className:"af-work-load-skills-menu",onScroll:A,children:[$.collectionGroups.map(D=>{const I=D.skills.map(_=>_.key),B=I.filter(_=>C.has(_)).length,P=I.length>0&&B===I.length,O=v.has(D.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(O?" af-work-load-skills-menu__group--collapsed":""),children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head",children:[o.jsx("input",{type:"checkbox",checked:P,onChange:_=>L(I,_.target.checked),"aria-label":`选择 ${D.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>F(D.id),"aria-expanded":!O,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:D.name}),D.description?o.jsx("em",{children:D.description}):null]})}),o.jsxs("small",{children:[B,"/",I.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>F(D.id),"aria-label":O?`展开 ${D.name}`:`收起 ${D.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:O?"chevron_right":"expand_more"})})]}),O?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:D.skills.map(_=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has(_.key),onChange:Y=>L([_.key],Y.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:_.name}),_.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:_.description}):null]})]},`${D.id}:${_.key}`))})]},D.id)}),$.ungrouped.length>0?o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("small",{children:$.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:$.ungrouped.map(D=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has(D.key),onChange:I=>L([D.key],I.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:D.name}),D.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:D.description}):null]})]},`ungrouped:${D.key}`))})]}):null,$.collectionGroups.length===0&&$.ungrouped.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>a==null?void 0:a(e,[]),children:"清空"})]}),o.jsx("div",{ref:b,className:"af-work-load-skills-scrollbar"+(w.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:M,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${w.height}%`,top:`${w.top}%`}})})]}):null]})]})}function ZK({id:e,data:t,selected:n,deleteNode:r,servers:s=[],onChangeMcpNames:i}){const a=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],l=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],[c,d]=m.useState(!1),[f,u]=m.useState(""),p=m.useMemo(()=>new Set(YK(t)),[t]),h=m.useMemo(()=>(Array.isArray(s)?s:[]).map(k=>({name:String((k==null?void 0:k.name)||""),description:String((k==null?void 0:k.description)||""),detail:String((k==null?void 0:k.url)||[k==null?void 0:k.command,...Array.isArray(k==null?void 0:k.args)?k.args:[]].filter(Boolean).join(" ")||""),type:String((k==null?void 0:k.type)||"")})).filter(k=>k.name),[s]),g=m.useMemo(()=>{const k=f.trim().toLowerCase();return k?h.filter(y=>[y.name,y.description,y.detail,y.type].join(" ").toLowerCase().includes(k)):h},[f,h]),v=m.useCallback((k,y)=>{const b=new Set(p);for(const w of k)y?b.add(w):b.delete(w);i==null||i(e,Array.from(b))},[e,p,i]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[a.map((k,y)=>{if(k.showOnNode===!1)return null;const b=`${2.6+y*1.7}rem`,w=k.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:b},children:w}),o.jsx(fs,{type:"target",position:Ke.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:b,background:Un(k.type)},title:`${w} · ${k.type}`})]},`in-${y}`)}),l.map((k,y)=>{if(k.showOnNode===!1)return null;const b=`${2.6+y*1.7}rem`,w=k.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:b},children:w}),o.jsx(fs,{type:"source",position:Ke.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:b,background:Un(k.type)},title:`${w} · ${k.type}`})]},`out-${y}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"hub"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load MCP"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_mcp"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:k=>{var y;k.stopPropagation(),c||(y=t==null?void 0:t.onRefreshMcps)==null||y.call(t),d(b=>!b)},children:[o.jsx("span",{children:p.size>0?`${p.size} MCP selected`:"选择 MCP"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:c?"expand_less":"expand_more"})]}),c?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:f,onChange:k=>u(k.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),f?o.jsx("button",{type:"button",onClick:()=>u(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{className:"af-work-load-skills-menu",children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"MCP Servers"}),o.jsx("small",{children:g.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:g.map(k=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:p.has(k.name),onChange:y=>v([k.name],y.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:k.name}),k.description||k.detail?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:k.description||k.detail}):null]})]},k.name))})]}),g.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 MCP"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空"})]})]}):null]})]})}function eq(){var Df,Ff;const{i18n:e}=hn(),{navigate:t}=Da(),n=Al(),r=GP(),s=m.useMemo(fK,[]),[i,a]=XP([]),[l,c,d]=JP([]),f=m.useRef([]),u=m.useRef([]),p=m.useRef(new Map),h=m.useRef(new Map),g=m.useRef(null),v=m.useRef(null),k=m.useRef(null),[y,b]=m.useState(null),[w,N]=m.useState({}),C=m.useRef({}),j=m.useRef(!1),T=m.useRef(null),[$,L]=m.useState([]),[F,A]=m.useState(""),[R,V]=m.useState("nodes"),[M,D]=m.useState([]),[I,B]=m.useState(!1),[P,O]=m.useState(""),[_,Y]=m.useState(!1),[Q,K]=m.useState({name:"",id:"",description:""}),[ie,fe]=m.useState(!1),[ye,we]=m.useState(""),[ae,ge]=m.useState(""),_e=m.useRef(null),[Ae,Ce]=m.useState(!1),[Ne,Ye]=m.useState("nodes"),[Ze,Ge]=m.useState(""),[It,qe]=m.useState(0),[ct,Ht]=m.useState(""),[Le,Jt]=m.useState(null),[Qt,Nn]=m.useState(""),[ce,ee]=m.useState([]),[he,Me]=m.useState(""),[We,Qe]=m.useState(""),[Gt,mn]=m.useState(()=>new Set),gn=m.useRef(null),[yn,Pr]=m.useState(()=>{try{const E=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(E)&&E>=160)return E}catch{}return 360}),[xn,Dn]=m.useState(!1),[xe,De]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[tn,Fn]=m.useState(""),[st,zn]=m.useState([]),[Rs,Ar]=m.useState(!1),[Pn,hs]=m.useState([]),[Ls,zo]=m.useState([]),[so,ji]=m.useState(!1),[ms,io]=m.useState([]),Jn=m.useCallback(E=>{_e.current&&window.clearTimeout(_e.current),ge(E),_e.current=window.setTimeout(()=>{ge(""),_e.current=null},3800)},[]),gs=m.useCallback(E=>{const H=String(E||"").trim();if(!H)return;const G=()=>r(H);window.requestAnimationFrame(G),window.setTimeout(G,80)},[r]);m.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(yn)))}catch{}},[yn]);const Qs=m.useCallback(E=>{const H=gn.current;if(!H)return;const G=H.getBoundingClientRect(),J=16,Z=150,se=230,re=G.top+J,oe=G.bottom-J,ue=Math.max(Z,oe-re-se),je=Math.min(Math.max(E-re,Z),ue);Pr(je)},[]),Bo=m.useCallback(E=>{E.preventDefault(),E.stopPropagation(),Dn(!0),Qs(E.clientY);const H=J=>{J.preventDefault(),Qs(J.clientY)},G=()=>{Dn(!1),window.removeEventListener("pointermove",H,!0),window.removeEventListener("pointerup",G,!0),window.removeEventListener("pointercancel",G,!0)};window.addEventListener("pointermove",H,!0),window.addEventListener("pointerup",G,!0),window.addEventListener("pointercancel",G,!0)},[Qs]);m.useEffect(()=>()=>{_e.current&&window.clearTimeout(_e.current)},[]);const[oo,An]=m.useState(()=>new Set),[Pe,qt]=m.useState(!1),ir=m.useRef(null),ut=m.useRef(null),Zs=m.useRef(null),[Kn,Bn]=m.useState({}),[xr,tt]=m.useState(""),[Ct,Vt]=m.useState(!1),[Fr,Be]=m.useState([]),[Qn,Hn]=m.useState([]),[Ci,ei]=m.useState("workspace"),[Ei,Os]=m.useState(!1),[ao,ti]=m.useState(!0),[Ms,en]=m.useState(""),[wr,zr]=m.useState({}),[ys,Yr]=m.useState(!1),[W,de]=m.useState(!1),[Ie,Ee]=m.useState("pan"),[Re,Ft]=m.useState(null),[St,In]=m.useState(""),Tn=m.useRef(null),Ir=m.useRef(!1),[lo,$s]=m.useState(()=>new Set),[qn,xs]=m.useState({}),[Tf,dt]=m.useState(""),or=m.useMemo(()=>hK(s),[s]),[fu,za]=m.useState("");m.useEffect(()=>{s.flowId&&JE(s.flowId,s.flowSource||"user","workspace",!!s.archived)},[s]),m.useEffect(()=>{Be([]),Hn([]),ei("workspace"),ti(!0)},[s]);const Yn=m.useCallback(async()=>{const E=ic(s),H=await fetch(`/api/workspace/files?${E.toString()}`),G=await H.json();if(!H.ok)throw new Error(G.error||"读取 workspace 失败");const J=G.files||[];ee(J),mn(new Set(oT(J))),Me(G.root||"")},[s]),co=m.useCallback(async()=>{B(!0),O("");try{const E=await fetch("/api/marketplace/flow-snippets"),H=await E.json().catch(()=>({}));if(!E.ok)throw new Error(H.error||"读取流程片段失败");D(Array.isArray(H.snippets)?H.snippets:[])}catch(E){O(String(E.message||E)),D([])}finally{B(!1)}},[]),Zn=m.useCallback(async(E=i,H=l)=>{var se;if(!j.current)return;const G=Vp(E,H,C.current),J=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,graph:G})}),Z=await J.json();if(!J.ok)throw new Error(Z.error||"保存 workspace graph 失败");C.current=((se=Z.graph)==null?void 0:se.instances)||G.instances,N(C.current),dt("Workspace graph saved")},[l,s,i]),Xt=m.useCallback(E=>{var G;const H=(G=E==null?void 0:E.extra)!=null&&G.instances&&typeof E.extra.instances=="object"?E.extra.instances:{};C.current=H,N(H),a(Array.isArray(E==null?void 0:E.nodes)?E.nodes:[]),c(Array.isArray(E==null?void 0:E.edges)?E.edges:[]),Ht(""),b(null)},[c,a]),pu=m.useMemo(()=>({instances:w}),[w]),Rn=RI({nodes:i,edges:l,extra:pu,enabled:j.current,onRestore:Xt}),{resetHistory:Tl,undo:Ba,redo:ni}=Rn,ri=m.useCallback(async()=>{j.current=!1;const E=ic(s),H=ic(s);H.set("lang",String(e.language||"zh").startsWith("zh")?"zh":"en");const[G,J]=await Promise.all([fetch(`/api/nodes?${H.toString()}`),fetch(`/api/workspace/graph?${E.toString()}`),Yn()]),Z=await G.json(),se=await J.json();if(!G.ok)throw new Error(Z.error||"读取节点定义失败");if(!J.ok)throw new Error(se.error||"读取 workspace graph 失败");const re=[...(Array.isArray(Z)?Z:Z.nodes||[]).filter(je=>!oK.has(je.id)),lK,cK,aK];L(re);const oe=se.graph||JSON.parse(localStorage.getItem(iK)||"null")||{},ue=By(oe,re);C.current=ue.instances,N(ue.instances),a(ue.nodes),c(ue.edges),Tl(ue.nodes,ue.edges,{instances:ue.instances}),dt(se.writable?"Workspace ready":"Readonly workspace"),j.current=!0},[s,e.language,Yn,Tl,c,a]),hu=m.useCallback(async(E,H)=>{const G={packageId:(E==null?void 0:E.newId)||(E==null?void 0:E.id)||(E==null?void 0:E.label),label:(E==null?void 0:E.label)||(E==null?void 0:E.newId)||(E==null?void 0:E.id),version:"1.0.0",definitionId:H,body:(E==null?void 0:E.body)||"",script:(E==null?void 0:E.script)||"",inputs:Array.isArray(E==null?void 0:E.inputs)?E.inputs:[],outputs:Array.isArray(E==null?void 0:E.outputs)?E.outputs:[],flowId:s.flowId,flowSource:s.flowSource||"user",archived:!!s.archived},J=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)}),Z=await J.json().catch(()=>({}));if(!J.ok||(Z==null?void 0:Z.ok)===!1)throw new Error((Z==null?void 0:Z.error)||"Publish failed");return await ri(),dt(`Published node ${Z.definitionId||Z.id||G.packageId}`),Z},[s,ri]),Ho=m.useCallback((E="workspace")=>{Os(!0),Jt(null),ei(E||"workspace")},[]),ar=m.useCallback(async(E="")=>{const H=String(E||St||"").trim();if(H){Ir.current=!0,Tn.current&&(Tn.current.abort(),Tn.current=null),In(""),$s(new Set),xs(G=>{const J={...G};for(const[Z,se]of Object.entries(J))(se==null?void 0:se.status)==="running"&&(J[Z]={status:"stopped"});return J[H]={status:"stopped"},J}),dt(`Workspace run stopped: ${H}`),Hn(G=>G.map(J=>J.runNodeId===H&&J.status==="running"?{...J,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(J.messages)?J.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:J));try{await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,runNodeId:H})})}catch{}}},[s,St]),Ha=m.useCallback(async E=>{if(!E||St)return;const H=Vp(i,l,C.current),G=`run-${Date.now()}-${String(E).replace(/[^a-z0-9_-]+/gi,"_")}`,J=`Run ${E}`,Z=new AbortController;Tn.current=Z,Ir.current=!1,In(E),$s(new Set([E])),xs({[E]:{status:"running"}}),dt(`Running ${E}...`),ei(G),Hn(se=>[...se.slice(-7),{id:G,label:J,runNodeId:E,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);try{await Zn(i,l);const se=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:Z.signal,body:JSON.stringify({...s,graph:H,runNodeId:E,model:tn,selectedSkills:Pn,stream:!0})});if(!se.ok){const me=await se.json().catch(()=>({}));throw new Error(me.error||"Workspace run failed")}if(!se.body)throw new Error("Workspace run stream unavailable");const re=se.body.getReader(),oe=new TextDecoder;let ue="",je=[],rt=[],Nt=E;const bt=(me,Ue)=>{var $t,nn;const Xe=i.find(Lt=>Lt.id===me),it=String((($t=Xe==null?void 0:Xe.data)==null?void 0:$t.label)||me||"").trim(),$e=String(Ue||((nn=Xe==null?void 0:Xe.data)==null?void 0:nn.definitionId)||"").trim();return $e&&$e!==it?`${it} (${$e})`:it},Ut=(me,Ue,Xe)=>{const it=String(me||"").trim();it&&Hn($e=>$e.map($t=>{if($t.id!==G)return $t;const Lt=[...Array.isArray($t.steps)?$t.steps:[]],wt=Lt.findIndex(ws=>ws.id===it),_t={id:it,label:bt(it,Ue),status:Xe};wt>=0?Lt[wt]={...Lt[wt],..._t}:Lt.push(_t);const jt=Lt.map((ws,zf)=>{const Xa=ws.status==="done"?"[done]":ws.status==="failed"?"[failed]":"[running]";return`${zf+1}. ${Xa} ${ws.label}`}).join(`
|
|
144
|
-
`),br=Array.isArray($t.messages)?$t.messages:[],cr=br.findIndex(ws=>ws.kind==="run-summary"),vr={role:"assistant",kind:"run-summary",text:jt||"准备运行...",at:Date.now()},Yo=[...br];return cr>=0?Yo[cr]=vr:Yo.unshift(vr),{...$t,steps:Lt,messages:Yo.slice(-160)}}))},jn=me=>{const Ue=String(me||"").trim();if(!Ue)return;const Xe=Nt;Nt=Ue,$s(new Set([Ue])),xs(it=>{var $e;return{...it,...Xe&&Xe!==Ue&&(($e=it[Xe])==null?void 0:$e.status)==="running"?{[Xe]:{status:"success"}}:{},[Ue]:{status:"running"}}})},yt=me=>{const Ue=String(me||"").trim();Ue&&($s(Xe=>{const it=new Set(Xe);return it.delete(Ue),it}),xs(Xe=>({...Xe,[Ue]:{status:"success"}})))},Tt=(me,Ue)=>{const Xe=String(Ue||"");if(!Xe.trim())return;const it=["assistant","thinking","result","error","prompt"].includes(me)?me:"assistant";Hn($e=>$e.map($t=>{if($t.id!==G)return $t;let nn=Array.isArray($t.messages)?$t.messages:[];if(it==="result"){const _t=[...nn].reverse().find(jt=>jt.kind==="assistant");if(String((_t==null?void 0:_t.text)||"").trim()===Xe.trim())return $t}if(it==="assistant"){const _t=nn.findIndex(jt=>jt.kind==="result"&&String(jt.text||"").trim()===Xe.trim());_t>=0&&(nn=nn.filter((jt,br)=>br!==_t))}const Lt=[...nn],wt=Lt[Lt.length-1];return wt&&wt.kind===it&&!wt.error?Lt[Lt.length-1]={...wt,text:`${wt.text||""}${wt.text?`
|
|
145
|
-
`:""}${Xe}`}:Lt.push({role:"assistant",kind:it,text:Xe,...it==="error"?{error:!0}:{},at:Date.now()}),{...$t,messages:Lt.slice(-160)}}))},xt=me=>{const Ue=String(me||"");Ue.trim()&&Hn(Xe=>Xe.map(it=>{var Lt;if(it.id!==G)return it;const $e=Array.isArray(it.messages)?it.messages:[],$t=$e.findIndex(wt=>wt.kind==="thinking"),nn=[...$e];if($t>=0){const wt=String(((Lt=nn[$t])==null?void 0:Lt.text)||"");nn[$t]={...nn[$t],text:`${wt}${wt&&!wt.endsWith(`
|
|
146
|
-
`),""}${Ue}`,at:Date.now()}}else{const wt=nn.findIndex(_t=>_t.kind==="activity");nn.splice(wt>=0?wt+1:nn.length,0,{role:"assistant",kind:"thinking",text:Ue,at:Date.now()})}return{...it,messages:nn.slice(-160)}}))},Rt=me=>{const Ue=gK(me);Ue&&Hn(Xe=>Xe.map(it=>{if(it.id!==G)return it;const $e=Array.isArray(it.activities)?it.activities:[],$t=$e[$e.length-1]===Ue?$e:[...$e,Ue].slice(-8),nn=Array.isArray(it.messages)?it.messages:[],Lt=nn.findIndex(jt=>jt.kind==="activity"),wt={role:"assistant",kind:"activity",text:$t.map((jt,br)=>`${br+1}. ${jt}`).join(`
|
|
147
|
-
`),at:Date.now()},_t=[...nn];if(Lt>=0)_t[Lt]=wt;else{const jt=_t.findIndex(br=>br.kind==="run-summary");_t.splice(jt>=0?jt+1:0,0,wt)}return{...it,activities:$t,messages:_t.slice(-160)}}))},Et=me=>{const Ue=String((me==null?void 0:me.source)||"runner"),Xe=String((me==null?void 0:me.stream)||""),it=String((me==null?void 0:me.eventType)||"event"),$e=String((me==null?void 0:me.text)||"").trim();if(!$e)return;const $t=`[${Ue}${Xe?`:${Xe}`:""}] ${it}
|
|
148
|
-
${$e}`;Hn(nn=>nn.map(Lt=>{if(Lt.id!==G)return Lt;const _t=[...Array.isArray(Lt.rawTrace)?Lt.rawTrace:[],$t].slice(-80),jt=Array.isArray(Lt.messages)?Lt.messages:[],br=jt.findIndex(Yo=>Yo.kind==="raw"),cr={role:"assistant",kind:"raw",text:_t.join(`
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
`),at:Date.now()},vr=[...jt];return br>=0?vr[br]=cr:vr.push(cr),{...Lt,rawTrace:_t,messages:vr.slice(-160)}}))},cn=me=>{Hn(Ue=>Ue.map(Xe=>Xe.id===G?{...Xe,status:me,endedAt:Date.now()}:Xe))},et=me=>{const Ue=By(me||H,$),Xe=new Map(Ue.nodes.map($e=>[$e.id,$e])),it=Ue.instances||{};a($e=>{const $t=new Set($e.map(wt=>wt.id)),Lt={...Vp($e,u.current,C.current).instances||{}};for(const[wt,_t]of Object.entries(it)){if(!$t.has(wt))continue;const jt=Lt[wt];Ns((_t==null?void 0:_t.definitionId)||(jt==null?void 0:jt.definitionId))?Lt[wt]=_t:Array.isArray(_t==null?void 0:_t.output)&&(Lt[wt]={...jt||_t,output:_t.output})}return C.current=Lt,N(Lt),$e.map(wt=>{var jt,br,cr;const _t=Xe.get(wt.id);return _t?Ns(((jt=_t.data)==null?void 0:jt.definitionId)||((br=wt.data)==null?void 0:br.definitionId))?{...wt,data:{...wt.data,..._t.data}}:Array.isArray((cr=_t.data)==null?void 0:cr.outputs)?{...wt,data:{...wt.data,outputs:_t.data.outputs}}:wt:wt})})};for(;;){const{value:me,done:Ue}=await re.read();if(Ue)break;ue+=oe.decode(me,{stream:!0});const Xe=ue.split(`
|
|
153
|
-
`);ue=Xe.pop()||"";for(const it of Xe){if(!it.trim())continue;const $e=JSON.parse(it);if($e.type==="error")throw new Error($e.error||"Workspace run failed");if($e.type==="stopped"){Ir.current=!0,je=Array.isArray($e.order)?$e.order:je;continue}if($e.type==="node-start"&&(dt(`Running ${$e.nodeId}...`),jn($e.nodeId),Ut($e.nodeId,$e.definitionId,"running")),$e.type==="node-done"&&(yt($e.nodeId),Ut($e.nodeId,$e.definitionId,"done")),$e.type==="status"&&Rt($e.line||$e.message||""),$e.type==="paused"&&(rt=Array.isArray($e.nodeIds)?$e.nodeIds:[]),$e.type==="natural"&&($e.kind==="thinking"?xt($e.text||""):Tt($e.kind,$e.text||"")),$e.type==="raw"){const $t=kj($e);$t&&xt($t),Et($e)}$e.type==="graph"&&$e.graph&&et($e.graph),$e.type==="done"&&($e.graph&&et($e.graph),je=Array.isArray($e.order)?$e.order:[],rt=Array.isArray($e.pauseNodeIds)?$e.pauseNodeIds:rt)}}if(ue.trim()){const me=JSON.parse(ue);if(me.type==="error")throw new Error(me.error||"Workspace run failed");if(me.type==="stopped"&&(Ir.current=!0),me.type==="node-start"&&(dt(`Running ${me.nodeId}...`),jn(me.nodeId),Ut(me.nodeId,me.definitionId,"running")),me.type==="node-done"&&(yt(me.nodeId),Ut(me.nodeId,me.definitionId,"done")),me.type==="status"&&Rt(me.line||me.message||""),me.type==="paused"&&(rt=Array.isArray(me.nodeIds)?me.nodeIds:[]),me.type==="natural"&&(me.kind==="thinking"?xt(me.text||""):Tt(me.kind,me.text||"")),me.type==="raw"){const Ue=kj(me);Ue&&xt(Ue),Et(me)}me.type==="graph"&&me.graph&&et(me.graph),me.type==="done"&&(me.graph&&et(me.graph),je=Array.isArray(me.order)?me.order:[],rt=Array.isArray(me.pauseNodeIds)?me.pauseNodeIds:rt)}Ir.current&&($s(new Set),xs(me=>{var Xe;const Ue=((Xe=Object.entries(me).find(([,it])=>(it==null?void 0:it.status)==="running"))==null?void 0:Xe[0])||E;return Ue?{...me,[Ue]:{status:"stopped"}}:me})),dt(Ir.current?`Workspace run stopped: ${E}`:rt.length?`Workspace run paused at ${rt.join(", ")}`:`Workspace run done: ${je.length?je.join(" -> "):E}`),cn(Ir.current?"stopped":rt.length?"paused":"done"),Ir.current||await Yn()}catch(se){if(Ir.current||(se==null?void 0:se.name)==="AbortError"){$s(new Set),xs(re=>{var ue;const oe=((ue=Object.entries(re).find(([,je])=>(je==null?void 0:je.status)==="running"))==null?void 0:ue[0])||E;return oe?{...re,[oe]:{status:"stopped"}}:re}),dt(`Workspace run stopped: ${E}`),Hn(re=>re.map(oe=>oe.id===G?{...oe,status:"stopped",endedAt:Date.now()}:oe));return}$s(new Set),xs(re=>{var ue;const oe=(ue=Object.entries(re).find(([,je])=>(je==null?void 0:je.status)==="running"))==null?void 0:ue[0];return oe?{...re,[oe]:{status:"failed"}}:re}),dt(String(se.message||se)),Hn(re=>re.map(oe=>oe.id===G?{...oe,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(oe.messages)?oe.messages:[],{role:"assistant",error:!0,text:String(se.message||se),at:Date.now()}].slice(-160)}:oe))}finally{Tn.current===Z&&(Tn.current=null),In(""),$s(new Set)}},[tn,l,s,Yn,i,$,St,Zn,Pn,c,a]),_i=m.useCallback(async()=>{try{const H=await(await fetch("/api/skills")).json().catch(()=>({})),G=Array.isArray(H.skills)?H.skills.map(J=>({key:String(J.key),name:String(J.name||J.id||J.key),description:J.description?String(J.description):"",sourceLabel:J.sourceLabel?String(J.sourceLabel):""})):[];zn(G),Ar(!0)}catch{Ar(!0)}},[]),uo=m.useCallback(async()=>{try{const H=await(await fetch("/api/mcps")).json().catch(()=>({})),G=Array.isArray(H.servers)?H.servers.map(J=>({name:String((J==null?void 0:J.name)||""),type:String((J==null?void 0:J.type)||""),url:String((J==null?void 0:J.url)||""),command:String((J==null?void 0:J.command)||""),args:Array.isArray(J==null?void 0:J.args)?J.args.map(String):[],description:String((J==null?void 0:J.description)||"")})).filter(J=>J.name):[];io(G)}catch{io([])}},[]);m.useEffect(()=>{ri().catch(E=>dt(String(E.message||E))),co(),fetch("/api/model-lists").then(E=>E.json()).then(E=>De({cursor:Array.isArray(E.cursor)?E.cursor.map(String):[],opencode:Array.isArray(E.opencode)?E.opencode.map(String):[],claudeCode:Array.isArray(E.claudeCode)?E.claudeCode.map(String):[]})).catch(()=>{}),_i(),uo(),fetch("/api/skill-collections").then(E=>E.json()).then(E=>{zo(Sa(E)),ji(!0)}).catch(()=>{}),fetch("/api/auth/me").then(E=>E.json()).then(E=>Ft(E.user||null)).catch(()=>Ft(null))},[ri,co,uo,_i,or]),m.useEffect(()=>{if(za(""),!(!Rs||!so)){if(!or){hs([]);return}hs(t_(or,"workspace",st,Ls)),za(or)}},[Ls,so,st,Rs,or]),m.useEffect(()=>{if(!(fu!==or||!or))try{localStorage.setItem(or,JSON.stringify(Pn))}catch{}},[Pn,or,fu]),m.useEffect(()=>{C.current=w},[w]),m.useEffect(()=>{f.current=i},[i]),m.useEffect(()=>{const E=p.current,H=new Map,G=[];for(const re of i){const oe=ZI(re);H.set(re.id,oe),E.get(re.id)!==oe&&G.push(re.id)}if(p.current=H,G.length===0)return;const J=()=>G.forEach(re=>r(re)),Z=window.requestAnimationFrame(J),se=window.setTimeout(J,80);return()=>{window.cancelAnimationFrame(Z),window.clearTimeout(se)}},[i,r]),m.useEffect(()=>{u.current=l},[l]),m.useEffect(()=>{k.current=y},[y]),m.useEffect(()=>{if(!y)return;const E=G=>{G.key==="Escape"&&b(null)},H=G=>{var J,Z;(Z=(J=G.target)==null?void 0:J.closest)!=null&&Z.call(J,".af-connect-node-menu")||b(null)};return document.addEventListener("keydown",E),document.addEventListener("pointerdown",H),()=>{document.removeEventListener("keydown",E),document.removeEventListener("pointerdown",H)}},[y]),m.useEffect(()=>{if(j.current)return T.current&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{Zn().catch(E=>dt(String(E.message||E)))},650),()=>{T.current&&window.clearTimeout(T.current)}},[i,l,Zn]);const mu=m.useCallback((E,H)=>{const G=qK(H),J=ue=>Array.isArray(ue)?ue.map(je=>(je==null?void 0:je.name)!=="skillKeys"&&(je==null?void 0:je.name)!=="skillsContext"&&(je==null?void 0:je.type)!=="text"?je:{...je,default:G,value:G}):[],Z=i.map(ue=>{var je;return ue.id!==E?ue:{...ue,data:{...ue.data,body:G,inputs:J((je=ue.data)==null?void 0:je.inputs)}}}),se=C.current||{},re=se[E]&&typeof se[E]=="object"?se[E]:{},oe={...se,[E]:{...re,body:G,input:J(re.input)}};C.current=oe,a(Z),N(oe),Jt(ue=>!ue||ue.id!==E?ue:{...ue,body:G,inputs:J(ue.inputs)}),Zn(Z,l).catch(ue=>dt(String(ue.message||ue)))},[l,i,Zn,a]),Vo=m.useCallback((E,H)=>{const G=GK(H),J=ue=>Array.isArray(ue)?ue.map(je=>(je==null?void 0:je.name)!=="serverNames"&&(je==null?void 0:je.name)!=="mcpContext"&&(je==null?void 0:je.type)!=="text"?je:{...je,default:G,value:G}):[],Z=i.map(ue=>{var je;return ue.id!==E?ue:{...ue,data:{...ue.data,body:G,inputs:J((je=ue.data)==null?void 0:je.inputs)}}}),se=C.current||{},re=se[E]&&typeof se[E]=="object"?se[E]:{},oe={...se,[E]:{...re,body:G,input:J(re.input)}};C.current=oe,a(Z),N(oe),Jt(ue=>!ue||ue.id!==E?ue:{...ue,body:G,inputs:J(ue.inputs)}),Zn(Z,l).catch(ue=>dt(String(ue.message||ue)))},[l,i,Zn,a]),Va=m.useCallback(E=>{const H=String(E||"").trim();H&&(en(G=>G===H?"":H),zr(G=>({...G,[H]:G[H]||{sessionId:`nodechat_${Date.now()}_${H.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),Wa=m.useCallback((E,H)=>{const G=String(E||"").trim();G&&zr(J=>({...J,[G]:{...J[G]||{sessionId:`nodechat_${Date.now()}_${G.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(H||""),error:""}}))},[]),Pi=m.useCallback((E,H,G="replace",J={})=>{var Tt;const Z=String(E||"").trim();if(!Z)return;const se=f.current.find(xt=>xt.id===Z),re=Ns((Tt=se==null?void 0:se.data)==null?void 0:Tt.definitionId),oe=re==="html"?nT(H):String(H||""),ue=se?vd(se.data):"",je=G==="append"&&String(ue||"").trim()?`${String(ue).replace(/\s+$/g,"")}
|
|
154
|
-
|
|
155
|
-
${oe.trim()}`:oe,rt=re==="image"?"src":"content",Nt=xt=>{let Rt=!1;return(Array.isArray(xt)?xt:[]).map(cn=>{const et=String((cn==null?void 0:cn.name)||""),me=String((cn==null?void 0:cn.type)||"");return!Rt&&(et===rt||et==="filePath"||me==="text")?(Rt=!0,{...cn,default:je,value:je}):cn})},bt=f.current.map(xt=>{var Rt,Et;return xt.id!==Z?xt:{...xt,data:{...xt.data,body:je,inputs:Nt((Rt=xt.data)==null?void 0:Rt.inputs),outputs:Nt((Et=xt.data)==null?void 0:Et.outputs)}}}),Ut=C.current||{},jn=Ut[Z]&&typeof Ut[Z]=="object"?Ut[Z]:{},yt={...Ut,[Z]:{...jn,body:je,input:Nt(jn.input),output:Nt(jn.output)}};C.current=yt,a(bt),N(yt),Jt(xt=>(xt==null?void 0:xt.id)===Z?{...xt,body:je}:xt),(J==null?void 0:J.logChat)!==!1&&zr(xt=>{var Rt;return{...xt,[Z]:{...xt[Z]||{},candidateContent:"",messages:[...(Rt=xt[Z])!=null&&Rt.messages&&Array.isArray(xt[Z].messages)?xt[Z].messages:[],{role:"assistant",text:G==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),Zn(bt,u.current).catch(xt=>dt(String(xt.message||xt))),dt(String((J==null?void 0:J.statusMessage)||"")||(G==="append"?"已追加节点内容":"已替换节点内容"))},[Zn,a]),Ua=m.useCallback(async(E,H)=>{const G=String(E||"").trim();if(!G||!Mw(H)){dt("请选择图片文件");return}try{const J=new FormData;J.set("file",H),J.set("dir","img"),s.flowId&&J.set("flowId",s.flowId),s.flowSource&&J.set("flowSource",s.flowSource),s.archived&&J.set("archived","1");const Z=await fetch("/api/workspace/upload",{method:"POST",body:J}),se=await Z.json().catch(()=>({}));if(!Z.ok)throw new Error(se.error||"上传图片失败");const re=String(se.path||"").trim();if(!re)throw new Error("上传图片失败:未返回路径");Pi(G,re,"replace",{logChat:!1,statusMessage:`已上传图片 ${re}`}),await Yn(),mn(oe=>{const ue=new Set(oe);for(const je of Wp(re))ue.delete(je);return ue})}catch(J){dt(String(J.message||J))}},[s,Yn,Pi]),Rf=m.useCallback((E,H="replace")=>{var Z;const G=String(E||"").trim(),J=String(((Z=wr[G])==null?void 0:Z.candidateContent)||"").trim();!G||!J||Pi(G,J,H)},[wr,Pi]),Ds=m.useCallback(async(E,H=void 0)=>{var je,rt,Nt;const G=String(E||"").trim();if(!G)return;const J=wr[G]||{},Z=String(H!==void 0?H:J.draft||"").trim();if(!Z||J.running)return;const se=f.current.find(bt=>bt.id===G);if(!se)return;const re={role:"user",text:Z,at:Date.now()},oe=Array.isArray(J.messages)?J.messages:[],ue=J.sessionId||`nodechat_${Date.now()}_${G.replace(/[^a-z0-9_-]+/gi,"_")}`;zr(bt=>({...bt,[G]:{...J,sessionId:ue,messages:[...oe,re],draft:"",running:!0,error:""}}));try{const bt=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,sessionId:ue,node:{id:G,label:((je=se.data)==null?void 0:je.label)||G,definitionId:((rt=se.data)==null?void 0:rt.definitionId)||""},nodeKind:Ns((Nt=se.data)==null?void 0:Nt.definitionId)||"markdown",currentContent:vd(se.data),messages:oe,message:Z,model:tn})}),Ut=await bt.json().catch(()=>({}));if(!bt.ok)throw new Error(Ut.error||"节点微调失败");const jn=String(Ut.candidateContent||Ut.reply||"").trim();zr(yt=>{var Tt;return{...yt,[G]:{...yt[G]||{},sessionId:String(Ut.sessionId||ue),running:!1,candidateContent:jn,messages:[...(Tt=yt[G])!=null&&Tt.messages&&Array.isArray(yt[G].messages)?yt[G].messages:[...oe,re],{role:"assistant",text:jn||"已生成候选内容。",at:Date.now()}]}}})}catch(bt){const Ut=String(bt.message||bt);zr(jn=>({...jn,[G]:{...jn[G]||{},running:!1,error:Ut}})),dt(Ut)}},[tn,s,wr]),Rl=m.useCallback(async(E,H)=>{const G=vd(H);if(!String(G||"").trim()){dt("展示节点没有可保存内容");return}const J=DK(E,H),Z=window.prompt("保存到 workspace 相对路径",J);if(Z)try{const se=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:Z,content:G})}),re=await se.json().catch(()=>({}));if(!se.ok)throw new Error(re.error||"保存文件失败");const oe=re.path||Z,ue=ic(s);ue.set("path",oe);const je=await fetch(`/api/workspace/file?${ue.toString()}`);if(!je.ok){const rt=await je.json().catch(()=>({}));throw new Error(rt.error||`保存后读取失败:${oe}`)}await Yn(),ee(rt=>WK(rt,oe,String(G||"").length)),mn(rt=>{const Nt=new Set(rt);for(const bt of Wp(oe))Nt.delete(bt);return Nt}),dt(`已保存 ${oe}`)}catch(se){dt(String(se.message||se))}},[s,Yn]),gu=m.useCallback((E,H)=>{const G=String(E||"");G&&Jt(J=>{if(!J||J.id!==G)return J;const Z=typeof H=="function"?H(J):H;return!Z||typeof Z!="object"?J:{...J,...Z}})},[]),si=m.useMemo(()=>i.map(E=>{var H,G;return{...E,data:{...E.data,selected:E.selected===!0,modelLists:xe,showBodyPreview:!0,isExecuting:lo.has(E.id),nodeStatus:((H=qn[E.id])==null?void 0:H.status)??null,nodeElapsed:((G=qn[E.id])==null?void 0:G.elapsed)??null,flowParams:s,onRunWorkspaceNode:Ha,onStopWorkspaceNode:ar,runningRunNodeId:St,skills:st,skillCollections:Ls,onChangeLoadSkillKeys:mu,onRefreshSkills:_i,mcpServers:ms,onChangeLoadMcpNames:Vo,onRefreshMcps:uo,onSaveDisplayNodeToFile:Rl,onUploadImageToDisplayNode:Ua,nodeChatActive:Ms===E.id,nodeChat:wr[E.id]||null,onSetDisplayNodeContent:Pi,onToggleNodeChat:Va,onCloseNodeChat:()=>en(""),onUpdateNodeChatDraft:Wa,onSendNodeChat:Ds,onApplyNodeChatCandidate:Rf,onSyncNodePropDraft:gu}}}),[Ms,Rf,Vo,mu,s,ms,xe,wr,i,uo,_i,Ha,St,Rl,Ds,Pi,Ls,st,ar,gu,Va,Wa,Ua,lo,qn]);m.useEffect(()=>{const E=h.current,H=new Map,G=[];for(const re of si){const oe=vK(re);H.set(re.id,oe),E.get(re.id)!==oe&&G.push(re.id)}if(h.current=H,G.length===0)return;const J=()=>G.forEach(re=>r(re)),Z=window.requestAnimationFrame(J),se=window.setTimeout(J,80);return()=>{window.cancelAnimationFrame(Z),window.clearTimeout(se)}},[si,r]);const Mt=m.useMemo(()=>i.find(E=>E.id===ct)||null,[i,ct]),Ll=m.useRef({id:"",draft:null}),Ol=m.useMemo(()=>{const E=_j(Mt);return E?JSON.stringify(E):""},[Mt]);m.useEffect(()=>{if(!Mt){Ll.current={id:"",draft:null},Jt(null),Nn("");return}const E=_j(Mt),H=Ll.current;Ll.current={id:Mt.id,draft:E},Jt(G=>!G||G.id!==Mt.id||H.id!==Mt.id||!H.draft?E:JK(G,H.draft,E)),Nn("")},[Mt==null?void 0:Mt.id,Ol]);const Ml=m.useCallback((E=!1)=>{var Tt,xt;if(!Le||!Mt)return!1;const H=Mt.id,G=String(Le.newId||"").trim(),J=E?G:H;if(Nn(""),E){if(!BI.test(J))return Nn("Invalid instance id"),!1;if(i.some(Rt=>Rt.id===J&&Rt.id!==H))return Nn("Duplicate instance id"),!1}const Z=String(Le.role||"").trim(),se=Ia.includes(Z)?Z:"normal",re=String(Le.model||"").trim(),oe=Rt=>(Array.isArray(Rt)?Rt:[]).map(Et=>({type:String((Et==null?void 0:Et.type)??"node").trim()||"node",name:String((Et==null?void 0:Et.name)??""),default:String((Et==null?void 0:Et.default)??""),required:!!(Et!=null&&Et.required),showOnNode:(Et==null?void 0:Et.showOnNode)!=null?Et.showOnNode!==!1:!!(Et!=null&&Et.required)||String((Et==null?void 0:Et.type)??"node").trim().toLowerCase()==="node"})),ue=String(((Tt=Mt.data)==null?void 0:Tt.definitionId)??J),je=ue.startsWith("provide_"),rt={...Mt.data,label:String(Le.label||"").trim()||J,role:se,model:re===""||re==="default"?void 0:re,body:je?"":String(Le.body??""),images:je?[]:is(Le.images),inputs:oe(Le.inputs),outputs:je&&Array.isArray((xt=Mt.data)==null?void 0:xt.outputs)?Mt.data.outputs:oe(Le.outputs)},Nt=String(Le.script??"").trim();ue==="tool_nodejs"||Nt!==""?rt.script=String(Le.script??""):delete rt.script;const bt=Mt.data||{};if(!(J!==H||bt.label!==rt.label||bt.role!==rt.role||bt.model!==rt.model||bt.body!==rt.body||JSON.stringify(is(bt.images))!==JSON.stringify(rt.images)||(bt.script??void 0)!==(rt.script??void 0)||JSON.stringify(bt.inputs||[])!==JSON.stringify(rt.inputs||[])||JSON.stringify(bt.outputs||[])!==JSON.stringify(rt.outputs||[])))return!0;let jn=i.map(Rt=>Rt.id===H?{...Rt,id:J,selected:!0,data:rt}:Rt),yt=l;if(J!==H){const Rt={...C.current},Et={...Rt[H]||{}};delete Rt[H],Rt[J]=Et,C.current=Rt,N(Rt),yt=l.map((cn,et)=>({...cn,source:cn.source===H?J:cn.source,target:cn.target===H?J:cn.target,id:`we-${cn.source===H?J:cn.source}-${cn.target===H?J:cn.target}-${et}`})),Ht(J)}return a(jn),c(yt),gs(J),!0},[l,Le,i,Mt,c,a,gs]);m.useEffect(()=>{if(!Le||!Mt)return;const E=window.setTimeout(()=>{Ml(!1)},350);return()=>window.clearTimeout(E)},[Le==null?void 0:Le.label,Le==null?void 0:Le.role,Le==null?void 0:Le.model,Le==null?void 0:Le.body,JSON.stringify((Le==null?void 0:Le.images)||[]),Le==null?void 0:Le.script,JSON.stringify((Le==null?void 0:Le.inputs)||[]),JSON.stringify((Le==null?void 0:Le.outputs)||[]),Ml,Mt==null?void 0:Mt.id]);const Wo=m.useMemo(()=>{const E=new Map(si.map(H=>[H.id,H]));return l.map(H=>{var je,rt,Nt,bt;const G=E.get(H.source),J=E.get(H.target),Z=/^output-(\d+)$/.exec(H.sourceHandle||""),se=/^input-(\d+)$/.exec(H.targetHandle||""),re=G&&Z?(rt=(je=G.data)==null?void 0:je.outputs)==null?void 0:rt[parseInt(Z[1],10)]:null,oe=J&&se?(bt=(Nt=J.data)==null?void 0:Nt.inputs)==null?void 0:bt[parseInt(se[1],10)]:null,ue=re!=null&&re.type?Un(re.type):oe!=null&&oe.type?Un(oe.type):"";return ue?{...H,style:{...H.style||{},stroke:ue,strokeWidth:2},markerEnd:{type:us.ArrowClosed,color:ue}}:H})},[l,si]),Uo=m.useMemo(()=>{const E=F.trim().toLowerCase(),H={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const G of $)E&&![G.id,G.label,G.displayName,G.description].some(J=>String(J||"").toLowerCase().includes(E))||H[td(G)].push(G);for(const G of sc)H[G].sort((J,Z)=>J.id.localeCompare(Z.id));return H},[$,F]),fo=m.useMemo(()=>{const E=Ze.trim().toLowerCase();return $.filter(H=>!E||[H.id,H.label,H.displayName,H.description].some(G=>String(G||"").toLowerCase().includes(E))).sort((H,G)=>{const J=sc.indexOf(td(H)),Z=sc.indexOf(td(G));return J!==Z?J-Z:nd(H).localeCompare(nd(G))}).slice(0,30)},[$,Ze]),pr=m.useMemo(()=>{const E=Ze.trim().toLowerCase();return M.filter(H=>!E||[H.id,H.version,H.displayName,H.name,H.description,...Array.isArray(H.tags)?H.tags:[]].some(G=>String(G||"").toLowerCase().includes(E))).sort((H,G)=>String(H.displayName||H.name||H.id).localeCompare(String(G.displayName||G.name||G.id))).slice(0,30)},[M,Ze]);m.useEffect(()=>{qe(0)},[Ze,Ae,Ne]),m.useEffect(()=>{if(!Ae)return;const E=window.setTimeout(()=>{var H;return(H=Zs.current)==null?void 0:H.focus()},0);return()=>window.clearTimeout(E)},[Ae]);const Ka=m.useMemo(()=>{const E=We.trim().toLowerCase();return E?iT(ce).filter(H=>H.path.toLowerCase().includes(E)):ce},[We,ce]),$l=[...(xe.cursor||[]).map(E=>({label:`Cursor · ${E.split(" - ")[0]}`,value:`cursor:${E.split(" - ")[0]}`})),...(xe.opencode||[]).map(E=>({label:`OpenCode · ${E.split(" - ")[0]}`,value:`opencode:${E.split(" - ")[0]}`})),...(xe.claudeCode||[]).map(E=>({label:`Claude · ${E.split(" - ")[0]}`,value:`claude-code:${E.split(" - ")[0]}`}))],po=m.useMemo(()=>new Set(Pn),[Pn]),Fs=m.useMemo(()=>{const E=new Map(st.map(se=>[se.key,se])),H=new Set,G=new Set,J=Ls.map(se=>{const re=Pa(se,st).map(oe=>E.get(oe)).filter(Boolean);for(const oe of re)H.add(oe.key),G.add(String(oe.name||oe.id||oe.key||"").trim());return{...se,skills:re}}).filter(se=>se.skills.length>0),Z=st.filter(se=>{const re=String(se.name||se.id||se.key||"").trim();return!H.has(se.key)&&!G.has(re)});return{groups:J,ungrouped:Z}},[Ls,st]);m.useEffect(()=>{An(E=>{let H=!1;const G=new Set(E);for(const J of Fs.groups)G.has(J.id)||(G.add(J.id),H=!0);return H?G:E})},[Fs.groups]);const Ln=m.useMemo(()=>{const E=i.filter(H=>H.selected);return E.length>0?E:ct?i.filter(H=>H.id===ct):[]},[i,ct]),Dl=m.useMemo(()=>Ln.map(E=>E.id),[Ln]),yu=m.useMemo(()=>{const E=String((Re==null?void 0:Re.username)||(Re==null?void 0:Re.userId)||"").trim();return E?E.slice(0,1).toUpperCase():"?"},[Re]),Ko=m.useMemo(()=>new Set(Dl),[Dl]),Ai=m.useMemo(()=>l.filter(E=>Ko.has(E.source)&&Ko.has(E.target)),[l,Ko]),Fl=m.useMemo(()=>{const E=F.trim().toLowerCase();return E?M.filter(H=>[H.id,H.version,H.displayName,H.name,H.description,...Array.isArray(H.tags)?H.tags:[]].filter(Boolean).some(G=>String(G).toLowerCase().includes(E))):M},[M,F]),xu=m.useCallback((E,H)=>{const G=String(E||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let J=`${G}_${Date.now().toString(36)}`,Z=2;for(;H.has(J);)J=`${G}_${Date.now().toString(36)}_${Z}`,Z+=1;return H.add(J),J},[]),ho=m.useCallback((E,H)=>{var cn,et;const G=E!=null&&E.snippet&&typeof E.snippet=="object"?E.snippet:{},J=G.instances&&typeof G.instances=="object"?G.instances:{},Z=Object.keys(J);if(Z.length===0)return;const se=new Set(f.current.map(me=>me.id)),re={};for(const me of Z)re[me]=xu(me,se);const oe=(cn=G.ui)!=null&&cn.nodePositions&&typeof G.ui.nodePositions=="object"?G.ui.nodePositions:{},ue=(et=G.ui)!=null&&et.nodeSizes&&typeof G.ui.nodeSizes=="object"?G.ui.nodeSizes:{},je=Z.map(me=>{const Ue=oe[me];return{id:me,x:typeof(Ue==null?void 0:Ue.x)=="number"?Ue.x:0,y:typeof(Ue==null?void 0:Ue.y)=="number"?Ue.y:0}}),rt=Math.min(...je.map(me=>me.x)),Nt=Math.min(...je.map(me=>me.y));let bt=H||{x:360+f.current.length*24,y:180+f.current.length*18};if(!H){const me=document.querySelector(".af-workspace-canvas .react-flow");if(me){const Ue=me.getBoundingClientRect();bt=n.screenToFlowPosition({x:Ue.left+Ue.width*.48,y:Ue.top+Ue.height*.32})}}const Ut={},jn={},yt={};for(const me of je){const Ue=re[me.id];Ut[Ue]={...J[me.id]||{}},jn[Ue]={x:bt.x+(me.x-rt),y:bt.y+(me.y-Nt)};const Xe=ue[me.id];typeof(Xe==null?void 0:Xe.width)=="number"&&typeof(Xe==null?void 0:Xe.height)=="number"&&(yt[Ue]={width:Xe.width,height:Xe.height})}const Tt=new Set(Z),xt=(Array.isArray(G.edges)?G.edges:[]).filter(me=>Tt.has(me==null?void 0:me.source)&&Tt.has(me==null?void 0:me.target)).map(me=>({source:re[me.source],target:re[me.target],sourceHandle:me.sourceHandle??null,targetHandle:me.targetHandle??null})),Rt=By({instances:Ut,edges:xt,ui:{nodePositions:jn,nodeSizes:yt}},$),Et=Rt.nodes.map(me=>({...me,selected:!0}));C.current={...C.current,...Rt.instances},N(C.current),a(me=>[...me.map(Ue=>({...Ue,selected:!1})),...Et]),c(me=>[...me.map(Ue=>({...Ue,selected:!1})),...Rt.edges]),dt(`已添加流程片段:${E.displayName||E.id}`)},[xu,$,n,c,a]),wu=m.useCallback(()=>{var G,J;if(Ln.length<2){O("请先在 workspace 画布上选择至少两个节点。"),V("flows");return}const E=Ln[0],H=Ln.length===2?`${((G=E.data)==null?void 0:G.label)||E.id} 片段`:`${((J=E.data)==null?void 0:J.label)||E.id} 等 ${Ln.length} 个节点`;K({name:H,id:H.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),we(""),Y(!0),V("flows")},[Ln]),qa=m.useCallback(async()=>{var Z,se;if(Ln.length<2)return;const E=Q.name.trim();if(!E){we("请填写片段名称。");return}const H={},G={};for(const re of Ln){H[re.id]={x:((Z=re.position)==null?void 0:Z.x)||0,y:((se=re.position)==null?void 0:se.y)||0};const oe=eT(re);oe&&(G[re.id]=oe)}const J=Ai.map(re=>({source:re.source,target:re.target,sourceHandle:re.sourceHandle??null,targetHandle:re.targetHandle??null}));fe(!0),we("");try{const re=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Q.id,name:E,displayName:E,version:"1.0.0",description:Q.description,snippet:{instances:jf(Ln,C.current),edges:J,ui:{nodePositions:H,nodeSizes:G}}})}),oe=await re.json().catch(()=>({}));if(!re.ok||oe.ok===!1)throw new Error(oe.error||"发布流程片段失败");Y(!1),dt(`流程片段已发布:${oe.id||E}`),Jn(`流程片段已发布:${oe.id||E}`),await co(),V("flows")}catch(re){we(String(re.message||re))}finally{fe(!1)}},[co,Q,Ai,Ln,Jn]),dg=m.useCallback(E=>{a(H=>H.map(G=>G.id===E?{...G,selected:!1}:G)),Ht(H=>H===E?"":H)},[a]),qo=m.useCallback(()=>{const E=ir.current;if(!E)return;const H=E.getBoundingClientRect(),G=Math.min(420,Math.max(320,H.width+160)),J=12,Z=Math.max(180,H.top-J*2),se=Math.min(560,Z);Bn({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-G-12,H.left)),top:Math.max(J,H.top-se-J),width:G,maxHeight:se,zIndex:1e4})},[]);m.useEffect(()=>{if(!Pe)return;qo();const E=G=>{var Z,se;const J=G.target;(Z=ir.current)!=null&&Z.contains(J)||(se=ut.current)!=null&&se.contains(J)||qt(!1)},H=G=>{G.key==="Escape"&&qt(!1)};return window.addEventListener("pointerdown",E),window.addEventListener("keydown",H),window.addEventListener("resize",qo),window.addEventListener("scroll",qo,!0),()=>{window.removeEventListener("pointerdown",E),window.removeEventListener("keydown",H),window.removeEventListener("resize",qo),window.removeEventListener("scroll",qo,!0)}},[Pe,qo]);const gt=m.useCallback(E=>{var J,Z;const H=new Map;for(const se of E||[])(se==null?void 0:se.type)==="dimensions"&&((J=se.dimensions)!=null&&J.width)&&((Z=se.dimensions)!=null&&Z.height)&&H.set(se.id,{width:Math.round(Number(se.dimensions.width)),height:Math.round(Number(se.dimensions.height))});const G=Array.from(H.keys());if(a(se=>rv(E,se).map(re=>{var ue;const oe=H.get(re.id);return oe?Ns((ue=re.data)==null?void 0:ue.definitionId)?{...re,width:oe.width,height:oe.height,data:{...re.data,nodeSize:oe,displaySize:oe}}:{...re,width:oe.width,height:oe.height,data:{...re.data,nodeSize:oe}}:re})),G.length>0){const se=()=>G.forEach(re=>r(re));window.requestAnimationFrame(se),window.setTimeout(se,80)}},[a,r]),Ii=m.useCallback(()=>{const E=document.querySelector(".af-workspace-canvas .react-flow");if(E){const H=E.getBoundingClientRect();return n.screenToFlowPosition({x:H.left+H.width*.48,y:H.top+H.height*.32})}return{x:360+i.length*36,y:180+i.length*28}},[i.length,n]),zl=m.useCallback(()=>{var E,H,G;if(Mt){const J=Number(((E=Mt.measured)==null?void 0:E.width)||Mt.width||260);return{x:Number(((H=Mt.position)==null?void 0:H.x)||0)+J+140,y:Number(((G=Mt.position)==null?void 0:G.y)||0)}}return Ii()},[Ii,Mt]),Gr=m.useCallback((E,H={})=>{if(!E)return null;const G=Pv(E)||E.id,J=QI(E),Z=H.id||wK(G,i),se=Hp(E.inputs),re=Hp(E.outputs),oe={definitionId:G,...J?{marketplaceRef:J}:{},...E.packageId?{marketplacePackageId:E.packageId}:{},...E.version?{marketplaceVersion:E.version}:{},label:H.label||pm(E),role:"normal",body:H.body||"",input:H.inputs||se,output:H.outputs||re},ue={id:Z,type:Cf,position:H.position||Ii(),data:{label:oe.label,definitionId:G,...J?{marketplaceRef:J}:{},...E.packageId?{marketplacePackageId:E.packageId}:{},...E.version?{marketplaceVersion:E.version}:{},schemaType:JI(G,E),role:"normal",body:oe.body,inputs:oe.input,outputs:oe.output}},je={...rf(ue,{...C.current,[Z]:oe},$),selected:!0};return a(rt=>[...rt.map(Nt=>({...Nt,selected:!1})),je]),H.openProperties&&Ht(Z),Z},[Ii,i,$,a]),ft=m.useCallback(E=>Cj(E,f.current),[]),fg=m.useCallback(E=>{if(!Cj(E,f.current)){dt("端口类型不匹配,已取消连线");return}b(null),a(H=>um(H,E)),c(H=>{const G=H.filter(J=>!(J.target===E.target&&J.targetHandle===E.targetHandle));return Gd({...E,markerEnd:{type:us.ArrowClosed}},G)})},[c,a]),mo=m.useCallback((E,H)=>{v.current=yK(H,f.current),b(null)},[]),Lf=m.useCallback((E,H)=>{var bt,Ut,jn,yt;const G=v.current;if(v.current=null,!G||H!=null&&H.toNode)return;const J=xK($,G);if(J.length===0){dt(`没有匹配 ${G.slotType} 端口的节点`);return}const Z=((Ut=(bt=E==null?void 0:E.changedTouches)==null?void 0:bt[0])==null?void 0:Ut.clientX)??(E==null?void 0:E.clientX),se=((yt=(jn=E==null?void 0:E.changedTouches)==null?void 0:jn[0])==null?void 0:yt.clientY)??(E==null?void 0:E.clientY);if(!Number.isFinite(Z)||!Number.isFinite(se))return;const re=document.querySelector(".af-workspace-canvas .react-flow");if(!re)return;const oe=re.getBoundingClientRect(),ue=320,je=Math.min(440,104+J.length*58),rt=Math.max(12,Math.min(Z-oe.left,oe.width-ue-12)),Nt=Math.max(12,Math.min(se-oe.top,oe.height-je-12));b({left:rt,top:Nt,flowPosition:n.screenToFlowPosition({x:Z,y:se}),draft:G,candidates:J,query:""})},[$,n]),bu=m.useCallback(E=>{const H=k.current;if(!H||!(E!=null&&E.def))return;const G=Gr(E.def,{position:H.flowPosition});if(!G)return;const J=H.draft.handleType==="source"?{source:H.draft.nodeId,sourceHandle:H.draft.handleId,target:G,targetHandle:`input-${E.slotIndex}`}:{source:G,sourceHandle:`output-${E.slotIndex}`,target:H.draft.nodeId,targetHandle:H.draft.handleId};a(Z=>um(Z,J)),c(Z=>{const se=Z.filter(re=>!(re.target===J.target&&re.targetHandle===J.targetHandle));return Gd({...J,markerEnd:{type:us.ArrowClosed}},se)}),b(null)},[Gr,c]),pg=m.useCallback(E=>{E&&(Gr(E,{position:zl()}),Ce(!1),Ge(""))},[Gr,zl]),zs=m.useCallback(E=>{E&&(ho(E,zl()),Ce(!1),Ge(""))},[ho,zl]);m.useEffect(()=>{const E=H=>{if(H.defaultPrevented)return;const G=MI(H.target)||mK(H.target);if((H.metaKey||H.ctrlKey)&&H.key.toLowerCase()==="s"){H.preventDefault(),Zn().catch(re=>dt(String(re.message||re)));return}if(W){(H.key==="Escape"||fm(H))&&(H.preventDefault(),de(!1));return}if(G)return;const J=H.key.toLowerCase(),Z=(H.metaKey||H.ctrlKey)&&!H.shiftKey&&J==="z",se=(H.metaKey||H.ctrlKey)&&(H.shiftKey&&J==="z"||J==="y");if(Z||se){H.preventDefault(),H.stopPropagation();const re=Z?Ba():ni();dt(re?Z?"Undo canvas change":"Redo canvas change":Z?"Nothing to undo":"Nothing to redo");return}if((H.metaKey||H.ctrlKey)&&H.key.toLowerCase()==="c"){const re=EI(f.current,u.current,C.current);re&&(H.preventDefault(),H.stopPropagation(),g.current=re,dt(`Copied ${re.nodes.length} node${re.nodes.length>1?"s":""}`));return}if((H.metaKey||H.ctrlKey)&&H.key.toLowerCase()==="v"){const re=_I(g.current,f.current,u.current,C.current);re&&(H.preventDefault(),H.stopPropagation(),C.current=re.instances,N(re.instances),a(re.nodes),c(re.edges),dt(`Pasted ${re.pastedNodeIds.length} node${re.pastedNodeIds.length>1?"s":""}`));return}if(fm(H)&&!H.metaKey&&!H.ctrlKey&&!H.altKey){H.preventDefault(),de(!0);return}if(H.key==="a"||H.key==="A"){if(H.metaKey||H.ctrlKey){H.preventDefault(),a(re=>re.map(oe=>({...oe,selected:!0}))),c(re=>re.map(oe=>({...oe,selected:!1})));return}if(H.altKey)return;H.preventDefault(),Ce(!0);return}if((H.key==="v"||H.key==="V")&&!H.metaKey&&!H.ctrlKey&&!H.altKey){H.preventDefault(),Ee("select");return}(H.key==="h"||H.key==="H")&&!H.metaKey&&!H.ctrlKey&&!H.altKey&&(H.preventDefault(),Ee("pan"))};return window.addEventListener("keydown",E,!0),()=>window.removeEventListener("keydown",E,!0)},[ni,Zn,W,c,a,Ba]);const hg=m.useCallback(E=>{mn(H=>{const G=new Set(H);return G.has(E)?G.delete(E):G.add(E),G})},[]),go=m.useCallback((E,H)=>{E.dataTransfer.effectAllowed="copy",E.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:H.path,name:H.name,type:H.type})),E.dataTransfer.setData("text/plain",H.path)},[]),Ya=m.useCallback((E,H)=>{E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("application/agentflow-node",H.id),E.dataTransfer.setData("text/plain",H.id)},[]),Ga=m.useCallback(async(E,H)=>{const G=String((E==null?void 0:E.name)||(E==null?void 0:E.path)||"").toLowerCase(),J=G.split(".").pop(),Z=J==="html"?"display_html":J==="csv"||J==="tsv"||J==="json"&&/\b(table|data|rows|report)\b/i.test(G)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(J)?"display_image":"display_markdown",se=$.find(Nt=>Nt.id===Z);if(!se){dt("展示节点不可用");return}const re=Z==="display_image";let oe=String(E.path||"");if(!re){const Nt=ic(s);Nt.set("path",E.path);const bt=await fetch(`/api/workspace/file?${Nt.toString()}`),Ut=await bt.json();if(!bt.ok)throw new Error(Ut.error||"读取文件失败");oe=String(Ut.content||"")}const ue=Z==="display_image"?"src":"content",je=Hp(se.inputs).map(Nt=>Nt.name===ue?{...Nt,default:oe,value:oe}:Nt),rt=Hp(se.outputs).map(Nt=>Nt.name===ue?{...Nt,default:oe,value:oe}:Nt);Gr(se,{label:E.name||"Display",body:oe,inputs:je,outputs:rt,position:H}),dt(`已创建展示:${E.path}`)},[Gr,s,$]),mg=m.useCallback(E=>{Ga(E,Ii()).catch(H=>dt(String(H.message||H)))},[Ga,Ii]),Bl=m.useCallback(E=>{const H=E.dataTransfer.getData("application/x-agentflow-workspace-file");if(H){E.preventDefault();let re;try{re=JSON.parse(H)}catch{return}if(!(re!=null&&re.path))return;const oe=n.screenToFlowPosition({x:E.clientX,y:E.clientY});Ga(re,oe).catch(ue=>dt(String(ue.message||ue)));return}const G=E.dataTransfer.getData("application/agentflow-snippet");if(G){const re=M.find(ue=>`${ue.id}@${ue.version}`===G);if(!re)return;E.preventDefault();const oe=n.screenToFlowPosition({x:E.clientX,y:E.clientY});ho(re,oe);return}const J=E.dataTransfer.getData("application/agentflow-node");if(!J)return;const Z=$.find(re=>re.id===J);if(!Z)return;E.preventDefault();const se=n.screenToFlowPosition({x:E.clientX,y:E.clientY});Gr(Z,{position:se})},[Ga,Gr,M,ho,$,n]),gg=m.useCallback(E=>{const H=Array.from(E.dataTransfer.types||[]);!H.includes("application/x-agentflow-workspace-file")&&!H.includes("application/agentflow-node")&&!H.includes("application/agentflow-snippet")||(E.preventDefault(),E.dataTransfer.dropEffect=H.includes("application/agentflow-node")||H.includes("application/agentflow-snippet")?"move":"copy")},[]),vu=m.useCallback(async(E="")=>{const H=window.prompt("新文件名",E?`${E}/notes.md`:"notes.md");if(!H)return;const G=E&&!H.includes("/")?`${E}/${H}`:H;try{const J=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:G,content:""})}),Z=await J.json();if(!J.ok)throw new Error(Z.error||"创建文件失败");await Yn(),mn(se=>{const re=new Set(se);for(const oe of Wp(Z.path||G))re.delete(oe);return re}),dt(`已创建 ${Z.path}`)}catch(J){dt(String(J.message||J))}},[s,Yn]),Of=m.useCallback(async(E="")=>{const H=window.prompt("新文件夹名",E?`${E}/docs`:"docs");if(!H)return;const G=E&&!H.includes("/")?`${E}/${H}`:H;try{const J=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:G})}),Z=await J.json();if(!J.ok)throw new Error(Z.error||"创建文件夹失败");await Yn(),mn(se=>{const re=new Set(se);for(const oe of Wp(Z.path||G))re.delete(oe);return Z.path&&re.delete(Z.path),re}),dt(`已创建 ${Z.path}`)}catch(J){dt(String(J.message||J))}},[s,Yn]),yg=m.useCallback(async E=>{if(!(!(E!=null&&E.path)||!window.confirm(`删除 ${E.path}?`)))try{const H=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:E.path})}),G=await H.json();if(!H.ok)throw new Error(G.error||"删除失败");dt(`已删除 ${G.path}`),await Yn()}catch(H){dt(String(H.message||H))}},[s,Yn]),Mf=m.useCallback(async()=>{const E=xr.trim();if(!E||Ct)return;const H=Vp(i,l,C.current);tt(""),Vt(!0),Ho("workspace"),Be(G=>[...G,{role:"user",text:E,at:Date.now()}]);try{await Zn(i,l);const G=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,prompt:E,outputKind:"markdown",workspaceGraph:H,allowFlowYaml:!1,model:tn,selectedSkills:Pn,selectedNodeIds:Dl})}),J=await G.json();if(!G.ok)throw new Error(J.error||"生成失败");const Z=String(J.content||"").trim();Be(se=>[...se,{role:"assistant",text:Z,at:Date.now()}]),await ri(),dt("AI 生成完成")}catch(G){const J=String(G.message||G);Be(Z=>[...Z,{role:"assistant",text:J,error:!0,at:Date.now()}]),dt(J)}finally{Vt(!1)}},[tn,Ct,xr,l,s,ri,i,Ho,Zn,Dl,Pn]),lr=Qn.find(E=>E.id===Ci)||null,ku=lr?Array.isArray(lr.messages)?lr.messages:[]:Fr,Hl=lr?lr.status==="running":Ct,$f=lr?lr.status==="running"?`${lr.label} running`:lr.status==="paused"?`${lr.label} paused`:lr.status==="failed"?`${lr.label} failed`:`${lr.label} done`:Ct?"Workspace agent running":Fr.length>0?"Workspace conversation":"Ready";return o.jsxs("div",{className:"af-workspace-page",children:[o.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[o.jsxs("div",{className:"af-pipeline-top-left",children:[o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>t("/projects"),"aria-label":"返回",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",title:s.flowId?`${s.flowId} · ${he}`:he||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",dK,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",onClick:()=>{t(zb({id:s.flowId,source:s.flowSource||"user",archived:!!s.archived},"pipeline"))},children:"Pipeline"}),o.jsx("button",{type:"button",className:"af-view-switch__active",children:"Workspace"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[o.jsx("span",{className:"af-workspace-save-status",children:Tf}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>de(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(Ei?" af-composer-topbar-btn--active":"")+(Ct?" af-composer-topbar-btn--running":""),onClick:()=>Os(E=>!E),children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",onClick:()=>Zn().catch(E=>dt(String(E.message||E))),children:"Save"})]})]}),ae?o.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsx("span",{children:ae}),o.jsx("button",{type:"button",onClick:()=>ge(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(Ei||Le?" af-workspace-body--drawer":"")+(ys?" af-workspace-body--sidebar-collapsed":""),children:[ys?o.jsx("nav",{className:"af-workspace-rail","aria-label":"Workspace sidebar",children:o.jsxs("div",{className:"af-workspace-rail__stack",children:[o.jsxs("button",{type:"button",className:"af-workspace-rail__primary",onClick:()=>Ce(!0),"aria-label":"添加节点",title:"添加节点",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"}),o.jsx("span",{className:"af-workspace-rail__dot","aria-hidden":!0})]}),o.jsx("button",{type:"button",className:"af-workspace-rail__btn",onClick:()=>Yr(!1),"aria-label":"展开文件",title:"展开文件",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"})}),o.jsx("span",{className:"af-workspace-rail__divider","aria-hidden":!0}),o.jsx("button",{type:"button",className:"af-workspace-rail__avatar",onClick:()=>Yr(!1),"aria-label":"展开侧边栏",title:(Re==null?void 0:Re.username)||(Re==null?void 0:Re.userId)||"展开侧边栏",children:yu})]})}):null,o.jsxs("aside",{ref:gn,className:"af-workspace-sidebar"+(xn?" af-workspace-sidebar--resizing":""),"aria-hidden":ys,style:{"--af-work-files-pane-height":`${Math.round(yn)}px`},children:[o.jsxs("section",{className:"af-workspace-files-section",children:[o.jsxs("div",{className:"af-workspace-sidebar-head",children:[o.jsx("h2",{children:"Files"}),o.jsxs("div",{className:"af-workspace-sidebar-actions",children:[o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Yr(!0),"aria-label":"最小化侧边栏",title:"最小化侧边栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"keyboard_double_arrow_left"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>vu(""),"aria-label":"新增文件",title:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Of(""),"aria-label":"新增文件夹",title:"新增文件夹",children:o.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void Yn(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),o.jsx("input",{className:"af-workspace-search",value:We,onChange:E=>Qe(E.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",children:o.jsx(aT,{items:Ka,onOpen:mg,collapsedDirs:Gt,onToggleDir:hg,onCreateFile:vu,onCreateFolder:Of,onDelete:yg,onFileDragStart:go})})]}),o.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:Bo,role:"separator","aria-orientation":"horizontal","aria-label":"调整 Files 和 Palette 区域大小",title:"拖动调整 Files / Palette 高度"}),o.jsxs("section",{className:"af-workspace-nodes-section",children:[o.jsxs("div",{className:"af-node-palette-head af-workspace-node-palette-head",children:[o.jsxs("h2",{className:"af-node-palette-title",children:[o.jsx("span",{children:"Palette"}),o.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),o.jsxs("label",{className:"af-palette-search-wrap",children:[o.jsx("span",{className:"af-visually-hidden",children:R==="flows"?"搜索流程片段":"搜索节点"}),o.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",className:"af-palette-search-input",value:F,onChange:E=>A(E.target.value),placeholder:R==="flows"?"搜索流程片段...":"搜索节点...","aria-label":R==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":R==="nodes",className:"af-palette-tab"+(R==="nodes"?" af-palette-tab--active":""),onClick:()=>V("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":R==="flows",className:"af-palette-tab"+(R==="flows"?" af-palette-tab--active":""),onClick:()=>V("flows"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),o.jsx("div",{className:"af-node-palette-scroll af-workspace-node-palette-scroll",children:R==="flows"?o.jsxs(o.Fragment,{children:[o.jsx("section",{className:"af-palette-section af-flow-palette-section--snippets",children:o.jsxs("div",{className:"af-flow-snippet-actions",children:[o.jsxs("button",{type:"button",className:"af-flow-snippet-publish-btn",onClick:wu,disabled:Ln.length<2,title:Ln.length<2?"选择至少两个节点后发布流程片段":"发布选中的流程片段",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布选中片段"]}),o.jsxs("span",{className:"af-flow-snippet-selection",children:["已选 ",Ln.length," 节点 / ",Ai.length," 连线"]})]})}),P?o.jsx("p",{className:"af-err af-palette-list-err",children:P}):null,I?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):Fl.length>0?o.jsxs("section",{className:"af-palette-section af-flow-palette-section--snippets",children:[o.jsx("h3",{className:"af-palette-cat",children:"FLOW SNIPPETS"}),o.jsx("div",{className:"af-palette-cards",children:Fl.map(E=>{const H=`${E.id}@${E.version}`,G=E.displayName||E.name||E.id,J=E.description||`${E.nodeCount||0} 个节点,${E.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:Z=>{Z.dataTransfer.effectAllowed="move",Z.dataTransfer.setData("application/agentflow-snippet",H),Z.dataTransfer.setData("text/plain",H)},onClick:()=>ho(E),title:J,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:G}),o.jsxs("span",{className:"af-palette-card-id",children:[E.id,"@",E.version]})]})]}),J?o.jsx("span",{className:"af-palette-card-desc",children:J}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[E.nodeCount||0," nodes"]}),o.jsxs("span",{children:[E.edgeCount||0," edges"]})]})]},H)})})]}):o.jsx("p",{className:"af-palette-empty",children:F.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[sc.map(E=>{var H;return(H=Uo[E])!=null&&H.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${E}`,children:[o.jsx("h3",{className:"af-palette-cat",children:E}),o.jsx("div",{className:"af-palette-cards",children:Uo[E].map(G=>{const J=jj(G.inputs,"input"),Z=jj(G.outputs,"output"),se=$w(G),re=nd(G);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:oe=>Ya(oe,G),onClick:()=>Gr(G),title:se||G.id,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:Sj(E)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:re}),re!==G.id?o.jsx("span",{className:"af-palette-card-id",children:G.id}):null]})]}),se?o.jsx("span",{className:"af-palette-card-desc",children:se}):null,o.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[J.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[J.shown.map((oe,ue)=>o.jsxs("span",{className:"af-palette-card-port",title:Nj("input",oe,ue),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Un(oe==null?void 0:oe.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:zy(oe,ue)})]},`in-${ue}`)),J.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",J.hidden]}):null]})]}),o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[Z.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[Z.shown.map((oe,ue)=>o.jsxs("span",{className:"af-palette-card-port",title:Nj("output",oe,ue),children:[o.jsx("span",{className:"af-palette-card-port-name",children:zy(oe,ue)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Un(oe==null?void 0:oe.type)}})]},`out-${ue}`)),Z.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",Z.hidden]}):null]})]})]})]},G.id)})})]},E):null}),$.length>0&&F.trim()&&sc.every(E=>{var H;return!((H=Uo[E])!=null&&H.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),o.jsxs("main",{className:"af-workspace-canvas",children:[o.jsx(YP,{className:"af-flow-canvas af-workspace-flow"+(Ie==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),nodes:si,edges:Wo,nodeTypes:HK,onNodesChange:gt,onEdgesChange:d,onConnect:fg,onConnectStart:mo,onConnectEnd:Lf,isValidConnection:ft,onNodeClick:(E,H)=>{ct&&Ht(H.id)},onNodeDoubleClick:(E,H)=>{E.preventDefault(),Os(!1),a(G=>G.map(J=>({...J,selected:J.id===H.id}))),c(G=>G.map(J=>({...J,selected:!1}))),Ht(H.id)},onPaneClick:()=>Ht(""),onDrop:Bl,onDragOver:gg,selectionOnDrag:Ie==="select",panOnDrag:Ie==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(ZP,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),y?(()=>{var J;const E=String(y.query||"").trim().toLowerCase(),H=E?y.candidates.filter(Z=>{var se,re,oe;return[(se=Z.def)==null?void 0:se.id,Z.displayLabel,Z.description,(re=Z.slot)==null?void 0:re.name,(oe=Z.slot)==null?void 0:oe.type].filter(Boolean).some(ue=>String(ue).toLowerCase().includes(E))}):y.candidates,G=y.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:y.left,top:y.top},role:"dialog","aria-label":"选择匹配节点",children:[o.jsxs("div",{className:"af-connect-node-menu__head",children:[o.jsxs("div",{className:"af-connect-node-menu__title",children:[o.jsx("span",{className:"af-connect-node-menu__dot",style:{background:Un((J=y.draft.slot)==null?void 0:J.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",y.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>b(null),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("label",{className:"af-connect-node-menu__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:y.query,onChange:Z=>b(se=>se&&{...se,query:Z.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[H.map(Z=>{var oe,ue;const se=Z.displayLabel||((oe=Z.def)==null?void 0:oe.id),re=zy(Z.slot,Z.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>bu(Z),title:Z.description||Z.def.id,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:se}),se!==Z.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:Z.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:G}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Un((ue=Z.slot)==null?void 0:ue.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:re})]})]},`${Z.def.id}-${Z.slotIndex}`)}),H.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,ao?o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>ti(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})}):o.jsx("div",{className:"af-workspace-composer af-bottom-composer-stack af-flow-bottom-composer",children:o.jsxs("div",{className:"af-pipeline-composer-inner",children:[o.jsx("button",{type:"button",className:"af-workspace-composer-minimize",onClick:()=>ti(!0),"aria-label":"最小化 AI 输入框",title:"最小化",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"remove"})}),o.jsx("div",{className:"af-composer-selected","aria-label":"Selected workspace nodes",children:Ln.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Ln.map(E=>{var Z,se;const H=String(((Z=E.data)==null?void 0:Z.label)??E.id),G=(se=E.data)!=null&&se.definitionId?String(E.data.definitionId):"",J=G&&G!==H?`${H} · ${E.id} · ${G}`:`${H} · ${E.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:J,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:G||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:H}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>dg(E.id),"aria-label":`取消选择 ${E.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},E.id)})}),o.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[o.jsx("div",{className:"af-composer-input-wrap",children:o.jsx("textarea",{className:"af-composer-textarea",value:xr,rows:2,onChange:E=>tt(E.target.value),onKeyDown:E=>{(E.metaKey||E.ctrlKey)&&E.key==="Enter"&&(E.preventDefault(),Mf())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1})}),o.jsxs("div",{className:"af-composer-toolbar",children:[o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:ir,type:"button",className:"af-composer-skills-button"+(Pn.length>0?" af-composer-skills-button--active":""),disabled:Ct,"aria-haspopup":"listbox","aria-expanded":Pe,onClick:()=>qt(E=>!E),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:Pn.length>0?`Skills ${Pn.length}`:"Skills"})]}),Pe&&!Ct?ts.createPortal(o.jsx("div",{ref:ut,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:Kn,children:st.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[Fs.groups.map(E=>{const H=Pa(E,st),G=e_(E,po,st),J=oo.has(E.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(J?" af-composer-skill-group--collapsed":""),children:[o.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[o.jsxs("label",{className:"af-composer-skill-group-check",children:[o.jsx("input",{type:"checkbox",checked:G==="all",disabled:H.length===0,onChange:Z=>{const se=Z.target.checked;hs(re=>se?QE(re,H):ZE(re,H))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:E.name}),E.builtin?o.jsx("em",{children:"built-in"}):null,G==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":J?`展开 ${E.name}`:`收起 ${E.name}`,onClick:()=>{An(Z=>{const se=new Set(Z);return se.has(E.id)?se.delete(E.id):se.add(E.id),se})},children:[o.jsx("span",{children:E.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:J?"expand_more":"expand_less"})]})]}),J?null:o.jsx("div",{className:"af-composer-skill-group-items",children:E.skills.map(Z=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:po.has(Z.key),onChange:se=>{const re=se.target.checked;hs(oe=>re?oe.includes(Z.key)?oe:[...oe,Z.key]:oe.filter(ue=>ue!==Z.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:Z.name}),Z.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:Z.description}):null]})]},`${E.id}:${Z.key}`))})]},E.id)}),Fs.ungrouped.length>0?o.jsxs("div",{className:"af-composer-skill-group",children:[o.jsxs("div",{className:"af-composer-skill-group-title",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("span",{children:Fs.ungrouped.length})]}),Fs.ungrouped.map(E=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:po.has(E.key),onChange:H=>{const G=H.target.checked;hs(J=>G?J.includes(E.key)?J:[...J,E.key]:J.filter(Z=>Z!==E.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:E.name}),E.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:E.description}):null]})]},`ungrouped:${E.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:tn,onChange:E=>Fn(E.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),$l.map(E=>o.jsx("option",{value:E.value,children:E.label},E.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(xr.trim()&&!Ct?" af-composer-send--active":"")+(Ct?" af-composer-send--stop":""),disabled:Ct||!xr.trim(),"aria-label":Ct?"Running":"Send",onClick:()=>void Mf(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Ct?"sync":"arrow_upward"})})]})]})]})})]}),Ei?o.jsx("aside",{className:"af-pipeline-drawer af-pipeline-drawer--wide af-workspace-composer-drawer","aria-label":"Workspace AI Composer",children:o.jsxs("div",{className:"af-composer-sidebar",children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:()=>Os(!1),"aria-label":"关闭 AI 对话侧栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-composer-session-tabs",children:[o.jsx("button",{type:"button",className:"af-composer-session-tab"+(Ci==="workspace"?" af-composer-session-tab--active":""),onClick:()=>ei("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),Qn.map(E=>o.jsx("button",{type:"button",className:"af-composer-session-tab"+(Ci===E.id?" af-composer-session-tab--active":"")+(E.status==="running"?" af-composer-session-tab--running":""),onClick:()=>ei(E.id),title:E.runNodeId||E.label,children:o.jsx("span",{className:"af-composer-session-label",children:E.label})},E.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(Hl?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:$f}),o.jsx("div",{className:"af-composer-sidebar-thread",children:o.jsx(UK,{messages:ku,running:Hl,showRunningIndicator:!lr})})]})}):Le&&Mt?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(HI,{draft:Le,setDraft:Jt,definitionId:String(((Df=Mt.data)==null?void 0:Df.definitionId)||Mt.id),systemPromptReadonly:String(((Ff=Mt.data)==null?void 0:Ff.description)||""),modelLists:xe,disabled:!1,onIdBlur:()=>Ml(!0),onClose:()=>Ht(""),onPublishToMarketplace:hu,error:Qt,ioSlots:{inputs:Array.isArray(Le==null?void 0:Le.inputs)?Le.inputs:[],outputs:Array.isArray(Le==null?void 0:Le.outputs)?Le.outputs:[]}})}):null,o.jsx($I,{open:W,onClose:()=>de(!1)}),_?ts.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Y(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"名称"}),o.jsx("input",{type:"text",value:Q.name,onChange:E=>{const H=E.target.value;K(G=>({...G,name:H,id:G.id?G.id:H.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:内容整理片段",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"ID"}),o.jsx("input",{type:"text",value:Q.id,onChange:E=>K(H=>({...H,id:E.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:Q.description,onChange:E=>K(H=>({...H,description:E.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Ln.length," 个节点和 ",Ai.length," 条内部连线。"]}),ye?o.jsx("div",{className:"af-flow-snippet-error",children:ye}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Y(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:ie||!Q.name.trim(),onClick:()=>void qa(),children:ie?"发布中...":"发布"})]})]})}),document.body):null,Ae?ts.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>Ce(!1),children:o.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:E=>E.stopPropagation(),children:[o.jsxs("div",{className:"af-workspace-quick-add__tabs",role:"tablist","aria-label":"选择添加类型",children:[o.jsx("button",{type:"button",role:"tab","aria-selected":Ne==="nodes",className:"af-workspace-quick-add__tab"+(Ne==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>Ye("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":Ne==="flows",className:"af-workspace-quick-add__tab"+(Ne==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>Ye("flows"),children:"流程"})]}),o.jsxs("div",{className:"af-workspace-quick-add__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:Zs,value:Ze,onChange:E=>Ge(E.target.value),onKeyDown:E=>{if(E.key==="Escape")E.preventDefault(),Ce(!1);else if(E.key==="ArrowDown"){E.preventDefault();const H=Ne==="flows"?pr.length:fo.length;qe(G=>Math.min(Math.max(0,H-1),G+1))}else E.key==="ArrowUp"?(E.preventDefault(),qe(H=>Math.max(0,H-1))):E.key==="Tab"?(E.preventDefault(),Ye(H=>H==="nodes"?"flows":"nodes")):E.key==="Enter"&&(E.preventDefault(),Ne==="flows"?zs(pr[It]||pr[0]):pg(fo[It]||fo[0]))},placeholder:Ne==="flows"?"搜索流程片段...":"搜索节点...","aria-label":Ne==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:Ne==="flows"?pr.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:I?"正在加载流程片段...":P||"没有匹配的流程片段"}):pr.map((E,H)=>{const G=E.displayName||E.name||E.id,J=E.snippet&&typeof E.snippet=="object"?E.snippet.instances:null,Z=E.snippet&&typeof E.snippet=="object"?E.snippet.edges:null,se=Number.isFinite(Number(E.nodeCount))?Number(E.nodeCount):Object.keys(J||{}).length,re=Number.isFinite(Number(E.edgeCount))?Number(E.edgeCount):Array.isArray(Z)?Z.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(H===It?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>qe(H),onClick:()=>zs(E),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:"schema"}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:G}),o.jsxs("span",{className:"af-workspace-quick-add__meta",children:[E.id,E.version?` · v${E.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:E.description||`${se} 节点 / ${re} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${E.id}@${E.version}`)}):fo.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):fo.map((E,H)=>{const G=td(E),J=nd(E),Z=$w(E);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(H===It?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>qe(H),onClick:()=>pg(E),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:Sj(G)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:J}),o.jsx("span",{className:"af-workspace-quick-add__meta",children:E.id}),Z?o.jsx("span",{className:"af-workspace-quick-add__desc",children:Z}):null]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:G})]},E.id)})})]})}),document.body):null]})]})}function tq(){return o.jsx(iv,{children:o.jsx(eq,{})})}const ht=e=>typeof e=="string",Vu=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},Pj=e=>e==null?"":""+e,nq=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},rq=/###/g,Aj=e=>e&&e.indexOf("###")>-1?e.replace(rq,"."):e,Ij=e=>!e||ht(e),kd=(e,t,n)=>{const r=ht(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(Ij(e))return{};const i=Aj(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return Ij(e)?{}:{obj:e,k:Aj(r[s])}},Tj=(e,t,n)=>{const{obj:r,k:s}=kd(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let i=t[t.length-1],a=t.slice(0,t.length-1),l=kd(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=kd(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},sq=(e,t,n,r)=>{const{obj:s,k:i}=kd(e,t,Object);s[i]=s[i]||[],s[i].push(n)},mm=(e,t)=>{const{obj:n,k:r}=kd(e,t);if(n)return n[r]},iq=(e,t,n)=>{const r=mm(e,n);return r!==void 0?r:mm(t,n)},lT=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?ht(e[r])||e[r]instanceof String||ht(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):lT(e[r],t[r],n):e[r]=t[r]);return e},tc=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var oq={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const aq=e=>ht(e)?e.replace(/[&<>"'\/]/g,t=>oq[t]):e;class lq{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const cq=[" ",",","?","!",";"],uq=new lq(20),dq=(e,t,n)=>{t=t||"",n=n||"";const r=cq.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=uq.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let i=!s.test(e);if(!i){const a=e.indexOf(n);a>0&&!s.test(e.substring(0,a))&&(i=!0)}return i},Dw=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let i=0;i<r.length;){if(!s||typeof s!="object")return;let a,l="";for(let c=i;c<r.length;++c)if(c!==i&&(l+=n),l+=r[c],a=s[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<r.length-1)continue;i+=c-i+1;break}s=a}return s},gm=e=>e&&e.replace("_","-"),fq={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class ym{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||fq,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,s){return s&&!this.debug?null:(ht(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new ym(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new ym(this.logger,t)}}var qi=new ym;class ig{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(a=>{let[l,c]=a;for(let d=0;d<c;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[l,c]=a;for(let d=0;d<c;d++)l.apply(l,[t,...r])})}}class Rj extends ig{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.indexOf(".")>-1?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):ht(r)&&i?l.push(...r.split(i)):l.push(r)));const c=mm(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!ht(r)?c:Dw(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(l=t.split("."),s=n,n=l[1]),this.addNamespaces(n),Tj(this.data,l,s),i.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(ht(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),s=r,r=n,n=l[1]),this.addNamespaces(n);let c=mm(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?lT(c,r,i):c={...c,...r},Tj(this.data,l,c),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var cT={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,s))}),t}};const Lj={};class xm extends ig{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),nq(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=qi.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!dq(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:ht(i)?[i]:i};const d=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(d[0])>-1)&&(i=d.shift()),t=d.join(s)}return{key:t,namespaces:ht(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],d=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(f){const N=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${N}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${N}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const u=this.resolve(t,n);let p=u&&u.res;const h=u&&u.usedKey||a,g=u&&u.exactUsedKey||a,v=Object.prototype.toString.apply(p),k=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!ht(p)&&typeof p!="boolean"&&typeof p!="number";if(b&&p&&w&&k.indexOf(v)<0&&!(ht(y)&&Array.isArray(p))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const N=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,p,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(u.res=N,u.usedParams=this.getUsedParamsDetails(n),u):N}if(i){const N=Array.isArray(p),C=N?[]:{},j=N?g:h;for(const T in p)if(Object.prototype.hasOwnProperty.call(p,T)){const $=`${j}${i}${T}`;C[T]=this.translate($,{...n,joinArrays:!1,ns:l}),C[T]===$&&(C[T]=p[T])}p=C}}else if(b&&ht(y)&&Array.isArray(p))p=p.join(y),p&&(p=this.extendTranslation(p,t,n,r));else{let N=!1,C=!1;const j=n.count!==void 0&&!ht(n.count),T=xm.hasDefaultValue(n),$=j?this.pluralResolver.getSuffix(d,n.count,n):"",L=n.ordinal&&j?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",F=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),A=F&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${$}`]||n[`defaultValue${L}`]||n.defaultValue;!this.isValidLookup(p)&&T&&(N=!0,p=A),this.isValidLookup(p)||(C=!0,p=a);const V=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:p,M=T&&A!==p&&this.options.updateMissing;if(C||N||M){if(this.logger.log(M?"updateKey":"missingKey",d,c,a,M?A:p),i){const P=this.resolve(a,{...n,keySeparator:!1});P&&P.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let D=[];const I=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&I&&I[0])for(let P=0;P<I.length;P++)D.push(I[P]);else this.options.saveMissingTo==="all"?D=this.languageUtils.toResolveHierarchy(n.lng||this.language):D.push(n.lng||this.language);const B=(P,O,_)=>{const Y=T&&_!==p?_:V;this.options.missingKeyHandler?this.options.missingKeyHandler(P,c,O,Y,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(P,c,O,Y,M,n),this.emit("missingKey",P,c,O,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?D.forEach(P=>{const O=this.pluralResolver.getSuffixes(P,n);F&&n[`defaultValue${this.options.pluralSeparator}zero`]&&O.indexOf(`${this.options.pluralSeparator}zero`)<0&&O.push(`${this.options.pluralSeparator}zero`),O.forEach(_=>{B([P],a+_,n[`defaultValue${_}`]||A)})}):B(D,a,A))}p=this.extendTranslation(p,t,n,u,r),C&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${c}:${a}`),(C||N)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,N?p:void 0):p=this.options.parseMissingKeyHandler(p))}return s?(u.res=p,u.usedParams=this.getUsedParamsDetails(n),u):p}extendTranslation(t,n,r,s,i){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const d=ht(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(d){const p=t.match(this.interpolator.nestingRegexp);f=p&&p.length}let u=r.replace&&!ht(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),t=this.interpolator.interpolate(t,u,r.lng||this.language||s.usedLng,r),d){const p=t.match(this.interpolator.nestingRegexp),h=p&&p.length;f<h&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var p=arguments.length,h=new Array(p),g=0;g<p;g++)h[g]=arguments[g];return i&&i[0]===h[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):a.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=ht(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=cT.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,a,l;return ht(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),f=d.key;s=f;let u=d.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const p=n.count!==void 0&&!ht(n.count),h=p&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(ht(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(k=>{this.isValidLookup(r)||(l=k,!Lj[`${v[0]}-${k}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(Lj[`${v[0]}-${k}`]=!0,this.logger.warn(`key "${s}" for languages "${v.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),v.forEach(y=>{if(this.isValidLookup(r))return;a=y;const b=[f];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(b,f,y,k,n);else{let N;p&&(N=this.pluralResolver.getSuffix(y,n.count,n));const C=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(b.push(f+N),n.ordinal&&N.indexOf(j)===0&&b.push(f+N.replace(j,this.options.pluralSeparator)),h&&b.push(f+C)),g){const T=`${f}${this.options.contextSeparator}${n.context}`;b.push(T),p&&(b.push(T+N),n.ordinal&&N.indexOf(j)===0&&b.push(T+N.replace(j,this.options.pluralSeparator)),h&&b.push(T+C))}}let w;for(;w=b.pop();)this.isValidLookup(r)||(i=w,r=this.getResource(y,k,w,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!ht(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const i of n)delete s[i]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const Hy=e=>e.charAt(0).toUpperCase()+e.slice(1);class Oj{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=qi.create("languageUtils")}getScriptPartFromCode(t){if(t=gm(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=gm(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ht(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let s=Intl.getCanonicalLocales(t)[0];if(s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s)return s}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Hy(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Hy(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Hy(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),ht(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],i=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return ht(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):ht(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let pq=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],hq={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const mq=["v1","v2","v3"],gq=["v4"],Mj={zero:0,one:1,two:2,few:3,many:4,other:5},yq=()=>{const e={};return pq.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:hq[t.fc]}})}),e};class xq{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=qi.create("pluralResolver"),(!this.options.compatibilityJSON||gq.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=yq(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const r=gm(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(r,{type:s})}catch{if(!t.match(/-|_/))return;const c=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(c,n)}return this.pluralRulesCache[i]=a,a}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,i)=>Mj[s]-Mj[i]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(t,s,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:this.getSuffixRetroCompatible(s,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let s=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const i=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!mq.includes(this.options.compatibilityJSON)}}const $j=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=iq(e,t,n);return!i&&s&&ht(n)&&(i=Dw(e,n,r),i===void 0&&(i=Dw(t,n,r))),i},Vy=e=>e.replace(/\$/g,"$$$$");class wq{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=qi.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:i,prefixEscaped:a,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:f,unescapePrefix:u,nestingPrefix:p,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:v,nestingOptionsSeparator:k,maxReplaces:y,alwaysFormat:b}=t.interpolation;this.escape=n!==void 0?n:aq,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?tc(i):a||"{{",this.suffix=l?tc(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=f?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=p?tc(p):h||tc("$t("),this.nestingSuffix=g?tc(g):v||tc(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=y||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,a,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=h=>{if(h.indexOf(this.formatSeparator)<0){const y=$j(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...s,...n,interpolationkey:h}):y}const g=h.split(this.formatSeparator),v=g.shift().trim(),k=g.join(this.formatSeparator).trim();return this.format($j(n,c,v,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...s,...n,interpolationkey:v})};this.resetRegExp();const f=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,u=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Vy(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Vy(this.escape(h)):Vy(h)}].forEach(h=>{for(l=0;i=h.regex.exec(t);){const g=i[1].trim();if(a=d(g),a===void 0)if(typeof f=="function"){const k=f(t,i,s);a=ht(k)?k:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))a="";else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),a="";else!ht(a)&&!this.useRawValueToEscape&&(a=Pj(a));const v=h.safeValue(a);if(t=t.replace(i[0],v),u?(h.regex.lastIndex+=a.length,h.regex.lastIndex-=i[0].length):h.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,a;const l=(c,d)=>{const f=this.nestingOptionsSeparator;if(c.indexOf(f)<0)return c;const u=c.split(new RegExp(`${f}[ ]*{`));let p=`{${u[1]}`;c=u[0],p=this.interpolate(p,a);const h=p.match(/'/g),g=p.match(/"/g);(h&&h.length%2===0&&!g||g.length%2!==0)&&(p=p.replace(/'/g,'"'));try{a=JSON.parse(p),d&&(a={...d,...a})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,v),`${c}${f}${p}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];a={...r},a=a.replace&&!ht(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let d=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const f=s[1].split(this.formatSeparator).map(u=>u.trim());s[1]=f.shift(),c=f,d=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!ht(i))return i;ht(i)||(i=Pj(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),d&&(i=c.reduce((f,u)=>this.format(f,u,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const bq=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(a=>{if(a){const[l,...c]=a.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),f=l.trim();n[f]||(n[f]=d),d==="false"&&(n[f]=!1),d==="true"&&(n[f]=!0),isNaN(d)||(n[f]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},nc=e=>{const t={};return(n,r,s)=>{let i=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(i={...i,[s.interpolationkey]:void 0});const a=r+JSON.stringify(i);let l=t[a];return l||(l=e(gm(r),s),t[a]=l),l(n)}};class vq{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=qi.create("formatter"),this.options=t,this.formats={number:nc((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:nc((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:nc((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:nc((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:nc((n,r)=>{const s=new Intl.ListFormat(n,{...r});return i=>s.format(i)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=nc(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(l=>l.indexOf(")")>-1)){const l=i.findIndex(c=>c.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,l)].join(this.formatSeparator)}return i.reduce((l,c)=>{const{formatName:d,formatOptions:f}=bq(c);if(this.formats[d]){let u=l;try{const p=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=p.locale||p.lng||s.locale||s.lng||r;u=this.formats[d](l,h,{...f,...s,...p})}catch(p){this.logger.warn(p)}return u}else this.logger.warn(`there was no format function for ${d}`);return l},t)}}const kq=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class Sq extends ig{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=qi.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const i={},a={},l={},c={};return t.forEach(d=>{let f=!0;n.forEach(u=>{const p=`${d}|${u}`;!r.reload&&this.store.hasResourceBundle(d,u)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?a[p]===void 0&&(a[p]=!0):(this.state[p]=1,f=!1,a[p]===void 0&&(a[p]=!0),i[p]===void 0&&(i[p]=!0),c[u]===void 0&&(c[u]=!0)))}),f||(l[d]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const s=t.split("|"),i=s[0],a=s[1];n&&this.emit("failedLoading",i,a,n),!n&&r&&this.store.addResourceBundle(i,a,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const l={};this.queue.forEach(c=>{sq(c.loaded,[i],a),kq(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const f=c.loaded[d];f.length&&f.forEach(u=>{l[d][u]===void 0&&(l[d][u]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:i,callback:a});return}this.readingCalls++;const l=(d,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const u=this.waitingReads.shift();this.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}if(d&&f&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,a)},i);return}a(d,f)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(t,n);d&&typeof d.then=="function"?d.then(f=>l(null,f)).catch(l):l(null,d)}catch(d){l(d)}return}return c(t,n,l)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();ht(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ht(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,l),this.loaded(t,a,l)})}saveMissing(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...a,isUpdate:i},d=this.backend.create.bind(this.backend);if(d.length<6)try{let f;d.length===5?f=d(t,n,r,s,c):f=d(t,n,r,s),f&&typeof f.then=="function"?f.then(u=>l(null,u)).catch(l):l(null,f)}catch(f){l(f)}else d(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const Dj=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),ht(e[1])&&(t.defaultValue=e[1]),ht(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Fj=e=>(ht(e.ns)&&(e.ns=[e.ns]),ht(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ht(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Up=()=>{},Nq=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class sf extends ig{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Fj(t),this.services={},this.logger=qi,this.modules={external:[]},Nq(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(ht(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=Dj();this.options={...s,...this.options,...Fj(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?qi.init(i(this.modules.logger),this.options):qi.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=vq);const u=new Oj(this.options);this.store=new Rj(this.options.resources,this.options);const p=this.services;p.logger=qi,p.resourceStore=this.store,p.languageUtils=u,p.pluralResolver=new xq(u,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(p.formatter=i(f),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new wq(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new Sq(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(h){for(var g=arguments.length,v=new Array(g>1?g-1:0),k=1;k<g;k++)v[k-1]=arguments[k];t.emit(h,...v)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new xm(this.services,this.options),this.translator.on("*",function(h){for(var g=arguments.length,v=new Array(g>1?g-1:0),k=1;k<g;k++)v[k-1]=arguments[k];t.emit(h,...v)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Up),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=function(){return t.store[f](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=function(){return t.store[f](...arguments),t}});const c=Vu(),d=()=>{const f=(u,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(p),r(u,p)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initImmediate?d():setTimeout(d,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Up;const s=ht(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(d=>{d!=="cimode"&&i.indexOf(d)<0&&i.push(d)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>a(c)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const s=Vu();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=Up),this.services.backendConnector.reload(t,n,i=>{s.resolve(),r(i)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&cT.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const s=Vu();this.emit("languageChanging",t);const i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,d)=>{d?(i(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const d=ht(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);d&&(this.language||i(d),this.translator.language||this.translator.changeLanguage(d),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(d)),this.loadResources(d,f=>{a(f,d)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(t),s}getFixedT(t,n,r){var s=this;const i=function(a,l){let c;if(typeof l!="object"){for(var d=arguments.length,f=new Array(d>2?d-2:0),u=2;u<d;u++)f[u-2]=arguments[u];c=s.options.overloadTranslationOptionHandler([a,l].concat(f))}else c={...l};c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||i.keyPrefix);const p=s.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(a)?h=a.map(g=>`${c.keyPrefix}${p}${g}`):h=c.keyPrefix?`${c.keyPrefix}${p}${a}`:a,s.t(h,c)};return ht(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!s||a(i,t)))}loadNamespaces(t,n){const r=Vu();return this.options.ns?(ht(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Vu();ht(t)&&(t=[t]);const s=this.options.preload||[],i=t.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return i.length?(this.options.preload=s.concat(i),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new Oj(Dj());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new sf(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Up;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new sf(s);return(t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(l=>{i[l]=this[l]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new Rj(this.store.data,s),i.services.resourceStore=i.store),i.translator=new xm(i.services,s),i.translator.on("*",function(l){for(var c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];i.emit(l,...d)}),i.init(s,n),i.translator.options=s,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const _r=sf.createInstance();_r.createInstance=sf.createInstance;_r.createInstance;_r.dir;_r.init;_r.loadResources;_r.reloadResources;_r.use;_r.changeLanguage;_r.getFixedT;_r.t;_r.exists;_r.setDefaultNamespace;_r.hasLoadedNamespace;_r.loadNamespaces;_r.loadLanguages;function jq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function of(e){"@babel/helpers - typeof";return of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},of(e)}function Cq(e,t){if(of(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(of(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Eq(e){var t=Cq(e,"string");return of(t)=="symbol"?t:t+""}function _q(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,Eq(r.key),r)}}function Pq(e,t,n){return t&&_q(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var uT=[],Aq=uT.forEach,Iq=uT.slice;function Tq(e){return Aq.call(Iq.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var zj=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Rq=function(t,n,r){var s=r||{};s.path=s.path||"/";var i=encodeURIComponent(n),a="".concat(t,"=").concat(i);if(s.maxAge>0){var l=s.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(l))}if(s.domain){if(!zj.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!zj.test(s.path))throw new TypeError("option path is invalid");a+="; Path=".concat(s.path)}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(s.expires.toUTCString())}if(s.httpOnly&&(a+="; HttpOnly"),s.secure&&(a+="; Secure"),s.sameSite){var c=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite;switch(c){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},Bj={create:function(t,n,r,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),s&&(i.domain=s),document.cookie=Rq(t,encodeURIComponent(n),i)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),s=0;s<r.length;s++){for(var i=r[s];i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(n)===0)return i.substring(n.length,i.length)}return null},remove:function(t){this.create(t,"",-1)}},Lq={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=Bj.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&Bj.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},Oq={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var s=r.substring(1),i=s.split("&"),a=0;a<i.length;a++){var l=i[a].indexOf("=");if(l>0){var c=i[a].substring(0,l);c===t.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},Wu=null,Hj=function(){if(Wu!==null)return Wu;try{Wu=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Wu=!1}return Wu},Mq={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&Hj()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&Hj()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Uu=null,Vj=function(){if(Uu!==null)return Uu;try{Uu=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Uu=!1}return Uu},$q={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&Vj()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Vj()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},Dq={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r<navigator.languages.length;r++)n.push(navigator.languages[r]);navigator.userLanguage&&n.push(navigator.userLanguage),navigator.language&&n.push(navigator.language)}return n.length>0?n:void 0}},Fq={name:"htmlTag",lookup:function(t){var n,r=t.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},zq={name:"path",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof r[t.lookupFromPathIndex]!="string")return;n=r[t.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},Bq={name:"subdomain",lookup:function(t){var n=typeof t.lookupFromSubdomainIndex=="number"?t.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}},dT=!1;try{document.cookie,dT=!0}catch{}var fT=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];dT||fT.splice(1,1);function Hq(){return{order:fT,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var pT=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};jq(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return Pq(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=Tq(r,this.options||{},Hq()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(i){return i.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(Lq),this.addDetector(Oq),this.addDetector(Mq),this.addDetector($q),this.addDetector(Dq),this.addDetector(Fq),this.addDetector(zq),this.addDetector(Bq)}},{key:"addDetector",value:function(n){return this.detectors[n.name]=n,this}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var s=[];return n.forEach(function(i){if(r.detectors[i]){var a=r.detectors[i].lookup(r.options);a&&typeof a=="string"&&(a=[a]),a&&(s=s.concat(a))}}),s=s.map(function(i){return r.options.convertDetectedLanguage(i)}),this.services.languageUtils.getBestMatchFromCodes?s:s.length>0?s[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var s=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(i){s.detectors[i]&&s.detectors[i].cacheUserLanguage(n,s.options)}))}}])}();pT.type="languageDetector";const Vq={name:"AgentFlow",tagline:"AI Workflow Orchestration"},Wq={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},Uq={loading:"Loading...",saving:"Saving...",save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",create:"Create",close:"Close",confirm:"Confirm",copy:"Copy",copied:"Copied!",refresh:"Refresh",search:"Search",filter:"Filter",success:"Success",error:"Error",warning:"Warning",info:"Info",done:"Done",pending:"Pending",running:"Running",notFound:"Not found",required:"Required",optional:"Optional"},Kq={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},qq={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},Yq={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},Gq={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},Xq={app:Vq,nav:Wq,common:Uq,status:Kq,nodeTypes:qq,engine:Yq,links:Gq},Jq="Flow Editor",Qq="Nodes",Zq="Edges",eY="Properties",tY={label:"Node Label",type:"Node Type",model:"Model",body:"Body",inputs:"Inputs",outputs:"Outputs",addInput:"Add Input",addOutput:"Add Output",remove:"Remove Node",duplicate:"Duplicate Node",nodeType:"Node Type",displayName:"Display Name",displayNameHint:"(letters, numbers, underscores, hyphens, do not start with a number)",role:"Role",modelHint:"From ~/agentflow/model-lists.json; UI service runs agentflow update-model-lists in background on startup",defaultModel:"Default",userPrompt:"User Prompt (USER PROMPT / body)",systemDescription:"System Description (read-only, from node definition)",directCommand:"Direct Command (script)",scriptHint:"(tool_nodejs: skips AI when script exists, executed by pipeline)",diskRunning:"Disk record shows running",deleteNode:"Delete node",inputTooltip:"Input {{name}} | Type: {{type}}",outputTooltip:"Output {{name}} | Type: {{type}}",defaultSuffix:" | Default: {{value}}",fallbackLabel:"Node",expandProvide:"Edit content"},nY={title:"Node Properties",noInputPins:"No input pins",noOutputPins:"No output pins",type:"Type",name:"Name",defaultValue:"Default / value",required:"Req",showOnNode:"Card",requiredHint:"Mark this pin as required so users know it must be connected or given a value",showOnNodeHint:"Show this pin name on the canvas node card; hidden pins can still be connected",pinRequiredAriaLabel:"{{label}} {{index}} required",pinShowOnNodeAriaLabel:"{{label}} {{index}} show on node card",conversationOutput:"Conversation & Output",addPin:"Add Pin",addPinAriaLabel:"Add {{label}}",handleHint:"Matches Handle index on canvas ({{prefix}}-0, {{prefix}}-1…). After adding/removing/reordering, existing connections may break — check validation after saving.",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} type",pinNameAriaLabel:"{{label}} {{index}} name",pinDefaultAriaLabel:"{{label}} {{index}} default",deletePinAriaLabel:"Delete {{label}} {{index}}",deletePin:"Delete this pin",instanceId:"Node ID",yamlValueNotInList:"(YAML value, not in current list)",inputPins:"Input Pins (INPUT)",outputPins:"Output Pins (OUTPUT)",expand:"Expand",collapse:"Collapse",expandEditScript:"Expand edit script",expandEdit:"Expand edit",editScript:"Edit script",editUserPrompt:"Edit user prompt",scriptPlaceholder:"instances.*.script — full shell command; supports ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir}, ${runDir} and slot names (don't quote placeholders)",scriptPlaceholderExpand:"instances.*.script — full shell command; don't quote ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir} placeholders",bodyPlaceholder:"instances.*.body — supports multiline and ${variables}; type ${ to pick a slot",bodyPlaceholderExpand:"instances.*.body — supports multiline and ${variables}",noDescription:"(No description in current node definition)",modelAriaLabel:"Model",placeholderSlots:"Placeholders: input/output slots",publishToMarketplace:"Publish Node",publishToMarketplaceHint:"Publish the current node to the workspace local marketplace",publishing:"Publishing…",publishRunning:"Publishing to local marketplace…",publishSuccess:"Node published to local marketplace",publishSuccessWithId:"Node published: {{id}}"},rY={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},sY={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},iY={workspace:"Workspace",loading:"Loading...",archived:"Archived",noPipelines:"No pipelines",more:"more",moreFlows:"more flows",noRuns:"No run records",searchNodes:"Search nodes",noComponents:"No components available (check node library directory)",noMatch:"No matching nodes, adjust search terms",selectPipeline:"Select a pipeline from above to load components and canvas",validationWarnings:"Validation warnings (consistent with agentflow validate slot checks)",output:"Output",model:"Model",userDir:"User Directory",toggleRecentActivity:"Toggle recent opened or recent runs"},oY={selectPipeline:"Please select a pipeline from the dropdown above",loadingProps:"Loading node properties...",pipelineId:"Pipeline ID",diskPath:"Disk Path",storageLocation:"Storage Location",introduction:"Introduction",introductionPlaceholder:"Briefly describe this pipeline (saved as flow.yaml ui.description)",metadata:"Metadata",nodeCount:"Node Count",nodesUnit:"nodes",loading:"Loading...",noRuns:"No run records (run records are generated in the workspace after terminal execution)"},aY={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},lY={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},cY={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},uY={node:"Node",text:"Text",file:"File",bool:"Boolean"},dY={title:"Node Execution Context",resizeHandle:"Drag to resize node context width",apiConnectError:"Cannot connect to API (please open the page with agentflow ui, or configure /api proxy for Vite dev)",invalidJson:"Response is not valid JSON",requestTimeout:"Request timed out, please retry or check agentflow ui",executingNoArtifacts:"Executing, artifacts not yet written to workspace…",noData:"No data (this run has not reached this node or produced artifacts)",latest:"Latest",detectedContentType:"Detected content type",roundNoContent:"No content in this round",empty:"(empty)",imageTruncated:"Image truncated (exceeds size limit)",statusSuccess:"Success",statusFailed:"Failed",statusRunning:"Running",statusCacheMiss:"Cache miss",statusPending:"Pending"},fY={title:"Keyboard Shortcuts",general:"General",saveDesc:"Save; when node properties sidebar is open, submit node first then save flow",shortcutsLabel:"Keyboard Shortcuts",jumpToNode:"Jump to node by ID",openNodePalette:"Open node palette",canvas:"Canvas",selectTool:"Select Tool",panTool:"Pan Tool",holdSpacePan:"Hold Space to temporarily pan",selectAll:"Select all nodes",undo:"Undo canvas change",redo:"Redo canvas change"},pY={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},hY={title:"Start Building Your Flow",text:"Describe your workflow in the AI input box below, or drag nodes from the left panel to the canvas",composerHint:"Build AgentFlow with AI Composer",composerSub:"Drag nodes from the left panel, or describe your workflow in the <strong>input box below</strong>.<br/>Press <kbd>?</kbd> to view shortcuts."},mY={mainNav:"Main Navigation"},gY={flowWarningAriaLabel:"Flow validation warnings",reloadFromServer:"Reload flow from server and refresh validation",reloadFromServerShort:"Reload from server",closeBanner:"Close validation warning banner",nodePrefix:"Node",focusNodeAriaLabel:"Select and focus node {{nodeId}} on canvas",slotWarningCount:"Slot validation: {{count}} warnings (hidden)",show:"Show",shortcutHint:"Press ? to view keyboard shortcuts",shortcutHintLabel:"shortcuts",inputSlotNoEdge:' input slot "{{slotName}}" ({{handle}}) has no edge connection',outputSlotNoEdge:' output slot "{{slotName}}" ({{handle}}) has no edge connection'},yY={title:"AI Assistant",placeholder:"Ask AI to help with this node...",thinking:"Thinking",reply:"Reply",result:"Result",error:"Error",waiting:"Waiting for response...",yourQuestion:"Your question",send:"Send",expand:"Expand conversation",collapse:"Collapse",connecting:"Connecting…",requestFailed:"Request failed",cannotReadStream:"Cannot read response stream",connectTimeout:"Connection timeout (120s), please confirm UI service is running and retry. [CONNECT_TIMEOUT]",aborted:"Aborted",executing:"Executing…",ready:"Ready",done:"Done",inputPlaceholder:"Type your question (⌘/Ctrl+Enter to send)",inputAriaLabel:"Question input",mentionAriaLabel:"Mention: instances and node types",modelLabel:"Model",modelAriaLabel:"Conversation model",modelDefault:"Default",modelNotInList:"(not in current list)",stopGeneration:"Stop generation",conversationOutput:"Conversation & Output",collapseAriaLabel:"Collapse",closeSidebar:"Close sidebar",endConversation:"End conversation (will stop generation)",closeConversation:"Close conversation",newConversation:"New conversation",switchConversation:"Switch conversation",selectedNodesAriaLabel:"Selected nodes list",selectedNodesEmpty:"Select nodes on canvas, or use @ in the input to pick Instances or Node types",removeFromInput:"Remove @{{id}} from input",deselectNode:"Deselect {{id}}",taskPlan:`📋 Task Plan ({{count}} steps):
|
|
156
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
157
|
-
Current: {{current}}`,phaseComplete:"{{phaseName}} completed. Next phase: {{nextPhase}}",nextPhase:"Next phase",continuePhase:"Continue {{label}}",skipRemainingPhases:"Please complete all remaining steps at once (skip phased confirmation)",phaseProgress:"Phase progress",phaseReviewLabel:"Phase options",phaseReviewHint:'This phase is complete. Review the canvas, then continue to "{{nextPhase}}".',phaseReviewContinue:"Continue: {{label}}",phaseReviewSkip:"Skip — finish remaining in one pass",stepsAriaLabel:"Task steps progress",phasesAriaLabel:"Generation phases progress",phaseNumber:"Phase {{index}}",stepRoleLabel:"Role: {{role}}",stepInstanceLabel:"Instance: {{instanceId}}",pageRefreshReset:"Reset after page refresh",conversationLabel:"Conversation {{n}}"},xY={currentPipeline:"Current Pipeline",backToEdit:"Back to edit",backToProjects:"Back to projects",executionLog:"Execution log",history:"History",pipelineSettings:"Pipeline settings",shortcutsLabel:"Shortcuts",shortcutsTitle:"Shortcuts (?)",deletePipeline:"Delete pipeline",resumeTitle:"Resume in same run directory (uuid={{uuid}})",resumeTitleNoUuid:"No apply-start received, will start a new run",rerunTitle:"Start a new run from scratch",runOptions:"Run options",runWithParams:"Run with params",runWithPreset:"Run with preset",editRun:"Edit run parameters",startRun:"Start run",stopRun:"Stop background run"},wY={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},bY={connectingApi:"Connecting to /api/flow/run…",connectingApiResume:"Connecting to /api/flow/run (resuming run uuid={{uuid}})…",connectedReceiving:"Connected to execution stream, receiving NDJSON output…",noBody:"Response has no body (cannot stream), please check browser and agentflow ui version",nodeStart:"▶ Starting: {{instanceId}}",nodeStartWithLabel:"▶ Starting: {{instanceId}} ({{label}})",nodeDone:"✓ Done: {{instanceId}}",nodeDoneWithElapsed:"✓ Done: {{instanceId}} ({{elapsed}})",nodeFailed:"✗ Failed: {{instanceId}}",pipelineStart:"Pipeline started (uuid={{uuid}})",pipelineDone:"Pipeline completed",pipelineDoneWithElapsed:"Pipeline completed ({{elapsed}})",pipelinePaused:"Pipeline paused: waiting for user input ({{nodes}})",unknownError:"Unknown error",executionEnd:"Execution ended (exit code: {{exitCode}})",executionStopped:"Execution paused",pauseRun:"Pause run (can resume later)",pauseConfirm:"Pause the current run? You can resume from the interrupted node later.",pauseTitle:"Pause run",pauseConfirmOk:"Pause",backPromptTitle:"Back to projects",backPromptMessage:"Pipeline still running. Keep it in the background and exit, or stop it and return to edit mode?",backBackground:"Run in background & exit",backStopEdit:"Stop & enter edit",resizeConsole:"Drag to resize execution log height",closeLog:"Close log",userCheckContent:"Waiting for user to confirm content for node {{instanceId}}",userAskPrompt:"Waiting for user to choose branch for node {{instanceId}}"},vY={close:"Close",loading:"Loading…",placeholder:"File content",largeFileWarning:"Large file, editor performance may be affected",reset:"Reset",aiEdit:"AI Edit",aiRunning:"AI processing…",save:"Save",saving:"Saving…",saved:"Saved"},kY={title:"Pipeline Settings",subtitle:"Manage basic information, storage, node marketplace, scheduled runs, and metadata.",sectionNav:"Settings sections",basicInfo:"Basic Info",storageAndPath:"Storage & Path",nodeMarketplace:"Node Marketplace",overview:"Pipeline Overview",owner:"Owner",source:"Source",marketplaceNodes:"Marketplace nodes",marketNodesUnit:"market nodes",marketplaceHint:"Local marketplace nodes can be added to this pipeline; installed nodes can then be placed on the canvas.",marketplaceEmpty:"No local marketplace nodes are installed in this workspace yet. Publish one from the node properties panel.",addNodeFromMarket:"Back to canvas",quickActions:"Quick Actions",saveChanges:"Save changes",savingChanges:"Saving…",installNode:"Add to pipeline",installingNode:"Adding…",addInstalledNode:"Add to canvas",previewNode:"Preview",nodePreviewTitle:"Node preview",nodeStylePreview:"Node style preview",closePreview:"Close preview",nodeFunction:"Node purpose",nodePackageInfo:"Package info",definitionId:"Definition ID",version:"Version",packagePath:"Package path",packagedFiles:"Packaged files",marketplaceNoDescription:"No node purpose has been provided.",noInputs:"No inputs",noOutputs:"No outputs",backToCanvas:"Back to canvas",help:"Help",helpText:"Publish nodes from the node properties panel; installed collections sync into the local node marketplace.",archived:"Archived",archivedNote:"This pipeline is in the archive directory (_archived) and cannot be moved between user directory and workspace.",builtinNote:"Built-in templates are read-only; first save will write to workspace .workspace/agentflow/pipelines (pipelines), .workspace/agentflow/nodes (custom nodes), etc.",moveBusy:"Moving…",moveToWorkspace:"Move to workspace",moveToUserDir:"Move to user directory",globalSettings:"Global settings",currentPipeline:"Current pipeline:",builtin:"Built-in",rename:"Rename",renameBusy:"Renaming…",renameSuccess:"Renamed",copyPath:"Copy path",pathCopied:"Copied"},SY={title:"Scheduled Run",enabled:"Enable scheduled trigger",cron:"Cron expression",timezone:"Timezone",preset:"Run preset",defaultPreset:"Default inputs",overlapSkip:"Overlap policy: skip this trigger while the pipeline is running",nextRun:"Next estimated trigger: {{time}}",noNextRun:"No next trigger is configured",runtime:"Scheduler state",running:"Running",waiting:"Waiting",disabled:"Disabled",lastTriggeredAt:"Last triggered",lastSkippedAt:"Last skipped",lastRun:"Last run",lastExit:"Last exit code",lastFinishedAt:"Last finished",readonlyNote:"Built-in or archived pipelines cannot save schedule settings.",save:"Save schedule",saving:"Saving…",saved:"Schedule saved"},NY={title:"Execution History",summary:"Execution results summary",successCount:"{{count}} succeeded",failedCount:"{{count}} failed",stoppedCount:"{{count}} stopped",interruptedCount:"{{count}} interrupted",runningCount:"{{count}} running",success:"Success",failed:"Failed",stopped:"Stopped",interrupted:"Interrupted",running:"Running",unknown:"Unknown",runLabel:"Run #{{id}}",enterRunView:"Enter run view with canvas and log"},jY={invalidInstanceId:"Invalid Instance ID: only letters, numbers, underscores, and hyphens allowed, must not start with a number.",duplicateInstanceId:"This Instance ID already exists, please choose another.",loadFlowFailed:"Failed to load flow",loadNodesFailed:"Failed to load node library"},CY={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},EY={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},_Y={title:"User Confirmation ({{instanceId}})",edit:"Edit",save:"Save",cancel:"Cancel",aiEditPlaceholder:"Enter AI edit instruction, e.g., remove item 2, merge first two items…",aiEditBtn:"AI Edit",aiEditStarted:"AI is modifying content…",aiEditDone:"AI modification complete",aiEditFailed:"AI modification failed",contentSaved:"Content saved",saveFailed:"Save failed",close:"Close",continue:"Continue Execution",hint:"Edit or use AI to modify, then save. Click 'Continue Execution' to resume the flow"},PY={title:"User Choice ({{instanceId}})",hint:"Pick an option below to continue the flow",submitting:"Submitting…",submitFailed:"Submit failed",close:"Close",noOptions:"No options configured on this node. Add items to the output slots in the editor first."},AY={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},IY={save:"Save",cancel:"Cancel"},TY={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},RY={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},LY={preset:"Preset",default:"Default",newPreset:"New preset",deletePreset:"Delete preset",presetNamePlaceholder:"Preset name",inputParams:"Input Parameters",noProvideNodes:"No provide nodes in this flow",filePathPlaceholder:"File path…",stringValuePlaceholder:"Value…",presetSaved:"Preset saved",presetDeleted:"Preset Deleted",savePreset:"Save current preset",expandInput:"Edit content"},OY={title:Jq,nodes:Qq,edges:Zq,properties:eY,node:tY,nodeProps:nY,actions:rY,panel:sY,palette:iY,pipeline:oY,status:aY,roles:lY,phases:cY,types:uY,runContext:dY,shortcuts:fY,jumpPalette:pY,emptyCanvas:hY,sidebar:mY,validation:gY,composer:yY,topbar:xY,palette2:wY,run:bY,fileEdit:vY,settings:kY,schedule:SY,history:NY,nodePropsError:jY,placeholder:CY,time:EY,userCheck:_Y,userAsk:PY,toolPrint:AY,provideEdit:IY,runParams:TY,runPreset:RY,runConfig:LY},MY="Settings",$Y={engine:"Engine Settings",preferences:"Global Preferences"},DY={title:"Workspace",currentPath:"Current Workspace Root",placeholder:"Loading...",copyPath:"Copy path",description:"Pipelines and node lists are resolved relative to this directory (passed when starting the UI)."},FY={title:"Cursor CLI",status:{cached:"Cached",notCached:"Not cached"},modelPreviewLabel:"Cursor model id list",modelList:{cached:"Model list cached",empty:"No model list",count:"{{count}} items",fetchedAt:"Updated {{time}}",never:"Never fetched",refresh:"Refresh List",fetching:"Fetching..."}},zY={modelPreviewLabel:"OpenCode model id list",title:"OpenCode CLI",status:{ready:"Ready",notFound:"Not found"},provider:"Plan / Provider ID",providerPlaceholder:"e.g., bailian-coding-plan",saving:"Saving and updating list...",description:"Corresponds to CLI opencode models <provider> parameter; written to user directory config and triggers model-lists.json refresh after typing stops."},BY={title:"Claude Code CLI",status:{ready:"Ready",notFound:"Not found"},modelPreviewLabel:"Claude Code model id list",description:"Built-in model list (Claude Code CLI has no models subcommand); refresh probes the claude binary in PATH. Run 'claude /login' first."},HY={title:"Environment Variables",note:"Private to the current signed-in user; overrides service-level env at runtime",noteAdmin:"Configure personal or global env; personal values override global values",saving:"Saving...",key:"Key",value:"Value",scope:"Scope",personal:"Personal",global:"Global",add:"Add",delete:"Delete {{key}}",invalidKey:"Env key must start with a letter or underscore, and only contain letters, numbers, and underscores.",newKey:"New env key",newValue:"Value (be careful with secrets)"},VY={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},WY={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},UY={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},KY={title:"Onboarding Tour",description:"Restart the product tour to learn about AgentFlow's core features.",reset:"Reset Tour",resetSuccess:"Reset complete. Tour will start automatically on next visit."},qY={title:MY,crumb:$Y,workspace:DY,cursor:FY,opencode:zY,claudeCode:BY,env:HY,system:VY,shortcuts:WY,language:UY,onboarding:KY},YY={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},GY={input:"Ask AI to help edit this node...",waiting:"Waiting for response...",selectedEmpty:"Select a node on the canvas, or use @ in the input to select instances or node types",textarea:"Describe your workflow or ask AI to help (⌘/Ctrl+Enter to send)"},XY={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},JY={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},QY={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},ZY={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},eG={aiLabels:YY,placeholders:GY,actions:XY,labels:JY,tooltips:QY,rightPanel:ZY},tG="Projects",nG="All",rG="Archived",sG="Nodes",iG="My Nodes",oG="My Flows",aG="Skills",lG="Active Projects",cG="Archived Pipelines",uG="Global Nodes",dG="Manage node versions published to the current workspace marketplace, {{count}} total.",fG="Manage flow snippets published to the current workspace marketplace, {{count}} total.",pG="Global Skills",hG="Create New Project",mG="New Pipeline",gG="SEARCH PIPELINES...",yG="SEARCH NODES...",xG="SEARCH FLOW SNIPPETS...",wG="SEARCH SKILLS...",bG="Refresh Resources",vG="Loading pipelines...",kG="Loading global resources...",SG="Filter result: {{count}} items (matching title, description, path and tags)",NG="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",jG="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",CG="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",EG="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",_G="Executable building blocks for pipeline runtime",PG="Nodes define what can be placed on the canvas, which inputs and outputs exist, and whether runtime behavior is agent, control, provide, or marketplace logic.",AG="Published local node packages",IG="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",TG="Published flow snippets",RG="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",LG="Operating guides for Composer and agents",OG="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",MG="No archived projects.",$G="No active pipelines; archived items are in the Archived tab.",DG="No global nodes available.",FG="No marketplace nodes have been published.",zG="No flow snippets have been published. Select multiple canvas nodes and publish them first.",BG="No skills available.",HG="No description.",VG='No node matches "{{query}}".',WG='No flow snippet matches "{{query}}".',UG='No skill matches "{{query}}".',KG="{{inputs}} in / {{outputs}} out",qG="Flow Snippet",YG="{{nodes}} nodes / {{edges}} edges",GG="Skill",XG="Node detail",JG="Flow snippet detail",QG="Skill detail",ZG="Type",eX="Source",tX="Package",nX="Version",rX="Path",sX="Editable",iX="Read only",oX="Editable",aX="Schema",lX="Inputs",cX="Outputs",uX="Runtime",dX="Node Body",fX="Files",pX="Usage",hX="No runtime manifest.",mX="No node body or README.",gX="No previewable files.",yX="Select a file to preview.",xX="Binary file preview is not supported.",wX="Large file; showing the first 256KB only.",bX="No pipelines using this node were found.",vX="Node Management",kX="Delete Node Version",SX="Deleting...",NX="AgentFlow checks all flow references before deleting; installed or used versions are kept.",jX="Delete {{id}}@{{version}}? This cannot be undone.",CX="Deleted {{id}}@{{version}}.",EX="{{count}} flow(s) still use it.",_X="Flow Snippet Management",PX="Delete Flow Snippet",AX="Deleting...",IX="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",TX="Delete {{id}}@{{version}}? This cannot be undone.",RX="Deleted {{id}}@{{version}}.",LX="No slots",OX="Purpose",MX="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",$X="A flow snippet is a reusable part of a fixed workflow. Loading it copies its nodes, edges, and layout into the current canvas without replacing existing content.",DX="Scale",FX="Flow Preview",zX="Edges",BX="Snippet JSON",HX="{{count}} more edge(s)",VX="No previewable nodes.",WX="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",UX="SKILL.md Preview",KX="No preview content available.",qX="Select a resource to inspect details.",YX="Failed to load pipeline list.",GX="No pipelines in current workspace.",XX="Run {{code1}} in the repository root and ensure the workspace contains {{code2}} or pipelines in the user directory; or click New Pipeline to create one.",JX='No pipelines found matching "{{query}}". Try different keywords or clear the search.',QX="Recent Activity",ZX="No recent activity",eJ="No recent activity matching the keyword",tJ="Recent Run",nJ="Recent Open",rJ={builtin:"Built-in",workspace:"Workspace",user:"User"},sJ={flow:"Flow",global:"Global",marketplace:"Marketplace"},iJ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},oJ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},aJ="Open to edit this pipeline in the node canvas.",lJ={eyebrow:"AgentFlow Hub",title:"Browse community flows",desc:"Discover and install ready-made pipelines shared by the community.",cta:"Explore Hub",cliHint:"Or install via CLI: agentflow download <slug>"},cJ={title:"Create New Pipeline",lead:"Enter a pipeline name (English identifier); description is optional and will be saved in flow's ui.description.",nameLabel:"Name (required)",namePlaceholder:"e.g., my_feature_flow",nameHint:"Must start with a letter, only letters, numbers, underscores _ and hyphens - allowed",descLabel:"Description (optional)",descPlaceholder:"Briefly describe the purpose of this pipeline...",locationLabel:"Save Location",userDir:"User Directory (~/agentflow/pipelines)",workspaceDir:"Current Workspace (.workspace/agentflow/pipelines)",createFailed:"Creation failed",creating:"Creating...",createAndOpen:"Create and Open",cancel:"Cancel",close:"Close"},uJ={title:"Import Pipeline",lead:'File "{{filename}}" selected. Please confirm the pipeline name and save location; ZIP will preserve scripts and other files in the directory.',nameLabel:"Name (required)",namePlaceholder:"e.g., my_shared_flow",nameHint:"Must start with a letter, only letters, numbers, underscores _ and hyphens - allowed",locationLabel:"Save Location",userDir:"User Directory (~/agentflow/pipelines)",workspaceDir:"Current Workspace (.workspace/agentflow/pipelines)",changeFile:"Change File...",importFailed:"Import failed",importing:"Importing...",importAndOpen:"Import and Open",cancel:"Cancel",close:"Close"},dJ={title:"Delete Pipeline",lead:'This will permanently delete the pipeline directory from disk (including flow.yaml, scripts, etc.) and cannot be undone. Please enter the pipeline ID "{{flowId}}" below to confirm.',confirmLabel:"Confirm Pipeline Name",deleteFailed:"Delete failed",deleteTimeout:"Delete request timed out, please retry (check UI service logs in terminal)",delete:"Delete",deleting:"Deleting...",confirmDelete:"Confirm Delete",cancel:"Cancel",close:"Close"},fJ={title:"Archive Pipeline",lead:'After archiving, the pipeline will be moved to the "Archived" list and can still be opened and edited from there. Please enter the pipeline ID "{{flowId}}" below to confirm.',confirmLabel:"Confirm Pipeline Name",archiveFailed:"Archive failed",archive:"Archive",archiving:"Archiving...",confirmArchive:"Confirm Archive",cancel:"Cancel",close:"Close"},pJ={title:tG,all:nG,archived:rG,nodes:sG,myNodes:iG,myFlows:oG,skills:aG,activeProjects:lG,archivedPipelines:cG,globalNodes:uG,myNodesHint:dG,myFlowsHint:fG,globalSkills:pG,createNew:hG,newPipeline:mG,searchPipelines:gG,searchNodes:yG,searchFlows:xG,searchSkills:wG,refreshResources:bG,loadingPipelines:vG,loadingResources:kG,filterResult:SG,archivedHint:NG,activeHint:jG,nodesHint:CG,skillsHint:EG,nodesPurposeTitle:_G,nodesPurposeDesc:PG,myNodesPurposeTitle:AG,myNodesPurposeDesc:IG,myFlowsPurposeTitle:TG,myFlowsPurposeDesc:RG,skillsPurposeTitle:LG,skillsPurposeDesc:OG,noArchived:MG,noActive:$G,noNodes:DG,noMyNodes:FG,noMyFlows:zG,noSkills:BG,noDescription:HG,noNodeMatch:VG,noFlowSnippetMatch:WG,noSkillMatch:UG,nodeSlots:KG,flowSnippet:qG,flowSnippetNodes:YG,skill:GG,nodeDetail:XG,flowDetail:JG,skillDetail:QG,detailType:ZG,detailSource:eX,detailPackage:tX,detailVersion:nX,detailPath:rX,detailEditable:sX,readOnly:iX,editable:oX,nodeSchema:aX,nodeInputs:lX,nodeOutputs:cX,nodeRuntime:uX,nodeBody:dX,nodeFiles:fX,nodeUsage:pX,noRuntimeManifest:hX,noNodeBody:mX,noNodeFiles:gX,selectNodeFile:yX,binaryFile:xX,fileTruncated:wX,noNodeUsage:bX,myNodeManagement:vX,deleteMyNode:kX,deletingMyNode:SX,deleteMyNodeHint:NX,deleteMyNodeConfirm:jX,deleteMyNodeSuccess:CX,deleteMyNodeUsedBy:EX,myFlowManagement:_X,deleteMyFlow:PX,deletingMyFlow:AX,deleteMyFlowHint:IX,deleteMyFlowConfirm:TX,deleteMyFlowSuccess:RX,noSlots:LX,resourceMeaning:OX,nodesMeaning:MX,myFlowsMeaning:$X,flowSnippetScale:DX,flowSnippetPreview:FX,flowSnippetEdges:zX,flowSnippetJson:BX,flowSnippetMoreEdges:HX,noFlowSnippetPreview:VX,skillsMeaning:WX,skillPreview:UX,skillPreviewEmpty:KX,selectResource:qX,loadFailed:YX,noPipelines:GX,emptyHint:XX,noMatch:JX,recentActivity:QX,noRecentActivity:ZX,noMatchRecent:eJ,recentRun:tJ,recentOpen:nJ,sourceBadge:rJ,resourceSource:sJ,resourceFilter:iJ,nodeDetailTabs:oJ,defaultCardDesc:aJ,hubCard:lJ,newPipelineModal:cJ,importModal:uJ,deleteModal:dJ,archiveModal:fJ},hJ="Back",mJ="Next",gJ="Skip",yJ="Done",xJ="Start Creating",wJ={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
158
|
-
|
|
159
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
160
|
-
|
|
161
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},bJ={intro:`Now you're in the flow editor.
|
|
162
|
-
|
|
163
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
164
|
-
|
|
165
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
166
|
-
|
|
167
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
168
|
-
|
|
169
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},vJ={guideTitle:"First-time Creation Guide",guideDesc:"After entering the name and description, AI will automatically generate the flow graph. You can freely adjust nodes and connections in the editor.",nameHintGuide:"e.g., MyFirstFlow (starts with a letter, supports numbers and underscores)",descPlaceholderGuide:"e.g., Implement user login functionality with registration, verification, and authorization",descHintGuide:"More detailed description leads to more accurate AI-generated flow",createGuide:"Create & Start Editing",typeNode:"Node reference type",typeStr:"String type",typeFile:"File path type",typeBool:"Boolean type"},kJ={back:hJ,next:mJ,skip:gJ,done:yJ,startCreate:xJ,projects:wJ,flow:bJ,newPipeline:vJ},SJ={name:"AgentFlow",tagline:"AI 工作流编排"},NJ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},jJ={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},CJ={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},EJ={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},_J={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},PJ={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},AJ={app:SJ,nav:NJ,common:jJ,status:CJ,nodeTypes:EJ,engine:_J,links:PJ},IJ="流程编辑器",TJ="节点",RJ="连线",LJ="属性",OJ={label:"节点标签",type:"节点类型",model:"模型",body:"内容",inputs:"输入",outputs:"输出",addInput:"添加输入",addOutput:"添加输出",remove:"删除节点",duplicate:"复制节点",nodeType:"节点类型",displayName:"显示名称",displayNameHint:"(字母、数字、下划线、短横线,勿以数字开头)",role:"角色",modelHint:"来自 ~/agentflow/model-lists.json;UI 服务启动时会后台执行 agentflow update-model-lists",defaultModel:"默认",userPrompt:"用户提示(USER PROMPT / body)",systemDescription:"系统说明(只读,来自节点定义)",directCommand:"直接执行命令",scriptHint:"(tool_nodejs:有 script 时跳过 AI,由流水线执行)",diskRunning:"磁盘记录为执行中",deleteNode:"删除节点",inputTooltip:"输入 {{name}} | 类型: {{type}}",outputTooltip:"输出 {{name}} | 类型: {{type}}",defaultSuffix:" | 默认: {{value}}",fallbackLabel:"节点",expandProvide:"编辑内容"},MJ={title:"节点属性",noInputPins:"当前无输入引脚",noOutputPins:"当前无输出引脚",type:"类型",name:"名称",defaultValue:"默认值 / value",required:"必填",showOnNode:"卡片",requiredHint:"标记为必填,用于提示用户该槽位必须提供值或连线",showOnNodeHint:"是否在画布节点卡片旁展示这个引脚名称;关闭后仍可连线",pinRequiredAriaLabel:"{{label}} {{index}} 是否必填",pinShowOnNodeAriaLabel:"{{label}} {{index}} 是否在节点卡片展示",conversationOutput:"对话与输出",addPin:"添加引脚",addPinAriaLabel:"添加{{label}}",handleHint:"与画布上 Handle 序号一致({{prefix}}-0、{{prefix}}-1…)。增删或调整顺序后,原有连线可能失效,保存后请留意校验提示。",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} 类型",pinNameAriaLabel:"{{label}} {{index}} 名称",pinDefaultAriaLabel:"{{label}} {{index}} 默认值",deletePinAriaLabel:"删除 {{label}} {{index}}",deletePin:"删除此引脚",instanceId:"节点 ID",yamlValueNotInList:"(YAML 中的值,不在当前列表)",inputPins:"输入引脚(INPUT)",outputPins:"输出引脚(OUTPUT)",expand:"展开",collapse:"收起",expandEditScript:"展开编辑 script",expandEdit:"展开编辑",editScript:"编辑 script",editUserPrompt:"编辑用户提示",scriptPlaceholder:"instances.*.script,完整 shell 命令;支持 ${workspaceRoot}、${pipelineWorkspace}、${flowDir}、${runDir} 与各槽位名(勿对占位符再包双引号)",scriptPlaceholderExpand:"instances.*.script,完整 shell 命令;勿对 ${workspaceRoot}、${pipelineWorkspace}、${flowDir} 等占位符再包双引号",bodyPlaceholder:"instances.*.body,支持多行与 ${变量};输入 ${ 选择槽位",bodyPlaceholderExpand:"instances.*.body,支持多行与 ${变量}",noDescription:"(当前节点定义无 description)",modelAriaLabel:"模型",placeholderSlots:"占位符:输入输出槽位",publishToMarketplace:"发布节点",publishToMarketplaceHint:"将当前节点发布到 Workspace 本地节点市场",publishing:"发布中…",publishRunning:"正在发布到本地节点市场…",publishSuccess:"节点已发布到本地节点市场",publishSuccessWithId:"节点已发布:{{id}}"},$J={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},DJ={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},FJ={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},zJ={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},BJ={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},HJ={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},VJ={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},WJ={node:"节点",text:"文本",file:"文件",bool:"布尔"},UJ={title:"节点执行上下文",resizeHandle:"拖动调整节点上下文宽度",apiConnectError:"无法连接 API(请使用 agentflow ui 打开页面,或为 Vite 开发配置 /api 代理)",invalidJson:"响应不是有效 JSON",requestTimeout:"请求超时,请稍后重试或检查 agentflow ui",executingNoArtifacts:"执行中,产物尚未写入工作区…",noData:"暂无数据(本 run 尚未执行到该节点或未产生产物)",latest:"最新",detectedContentType:"检测到的内容类型",roundNoContent:"该轮次暂无内容",empty:"(空)",imageTruncated:"图像已截断(超过大小上限)",statusSuccess:"成功",statusFailed:"失败",statusRunning:"运行中",statusCacheMiss:"缓存失效",statusPending:"等待"},KJ={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},qJ={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},YJ={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},GJ={mainNav:"主导航"},XJ={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},JJ={title:"AI 助手",placeholder:"让 AI 协助编辑此节点…",thinking:"思考",reply:"回复",result:"结果",error:"错误",waiting:"等待响应…",yourQuestion:"您的问题",send:"发送",expand:"展开对话",collapse:"收起",connecting:"连接中…",requestFailed:"请求失败",cannotReadStream:"无法读取响应流",connectTimeout:"连接超时(120s),请确认 UI 服务正在运行并重试。[CONNECT_TIMEOUT]",aborted:"已中止",executing:"执行中…",ready:"就绪",done:"完成",inputPlaceholder:"在此输入问题(⌘/Ctrl+Enter 发送)",inputAriaLabel:"问题输入",mentionAriaLabel:"提及:实例与节点类型",modelLabel:"模型",modelAriaLabel:"对话模型",modelDefault:"默认",modelNotInList:"(不在当前列表)",stopGeneration:"停止生成",conversationOutput:"对话与输出",collapseAriaLabel:"收起",closeSidebar:"关闭侧栏",endConversation:"结束对话(将停止生成)",closeConversation:"关闭对话",newConversation:"新建对话",switchConversation:"切换对话",selectedNodesAriaLabel:"已选节点列表",selectedNodesEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",removeFromInput:"从输入中移除 @{{id}}",deselectNode:"取消选中 {{id}}",taskPlan:`📋 任务规划({{count}} 步):
|
|
170
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
171
|
-
当前:{{current}}`,phaseComplete:"{{phaseName}}已完成。下一阶段:{{nextPhase}}",nextPhase:"下一阶段",continuePhase:"继续{{label}}",skipRemainingPhases:"请一次性完成剩余所有步骤(跳过分阶段确认)",phaseProgress:"分阶段进度",phaseReviewLabel:"分阶段选项",phaseReviewHint:"当前阶段完成,请在画布上检查结果,确认无误后进入「{{nextPhase}}」",phaseReviewContinue:"继续:{{label}}",phaseReviewSkip:"跳过,一次性完成剩余",stepsAriaLabel:"任务步骤进度",phasesAriaLabel:"生成阶段进度",phaseNumber:"第 {{index}} 阶段",stepRoleLabel:"角色:{{role}}",stepInstanceLabel:"实例:{{instanceId}}",pageRefreshReset:"页面刷新后重置",conversationLabel:"对话 {{n}}"},QJ={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},ZJ={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},eQ={connectingApi:"正在连接 /api/flow/run…",connectingApiResume:"正在连接 /api/flow/run(恢复 run uuid={{uuid}})…",connectedReceiving:"已连接执行流,正在接收 NDJSON 输出…",noBody:"响应无 body(无法流式读取),请检查浏览器与 agentflow ui 版本",nodeStart:"▶ 开始执行: {{instanceId}}",nodeStartWithLabel:"▶ 开始执行: {{instanceId}} ({{label}})",nodeDone:"✓ 完成: {{instanceId}}",nodeDoneWithElapsed:"✓ 完成: {{instanceId}} ({{elapsed}})",nodeFailed:"✗ 失败: {{instanceId}}",pipelineStart:"流水线开始执行 (uuid={{uuid}})",pipelineDone:"流水线执行完成",pipelineDoneWithElapsed:"流水线执行完成 ({{elapsed}})",pipelinePaused:"流水线暂停: 等待用户输入 ({{nodes}})",unknownError:"未知错误",executionEnd:"执行结束 (exit code: {{exitCode}})",executionStopped:"执行已暂停",pauseRun:"暂停运行(可稍后恢复)",pauseConfirm:"确认暂停当前 run?之后可从中断节点恢复。",pauseTitle:"暂停运行",pauseConfirmOk:"暂停",backPromptTitle:"返回项目列表",backPromptMessage:"流水线仍在运行,请选择处理方式:后台继续运行并退出,或停止后返回编辑。",backBackground:"后台运行并退出",backStopEdit:"停止并进入编辑",resizeConsole:"拖动调整执行日志高度",closeLog:"关闭日志",userCheckContent:"等待用户确认节点 {{instanceId}} 的内容",userAskPrompt:"等待用户选择节点 {{instanceId}} 的分支"},tQ={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},nQ={title:"流水线设置",subtitle:"管理流水线的基础信息、存储位置、节点市场、定时任务与元数据。",sectionNav:"设置分区",basicInfo:"基础信息",storageAndPath:"存储与路径",nodeMarketplace:"节点市场配置",overview:"流水线概览",owner:"所有者",source:"来源",marketplaceNodes:"市场节点",marketNodesUnit:"个市场节点",marketplaceHint:"本地市场中的节点可加入当前流水线;已加入后可直接添加到画布。",marketplaceEmpty:"当前工作区还没有安装本地市场节点。可在节点属性面板发布节点。",addNodeFromMarket:"返回画布添加节点",quickActions:"快捷操作",saveChanges:"保存更改",savingChanges:"保存中…",installNode:"加入流水线",installingNode:"加入中…",addInstalledNode:"添加到画布",previewNode:"预览",nodePreviewTitle:"节点预览",nodeStylePreview:"节点样式预览",closePreview:"关闭预览",nodeFunction:"节点用途",nodePackageInfo:"包信息",definitionId:"Definition ID",version:"版本",packagePath:"包路径",packagedFiles:"打包文件",marketplaceNoDescription:"暂无节点用途说明。",noInputs:"无输入",noOutputs:"无输出",backToCanvas:"返回画布",help:"帮助中心",helpText:"节点发布入口在节点属性面板;合集安装后会同步进入本地节点市场。",archived:"已归档",archivedNote:"此流水线位于归档目录(_archived),无法在用户目录与工作区之间移动。",builtinNote:"内置模板只读;首次保存将写入工作区 .workspace/agentflow/pipelines(流水线)、.workspace/agentflow/nodes(自定义节点)等;旧 .cursor/agentflow/ 下文件仍可读。",moveBusy:"移动中…",moveToWorkspace:"移动到工作区",moveToUserDir:"移动到用户目录",globalSettings:"全局设置",currentPipeline:"当前流水线:",builtin:"内置",rename:"重命名",renameBusy:"重命名中…",renameSuccess:"已重命名",copyPath:"复制路径",pathCopied:"已复制"},rQ={title:"定时执行",enabled:"启用定时触发",cron:"Cron 表达式",timezone:"时区",preset:"运行参数预设",defaultPreset:"默认参数",overlapSkip:"重叠策略:运行中则跳过本次触发",nextRun:"下一次预计触发:{{time}}",noNextRun:"未设置下一次触发时间",runtime:"调度状态",running:"运行中",waiting:"等待触发",disabled:"未启用",lastTriggeredAt:"最近触发",lastSkippedAt:"最近跳过",lastRun:"最近 Run",lastExit:"最近退出码",lastFinishedAt:"最近结束",readonlyNote:"内置或归档流水线不可保存定时配置。",save:"保存定时配置",saving:"保存中…",saved:"定时配置已保存"},sQ={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},iQ={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},oQ={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},aQ={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},lQ={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},cQ={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},uQ={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},dQ={save:"保存",cancel:"取消"},fQ={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},pQ={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},hQ={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},mQ={title:IJ,nodes:TJ,edges:RJ,properties:LJ,node:OJ,nodeProps:MJ,actions:$J,panel:DJ,palette:FJ,pipeline:zJ,status:BJ,roles:HJ,phases:VJ,types:WJ,runContext:UJ,shortcuts:KJ,jumpPalette:qJ,emptyCanvas:YJ,sidebar:GJ,validation:XJ,composer:JJ,topbar:QJ,palette2:ZJ,run:eQ,fileEdit:tQ,settings:nQ,schedule:rQ,history:sQ,nodePropsError:iQ,placeholder:oQ,time:aQ,userCheck:lQ,userAsk:cQ,toolPrint:uQ,provideEdit:dQ,runParams:fQ,runPreset:pQ,runConfig:hQ},gQ="设置",yQ={engine:"引擎设置",preferences:"全局首选项"},xQ={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},wQ={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},bQ={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},vQ={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},kQ={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},SQ={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},NQ={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},jQ={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},CQ={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},EQ={title:gQ,crumb:yQ,workspace:xQ,cursor:wQ,opencode:bQ,claudeCode:vQ,env:kQ,system:SQ,shortcuts:NQ,language:jQ,onboarding:CQ},_Q={thinking:"思考",result:"结果",reply:"回复",error:"错误"},PQ={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},AQ={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},IQ={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},TQ={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},RQ={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},LQ={aiLabels:_Q,placeholders:PQ,actions:AQ,labels:IQ,tooltips:TQ,rightPanel:RQ},OQ="项目",MQ="全部",$Q="已归档",DQ="Nodes",FQ="我的 Nodes",zQ="我的流程",BQ="Skills",HQ="活跃项目",VQ="已归档流水线",WQ="全局 Nodes",UQ="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",KQ="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",qQ="全局 Skills",YQ="创建新项目",GQ="新建流水线",XQ="搜索流水线…",JQ="搜索 nodes…",QQ="搜索流程片段…",ZQ="搜索 skills…",eZ="刷新资源",tZ="加载流水线列表…",nZ="加载全局资源…",rZ="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",sZ="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",iZ="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",oZ="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",aZ="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",lZ="流程运行时的可执行积木",cZ="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",uZ="已发布的本地节点包",dZ="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",fZ="已发布的流程片段",pZ="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",hZ="Composer/Agent 的操作指南",mZ="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",gZ="暂无归档项目。",yZ="暂无未归档流水线;已归档项在 Archived 标签中查看。",xZ="暂无可用全局 nodes。",wZ="暂无已发布的 marketplace nodes。",bZ="暂无已发布的流程片段。可在画布中选中多个节点后发布。",vZ="暂无可用 skills。",kZ="暂无描述。",SZ="未找到与「{{query}}」匹配的 node。",NZ="未找到与「{{query}}」匹配的流程片段。",jZ="未找到与「{{query}}」匹配的 skill。",CZ="{{inputs}} in / {{outputs}} out",EZ="流程片段",_Z="{{nodes}} 节点 / {{edges}} 连线",PZ="Skill",AZ="Node 详情",IZ="流程片段详情",TZ="Skill 详情",RZ="类型",LZ="来源",OZ="包",MZ="版本",$Z="路径",DZ="可编辑",FZ="只读",zZ="可编辑",BZ="Schema",HZ="输入",VZ="输出",WZ="Runtime",UZ="节点内容",KZ="Files",qZ="Usage",YZ="暂无 runtime manifest。",GZ="暂无节点正文或 README。",XZ="暂无可预览文件。",JZ="请选择文件查看内容。",QZ="二进制文件暂不支持预览。",ZZ="文件较大,仅显示前 256KB。",eee="暂未发现使用此 node 的流水线。",tee="节点管理",nee="删除节点版本",ree="删除中…",see="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",iee="确定删除 {{id}}@{{version}}?此操作不可撤销。",oee="已删除 {{id}}@{{version}}。",aee="仍有 {{count}} 个 Flow 使用它。",lee="流程片段管理",cee="删除流程片段",uee="删除中…",dee="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",fee="确定删除 {{id}}@{{version}}?此操作不可撤销。",pee="已删除 {{id}}@{{version}}。",hee="无槽位",mee="作用",gee="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",yee="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",xee="规模",wee="流程预览",bee="连线",vee="片段 JSON",kee="还有 {{count}} 条连线",See="暂无可预览节点。",Nee="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",jee="SKILL.md 预览",Cee="暂无可预览内容。",Eee="请选择一个资源查看详情。",_ee="未能加载流水线列表。",Pee="当前工作区暂无流水线。",Aee="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",Iee="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",Tee="最近打开或最近运行",Ree="暂无打开或运行记录",Lee="暂无与关键词匹配的最近记录",Oee="最近运行",Mee="最近打开",$ee={builtin:"内置",workspace:"工作区",user:"用户"},Dee={flow:"Flow",global:"Global",marketplace:"Marketplace"},Fee={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},zee={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},Bee="打开以在节点画布中编辑此流水线。",Hee={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},Vee={title:"新建空流水线",lead:"请先填写流水线名称(英文标识);介绍可选,将保存在 flow 的 ui.description。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_feature_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",descLabel:"介绍(可选)",descPlaceholder:"简要说明此流水线的用途…",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",createFailed:"创建失败",creating:"创建中…",createAndOpen:"创建并打开",cancel:"取消",close:"关闭"},Wee={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},Uee={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},Kee={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},qee={title:OQ,all:MQ,archived:$Q,nodes:DQ,myNodes:FQ,myFlows:zQ,skills:BQ,activeProjects:HQ,archivedPipelines:VQ,globalNodes:WQ,myNodesHint:UQ,myFlowsHint:KQ,globalSkills:qQ,createNew:YQ,newPipeline:GQ,searchPipelines:XQ,searchNodes:JQ,searchFlows:QQ,searchSkills:ZQ,refreshResources:eZ,loadingPipelines:tZ,loadingResources:nZ,filterResult:rZ,archivedHint:sZ,activeHint:iZ,nodesHint:oZ,skillsHint:aZ,nodesPurposeTitle:lZ,nodesPurposeDesc:cZ,myNodesPurposeTitle:uZ,myNodesPurposeDesc:dZ,myFlowsPurposeTitle:fZ,myFlowsPurposeDesc:pZ,skillsPurposeTitle:hZ,skillsPurposeDesc:mZ,noArchived:gZ,noActive:yZ,noNodes:xZ,noMyNodes:wZ,noMyFlows:bZ,noSkills:vZ,noDescription:kZ,noNodeMatch:SZ,noFlowSnippetMatch:NZ,noSkillMatch:jZ,nodeSlots:CZ,flowSnippet:EZ,flowSnippetNodes:_Z,skill:PZ,nodeDetail:AZ,flowDetail:IZ,skillDetail:TZ,detailType:RZ,detailSource:LZ,detailPackage:OZ,detailVersion:MZ,detailPath:$Z,detailEditable:DZ,readOnly:FZ,editable:zZ,nodeSchema:BZ,nodeInputs:HZ,nodeOutputs:VZ,nodeRuntime:WZ,nodeBody:UZ,nodeFiles:KZ,nodeUsage:qZ,noRuntimeManifest:YZ,noNodeBody:GZ,noNodeFiles:XZ,selectNodeFile:JZ,binaryFile:QZ,fileTruncated:ZZ,noNodeUsage:eee,myNodeManagement:tee,deleteMyNode:nee,deletingMyNode:ree,deleteMyNodeHint:see,deleteMyNodeConfirm:iee,deleteMyNodeSuccess:oee,deleteMyNodeUsedBy:aee,myFlowManagement:lee,deleteMyFlow:cee,deletingMyFlow:uee,deleteMyFlowHint:dee,deleteMyFlowConfirm:fee,deleteMyFlowSuccess:pee,noSlots:hee,resourceMeaning:mee,nodesMeaning:gee,myFlowsMeaning:yee,flowSnippetScale:xee,flowSnippetPreview:wee,flowSnippetEdges:bee,flowSnippetJson:vee,flowSnippetMoreEdges:kee,noFlowSnippetPreview:See,skillsMeaning:Nee,skillPreview:jee,skillPreviewEmpty:Cee,selectResource:Eee,loadFailed:_ee,noPipelines:Pee,emptyHint:Aee,noMatch:Iee,recentActivity:Tee,noRecentActivity:Ree,noMatchRecent:Lee,recentRun:Oee,recentOpen:Mee,sourceBadge:$ee,resourceSource:Dee,resourceFilter:Fee,nodeDetailTabs:zee,defaultCardDesc:Bee,hubCard:Hee,newPipelineModal:Vee,importModal:Wee,deleteModal:Uee,archiveModal:Kee},Yee="返回",Gee="下一步",Xee="跳过",Jee="完成",Qee="开始创建",Zee={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
172
|
-
|
|
173
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
174
|
-
|
|
175
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},ete={intro:`现在进入流程编辑器。
|
|
176
|
-
|
|
177
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
178
|
-
|
|
179
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
180
|
-
|
|
181
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
182
|
-
|
|
183
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},tte={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},nte={back:Yee,next:Gee,skip:Xee,done:Jee,startCreate:Qee,projects:Zee,flow:ete,newPipeline:tte},rte={en:{common:Xq,flow:OY,settings:qY,composer:eG,project:pJ,onboarding:kJ},zh:{common:AJ,flow:mQ,settings:EQ,composer:LQ,project:qee,onboarding:nte}};_r.use(pT).use(jO).init({resources:rte,fallbackLng:"en",debug:!1,ns:["common","flow","settings","composer","project","onboarding"],defaultNS:"common",interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],lookupLocalStorage:"agentflow-lang",caches:["localStorage"]}});const ste=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function ite(e){return _r.changeLanguage(e)}const Fw="agentflow-settings-opencode-plan-v1";function Wy(e){if(!e||typeof e!="object")return{cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null};const t=e;return{cursor:Array.isArray(t.cursor)?t.cursor.map(String):[],opencode:Array.isArray(t.opencode)?t.opencode.map(String):[],claudeCode:Array.isArray(t.claudeCode)?t.claudeCode.map(String):[],cursorFetchedAt:t.cursorFetchedAt??null,opencodeFetchedAt:t.opencodeFetchedAt??null,claudeCodeFetchedAt:t.claudeCodeFetchedAt??null}}function hT(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function ote(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function il(e,t="user"){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||typeof r!="object")continue;const s=String(r.key??"").trim(),i=String(r.value??""),a=String(r.id??"").trim()||hT(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:a,key:s,value:i,scope:c})}return n}function Wj(e){return il(e).map(({key:t,value:n})=>({key:t,value:n}))}function Uj(){try{return localStorage.getItem(Fw)??""}catch{return""}}function ate(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function Kj(e,t="zh"){if(!e)return"";const n=Date.parse(e);if(Number.isNaN(n))return String(e);try{const r=t==="en"?"en-US":t==="ja"?"ja-JP":"zh-CN";return new Intl.DateTimeFormat(r,{dateStyle:"short",timeStyle:"medium"}).format(new Date(n))}catch{return String(e)}}function lte({authUser:e}){const{t,i18n:n}=hn(["common","settings"]),r=n.language||"zh",[s,i]=m.useState(""),[a,l]=m.useState(""),[c,d]=m.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[f,u]=m.useState(""),[p,h]=m.useState(!1),[g,v]=m.useState(!1),[k,y]=m.useState(""),[b,w]=m.useState([]),[N,C]=m.useState(""),[j,T]=m.useState(!1),[$,L]=m.useState(""),[F,A]=m.useState(""),[R,V]=m.useState(!1),[M,D]=m.useState(()=>new Set),[I,B]=m.useState(""),[P,O]=m.useState([]),[_,Y]=m.useState(!1),[Q,K]=m.useState(""),ie=m.useRef(null),fe=m.useRef(!1),ye=m.useRef(!1),we=m.useRef(""),ae=m.useCallback(async()=>{l("");try{const ce=await fetch("/api/ui-context");if(!ce.ok)throw new Error("HTTP "+ce.status);const ee=await ce.json();i(typeof ee.workspaceRoot=="string"?ee.workspaceRoot:"")}catch(ce){l(String(ce.message||ce)),i("")}},[]),ge=m.useCallback(async()=>{u(""),h(!0);try{const ce=await fetch("/api/model-lists");if(!ce.ok)throw new Error("HTTP "+ce.status);const ee=await ce.json();d(Wy(ee))}catch(ce){u(String(ce.message||ce))}finally{h(!1)}},[]),_e=m.useCallback(async()=>{C("");try{const ce=await fetch("/api/user-env"),ee=await ce.json().catch(()=>({}));if(!ce.ok)throw new Error(typeof ee.error=="string"?ee.error:"HTTP "+ce.status);const he=il(Array.isArray(ee.env)?ee.env:[],"user").map(Qe=>({...Qe,scope:"user"})),We=[...e!=null&&e.isAdmin?il(Array.isArray(ee.globalEnv)?ee.globalEnv:[],"global").map(Qe=>({...Qe,scope:"global"})):[],...he];we.current=JSON.stringify(We),w(We)}catch(ce){w([]),C(String(ce.message||ce))}finally{ye.current=!0}},[e==null?void 0:e.isAdmin]),Ae=m.useCallback(async()=>{if(e!=null&&e.isAdmin){Y(!0),K("");try{const ce=await fetch("/api/feedback"),ee=await ce.json().catch(()=>({}));if(!ce.ok)throw new Error(typeof ee.error=="string"?ee.error:"HTTP "+ce.status);O(Array.isArray(ee.feedback)?ee.feedback:[])}catch(ce){K(String(ce.message||ce))}finally{Y(!1)}}},[e==null?void 0:e.isAdmin]),Ce=m.useCallback(async ce=>{const ee=il(ce),he=ee.filter(We=>We.scope!=="global"),Me=ee.filter(We=>We.scope==="global");T(!0),C("");try{const We=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:Wj(he),...e!=null&&e.isAdmin?{globalEnv:Wj(Me)}:{}})}),Qe=await We.json().catch(()=>({}));if(!We.ok)throw new Error(typeof Qe.error=="string"?Qe.error:"HTTP "+We.status);const Gt=il(Array.isArray(Qe.env)?Qe.env:[],"user").map(yn=>({...yn,scope:"user"})),gn=[...e!=null&&e.isAdmin?il(Array.isArray(Qe.globalEnv)?Qe.globalEnv:[],"global").map(yn=>({...yn,scope:"global"})):[],...Gt];we.current=JSON.stringify(gn),w(gn)}catch(We){C(String(We.message||We))}finally{T(!1)}},[e==null?void 0:e.isAdmin]),Ne=m.useCallback(async()=>{u(""),h(!0);try{const ce=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:I.trim()})}),ee=await ce.json().catch(()=>({}));if(!ce.ok)throw new Error(typeof ee.error=="string"?ee.error:"HTTP "+ce.status);d(Wy(ee.modelLists))}catch(ce){u(String(ce.message||ce))}finally{h(!1)}},[I]);m.useEffect(()=>{ae(),ge(),_e(),e!=null&&e.isAdmin&&Ae(),(async()=>{try{const ce=await fetch("/api/agentflow-config");if(ce.ok){const ee=await ce.json(),he=typeof ee.opencodeProvider=="string"?ee.opencodeProvider:"";B(he),ie.current=he;try{localStorage.setItem(Fw,he)}catch{}}else{const ee=Uj();B(ee),ie.current=ee}}catch{const ce=Uj();B(ce),ie.current=ce}finally{fe.current=!0}})()},[e==null?void 0:e.isAdmin,ae,Ae,ge,_e]),m.useEffect(()=>{if(!ye.current||JSON.stringify(il(b))===we.current)return;const ee=setTimeout(()=>{Ce(b)},350);return()=>clearTimeout(ee)},[b,Ce]),m.useEffect(()=>{if(!fe.current)return;const ce=I.trim();if(ce===ie.current)return;const ee=setTimeout(()=>{(async()=>{v(!0),y("");try{const he=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:ce})}),Me=await he.json().catch(()=>({}));if(!he.ok)throw new Error(typeof Me.error=="string"?Me.error:"HTTP "+he.status);ie.current=ce;try{localStorage.setItem(Fw,ce)}catch{}Me.modelLists&&d(Wy(Me.modelLists))}catch(he){y(String(he.message||he))}finally{v(!1)}})()},450);return()=>clearTimeout(ee)},[I]);const Ye=c.cursor.length>0,Ze=c.opencode.length>0,Ge=c.claudeCode.length>0,It=m.useCallback(()=>{var ce;s&&((ce=navigator.clipboard)==null||ce.writeText(s))},[s]),qe=m.useCallback(()=>{const ce=$.trim(),ee=F;if(ce){if(!ote(ce)){C(t("settings:env.invalidKey"));return}w(he=>[...he,{id:hT(),key:ce,value:ee,scope:e!=null&&e.isAdmin&&R?"global":"user"}]),L(""),A("")}},[e==null?void 0:e.isAdmin,R,$,F,t]),ct=m.useCallback(ce=>{w(ee=>ee.filter(he=>he.id!==ce))},[]),Ht=m.useCallback((ce,ee)=>{w(he=>he.map(Me=>Me.id===ce?{...Me,...ee}:Me))},[]),Le=m.useCallback(ce=>{D(ee=>{const he=new Set(ee);return he.has(ce)?he.delete(ce):he.add(ce),he})},[]),Jt=m.useCallback(ce=>{const ee=ce.target.value;ite(ee)},[]),Qt=ce=>{const ee=Kj(ce,r);return ee?t("settings:cursor.modelList.fetchedAt",{time:ee}):t("settings:cursor.modelList.never")},Nn=ce=>Kj(ce,r)||String(ce||"");return o.jsxs("div",{className:"af-settings-page",children:[o.jsx("header",{className:"af-settings-top",children:o.jsxs("div",{className:"af-settings-crumb","aria-label":t("settings:title"),children:[o.jsx("span",{className:"af-settings-crumb-muted",children:t("settings:crumb.engine")}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:t("settings:crumb.preferences")})]})}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("header",{className:"af-settings-hero",children:[o.jsxs("h1",{className:"af-settings-h1",children:[t("common:app.name")," ",t("settings:title")]}),o.jsx("p",{className:"af-settings-lead",children:t("settings:workspace.description")}),a?o.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,f?o.jsx("p",{className:"af-err af-settings-api-hint",children:f}):null,N?o.jsx("p",{className:"af-err af-settings-api-hint",children:N}):null]}),o.jsxs("div",{className:"af-settings-layout",children:[o.jsxs("div",{className:"af-settings-bento",children:[o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--low af-set-workspace",children:[o.jsxs("div",{className:"af-set-card-inner",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("span",{className:"material-symbols-outlined af-set-icon af-set-icon--secondary",children:"folder_managed"}),o.jsx("h2",{className:"af-set-h2",children:t("settings:workspace.title")})]}),o.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:t("settings:workspace.currentPath")}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-workspace-path",className:"af-set-input af-set-input--mono",type:"text",readOnly:!0,value:s,placeholder:t("common:loading")}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:It,"aria-label":t("settings:workspace.copyPath"),disabled:!s,children:o.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),o.jsx("p",{className:"af-set-hint",children:t("settings:workspace.description")})]}),o.jsx("div",{className:"af-set-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"Cursor CLI"}),o.jsx("span",{className:"af-set-badge"+(Ye?" af-set-badge--ok":" af-set-badge--muted"),children:t(Ye?"settings:cursor.status.cached":"settings:cursor.status.notCached")})]}),o.jsxs("div",{className:"af-set-cli-block",children:[o.jsx("div",{className:"af-set-cli-icon",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:Ye?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(Ye?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:Ye?t("settings:cursor.modelList.count",{count:c.cursor.length})+" · "+Qt(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),Ye?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:cursor.modelPreviewLabel"),children:c.cursor.join(`
|
|
184
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ne(),disabled:p,children:t(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"OpenCode"}),o.jsx("span",{className:"af-set-badge"+(Ze?" af-set-badge--ok":" af-set-badge--err"),children:t(Ze?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),o.jsx("p",{className:"af-set-p",children:t("settings:opencode.description")}),o.jsxs("div",{children:[o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:t("settings:opencode.provider")}),o.jsx("input",{id:"af-opencode-plan",className:"af-set-input af-set-input--sm af-set-input--mono",type:"text",value:I,onChange:ce=>B(ce.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),g?o.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,k?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:k}):null]}),Ze?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:t("settings:cursor.modelList.count",{count:c.opencode.length})+" · "+Qt(c.opencodeFetchedAt)}),o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:opencode.modelPreviewLabel"),children:c.opencode.join(`
|
|
185
|
-
`)})]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ne(),disabled:p,children:t(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:t("settings:claudeCode.title")}),o.jsx("span",{className:"af-set-badge"+(Ge?" af-set-badge--ok":" af-set-badge--err"),children:t(Ge?"settings:claudeCode.status.ready":"settings:claudeCode.status.notFound")})]}),o.jsxs("div",{className:"af-set-cli-block",children:[o.jsx("div",{className:"af-set-cli-icon",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:Ge?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(Ge?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:Ge?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+" · "+Qt(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),Ge?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:claudeCode.modelPreviewLabel"),children:c.claudeCode.join(`
|
|
186
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ne(),disabled:p,children:t(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),o.jsx("h2",{className:"af-set-h2",children:t("settings:env.title")})]}),o.jsx("span",{className:"af-set-env-note",children:j?t("settings:env.saving"):e!=null&&e.isAdmin?t("settings:env.noteAdmin"):t("settings:env.note")})]}),o.jsxs("div",{className:"af-set-env-rows"+(e!=null&&e.isAdmin?" af-set-env-rows--admin":""),children:[o.jsxs("div",{className:"af-set-env-row af-set-env-row--header","aria-hidden":!0,children:[o.jsx("span",{children:t("settings:env.key")}),e!=null&&e.isAdmin?o.jsx("span",{children:t("settings:env.scope")}):null,o.jsx("span",{children:t("settings:env.value")}),o.jsx("span",{})]}),b.map(ce=>o.jsxs("div",{className:"af-set-env-row"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",value:ce.key,onChange:ee=>Ht(ce.id,{key:ee.target.value}),"aria-label":t("settings:env.key"),spellCheck:!1})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:ce.scope!=="global"?"is-active":"",onClick:()=>Ht(ce.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:ce.scope==="global"?"is-active":"",onClick:()=>Ht(ce.id,{scope:"global"}),children:t("settings:env.global")})]})}):null,o.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:[o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:M.has(ce.id)?"text":"password",value:ce.value,onChange:ee=>Ht(ce.id,{value:ee.target.value}),placeholder:ate(ce.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>Le(ce.id),"aria-label":M.has(ce.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:M.has(ce.id)?"visibility_off":"visibility"})})]}),o.jsx("div",{className:"af-set-env-actions",children:o.jsx("button",{type:"button",className:"af-set-env-del","aria-label":t("settings:env.delete",{key:ce.key}),onClick:()=>ct(ce.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},ce.id)),o.jsxs("div",{className:"af-set-env-row af-set-env-row--draft"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",placeholder:"KEY_NAME",value:$,onChange:ce=>L(ce.target.value),"aria-label":t("settings:env.newKey")})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:R?"":"is-active",onClick:()=>V(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:R?"is-active":"",onClick:()=>V(!0),children:t("settings:env.global")})]})}):null,o.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:"password",placeholder:t("settings:env.newValue"),value:F,onChange:ce=>A(ce.target.value),"aria-label":t("settings:env.newValue")})}),o.jsx("div",{className:"af-set-env-actions",children:o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:qe,disabled:!$.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]})]})]}),e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--feedback",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"rate_review"})}),o.jsx("h2",{className:"af-set-h2",children:"意见反馈"})]}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Ae(),disabled:_,children:_?"刷新中...":"刷新"})]}),Q?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Q}):null,o.jsx("div",{className:"af-feedback-list",children:P.length>0?P.map(ce=>o.jsxs("article",{className:"af-feedback-item",children:[o.jsxs("header",{className:"af-feedback-item__head",children:[o.jsxs("div",{children:[o.jsx("h3",{children:ce.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:ce.username||ce.userId||"unknown"}),o.jsx("span",{children:Nn(ce.createdAt)})]})]}),ce.contact?o.jsx("span",{className:"af-feedback-item__contact",children:ce.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:ce.content}),ce.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:ce.pageUrl}):null]},ce.id)):o.jsx("div",{className:"af-feedback-empty",children:_?"正在加载反馈...":"暂无反馈"})})]}):null]}),o.jsxs("aside",{className:"af-settings-rail","aria-label":t("settings:title"),children:[o.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[o.jsxs("div",{className:"af-set-rail-inner",children:[o.jsx("h3",{className:"af-set-rail-h3",children:t("settings:system.title")}),o.jsxs("div",{className:"af-set-health-line",children:[o.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),o.jsx("span",{className:"af-set-health-label",children:t(!a&&!f?"settings:system.normal":"settings:system.abnormal")})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.cursorModels")}),o.jsx("span",{children:c.cursor.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.cursor.length>0?12+c.cursor.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.opencodeModels")}),o.jsx("span",{children:c.opencode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.opencode.length>0?12+c.opencode.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.claudeCodeModels")}),o.jsx("span",{children:c.claudeCode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.claudeCode.length>0?12+c.claudeCode.length*3:4)}%`}})})]})]}),o.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),o.jsxs("div",{className:"af-set-rail-card",children:[o.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:t("settings:language.title")}),o.jsxs("div",{className:"af-set-language-selector",children:[o.jsx("select",{className:"af-set-input af-set-input--sm",value:r,onChange:Jt,"aria-label":t("settings:language.description"),children:ste.map(ce=>o.jsxs("option",{value:ce.code,children:[ce.flag," ",ce.name]},ce.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})]})})]})}function cte(){const{navigate:e}=Da(),[t,n]=m.useState(""),[r,s]=m.useState(""),[i,a]=m.useState(!1),[l,c]=m.useState(""),[d,f]=m.useState(!1),u=async p=>{if(p.preventDefault(),!i){a(!0),c("");try{const h=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,content:r,pageUrl:window.location.href})}),g=await h.json().catch(()=>({}));if(!h.ok)throw new Error(g.error||"提交失败");f(!0),n(""),s("")}catch(h){c(String(h.message||h))}finally{a(!1)}}};return o.jsx("main",{className:"af-feedback-page",children:o.jsxs("section",{className:"af-feedback-panel",children:[o.jsxs("div",{className:"af-feedback-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),o.jsx("h1",{children:"意见反馈"}),o.jsx("p",{children:"提交使用中遇到的问题、改进建议或功能需求,管理员会在设置页统一查看。"})]}),o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>e("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]}),d?o.jsxs("div",{className:"af-feedback-success",role:"status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsxs("div",{children:[o.jsx("strong",{children:"已提交"}),o.jsx("span",{children:"感谢反馈,管理员可以在设置页查看这条记录。"})]})]}):null,o.jsxs("form",{className:"af-feedback-form",onSubmit:u,children:[o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{value:t,onChange:p=>n(p.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"反馈内容"}),o.jsx("textarea",{value:r,onChange:p=>s(p.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),l?o.jsx("p",{className:"af-err af-feedback-error",children:l}):null,o.jsx("div",{className:"af-feedback-actions",children:o.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:i||!t.trim()||!r.trim(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:i?"hourglass_empty":"send"}),i?"提交中...":"提交反馈"]})})]})]})})}function mT(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function qj(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:mT(),key:r,value:String(s??""),private:n.has(r)}))}function Yj(e){const t={};for(const n of Array.isArray(e)?e:[]){const r=String((n==null?void 0:n.key)||"").trim();r&&(t[r]=String((n==null?void 0:n.value)??""))}return t}function yh(e=null){const t=e!=null&&e.raw&&typeof e.raw=="object"?e.raw:{},n=Array.isArray(t.args)?t.args:Array.isArray(e==null?void 0:e.args)?e.args:[];return{originalName:String((e==null?void 0:e.name)||""),name:String((e==null?void 0:e.name)||""),type:e!=null&&e.url||t.url?"url":"command",url:String((e==null?void 0:e.url)||t.url||""),command:String((e==null?void 0:e.command)||t.command||""),argsText:n.map(String).join(`
|
|
187
|
-
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:qj(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:qj(t.headers||(e==null?void 0:e.headers),e==null?void 0:e.privateHeaderKeys),extraJson:JSON.stringify(Object.fromEntries(Object.entries(t).filter(([r])=>!["url","command","args","env","headers","description","__agentflowPrivateKeys"].includes(r))),null,2)}}function Uy(){return yh({name:"",raw:{command:""}})}function ute(e){const n={...e.extraJson.trim()?JSON.parse(e.extraJson):{}};if(e.type==="url")n.url=e.url.trim();else{n.command=e.command.trim();const i=e.argsText.split(/\r?\n/g).map(a=>a.trim()).filter(Boolean);i.length&&(n.args=i)}const r=Yj(e.envRows),s=Yj(e.headerRows);return Object.keys(r).length&&(n.env=r),Object.keys(s).length&&(n.headers=s),e.description.trim()&&(n.description=e.description.trim()),{name:e.originalName,nextName:e.name.trim(),server:n,privateEnvKeys:e.envRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean),privateHeaderKeys:e.headerRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean)}}function Gj(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function Xj(e){return e?e.ok?"ok":"error":"unknown"}function Jj({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(a,l,c)=>n(t.map(d=>d.id===a?{...d,[l]:c}:d));return o.jsxs("div",{className:"af-mcp-field",children:[o.jsxs("div",{className:"af-mcp-field-head",children:[o.jsx("span",{children:e}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>n([...t,{id:mT(),key:"",value:"",private:!0}]),children:"添加"})]}),o.jsxs("div",{className:"af-mcp-kv-list",children:[t.length===0?o.jsx("p",{className:"af-set-hint",children:"暂无"}):null,t.map(a=>o.jsxs("div",{className:"af-mcp-kv-row",children:[o.jsx("input",{className:"af-set-input af-set-input--mono",value:a.key,placeholder:r,onChange:l=>i(a.id,"key",l.target.value)}),o.jsx("input",{className:"af-set-input af-set-input--mono",value:a.value,placeholder:s,onChange:l=>i(a.id,"value",l.target.value)}),o.jsxs("label",{className:"af-mcp-private-toggle",title:"只保存到当前 AgentFlow 用户的个人配置",children:[o.jsx("input",{type:"checkbox",checked:!!a.private,onChange:l=>i(a.id,"private",l.target.checked)}),o.jsx("span",{children:"个人"})]}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>n(t.filter(l=>l.id!==a.id)),"aria-label":"删除",children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},a.id))]})]})}function dte(){var R;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,i]=m.useState(Uy),[a,l]=m.useState(""),[c,d]=m.useState(!1),[f,u]=m.useState(!1),[p,h]=m.useState(!1),[g,v]=m.useState({}),[k,y]=m.useState(""),[b,w]=m.useState(""),N=m.useMemo(()=>n.find(V=>V.name===a)||null,[a,n]),C=N&&g[N.name]||null,j=m.useCallback(async()=>{d(!0),y("");try{const V=await fetch("/api/mcps"),M=await V.json().catch(()=>({}));if(!V.ok)throw new Error(M.error||"MCP HTTP "+V.status);const D=Array.isArray(M.servers)?M.servers:[];t(String(M.path||"")),r(D),a&&D.some(I=>I.name===a)&&i(yh(D.find(I=>I.name===a)))}catch(V){y(String(V.message||V))}finally{d(!1)}},[a]);m.useEffect(()=>{j()},[j]);const T=()=>{l(""),i(Uy()),w(""),y("")},$=V=>{l(V.name),i(yh(V)),w(""),y("")},L=async(V="")=>{h(!0),y(""),w("");try{const M=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V?{name:V}:{})}),D=await M.json().catch(()=>({}));if(!M.ok)throw new Error(D.error||"检测 MCP 失败");const I=Array.isArray(D.results)?D.results:[];v(B=>{const P={...B};for(const O of I)O!=null&&O.name&&(P[O.name]=O);return P}),w(V?`已检测 ${V}。`:"已检测所有 MCP。")}catch(M){y(String(M.message||M))}finally{h(!1)}},F=async()=>{u(!0),y(""),w("");try{const V=ute(s);if(!V.nextName)throw new Error("请填写 MCP 名称");const M=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)}),D=await M.json().catch(()=>({}));if(!M.ok)throw new Error(D.error||"保存 MCP 失败");const I=Array.isArray(D.servers)?D.servers:[];r(I),t(String(D.path||e)),l(V.nextName),i(yh(I.find(B=>B.name===V.nextName)||null)),v(B=>{const P={...B};return s.originalName&&s.originalName!==V.nextName&&delete P[s.originalName],delete P[V.nextName],P}),w("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(V){y(String(V.message||V))}finally{u(!1)}},A=async V=>{if(V!=null&&V.name&&window.confirm(`删除 MCP "${V.name}"?`)){u(!0),y(""),w("");try{const M=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:V.name})}),D=await M.json().catch(()=>({}));if(!M.ok)throw new Error(D.error||"删除 MCP 失败");r(Array.isArray(D.servers)?D.servers:[]),l(""),i(Uy()),v(I=>{const B={...I};return delete B[V.name],B}),w("已删除。")}catch(M){y(String(M.message||M))}finally{u(!1)}}};return o.jsxs("main",{className:"af-settings-page",children:[o.jsxs("header",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"MCP"})]}),o.jsxs("div",{className:"af-settings-top-right",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:c||f,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>L(),disabled:p||c||f||n.length===0,children:p?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:T,disabled:f,children:"新增 MCP"})]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),o.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 Cursor MCP server。当前配置文件:",o.jsx("span",{className:"af-settings-code",children:e||"~/.cursor/mcp.json"})]})]}),o.jsxs("div",{className:"af-mcp-layout",children:[o.jsxs("section",{className:"af-set-card af-mcp-list-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2",children:"Servers"}),o.jsxs("div",{className:"af-mcp-list-head-actions",children:[o.jsx("span",{className:"af-set-badge af-set-badge--muted",children:n.length}),o.jsxs("button",{type:"button",className:"af-set-btn-mini",onClick:T,disabled:f,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),c?o.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!c?o.jsxs("div",{className:"af-mcp-empty",children:[o.jsx("p",{className:"af-set-p",children:"暂无 MCP server。"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:T,disabled:f,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(V=>o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===V.name?" af-mcp-server-item--active":""),onClick:()=>$(V),children:[o.jsx("span",{className:"material-symbols-outlined",children:V.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:V.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${Xj(g[V.name])}`,children:Gj(g[V.name])})]}),o.jsx("em",{children:V.url||[V.command,...V.args||[]].filter(Boolean).join(" ")})]})]},V.name))})]}),o.jsxs("section",{className:"af-set-card af-mcp-editor-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:N?"编辑 MCP":"新增 MCP"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),N?o.jsxs("div",{className:"af-mcp-editor-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>L(N.name),disabled:p||f,children:p?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>A(N),disabled:f,children:"删除"})]}):null]}),k?o.jsx("p",{className:"af-mcp-error",children:k}):null,b?o.jsx("p",{className:"af-mcp-status",children:b}):null,C?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${Xj(C)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:Gj(C)}),o.jsxs("span",{children:[C.elapsedMs||0,"ms"]})]}),C.error?o.jsx("p",{children:C.error}):null,(R=C.tools)!=null&&R.length?o.jsx("div",{className:"af-mcp-tools-list",children:C.tools.map(V=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:V.name}),V.description?o.jsx("span",{children:V.description}):null]},V.name))}):null]}):null,o.jsxs("div",{className:"af-mcp-form",children:[o.jsxs("label",{className:"af-set-label",children:["MCP 名称",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.name,onChange:V=>i(M=>({...M,name:V.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:V=>i(M=>({...M,type:V.target.value})),children:[o.jsx("option",{value:"url",children:"URL / HTTP"}),o.jsx("option",{value:"command",children:"Command / stdio"})]})]}),s.type==="url"?o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["URL",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.url,onChange:V=>i(M=>({...M,url:V.target.value})),placeholder:"http://127.0.0.1:3845/mcp"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"af-set-label",children:["Command",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.command,onChange:V=>i(M=>({...M,command:V.target.value})),placeholder:"uvx"})]}),o.jsxs("label",{className:"af-set-label",children:["Args,每行一个",o.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:4,value:s.argsText,onChange:V=>i(M=>({...M,argsText:V.target.value})),placeholder:`mcp-server-example
|
|
188
|
-
--flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:V=>i(M=>({...M,description:V.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(Jj,{title:"Headers",rows:s.headerRows,onChange:V=>i(M=>({...M,headerRows:V})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(Jj,{title:"Env",rows:s.envRows,onChange:V=>i(M=>({...M,envRows:V})),placeholderKey:"TOKEN",placeholderValue:"..."}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["额外 JSON 字段",o.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:5,value:s.extraJson,onChange:V=>i(M=>({...M,extraJson:V.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:T,disabled:f,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:F,disabled:f,children:f?"保存中...":"保存 MCP"})]})]})]})]})})]})}function gT(e){return t=>typeof t===e}var fte=gT("function"),pte=e=>e===null,Qj=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Zj=e=>!hte(e)&&!pte(e)&&(fte(e)||typeof e=="object"),hte=gT("undefined");function mte(e,t,n){return kte(n,e,t)?!0:(Ste(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?gte(e,t,n):e instanceof Map&&t instanceof Map?wte(e,t,n):e instanceof Set&&t instanceof Set?vte(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?yte(e,t):Qj(e)&&Qj(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?xte(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():bte(e,t,n))}function Ef(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!Zj(e)||!t||!Zj(t)?!1:mte(e,t,n)}function gte(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!Ef(e[s],t[s],n))return!1;return!0}function yte(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let s=e.byteLength;for(;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function xte(e,t,n){return e.message===t.message&&e.name===t.name&&Ef(e.cause,t.cause,n)}function wte(e,t,n){if(e.size!==t.size)return!1;for(const r of e.entries())if(!t.has(r[0]))return!1;for(const r of e.entries())if(!Ef(r[1],t.get(r[0]),n))return!1;return!0}function bte(e,t,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let s=r.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;for(let s=r.length;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!Ef(e[i],t[i],n))return!1}return!0}function vte(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function kte(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function Ste(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function Av(e,t){return Ef(e,t,new WeakMap)}function Ky(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function Nte(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function jte(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function Cte(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Ete(e,t){const n=Cte();m.useEffect(()=>{if(!n)return e()},t)}function yT(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function _te(e,t){const n=m.useRef(t);return Av(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function Pte(e){m.useEffect(()=>{e()},[])}function Ate(e=0){const[t,n]=m.useState({height:Ky()?window.innerHeight:0,width:Ky()?window.innerWidth:0}),r=m.useRef(0),s=m.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return m.useEffect(()=>{if(!Ky())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),jte(window,"resize",i),()=>{Nte(window,"resize",i)}},[]),t}var Ite=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],Tte=["bigint","boolean","null","number","string","symbol","undefined"];function _f(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Rte(t))return t}function Ni(e){return t=>_f(t)===e}function Rte(e){return Ite.includes(e)}function au(e){return t=>typeof t===e}function Lte(e){return Tte.includes(e)}var Ote=["innerHTML","ownerDocument","style","attributes","nodeValue"],Pf=e=>Array.isArray(e),Mte=e=>_f(e)==="AsyncGeneratorFunction",$te=Ni("AsyncFunction"),Dte=au("bigint"),Fte=e=>e===!0||e===!1,zte=Ni("Date"),Bte=Ni("Error"),Ta=au("function"),Hte=Ni("GeneratorFunction"),Vte=e=>typeof e=="number"&&Number.isInteger(e),zw=Ni("Map"),xT=e=>Number.isNaN(e),Iv=e=>e===null,wT=Ni("Function"),Wte=Ni("Promise"),Ute=Ni("RegExp"),Bw=Ni("Set"),Af=au("string"),Kte=au("symbol"),Tv=au("undefined"),qte=Ni("WeakMap"),Yte=Ni("WeakSet"),Rv=e=>Iv(e)||Tv(e),bT=e=>!Tv(e),Gte=e=>au("number")(e)&&!xT(e),Xte=e=>Af(e)&&e.trim().length>0,Jte=e=>{if(!Af(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},og=e=>!Rv(e)&&(Ta(e)||typeof e=="object"),vT=e=>{if(_f(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Qte=e=>Iv(e)||Lte(typeof e),Zte=e=>_f(e)==="URL",kT=e=>!Rv(e)&&Ta(e[Symbol.iterator]),ene=e=>kT(e)&&Ta(e.next)&&Ta(e.throw),tne=e=>Ta(e)&&/^class\s/.test(e.toString()),nne=(e,t)=>!Pf(e)||!Ta(t)?!1:e.every(n=>t(n)),rne=e=>og(e)&&!vT(e)&&e.nodeType===1&&Af(e.nodeName)&&Ote.every(t=>t in e),sne=e=>Af(e)&&e.length===0||Pf(e)&&e.length===0||og(e)&&!zw(e)&&!Bw(e)&&Object.keys(e).length===0||Bw(e)&&e.size===0||zw(e)&&e.size===0,ine=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,one=(e,t)=>Pf(e)?e.indexOf(t)>-1:!1,ane=(e,t,n)=>{if(!og(e)||!t)return!1;const r=e[t];return Ta(n)?n(r):bT(r)};function kt(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(Pf(e))return"Array";if(wT(e))return"Function";const t=_f(e);return t||"Object"}kt.array=Pf;kt.arrayOf=nne;kt.asyncGeneratorFunction=Mte;kt.asyncFunction=$te;kt.bigint=Dte;kt.boolean=Fte;kt.class=tne;kt.date=zte;kt.defined=bT;kt.domElement=rne;kt.empty=sne;kt.error=Bte;kt.function=Ta;kt.generator=ene;kt.generatorFunction=Hte;kt.instanceOf=ine;kt.integer=Vte;kt.iterable=kT;kt.map=zw;kt.nan=xT;kt.null=Iv;kt.nullOrUndefined=Rv;kt.nonEmptyString=Xte;kt.number=Gte;kt.numericString=Jte;kt.object=og;kt.oneOf=one;kt.plainFunction=wT;kt.plainObject=vT;kt.primitive=Qte;kt.promise=Wte;kt.propertyOf=ane;kt.regexp=Ute;kt.set=Bw;kt.string=Af;kt.symbol=Kte;kt.undefined=Tv;kt.url=Zte;kt.weakMap=qte;kt.weakSet=Yte;var Or=kt;/* v8 ignore next -- @preserve */var lne=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},cne=function(e,t){return e+af(t)},af=function(e){return e===null||typeof e=="boolean"||typeof e>"u"?"":typeof e=="number"?e.toString():typeof e=="string"?e:Array.isArray(e)?e.reduce(cne,""):lne(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?af(e.props.children):""};af.default=af;var une=af;const qy=La(une);var ST={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(i){return typeof i=="object"&&i!==null&&!(i instanceof RegExp)&&!(i instanceof Date)}}function r(s){function i(C){return C!=="constructor"&&C!=="prototype"&&C!=="__proto__"}function a(C){let j=0;const T=C.length,$=new Array(T);for(j;j<T;++j)$[j]=y(C[j]);return $}function l(C){const j={};if(p&&Object.getPrototypeOf(C)!==t)return p(C);const T=u(C);let $,L,F;for($=0,L=T.length;$<L;++$)i(F=T[$])&&(j[F]=y(C[F]));return j}function c(C,j){const T=C.length,$=j.length;let L=0;const F=new Array(T+$);for(L;L<T;++L)F[L]=y(C[L]);for(L=0;L<$;++L)F[L+T]=y(j[L]);return F}const d=Object.prototype.propertyIsEnumerable;function f(C){const j=Object.keys(C),T=Object.getOwnPropertySymbols(C);for(let $=0,L=T.length;$<L;++$)d.call(C,T[$])&&j.push(T[$]);return j}const u=s!=null&&s.symbols?f:Object.keys,p=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,h=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),g=(s==null?void 0:s.onlyDefinedProperties)===!0;function v(C){return typeof C!="object"||C===null}const k=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:y,deepmerge:w,getKeys:u,isMergeableObject:h}):c;function y(C){return h(C)?Array.isArray(C)?a(C):l(C):C}function b(C,j){const T={},$=u(C),L=u(j);let F,A,R;for(F=0,A=$.length;F<A;++F)i(R=$[F])&&L.indexOf(R)===-1&&(T[R]=y(C[R]));for(F=0,A=L.length;F<A;++F)if(i(R=L[F]))if(R in C)$.indexOf(R)!==-1&&(p&&h(j[R])&&Object.getPrototypeOf(j[R])!==t?T[R]=p(j[R]):T[R]=w(C[R],j[R]));else{if(g&&typeof j[R]>"u")continue;T[R]=y(j[R])}return T}function w(C,j){if(g&&typeof j>"u")return y(C);const T=Array.isArray(j),$=Array.isArray(C);return v(j)?j:h(C)?T&&$?k(C,j):T!==$?y(j):b(C,j):y(j)}function N(){switch(arguments.length){case 0:return{};case 1:return y(arguments[0]);case 2:return w(arguments[0],arguments[1])}let C;for(let j=0,T=arguments.length;j<T;++j)C=w(C,arguments[j]);return C}return s!=null&&s.all?N:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(ST);var dne=ST.exports;const fne=La(dne);var pne=new Error("Element already at target scroll position"),hne=new Error("Scroll cancelled"),mne=Math.min,e1=Date.now,gne={left:t1("scrollLeft"),top:t1("scrollTop")};function t1(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=xne);var a=e1(),l=n[e],c=s.ease||yne,d=isNaN(s.duration)?350:+s.duration,f=!1;return l===r?i(pne,n[e]):requestAnimationFrame(p),u;function u(){f=!0}function p(h){if(f)return i(hne,n[e]);var g=e1(),v=mne(1,(g-a)/d),k=c(v);n[e]=k*(r-l)+l,v<1?requestAnimationFrame(p):requestAnimationFrame(function(){i(null,n[e])})}}}function yne(e){return .5*(1-Math.cos(Math.PI*e))}function xne(){}const wne=La(gne);var NT={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Sd,function(){function t(r){var s=getComputedStyle(r,null).getPropertyValue("overflow");return s.indexOf("scroll")>-1||s.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var s=r.parentNode;s.parentNode;){if(t(s))return s;s=s.parentNode}return document.scrollingElement||document.documentElement}}return n})})(NT);var bne=NT.exports;const jT=La(bne),vne=["top","right","bottom","left"],n1=["start","end"],r1=vne.reduce((e,t)=>e.concat(t,t+"-"+n1[0],t+"-"+n1[1]),[]),eu=Math.min,gl=Math.max,wm=Math.round,Kp=Math.floor,Qi=e=>({x:e,y:e}),kne={left:"right",right:"left",bottom:"top",top:"bottom"};function Hw(e,t,n){return gl(e,eu(t,n))}function lu(e,t){return typeof e=="function"?e(t):e}function Mo(e){return e.split("-")[0]}function Zi(e){return e.split("-")[1]}function CT(e){return e==="x"?"y":"x"}function Lv(e){return e==="y"?"height":"width"}function ha(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ov(e){return CT(ha(e))}function ET(e,t,n){n===void 0&&(n=!1);const r=Zi(e),s=Ov(e),i=Lv(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=vm(a)),[a,vm(a)]}function Sne(e){const t=vm(e);return[bm(e),t,bm(t)]}function bm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const s1=["left","right"],i1=["right","left"],Nne=["top","bottom"],jne=["bottom","top"];function Cne(e,t,n){switch(e){case"top":case"bottom":return n?t?i1:s1:t?s1:i1;case"left":case"right":return t?Nne:jne;default:return[]}}function Ene(e,t,n,r){const s=Zi(e);let i=Cne(Mo(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(bm)))),i}function vm(e){const t=Mo(e);return kne[t]+e.slice(t.length)}function _ne(e){return{top:0,right:0,bottom:0,left:0,...e}}function _T(e){return typeof e!="number"?_ne(e):{top:e,right:e,bottom:e,left:e}}function km(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function o1(e,t,n){let{reference:r,floating:s}=e;const i=ha(t),a=Ov(t),l=Lv(a),c=Mo(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:f,y:r.y-s.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-s.width,y:u};break;default:h={x:r.x,y:r.y}}switch(Zi(t)){case"start":h[a]-=p*(n&&d?-1:1);break;case"end":h[a]+=p*(n&&d?-1:1);break}return h}async function Pne(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:h=0}=lu(t,e),g=_T(h),k=l[p?u==="floating"?"reference":"floating":u],y=km(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(k)))==null||n?k:k.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),b=u==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},C=km(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:w,strategy:c}):b);return{top:(y.top-C.top+g.top)/N.y,bottom:(C.bottom-y.bottom+g.bottom)/N.y,left:(y.left-C.left+g.left)/N.x,right:(C.right-y.right+g.right)/N.x}}const Ane=50,Ine=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:Pne},c=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=o1(d,r,c),p=r,h=0;const g={};for(let v=0;v<i.length;v++){const k=i[v];if(!k)continue;const{name:y,fn:b}=k,{x:w,y:N,data:C,reset:j}=await b({x:f,y:u,initialPlacement:r,placement:p,strategy:s,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});f=w??f,u=N??u,g[y]={...g[y],...C},j&&h<Ane&&(h++,typeof j=="object"&&(j.placement&&(p=j.placement),j.rects&&(d=j.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:f,y:u}=o1(d,p,c)),v=-1)}return{x:f,y:u,placement:p,strategy:s,middlewareData:g}},Tne=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=lu(e,t)||{};if(d==null)return{};const u=_T(f),p={x:n,y:r},h=Ov(s),g=Lv(h),v=await a.getDimensions(d),k=h==="y",y=k?"top":"left",b=k?"bottom":"right",w=k?"clientHeight":"clientWidth",N=i.reference[g]+i.reference[h]-p[h]-i.floating[g],C=p[h]-i.reference[h],j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let T=j?j[w]:0;(!T||!await(a.isElement==null?void 0:a.isElement(j)))&&(T=l.floating[w]||i.floating[g]);const $=N/2-C/2,L=T/2-v[g]/2-1,F=eu(u[y],L),A=eu(u[b],L),R=F,V=T-v[g]-A,M=T/2-v[g]/2+$,D=Hw(R,M,V),I=!c.arrow&&Zi(s)!=null&&M!==D&&i.reference[g]/2-(M<R?F:A)-v[g]/2<0,B=I?M<R?M-R:M-V:0;return{[h]:p[h]+B,data:{[h]:D,centerOffset:M-D-B,...I&&{alignmentOffset:B}},reset:I}}});function Rne(e,t,n){return(e?[...n.filter(s=>Zi(s)===e),...n.filter(s=>Zi(s)!==e)]:n.filter(s=>Mo(s)===s)).filter(s=>e?Zi(s)===e||(t?bm(s)!==s:!1):!0)}const Lne=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:a,placement:l,platform:c,elements:d}=t,{crossAxis:f=!1,alignment:u,allowedPlacements:p=r1,autoAlignment:h=!0,...g}=lu(e,t),v=u!==void 0||p===r1?Rne(u||null,h,p):p,k=await c.detectOverflow(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,b=v[y];if(b==null)return{};const w=ET(b,i,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==b)return{reset:{placement:v[0]}};const N=[k[Mo(b)],k[w[0]],k[w[1]]],C=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:b,overflows:N}],j=v[y+1];if(j)return{data:{index:y+1,overflows:C},reset:{placement:j}};const T=C.map(F=>{const A=Zi(F.placement);return[F.placement,A&&f?F.overflows.slice(0,2).reduce((R,V)=>R+V,0):F.overflows[0],F.overflows]}).sort((F,A)=>F[1]-A[1]),L=((s=T.filter(F=>F[2].slice(0,Zi(F[0])?2:3).every(A=>A<=0))[0])==null?void 0:s[0])||T[0][0];return L!==l?{data:{index:y+1,overflows:C},reset:{placement:L}}:{}}}},One=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...k}=lu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Mo(s),b=ha(l),w=Mo(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=p||(w||!v?[vm(l)]:Sne(l)),j=g!=="none";!p&&j&&C.push(...Ene(l,v,g,N));const T=[l,...C],$=await c.detectOverflow(t,k),L=[];let F=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&L.push($[y]),u){const M=ET(s,a,N);L.push($[M[0]],$[M[1]])}if(F=[...F,{placement:s,overflows:L}],!L.every(M=>M<=0)){var A,R;const M=(((A=i.flip)==null?void 0:A.index)||0)+1,D=T[M];if(D&&(!(u==="alignment"?b!==ha(D):!1)||F.every(P=>ha(P.placement)===b?P.overflows[0]>0:!0)))return{data:{index:M,overflows:F},reset:{placement:D}};let I=(R=F.filter(B=>B.overflows[0]<=0).sort((B,P)=>B.overflows[1]-P.overflows[1])[0])==null?void 0:R.placement;if(!I)switch(h){case"bestFit":{var V;const B=(V=F.filter(P=>{if(j){const O=ha(P.placement);return O===b||O==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(O=>O>0).reduce((O,_)=>O+_,0)]).sort((P,O)=>P[1]-O[1])[0])==null?void 0:V[0];B&&(I=B);break}case"initialPlacement":I=l;break}if(s!==I)return{reset:{placement:I}}}return{}}}},Mne=new Set(["left","top"]);async function $ne(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=Mo(n),l=Zi(n),c=ha(n)==="y",d=Mne.has(a)?-1:1,f=i&&c?-1:1,u=lu(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*f,y:p*d}:{x:p*d,y:h*f}}const Dne=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:a,middlewareData:l}=t,c=await $ne(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},Fne=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:b,y:w}=y;return{x:b,y:w}}},...d}=lu(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),p=ha(Mo(s)),h=CT(p);let g=f[h],v=f[p];if(a){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=g+u[y],N=g-u[b];g=Hw(w,g,N)}if(l){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=v+u[y],N=v-u[b];v=Hw(w,v,N)}const k=c.fn({...t,[h]:g,[p]:v});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[h]:a,[p]:l}}}}}};function ag(){return typeof window<"u"}function cu(e){return PT(e)?(e.nodeName||"").toLowerCase():"#document"}function _s(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ro(e){var t;return(t=(PT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function PT(e){return ag()?e instanceof Node||e instanceof _s(e).Node:!1}function vi(e){return ag()?e instanceof Element||e instanceof _s(e).Element:!1}function Fo(e){return ag()?e instanceof HTMLElement||e instanceof _s(e).HTMLElement:!1}function a1(e){return!ag()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _s(e).ShadowRoot}function If(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ki(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function zne(e){return/^(table|td|th)$/.test(cu(e))}function lg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Bne=/transform|translate|scale|rotate|perspective|filter/,Hne=/paint|layout|strict|content/,tl=e=>!!e&&e!=="none";let Yy;function Mv(e){const t=vi(e)?ki(e):e;return tl(t.transform)||tl(t.translate)||tl(t.scale)||tl(t.rotate)||tl(t.perspective)||!$v()&&(tl(t.backdropFilter)||tl(t.filter))||Bne.test(t.willChange||"")||Hne.test(t.contain||"")}function Vne(e){let t=Ra(e);for(;Fo(t)&&!tu(t);){if(Mv(t))return t;if(lg(t))return null;t=Ra(t)}return null}function $v(){return Yy==null&&(Yy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Yy}function tu(e){return/^(html|body|#document)$/.test(cu(e))}function ki(e){return _s(e).getComputedStyle(e)}function cg(e){return vi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ra(e){if(cu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||a1(e)&&e.host||ro(e);return a1(t)?t.host:t}function AT(e){const t=Ra(e);return tu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Fo(t)&&If(t)?t:AT(t)}function lf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=AT(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=_s(s);if(i){const l=Vw(a);return t.concat(a,a.visualViewport||[],If(s)?s:[],l&&n?lf(l):[])}else return t.concat(s,lf(s,[],n))}function Vw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function IT(e){const t=ki(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Fo(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=wm(n)!==i||wm(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Dv(e){return vi(e)?e:e.contextElement}function Lc(e){const t=Dv(e);if(!Fo(t))return Qi(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=IT(t);let a=(i?wm(n.width):n.width)/r,l=(i?wm(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Wne=Qi(0);function TT(e){const t=_s(e);return!$v()||!t.visualViewport?Wne:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Une(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_s(e)?!1:t}function El(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Dv(e);let a=Qi(1);t&&(r?vi(r)&&(a=Lc(r)):a=Lc(e));const l=Une(i,n,r)?TT(i):Qi(0);let c=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,f=s.width/a.x,u=s.height/a.y;if(i){const p=_s(i),h=r&&vi(r)?_s(r):r;let g=p,v=Vw(g);for(;v&&r&&h!==g;){const k=Lc(v),y=v.getBoundingClientRect(),b=ki(v),w=y.left+(v.clientLeft+parseFloat(b.paddingLeft))*k.x,N=y.top+(v.clientTop+parseFloat(b.paddingTop))*k.y;c*=k.x,d*=k.y,f*=k.x,u*=k.y,c+=w,d+=N,g=_s(v),v=Vw(g)}}return km({width:f,height:u,x:c,y:d})}function ug(e,t){const n=cg(e).scrollLeft;return t?t.left+n:El(ro(e)).left+n}function RT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ug(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Kne(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=ro(r),l=t?lg(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=Qi(1);const f=Qi(0),u=Fo(r);if((u||!u&&!i)&&((cu(r)!=="body"||If(a))&&(c=cg(r)),u)){const h=El(r);d=Lc(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const p=a&&!u&&!i?RT(a,c):Qi(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+p.x,y:n.y*d.y-c.scrollTop*d.y+f.y+p.y}}function qne(e){return Array.from(e.getClientRects())}function Yne(e){const t=ro(e),n=cg(e),r=e.ownerDocument.body,s=gl(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=gl(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+ug(e);const l=-n.scrollTop;return ki(r).direction==="rtl"&&(a+=gl(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const l1=25;function Gne(e,t){const n=_s(e),r=ro(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const f=$v();(!f||f&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=ug(r);if(d<=0){const f=r.ownerDocument,u=f.body,p=getComputedStyle(u),h=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-h);g<=l1&&(i-=g)}else d<=l1&&(i+=d);return{width:i,height:a,x:l,y:c}}function Xne(e,t){const n=El(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Fo(e)?Lc(e):Qi(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:a,height:l,x:c,y:d}}function c1(e,t,n){let r;if(t==="viewport")r=Gne(e,n);else if(t==="document")r=Yne(ro(e));else if(vi(t))r=Xne(t,n);else{const s=TT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return km(r)}function LT(e,t){const n=Ra(e);return n===t||!vi(n)||tu(n)?!1:ki(n).position==="fixed"||LT(n,t)}function Jne(e,t){const n=t.get(e);if(n)return n;let r=lf(e,[],!1).filter(l=>vi(l)&&cu(l)!=="body"),s=null;const i=ki(e).position==="fixed";let a=i?Ra(e):e;for(;vi(a)&&!tu(a);){const l=ki(a),c=Mv(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||If(a)&&!c&<(e,a))?r=r.filter(f=>f!==a):s=l,a=Ra(a)}return t.set(e,r),r}function Qne(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?lg(t)?[]:Jne(t,this._c):[].concat(n),r],l=c1(t,a[0],s);let c=l.top,d=l.right,f=l.bottom,u=l.left;for(let p=1;p<a.length;p++){const h=c1(t,a[p],s);c=gl(h.top,c),d=eu(h.right,d),f=eu(h.bottom,f),u=gl(h.left,u)}return{width:d-u,height:f-c,x:u,y:c}}function Zne(e){const{width:t,height:n}=IT(e);return{width:t,height:n}}function ere(e,t,n){const r=Fo(t),s=ro(t),i=n==="fixed",a=El(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Qi(0);function d(){c.x=ug(s)}if(r||!r&&!i)if((cu(t)!=="body"||If(s))&&(l=cg(t)),r){const h=El(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?RT(s,l):Qi(0),u=a.left+l.scrollLeft-c.x-f.x,p=a.top+l.scrollTop-c.y-f.y;return{x:u,y:p,width:a.width,height:a.height}}function Gy(e){return ki(e).position==="static"}function u1(e,t){if(!Fo(e)||ki(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ro(e)===n&&(n=n.ownerDocument.body),n}function OT(e,t){const n=_s(e);if(lg(e))return n;if(!Fo(e)){let s=Ra(e);for(;s&&!tu(s);){if(vi(s)&&!Gy(s))return s;s=Ra(s)}return n}let r=u1(e,t);for(;r&&zne(r)&&Gy(r);)r=u1(r,t);return r&&tu(r)&&Gy(r)&&!Mv(r)?n:r||Vne(e)||n}const tre=async function(e){const t=this.getOffsetParent||OT,n=this.getDimensions,r=await n(e.floating);return{reference:ere(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nre(e){return ki(e).direction==="rtl"}const rre={convertOffsetParentRelativeRectToViewportRelativeRect:Kne,getDocumentElement:ro,getClippingRect:Qne,getOffsetParent:OT,getElementRects:tre,getClientRects:qne,getDimensions:Zne,getScale:Lc,isElement:vi,isRTL:nre};function MT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sre(e,t){let n=null,r;const s=ro(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:p,height:h}=d;if(l||t(),!p||!h)return;const g=Kp(u),v=Kp(s.clientWidth-(f+p)),k=Kp(s.clientHeight-(u+h)),y=Kp(f),w={rootMargin:-g+"px "+-v+"px "+-k+"px "+-y+"px",threshold:gl(0,eu(1,c))||1};let N=!0;function C(j){const T=j[0].intersectionRatio;if(T!==c){if(!N)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}T===1&&!MT(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(C,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return a(!0),i}function d1(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=Dv(e),f=s||i?[...d?lf(d):[],...t?lf(t):[]]:[];f.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const u=d&&l?sre(d,n):null;let p=-1,h=null;a&&(h=new ResizeObserver(y=>{let[b]=y;b&&b.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),d&&!c&&h.observe(d),t&&h.observe(t));let g,v=c?El(e):null;c&&k();function k(){const y=El(e);v&&!MT(v,y)&&n(),v=y,g=requestAnimationFrame(k)}return n(),()=>{var y;f.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),u==null||u(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const ire=Dne,ore=Lne,are=Fne,lre=One,f1=Tne,cre=(e,t,n)=>{const r=new Map,s={platform:rre,...n},i={...s.platform,_c:r};return Ine(e,t,{...s,platform:i})};var ure=typeof document<"u",dre=function(){},xh=ure?m.useLayoutEffect:dre;function Sm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Sm(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!Sm(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function $T(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function p1(e,t){const n=$T(e);return Math.round(t*n)/n}function Xy(e){const t=m.useRef(e);return xh(()=>{t.current=e}),t}function h1(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,u]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(r);Sm(p,r)||h(r);const[g,v]=m.useState(null),[k,y]=m.useState(null),b=m.useCallback(P=>{P!==j.current&&(j.current=P,v(P))},[]),w=m.useCallback(P=>{P!==T.current&&(T.current=P,y(P))},[]),N=i||g,C=a||k,j=m.useRef(null),T=m.useRef(null),$=m.useRef(f),L=c!=null,F=Xy(c),A=Xy(s),R=Xy(d),V=m.useCallback(()=>{if(!j.current||!T.current)return;const P={placement:t,strategy:n,middleware:p};A.current&&(P.platform=A.current),cre(j.current,T.current,P).then(O=>{const _={...O,isPositioned:R.current!==!1};M.current&&!Sm($.current,_)&&($.current=_,ts.flushSync(()=>{u(_)}))})},[p,t,n,A,R]);xh(()=>{d===!1&&$.current.isPositioned&&($.current.isPositioned=!1,u(P=>({...P,isPositioned:!1})))},[d]);const M=m.useRef(!1);xh(()=>(M.current=!0,()=>{M.current=!1}),[]),xh(()=>{if(N&&(j.current=N),C&&(T.current=C),N&&C){if(F.current)return F.current(N,C,V);V()}},[N,C,V,F,L]);const D=m.useMemo(()=>({reference:j,floating:T,setReference:b,setFloating:w}),[b,w]),I=m.useMemo(()=>({reference:N,floating:C}),[N,C]),B=m.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const O=p1(I.floating,f.x),_=p1(I.floating,f.y);return l?{...P,transform:"translate("+O+"px, "+_+"px)",...$T(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:_}},[n,l,I.floating,f.x,f.y]);return m.useMemo(()=>({...f,update:V,refs:D,elements:I,floatingStyles:B}),[f,V,D,I,B])}const fre=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?f1({element:r.current,padding:s}).fn(n):{}:r?f1({element:r,padding:s}).fn(n):{}}}},m1=(e,t)=>{const n=ire(e);return{name:n.name,fn:n.fn,options:[e,t]}},pre=(e,t)=>{const n=are(e);return{name:n.name,fn:n.fn,options:[e,t]}},hre=(e,t)=>{const n=lre(e);return{name:n.name,fn:n.fn,options:[e,t]}},mre=(e,t)=>{const n=ore(e);return{name:n.name,fn:n.fn,options:[e,t]}},gre=(e,t)=>{const n=fre(e);return{name:n.name,fn:n.fn,options:[e,t]}},yre={arrowBase:32,arrowColor:"#ffffff",arrowSize:16,arrowSpacing:12,backgroundColor:"#ffffff",beaconSize:36,beaconTrigger:"click",beforeTimeout:5e3,blockTargetInteraction:!1,buttons:["back","close","primary"],closeButtonAction:"close",disableFocusTrap:!1,dismissKeyAction:"close",hideOverlay:!1,loaderDelay:300,offset:10,overlayClickAction:"close",overlayColor:"#00000080",primaryColor:"#000000",scrollDuration:300,scrollOffset:20,showProgress:!1,skipBeacon:!1,skipScroll:!1,spotlightPadding:10,spotlightRadius:4,targetWaitTimeout:1e3,textColor:"#000000",width:380,zIndex:100},xre={beaconOptions:{offset:-18}},DT={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},wre={isFixed:!1,locale:DT,placement:"bottom"},bre={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Dt={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},hr={TOUR_START:"tour:start",STEP_BEFORE_HOOK:"step:before_hook",STEP_BEFORE:"step:before",SCROLL_START:"scroll:start",SCROLL_END:"scroll:end",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",STEP_AFTER_HOOK:"step:after_hook",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found",ERROR:"error"},Fe={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},Vi={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},At={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},vre="react-joyride-portal";function kre(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Sc(...e){return fne({all:!0,isMergeableObject:t=>!(!Or.plainObject(t)||m.isValidElement(t))})(...e)}function FT(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function So(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=qy(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&FT(e.type)==="function")try{i=So(e.type({}),t)}catch{i=qy(n)}else i=qy(n);return i}function gr(e,t,n,...r){if(!e)return;const s=new Date,i=`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}.${String(s.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${i}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function Sre(e,t){const n=kre(t);return{...e,...n}}function cf(){}function Nre(e){return Object.keys(e)}function Nm(e,...t){if(!Or.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function g1(e,...t){if(!Or.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function Ww(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(FT(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(Or.string(s)&&s.includes("{current}"))return m.cloneElement(e,{children:r(s)});if(Array.isArray(s))return m.cloneElement(e,{children:s.map(i=>typeof i=="string"?r(i):Ww(i,t,n))});if(Or.function(e.type)&&!Object.values(e.props).length)try{return Ww(e.type({}),t,n)}catch{return e}return e}function y1(e){return Nre(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Fv(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function x1(e){let t=0,n=0,r=e;for(;r;)t+=r.offsetTop,n+=r.offsetLeft,r=r.offsetParent;return{left:n,top:t}}function zv(e){return e?e.getBoundingClientRect():null}function jre(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function qs(e){if(!e)return null;if(typeof e=="function")try{return e()}catch{return null}if(typeof e=="object"&&"current"in e)return e.current;if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function Cre(e,t,n){const r=zv(e),s=uu(e),i=s?!s.isSameNode(os()):!1,a=n??du(e);let l=0,c=(r==null?void 0:r.top)??0;return i&&a?c=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!a&&(c+=l),s.isSameNode(os())||(c+=os().scrollTop)),Math.floor(c-t)}function uu(e,t){if(!e)return os();const n=jT(e);if(n){if(n.isSameNode(os()))return t?document:os();if(!(n.scrollHeight>n.offsetHeight))return os()}return n}function Ere(e){const t=e.getBoundingClientRect(),n=os(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function _re(e,t){if(!e)return 0;const n=jT(e)??os(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=zv(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(zT(e)||Pre(e))){const f=e.getBoundingClientRect(),u=f.top-((s==null?void 0:s.top)??0),p=u+f.height,h=n.clientHeight,g=h*.2;u>=g&&p<=h-g?c=i:c=u+i}const d=Math.floor(c-t-r);return d<0?0:d}function Pre(e){return e.offsetParent!==document.body}function zT(e){if(!e)return!1;const t=uu(e);return t?!t.isSameNode(os()):!1}function du(e,t="fixed"){if(!e||!(e instanceof Element))return!1;const{nodeName:n}=e;return n==="BODY"||n==="HTML"?!1:getComputedStyle(e).position===t?!0:e.parentNode?du(e.parentNode,t):!1}function qp(e){if(!e)return!1;let t=e;for(;t&&t!==document.body;){if(t instanceof HTMLElement){const{display:n,visibility:r}=getComputedStyle(t);if(n==="none"||r==="hidden")return!1}t=t.parentElement??null}return!0}function w1(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==Fe.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?uu(s):os(),l=a?!a.isSameNode(os()):!1;return(r.isFixed||du(s))&&!l?!1:a.scrollHeight>a.clientHeight}function os(){return document.scrollingElement??document.documentElement}function b1(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(a=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;s=wne.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function Are(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,s,i,a)=>s+s+i+i+a+a),n=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})/i.exec(t);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:[]}const BT={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Yp={...BT,borderRadius:4,padding:8};function Ire(e,t){const{styles:n}=e,r=Sc(n??{},t.styles??{});let{width:s}=t;Fv()&&(s=typeof s=="number"&&window.innerWidth<s?window.innerWidth-30:s);const i={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return Sc({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...BT,display:"inline-flex",borderRadius:"50%",position:"relative"},beacon:{height:t.beaconSize,width:t.beaconSize},beaconInner:{animation:"joyride-beacon-inner 1.2s infinite ease-in-out",backgroundColor:t.primaryColor,borderRadius:"50%",display:"block",height:"50%",left:"50%",opacity:.7,position:"absolute",top:"50%",transform:"translate(-50%, -50%)",width:"50%"},beaconOuter:{animation:"joyride-beacon-outer 1.2s infinite ease-in-out",backgroundColor:`rgba(${Are(t.primaryColor).join(",")}, 0.2)`,border:`2px solid ${t.primaryColor}`,borderRadius:"50%",boxSizing:"border-box",display:"block",height:"100%",left:0,opacity:.9,position:"absolute",top:0,transformOrigin:"center",width:"100%"},buttonBack:{...Yp,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Yp,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Yp,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Yp,color:t.textColor,fontSize:14},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:"100%",transition:"opacity 0.3s"},loader:{alignItems:"center",display:"flex",height:48,inset:0,justifyContent:"center",pointerEvents:"none",position:"fixed",width:48,zIndex:t.zIndex+1},overlay:{...i,backgroundColor:t.overlayColor},spotlight:{},tooltip:{backgroundColor:t.backgroundColor,borderRadius:5,boxSizing:"border-box",color:t.textColor,fontSize:16,maxWidth:"100%",padding:12,position:"relative",width:s},tooltipContainer:{lineHeight:1.4,textAlign:"center"},tooltipTitle:{fontSize:18,margin:0},tooltipContent:{paddingBottom:12,paddingTop:12},tooltipFooter:{alignItems:"center",display:"flex",justifyContent:"flex-end"},tooltipFooterSpacer:{flex:1}},r)}const Tre=["after","arrowBase","arrowColor","arrowSize","arrowSpacing","backgroundColor","beaconSize","beaconTrigger","before","beforeTimeout","buttons","closeButtonAction","skipBeacon","dismissKeyAction","disableFocusTrap","hideOverlay","skipScroll","blockTargetInteraction","loaderDelay","offset","overlayClickAction","overlayColor","primaryColor","scrollDuration","scrollOffset","showProgress","spotlightPadding","spotlightRadius","targetWaitTimeout","textColor","width","zIndex"];function Bv(e,t){if(!t)return null;const n=Sc(wre,g1(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=Sc(yre,e.options??{},g1(t,...Tre)),s=Ire(e,{...n,...r}),i=Sc(xre,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:Sc(DT,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:Rre(r.spotlightPadding),styles:s}}function Rre(e){return typeof e=="number"?{top:e,right:e,bottom:e,left:e}:{top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0,left:(e==null?void 0:e.left)??0}}function Lre(e,t,n){const{action:r}=t,s=n&&[Dt.PREV,Dt.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function HT(e,t=!1){return Or.plainObject(e)?e.target?!0:(gr(t,"tour","target is missing from the step"),!1):(gr(t,"tour","step must be an object"),!1)}function VT(e,t=!1){return Or.array(e)?e.every(n=>HT(n,t)):(gr(t,"tour","steps must be an array"),!1)}var Ore=class{constructor(e){Vn(this,"beaconPosition",null);Vn(this,"debug");Vn(this,"eventListeners",new Map);Vn(this,"listeners",new Set);Vn(this,"props");Vn(this,"snapshot");Vn(this,"state");Vn(this,"steps");Vn(this,"tooltipPosition",null);Vn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});Vn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);Vn(this,"getServerSnapshot",()=>this.snapshot);Vn(this,"getSnapshot",()=>this.snapshot);Vn(this,"getEventState",()=>Nm(this.snapshot,"positioned"));Vn(this,"getState",()=>Nm(this.snapshot,"positioned"));Vn(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&gr(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Fe.BEACON_BEFORE||this.state.lifecycle===Fe.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(i=(s=this.getStep())==null?void 0:s.floatingOptions)==null?void 0:i.onPosition;n&&n(t)});Vn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});Vn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});Vn(this,"on",(e,t)=>{let n=this.eventListeners.get(e);return n||(n=new Set,this.eventListeners.set(e,n)),n.add(t),()=>{n.delete(t)}});Vn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Vn(this,"updateState",(e,t=!1)=>{const{controlled:n,index:r}=this.state,s=this.snapshot,i=n&&!t&&e.index!==void 0?r:e.index??r,a={action:e.action??this.state.action,controlled:n,index:i,lifecycle:e.lifecycle??this.state.lifecycle,origin:e.origin??null,positioned:e.positioned??this.state.positioned,scrolling:e.scrolling??this.state.scrolling,size:e.size??this.state.size,status:e.status??this.state.status,waiting:e.waiting??this.state.waiting},l=this.applyTransitions(a);if(this.state=l,!Av(s,l)){this.snapshot=Object.freeze({...l});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=Or.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,Or.number(t)&&gr(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Or.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&gr(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Dt.INIT,controlled:s,index:i,lifecycle:Fe.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?At.READY:At.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===At.WAITING&&e.size>0?{...e,status:At.RUNNING}:e}getStep(e){return Bv(this.props,this.steps[e??this.state.index])}};function Mre(e){return new Ore(e)}function v1(e,t){return Math.min(Math.max(e,0),t)}function $re(e,t,n){const r=m.useRef(t),s=m.useRef(n);return r.current=t,s.current=n,m.useMemo(()=>{const i=()=>e.current.getSnapshot();return{close:(k=null)=>{const{index:y,status:b}=i();b===At.RUNNING&&e.current.updateState({action:Dt.CLOSE,index:y+1,origin:k,lifecycle:Fe.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:k=>{const{controlled:y,size:b,status:w}=i();if(y){gr(r.current,"tour","go() is not supported in controlled mode");return}w===At.RUNNING&&e.current.updateState({action:Dt.GO,index:k,lifecycle:Fe.COMPLETE,positioned:!1,scrolling:!1,status:k<b?w:At.FINISHED,waiting:!1})},info:()=>Nm(e.current.getSnapshot(),"positioned"),next:k=>{const{index:y,size:b,status:w}=i();w===At.RUNNING&&e.current.updateState({action:Dt.NEXT,index:v1(y+1,b),lifecycle:Fe.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:k}=i();k===At.RUNNING&&e.current.updateState({action:Dt.UPDATE,lifecycle:Fe.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:k=>{const{index:y,size:b,status:w}=i();w===At.RUNNING&&e.current.updateState({action:Dt.PREV,index:v1(y-1,b),lifecycle:Fe.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},reset:(k=!1)=>{const{controlled:y}=i();if(y){gr(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Dt.RESET,index:0,lifecycle:Fe.INIT,positioned:!1,scrolling:!1,status:k?At.RUNNING:At.READY,waiting:!1})},skip:k=>{const{status:y}=i();y===At.RUNNING&&e.current.updateState({action:Dt.SKIP,lifecycle:Fe.COMPLETE,origin:k,positioned:!1,scrolling:!1,status:At.SKIPPED,waiting:!1})},start:k=>{const{index:y,size:b}=i();s.current(),e.current.updateState({action:Dt.START,index:Or.number(k)?k:y,lifecycle:Fe.INIT,positioned:!1,scrolling:!1,status:b?At.RUNNING:At.WAITING,waiting:!1},!0)},stop:(k=!1)=>{const{index:y,status:b}=i();[At.FINISHED,At.SKIPPED].includes(b)||e.current.updateState({action:Dt.STOP,index:y+(k?1:0),lifecycle:Fe.COMPLETE,positioned:!1,scrolling:!1,status:At.PAUSED,waiting:!1})}}},[e])}const Dre=new Set(["origin","positioned"]);function Fre(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return gr(!0,"tour","init",r),n.current=r,e.current.subscribe(s=>{const i=n.current;if(n.current=s,!i)return;const a={};let l=!1;for(const c of Object.keys(s))s[c]!==i[c]&&!Dre.has(c)&&(a[c]={from:i[c],to:s[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||gr(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function zre(e,t,n){const r=m.useRef(e),s=m.useRef(t);return r.current=e,s.current=t,m.useCallback((i,a,l)=>{var d;const c={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(d=r.current)==null||d.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function aa(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const s=e[n],i=t[n];return Array.isArray(r)?r.includes(s)&&!r.includes(i):s===r&&i!==r},previous:t}}function Bre(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:d,index:f,lifecycle:u,positioned:p,scrolling:h,size:g,status:v}=a,k=yT(l)??null,y=m.useRef(null),b=m.useRef(i),w=m.useRef(a),N=m.useRef(s),C=m.useRef(l),j=m.useRef(k),T=m.useRef(n),$=m.useRef(null),L=m.useRef(null),F=m.useRef(null);b.current=i,w.current=a,N.current=s,C.current=l,j.current=k,T.current=n;const A=()=>{$.current&&(clearInterval($.current),$.current=null),L.current=null,F.current&&(F.current.cancel(),F.current=null)};m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:R}=aa(w.current,N.current);(R("action",[Dt.NEXT,Dt.PREV,Dt.SKIP,Dt.CLOSE])||y.current===Dt.CLOSE&&d===Dt.START)&&(y.current=d)},[d]),m.useEffect(()=>{if(!N.current)return()=>{A()};const{hasChanged:R}=aa(w.current,N.current),V=C.current;if(R("index")&&A(),v!==At.RUNNING||!V||u!==Fe.INIT)return()=>{A()};const{hasChangedTo:M}=aa(w.current,N.current);M("status",At.RUNNING)&&[At.IDLE,At.READY,At.PAUSED].includes(N.current.status)&&r(hr.TOUR_START,V),c.current.cleanupPositionData();const{debug:D}=b.current;if(V.before&&!F.current){gr(D,`step:${f}`,"before()",V),F.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(hr.STEP_BEFORE_HOOK,V,{action:y.current??w.current.action});const I=()=>{F.current=null,c.current.updateState({action:y.current??w.current.action,waiting:!1,lifecycle:Fe.READY})},B=new AbortController,P=V.beforeTimeout;F.current={cancel:()=>B.abort()};const O=P?setTimeout(()=>{B.signal.aborted||(gr(D,`step:${f}`,"before()","timed out",`${P}ms`),B.abort(),t(V,"before_hook"),r(hr.ERROR,V,{error:new Error("Step before hook timed out")}),I())},P):null;V.before({...c.current.getState(),action:y.current??c.current.getState().action,step:V}).then(()=>{B.signal.aborted||(O&&clearTimeout(O),I())}).catch(_=>{B.signal.aborted||(O&&clearTimeout(O),t(V,"before_hook"),r(hr.ERROR,V,{error:_ instanceof Error?_:new Error(String(_))}),I())})}else if(!F.current){$.current&&L.current!==V.target&&A();const I=qs(V.target);if(I&&qp(I))A(),c.current.updateState({action:y.current??Dt.UPDATE,lifecycle:Fe.READY,waiting:!1});else if(V.targetWaitTimeout===0)c.current.updateState({action:y.current??Dt.UPDATE,lifecycle:Fe.READY,waiting:!1});else if(!$.current){const{targetWaitTimeout:B}=V,P=Date.now();L.current=V.target,gr(D,`step:${f}`,"polling","started",`${B}ms`),c.current.updateState({waiting:!0}),$.current=setInterval(()=>{const O=qs(V.target),_=Date.now()-P,Y=_>=B;(O&&qp(O)||Y)&&(gr(D,`step:${f}`,"polling",O&&qp(O)?"found":"timed out",`${_}ms`),A(),c.current.updateState({action:y.current??Dt.UPDATE,lifecycle:Fe.READY,waiting:!1}))},100)}}return()=>{A()}},[t,r,f,u,v,c]),m.useEffect(()=>{if(!N.current)return;const{hasChanged:R,hasChangedTo:V,previous:M}=aa(w.current,N.current),D=C.current;if(!D)return;const I=qs(D.target),B=!!I;if(B&&qp(I)){if(V("lifecycle",Fe.READY)&&M.lifecycle===Fe.INIT&&r(hr.STEP_BEFORE,D,{action:y.current??w.current.action}),V("lifecycle",Fe.READY)){const P=w.current,O=Lre(D,P,b.current.continuous)?Fe.TOOLTIP:Fe.BEACON,_=qs(D.scrollTarget??D.spotlightTarget??D.target),Y=w1({isFirstStep:P.index===0,scrollToFirstStep:b.current.scrollToFirstStep,step:D,target:_,targetLifecycle:O}),Q=O===Fe.TOOLTIP?Fe.TOOLTIP_BEFORE:Fe.BEACON_BEFORE;gr(b.current.debug,`step:${f}`,"scroll",Y?"needed":"skipped"),c.current.updateState({action:Dt.UPDATE,lifecycle:Q,scrolling:Y})}}else if(w.current.status===At.RUNNING&&u!==Fe.INIT&&u!==Fe.COMPLETE&&R("lifecycle")){gr(b.current.debug,`step:${f}`,B?"Target not visible":"Target not mounted",D),t(D,"target_not_found"),r(hr.TARGET_NOT_FOUND,D);const P=w.current;P.controlled||c.current.updateState({action:Dt.UPDATE,index:P.index+(P.action===Dt.PREV?-1:1),lifecycle:Fe.INIT})}},[t,r,f,u,c]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:R,previous:V}=aa(w.current,N.current),M=C.current,D=j.current;if(M&&R("lifecycle",Fe.TOOLTIP_BEFORE)&&V.lifecycle===Fe.BEACON){const P=qs(M.scrollTarget??M.spotlightTarget??M.target);if(w1({isFirstStep:w.current.index===0,scrollToFirstStep:b.current.scrollToFirstStep,step:M,target:P,targetLifecycle:Fe.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const I=u===Fe.BEACON_BEFORE||u===Fe.TOOLTIP_BEFORE;if(M&&I&&!h){const P=u===Fe.TOOLTIP_BEFORE?Fe.TOOLTIP:Fe.BEACON;c.current.updateState({action:Dt.UPDATE,lifecycle:P})}M&&R("lifecycle",Fe.BEACON)&&r(hr.BEACON,M),M&&R("lifecycle",Fe.TOOLTIP)&&r(hr.TOOLTIP,M);const B=w.current;if((B.status===At.RUNNING||B.controlled&&B.status===At.PAUSED&&M)&&D&&R("lifecycle",Fe.COMPLETE)&&V.lifecycle===Fe.TOOLTIP&&(r(hr.STEP_AFTER,D,{action:y.current??Dt.UPDATE,index:V.index??B.index,lifecycle:B.lifecycle}),D.after)){r(hr.STEP_AFTER_HOOK,D,{action:y.current??Dt.UPDATE,index:V.index??B.index,lifecycle:B.lifecycle});try{D.after({...c.current.getState(),action:y.current??Dt.UPDATE,index:V.index??B.index,lifecycle:B.lifecycle,step:D})}catch{}}},[r,u,p,h,c]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:R,previous:V}=aa(w.current,N.current),M=C.current,D=j.current;g&&!M&&u===Fe.INIT&&c.current.updateState({action:Dt.UPDATE,lifecycle:Fe.COMPLETE,status:At.FINISHED}),!w.current.controlled&&v===At.RUNNING&&R("lifecycle",Fe.COMPLETE)&&f<g&&c.current.updateState({action:Dt.UPDATE,lifecycle:Fe.INIT}),R("lifecycle",Fe.COMPLETE)&&f>=g&&c.current.updateState({action:Dt.UPDATE,lifecycle:Fe.COMPLETE,status:At.FINISHED});const I=M??D??Bv(b.current,b.current.steps[f-1]);if(I&&R("status",[At.FINISHED,At.SKIPPED])){let B;M?B=f:D?B=V.index??f:B=f-1,r(hr.TOUR_END,I,{index:B}),w.current.controlled||T.current.reset(),y.current=null}M&&R("action",Dt.STOP)&&(y.current=null,r(hr.TOUR_STATUS,M)),M&&R("action",Dt.RESET)&&(r(hr.TOUR_STATUS,M),y.current=null)},[d,r,f,u,g,v,c])}function Hre({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:d}=n,f=m.useRef(void 0),u=m.useRef(r),p=m.useRef(e);u.current=r,p.current=e,m.useEffect(()=>{const h=f.current;if(f.current=n,!h||n===h)return;const{hasChanged:g}=aa(n,h);if(Av(h.steps,d)||(VT(d,i)?s.current.setSteps(d):(gr(i,"tour","Steps are not valid",d),t(hr.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))l?s.current.getState().size&&p.current.start(c??a):p.current.stop();else if(Or.number(c)&&g("stepIndex")){const v=Or.number(h.stepIndex)&&h.stepIndex<c?Dt.NEXT:Dt.PREV;[At.FINISHED,At.SKIPPED].includes(u.current.status)||s.current.updateState({action:v,index:c,lifecycle:Fe.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,d,s])}function Vre(e,t){var l,c,d,f;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:i}=t;if(i.scrollTarget||i.spotlightTarget)return Math.max(0,e);let a=e-i.spotlightPadding.top;if(r===Fe.BEACON_BEFORE&&(n!=null&&n.placement)){const u=Wre(n);["bottom"].includes(n.placement)||(a+=Math.floor(u-s))}else if(r===Fe.TOOLTIP_BEFORE){const{placement:u}=i;if(u==="top"){const p=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,g=i.offset+i.spotlightPadding.top+h;a-=p+g}else if(u==="left"||u==="right"){const p=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,h=((f=qs(i.target))==null?void 0:f.getBoundingClientRect().height)??0,g=s+i.spotlightPadding.top+h/2-p/2;g<s&&(a-=s-g)}}return Math.max(0,a)}function Wre(e){var n;const t=(n=e.middlewareData)==null?void 0:n.offset;return t?["left","right"].some(r=>e.placement.startsWith(r))?t.x:t.y:0}function Ure({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:d,status:f}=r,u=m.useRef(null),p=m.useRef(r),h=m.useRef(t),g=m.useRef(n),v=m.useRef(s);p.current=r,h.current=t,g.current=n,v.current=s,m.useEffect(()=>()=>{var k;(k=u.current)==null||k.call(u)},[]),m.useEffect(()=>{var C;if(!h.current||!v.current)return;const{hasChangedTo:k}=aa(p.current,h.current),y=v.current,{debug:b}=g.current,{scrollDuration:w}=y,N=l===Fe.BEACON_BEFORE||l===Fe.TOOLTIP_BEFORE;if(f===At.RUNNING&&N&&d&&k("positioned",!0)){const j=qs(y.scrollTarget??y.spotlightTarget??y.target),T=i.current.getPositionData("beacon"),$=uu(j),L=$?!$.isSameNode(os()):!1;(C=u.current)==null||C.call(u),(async()=>{if(L&&!du($)){const B=os(),P=Ere($),O={initial:B.scrollTop,target:P,element:B,duration:w};e(hr.SCROLL_START,y,{scroll:O});const{cancel:_,promise:Y}=b1(P,{element:B,duration:w});u.current=_,await Y,e(hr.SCROLL_END,y,{scroll:O})}const A=Math.floor(_re(j,y.scrollOffset))||0,R=L?A:Vre(A,{beaconPosition:T,lifecycle:l,scrollOffset:y.scrollOffset,step:y});gr(b,`step:${a}`,"scroll",L?"custom":"document",`${A} → ${R}`);const V=$,M={initial:V.scrollTop,target:R,element:V,duration:w};e(hr.SCROLL_START,y,{scroll:M});const{cancel:D,promise:I}=b1(R,{element:V,duration:w});u.current=D,await I,e(hr.SCROLL_END,y,{scroll:M}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,d,f,i])}function Kre(e){const t=_te(()=>Sre(bre,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=m.useRef(Mre(t)),d=gP.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[f,u]=m.useState([]),p=m.useCallback((C,j)=>{u(T=>[...T,{reason:j,step:C}])},[]),h=m.useCallback(()=>{u([])},[]);Fre(c,n);const g=$re(c,n,h),v=zre(s,g,c),{index:k,size:y,status:b}=d,w=yT(d),N=m.useMemo(()=>Bv(t,l[k]),[k,t,l]);return Pte(()=>{i&&y&&VT(l,n)&&g.start(a??r)}),Ete(()=>{i&&y&&b===At.IDLE&&c.current.updateState({status:At.READY})},[i,y,b]),Hre({controls:g,emitEvent:v,props:t,state:d,store:c}),Bre({addFailure:p,controls:g,emitEvent:v,previousState:w,props:t,state:d,step:N,store:c}),Ure({emitEvent:v,previousState:w,props:t,state:d,step:N,store:c}),{controls:g,failures:f,mergedProps:t,state:d,step:N,store:c}}function qre(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(Or.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=vre,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Yre={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Gre({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return cf;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
189
|
-
@keyframes joyride-loader-spin {
|
|
190
|
-
to { transform: rotate(360deg); }
|
|
191
|
-
}
|
|
192
|
-
`)),document.head.appendChild(c),()=>{const d=document.getElementById("joyride-loader-animation");d!=null&&d.parentNode&&d.parentNode.removeChild(d)}},[r,e]),n===null)return null;const{height:s,width:i,...a}=t.styles.loader;let l;if(n){const c=n;l=nt.createElement(c,{step:t})}else l=nt.createElement("div",{style:{...Yre,height:s,width:i,borderTopColor:t.primaryColor}});return nt.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const Xre={height:0,isFixed:!1,left:0,top:0,width:0};function Ku(e,t){const n=qs(e);if(!n)return Xre;const r=zv(n),s=du(n),i=Cre(n,t.top,s);return{height:Math.round(((r==null?void 0:r.height)??0)+t.top+t.bottom),isFixed:s,left:Math.round(((r==null?void 0:r.left)??0)-t.left),top:i,width:Math.round(((r==null?void 0:r.width)??0)+t.left+t.right)}}function Jre(e,t,n){const[r,s]=m.useState(()=>Ku(e,t)),i=m.useRef(void 0),a=m.useRef(null),l=m.useRef(n),c=m.useRef(null),d=m.useCallback(()=>{clearTimeout(i.current),i.current=window.setTimeout(()=>{s(u=>{const p=Ku(e,t);return u.top===p.top&&u.left===p.left&&u.width===p.width&&u.height===p.height&&u.isFixed===p.isFixed?u:p})},100)},[e,t]);m.useEffect(()=>{let u=null;const p=g=>{a.current=uu(g,!0),a.current&&a.current.addEventListener("scroll",d,{passive:!0}),window.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(d),c.current.observe(g)),s(Ku(e,t))},h=qs(e);return h?p(h):(u=new MutationObserver(()=>{const g=qs(e);g&&(u==null||u.disconnect(),u=null,p(g))}),u.observe(document.body,{childList:!0,subtree:!0})),()=>{var g;u==null||u.disconnect(),a.current&&a.current.removeEventListener("scroll",d),window.removeEventListener("scroll",d),window.removeEventListener("resize",d),(g=c.current)==null||g.disconnect(),clearTimeout(i.current)}},[e,t,d]),m.useEffect(()=>{l.current&&!n&&s(Ku(e,t)),l.current=n},[n,e,t]);let f=r;return l.current&&!n&&(f=Ku(e,t)),f}function Qre(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function k1(e,t,n,r,s){if(n<=0||r<=0)return"";const i=Math.max(0,Math.min(s,n/2,r/2));let a=`M${e+i} ${t}`;return a+=`H${e+n-i}`,a+=`A${i} ${i} 0 0 1 ${e+n} ${t+i}`,a+=`V${t+r-i}`,a+=`A${i} ${i} 0 0 1 ${e+n-i} ${t+r}`,a+=`H${e+i}`,a+=`A${i} ${i} 0 0 1 ${e} ${t+r-i}`,a+=`V${t+i}`,a+=`A${i} ${i} 0 0 1 ${e+i} ${t}Z`,a}const Zre=[Fe.BEACON_BEFORE,Fe.BEACON];function ese(e){var I,B;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:c,scrolling:d,spotlightPadding:f,spotlightRadius:u,spotlightTarget:p,styles:h,target:g,waiting:v}=e,k=Ate(),y=Jre(p??g,f,d||v),b=m.useRef(null),w=(s===Fe.TOOLTIP||s===Fe.TOOLTIP_BEFORE)&&l!=="center",[N,C]=m.useState(!1),j=c?(I=b.current)==null?void 0:I.offsetParent:null,T=(j==null?void 0:j.clientWidth)??k.width,$=(j==null?void 0:j.clientHeight)??jre()??k.height,L=((B=h.overlay)==null?void 0:B.backgroundColor)??"rgba(0, 0, 0, 0.5)",F=m.useMemo(()=>{const{backgroundColor:P,mixBlendMode:O,..._}=h.overlay;return{height:$,pointerEvents:"none",..._}},[$,h.overlay]),A=w&&!d&&!v;m.useEffect(()=>{A?requestAnimationFrame(()=>C(!0)):C(!1)},[A]);const R=n&&Zre.includes(s),V=!n&&s!==Fe.TOOLTIP;if(r||!v&&(R||V))return null;let M="";if(A)if(c&&j){const P=qs(p??g);if(P){const O=x1(P),_=x1(j);M=k1(O.left-_.left-f.left,O.top-_.top-f.top,P.offsetWidth+f.left+f.right,P.offsetHeight+f.top+f.bottom,u)}}else M=k1(y.left,y.top,y.width,y.height,u);const D=Qre(T,$,M);return nt.createElement("div",{ref:b,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:F},nt.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:$,left:0,position:y.isFixed?"fixed":"absolute",top:0,width:T}},nt.createElement("path",{d:D,fill:L,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),M&&nt.createElement("path",{d:M,fill:L,style:{opacity:N?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),M&&Object.keys(h.spotlight).length>0&&nt.createElement("path",{d:M,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function WT(e){const{children:t,element:n}=e;return n?ts.createPortal(t,n):null}const tse='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function nse(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return cf;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(tse)],{shiftKey:l}=i;if(!a.length)return;i.preventDefault();let c=document.activeElement?a.indexOf(document.activeElement):0;c===-1||!l&&c+1===a.length?c=0:l&&c===0?c=a.length-1:c+=l?-1:1,a[c].focus()};e.addEventListener("keydown",r,!1);let s;{const i=e.querySelector(t);i&&(s=setTimeout(()=>{i.focus({preventScroll:!0})},100))}return()=>{var i;e.removeEventListener("keydown",r),s!==void 0&&clearTimeout(s),(i=n.current)==null||i.focus({preventScroll:!0})}},[e,t])}function _o(e,t,n){const[r]=e.split("-");switch(r){case"top":case"bottom":return{width:t,height:n};case"left":case"right":return{width:n,height:t};default:return null}}function rse(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,..._o(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,..._o(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,..._o(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,..._o(e,t,n)};default:return null}}function sse(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,..._o(e,r,n)};case"bottom":return{top:-n,left:t.x??0,..._o(e,r,n)};case"left":return{right:-n,top:t.y??0,..._o(e,r,n)};case"right":return{left:-n,top:t.y??0,..._o(e,r,n)};default:return{}}}function ise({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let c=null;if(l){if(!_o(r,n,i))return null;c=nt.createElement("span",{style:{flexShrink:0}},nt.createElement(l,{base:n,placement:r,size:i}))}else{const d=rse(r,n,i);if(!d)return null;c=nt.createElement("svg",{height:d.height,width:d.width,xmlns:"http://www.w3.org/2000/svg"},nt.createElement("polygon",{fill:"currentColor",points:d.points}))}return nt.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...sse(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function ose(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:c,size:d,step:f,styles:u}=e,p=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return cf;const k=document.createElement("style");k.id="joyride-beacon-animation",a&&k.setAttribute("nonce",a),k.appendChild(document.createTextNode(`
|
|
193
|
-
@keyframes joyride-beacon-inner {
|
|
194
|
-
20% {
|
|
195
|
-
opacity: 0.9;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
90% {
|
|
199
|
-
opacity: 0.7;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
@keyframes joyride-beacon-outer {
|
|
204
|
-
0% {
|
|
205
|
-
transform: scale(1);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
45% {
|
|
209
|
-
opacity: 0.7;
|
|
210
|
-
transform: scale(0.75);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
100% {
|
|
214
|
-
opacity: 0.9;
|
|
215
|
-
transform: scale(1);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
`)),document.head.appendChild(k);const y=setTimeout(()=>{Or.domElement(p.current)&&c&&p.current.focus()},0);return()=>{clearTimeout(y);const b=document.getElementById("joyride-beacon-animation");b!=null&&b.parentNode&&b.parentNode.removeChild(b)}},[h,a,c]);const g=So(i.open);let v;if(t){const k=t;v=nt.createElement(k,{continuous:n,index:r,isLastStep:s,size:d,step:f})}else v=nt.createElement("span",{style:u.beacon},nt.createElement("span",{style:u.beaconOuter}),nt.createElement("span",{style:u.beaconInner}));return nt.createElement("button",{ref:p,"aria-label":g,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:u.beaconWrapper,title:g,type:"button"},v)}function ase({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return nt.createElement("button",{style:i,type:"button",...t},nt.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof s=="number"?`${s}px`:s,xmlns:"http://www.w3.org/2000/svg"},nt.createElement("g",null,nt.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}function lse(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=e,{buttons:d,content:f,styles:u,title:p}=l,h={};d.includes("primary")&&(h.primary=nt.createElement("button",{"data-testid":"button-primary",style:u.buttonPrimary,type:"button",...i})),d.includes("skip")&&!s&&(h.skip=nt.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:u.buttonSkip,type:"button",...a})),d.includes("back")&&r>0&&(h.back=nt.createElement("button",{"data-testid":"button-back",style:u.buttonBack,type:"button",...t})),h.close=d.includes("close")&&nt.createElement(ase,{"data-testid":"button-close",styles:u.buttonClose,...n});const g=p?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":So(f),"aria-describedby":"joyride-tooltip-content"};return nt.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:u.tooltip,...c,...g},nt.createElement("div",{style:u.tooltipContainer},p&&nt.createElement("h4",{id:"joyride-tooltip-title",style:u.tooltipTitle},p),nt.createElement("div",{id:"joyride-tooltip-content",style:u.tooltipContent},f)),d.some(v=>v==="back"||v==="primary"||v==="skip")&&nt.createElement("div",{style:u.tooltipFooter},nt.createElement("div",{style:u.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function cse(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=y=>{y.preventDefault(),n.prev(Vi.BUTTON_BACK)},c=y=>{y.preventDefault(),a.closeButtonAction==="skip"?n.skip(Vi.BUTTON_CLOSE):n.close(Vi.BUTTON_CLOSE)},d=y=>{if(y.preventDefault(),!t){n.close(Vi.BUTTON_PRIMARY);return}n.next(Vi.BUTTON_PRIMARY)},f=y=>{y.preventDefault(),n.skip(Vi.BUTTON_SKIP)},u=()=>{const{back:y,close:b,last:w,next:N,nextWithProgress:C,skip:j}=a.locale,T=So(y),$=So(b),L=So(w),F=So(N),A=So(j);let R=b,V=$;if(t){if(R=N,V=F,a.showProgress&&!s){const M=So(C,{step:r+1,steps:i});R=Ww(C,r+1,i),V=M}s&&(R=w,V=L)}return{backProps:{"aria-label":T,children:y,"data-action":"back",onClick:l,role:"button",title:T},closeProps:{"aria-label":$,children:b,"data-action":"close",onClick:c,role:"button",title:$},primaryProps:{"aria-label":V,children:R,"data-action":"primary",onClick:d,role:"button",title:V},skipProps:{"aria-label":A,children:j,"data-action":"skip",onClick:f,role:"button",title:A},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:p,beaconComponent:h,tooltipComponent:g,...v}=a;let k;if(g){const y=g;k=nt.createElement(y,{...u(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:v})}else k=nt.createElement(lse,{...u(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:v});return k}function use(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function dse(e,t,n){var r,s;return e?[mre()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[hre({crossAxis:!1,fallbackPlacements:use(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function fse(e){var O,_,Y,Q,K;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:c,setTooltipRef:d,shouldScroll:f,size:u,step:p,target:h,updateState:g}=e,v=m.useRef(null),k=m.useRef({}),y=m.useRef({}),b=p.placement==="center",w=p.placement==="auto",N=m.useMemo(()=>({getBoundingClientRect:()=>({x:window.innerWidth/2,y:window.innerHeight/2,top:window.innerHeight/2,left:window.innerWidth/2,bottom:window.innerHeight/2,right:window.innerWidth/2,width:0,height:0})}),[]),C=m.useMemo(()=>zT(h)?uu(h):void 0,[h]),j=m.useMemo(()=>du(h),[h]),T=m.useMemo(()=>C?{boundary:C,rootBoundary:"viewport"}:{},[C]),$=b||w?"bottom":p.placement,L=b?"fixed":((O=p.floatingOptions)==null?void 0:O.strategy)??(p.isFixed||j?"fixed":"absolute"),F=m.useMemo(()=>{var ie,fe,ye,we;return b?[{name:"center",fn:({rects:ae})=>({x:(window.innerWidth-ae.floating.width)/2,y:(window.innerHeight-ae.floating.height)/2})}]:[m1(({placement:ae})=>{var Ae;let ge="right";ae.startsWith("top")?ge="top":ae.startsWith("bottom")?ge="bottom":ae.startsWith("left")&&(ge="left");const _e=p.spotlightTarget?0:p.spotlightPadding[ge];return p.offset+_e+((Ae=p.floatingOptions)!=null&&Ae.hideArrow?0:p.arrowSize)},[p.offset,p.spotlightPadding,p.spotlightTarget,p.arrowSize,(ie=p.floatingOptions)==null?void 0:ie.hideArrow]),...dse(w,p,$),pre({padding:10,...T,...(fe=p.floatingOptions)==null?void 0:fe.shiftOptions}),...(ye=p.floatingOptions)!=null&&ye.hideArrow?[]:[gre({element:v,padding:p.arrowSpacing},[p.arrowSpacing,p.arrowBase])],...((we=p.floatingOptions)==null?void 0:we.middleware)??[]]},[b,p,w,$,T]),A=h1({...b?{elements:{reference:N}}:{},placement:$,strategy:L,middleware:F}),R=h1({strategy:L,placement:p.beaconPlacement??(w||b?"bottom":p.placement),middleware:m.useMemo(()=>{var ie,fe;return[m1(((fe=(ie=p.floatingOptions)==null?void 0:ie.beaconOptions)==null?void 0:fe.offset)??-18)]},[(Y=(_=p.floatingOptions)==null?void 0:_.beaconOptions)==null?void 0:Y.offset]),whileElementsMounted:d1});y.current=A.middlewareData,k.current=R.middlewareData,m.useEffect(()=>{var ye;const{floating:ie,reference:fe}=A.elements;if(!(!fe||!ie||s!==Fe.TOOLTIP))return d1(fe,ie,A.update,(ye=p.floatingOptions)==null?void 0:ye.autoUpdate)},[s,A.update,(Q=p.floatingOptions)==null?void 0:Q.autoUpdate,p.target,A.elements]),m.useEffect(()=>{!b&&h&&A.refs.setReference(h),h&&R.refs.setReference(h)},[R.refs,b,h,A.refs]),m.useEffect(()=>{A.isPositioned&&c("tooltip",{placement:A.placement,x:A.x??0,y:A.y??0,middlewareData:y.current})},[c,A.isPositioned,A.placement,A.x,A.y]),m.useEffect(()=>{R.isPositioned&&c("beacon",{placement:R.placement,x:R.x??0,y:R.y??0,middlewareData:k.current})},[c,R.isPositioned,R.placement,R.x,R.y]);const V=p.zIndex+100,M=m.useCallback(ie=>{ie.type==="mouseenter"&&p.beaconTrigger!=="hover"||g({lifecycle:Fe.TOOLTIP_BEFORE,positioned:!1})},[p.beaconTrigger,g]),D=m.useCallback(ie=>{ie&&(A.refs.setFloating(ie),d(ie))},[A.refs,d]),{arrow:I,floater:B}=p.styles;let P=null;if(s===Fe.TOOLTIP||s===Fe.TOOLTIP_BEFORE){const ie=y1({...B,...A.floatingStyles,zIndex:V,opacity:a&&A.isPositioned?1:0,...!a&&{transition:"none"}});P=nt.createElement("div",{ref:D,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:ie},nt.createElement(cse,{continuous:t,controls:n,index:r,isLastStep:r+1===u,size:u,step:p}),!b&&!((K=p.floatingOptions)!=null&&K.hideArrow)&&nt.createElement(ise,{arrowComponent:p.arrowComponent,arrowRef:v,base:p.arrowBase,placement:A.placement,position:A.middlewareData.arrow,size:p.arrowSize,styles:I}))}else(s===Fe.BEACON||s===Fe.BEACON_BEFORE)&&(P=nt.createElement("div",{ref:R.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:y1({...R.floatingStyles,zIndex:V})},nt.createElement(ose,{beaconComponent:p.beaconComponent,continuous:t,index:r,isLastStep:r+1===u,locale:p.locale,nonce:i,onInteract:M,shouldFocus:f,size:u,step:p,styles:p.styles})));return nt.createElement(WT,{element:l},P)}function pse(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:c,size:d,step:f,updateState:u}=e,[p,h]=m.useState(null);nse(f.disableFocusTrap?null:p,"[data-action=primary]");const g=qs(f.target),v=s===Fe.TOOLTIP;return!HT(f)||!Or.domElement(g)?null:nt.createElement(fse,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:v,portalElement:a,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:d,step:f,target:g,updateState:u})}function hse({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:c,scrollToFirstStep:d}=t,f=qre(c),{index:u,lifecycle:p,status:h}=n,g=h===At.RUNNING,[v,k]=m.useState(!1),y=m.useRef(null),b=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?b===0?k(!0):y.current=setTimeout(()=>{k(!0)},b):k(!1),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[b,n.waiting]),m.useEffect(()=>{if(!g)return;const C=j=>{!r||p!==Fe.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(Vi.KEYBOARD):e.close(Vi.KEYBOARD))};return document.body.addEventListener("keydown",C,{passive:!0}),()=>{document.body.removeEventListener("keydown",C)}},[e,g,p,r]);const w=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(Vi.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(Vi.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!g)return null;const N=n.action===Dt.START&&!r.skipBeacon&&r.placement!=="center";return nt.createElement(nt.Fragment,null,p!==Fe.INIT&&nt.createElement(pse,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:f,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(u!==0||d),step:r,updateState:s.current.updateState}),nt.createElement(WT,{element:f},nt.createElement(nt.Fragment,null,v&&nt.createElement(Gre,{nonce:l,step:r}),!N&&nt.createElement(ese,{...r,continuous:i,lifecycle:p,onClickOverlay:w,portalElement:c?f:null,scrolling:n.scrolling,waiting:n.waiting}))))}function mse(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=Kre(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>a.current.on(l,c),[a]),state:m.useMemo(()=>Nm(s,"positioned"),[s]),step:i,Tour:Fv()?nt.createElement(hse,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function gse(e){const{Tour:t}=mse(e);return t}function yse(e){return Fv()?nt.createElement(gse,e):null}function xse(e){return[{target:"body",content:e("onboarding:projects.intro"),disableBeacon:!0,placement:"center"},{target:".af-hub-card",content:e("onboarding:projects.hubIntro"),disableBeacon:!0,placement:"left"}]}function wse(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function bse(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const Jy="af:onboarding";function vse({page:e,hasNodes:t=!1}){const{t:n}=hn(),[r,s]=m.useState(!1),[i,a]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?xse(n):t?wse(n):bse(n),[e,t,n]);return m.useEffect(()=>{const d=localStorage.getItem(Jy);console.log("[Onboarding] localStorage:",d);const f=d?JSON.parse(d):{};if(console.log("[Onboarding] progress:",f,"page:",e),f.completed||f[e]){console.log("[Onboarding] skipped - already done"),s(!1),a([]);return}console.log("[Onboarding] starting with steps:",c),a(c),s(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const d=f=>{var g;const u=f.target.closest("button");if(!u||!u.closest(".react-joyride__tooltip"))return;const h=(g=u.textContent)==null?void 0:g.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const v=localStorage.getItem(Jy)||"{}",k=JSON.parse(v);h===n("onboarding:skip")?(k.projects=!0,k.flow=!0,k.completed=!0):k[e]=!0,localStorage.setItem(Jy,JSON.stringify(k)),a([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const y=document.querySelector(".af-create-btn");y&&y.click()},500))}};return document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[r,e,n]),!r||i.length===0?null:o.jsx(yse,{ref:l,steps:i,run:r,continuous:!0,showSkipButton:!0,showProgress:i.length>1,styles:{options:{primaryColor:"#7c4dff",textColor:"#ffffff",backgroundColor:"#1a1a1a",arrowColor:"#1a1a1a",overlayColor:"rgba(0, 0, 0, 0.4)",zIndex:1e4},tooltip:{borderRadius:"1.5rem",padding:"1.5rem"},buttonNext:{borderRadius:"9999px",padding:"0.625rem 1.5rem"},buttonSkip:{borderRadius:"9999px",color:"#9ecaff"},buttonClose:{display:"none"}},locale:{back:n("onboarding:back"),next:n("onboarding:next"),skip:n("onboarding:skip"),last:n(e==="projects"?"onboarding:startCreate":"onboarding:done")},floaterProps:{disableAnimation:!0},scrollToFirstStep:!0})}function kse(){const{navigate:e,path:t}=Da(),[n,r]=m.useState([]),[s,i]=m.useState(!1);if(m.useEffect(()=>{let f=!1;const u=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const g=await h.json();if(f)return;const v=Array.isArray(g.runs)?g.runs:[];r(v.filter(k=>k&&k.status==="running"))}catch{}};u();const p=window.setInterval(u,3e3);return()=>{f=!0,window.clearInterval(p)}},[]),n.length===0)return null;const a=f=>{const u=new URLSearchParams({flowId:f.flowId,flowSource:f.flowSource||"workspace"});e(`/flow?${u.toString()}`),i(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(l==null?void 0:l.get("flowId"))||"",d=n.length===1;return o.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[s&&!d&&o.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>i(!1),children:n.map(f=>o.jsxs("button",{type:"button",className:"af-run-indicator__item"+(f.flowId===c?" af-run-indicator__item--current":""),onClick:()=>a(f),title:`${f.flowId} · ${f.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:f.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:f.runId.slice(0,12)})]},`${f.flowId}:${f.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>d?a(n[0]):i(f=>!f),title:d?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[o.jsx("span",{className:"af-run-indicator__pulse"}),o.jsx("span",{className:"af-run-indicator__label",children:d?n[0].flowId:`${n.length} running`})]})]})}class Sse extends m.Component{constructor(t){super(t),this.state={error:null,info:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[AgentFlow UI render error]",t,n),this.setState({error:t,info:n})}render(){var r,s,i;if(!this.state.error)return this.props.children;const t=String(((r=this.state.error)==null?void 0:r.stack)||((s=this.state.error)==null?void 0:s.message)||this.state.error),n=String(((i=this.state.info)==null?void 0:i.componentStack)||"");return o.jsx("div",{className:"af-auth-screen",children:o.jsxs("div",{className:"af-auth-panel af-ui-error-panel",children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"error"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow UI Error"}),o.jsx("p",{children:"页面渲染失败,下面是调试堆栈。"})]})]}),o.jsx("pre",{children:t}),n?o.jsx("pre",{children:n}):null]})})}}function Nse({authUser:e}){const{path:t}=Da();return t==="/projects"||t==="/"?o.jsx(Xl,{authUser:e}):t==="/nodes"?o.jsx(Xl,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?o.jsx(Xl,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?o.jsx(Xl,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?o.jsx(Xl,{authUser:e,resourceKind:"skills"}):t==="/mcps"?o.jsx(dte,{}):t==="/flow"?o.jsx(H7,{}):t==="/workspace"?o.jsx(tq,{}):t==="/settings"?o.jsx(lte,{authUser:e}):t==="/feedback"?o.jsx(cte,{}):o.jsx(Xl,{})}function jse({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=m.useState(""),[i,a]=m.useState(""),[l,c]=m.useState(!1),[d,f]=m.useState(""),u=async()=>{try{const g=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!g.authenticated,user:g.user||null,setupRequired:!!g.setupRequired}),f(g.error?String(g.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),f(String(h.message||h))}};m.useEffect(()=>{u()},[]);const p=async h=>{h.preventDefault(),c(!0),f("");try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),v=await g.json().catch(()=>({}));if(!g.ok)throw new Error(v.error||"登录失败");n({loading:!1,authenticated:!0,user:v.user||null,setupRequired:!1})}catch(g){f(String(g.message||g))}finally{c(!1)}};return t.loading?o.jsx("div",{className:"af-auth-screen",children:o.jsx("div",{className:"af-auth-panel",children:"Loading..."})}):t.authenticated?e({user:t.user,onLogout:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),n({loading:!1,authenticated:!1,user:null,setupRequired:!1})}}):o.jsx("div",{className:"af-auth-screen",children:o.jsxs("form",{className:"af-auth-panel",onSubmit:p,children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow"}),o.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"用户名"}),o.jsx("input",{value:r,onChange:h=>s(h.target.value),autoComplete:"username",autoFocus:!0})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"密码"}),o.jsx("input",{type:"password",value:i,onChange:h=>a(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),d?o.jsx("p",{className:"af-auth-error",children:d}):null,o.jsx("button",{className:"af-auth-submit",type:"submit",disabled:l||!r.trim()||i.length<4,children:l?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function Cse({authUser:e,onLogout:t}){const{path:n}=Da(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(vse,{page:r?"flow":"projects"}):null,r?null:o.jsx(TO,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(Nse,{authUser:e})}),o.jsx(kse,{})]})}function Ese(){return o.jsx(Sse,{children:o.jsx(pO,{children:o.jsx(jse,{children:({user:e,onLogout:t})=>o.jsx(Cse,{authUser:e,onLogout:t})})})})}window.addEventListener("error",e=>{console.error("[AgentFlow UI global error]",e.error||e.message,{filename:e.filename,lineno:e.lineno,colno:e.colno})});window.addEventListener("unhandledrejection",e=>{console.error("[AgentFlow UI unhandled rejection]",e.reason)});const S1=document.querySelector('link[rel="icon"]');S1&&(S1.href=FE);Qy.createRoot(document.getElementById("root")).render(o.jsx(nt.StrictMode,{children:o.jsx(Ese,{})}));
|