@fieldwangai/agentflow 0.1.37 → 0.1.39
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/admin-builtin-pipelines.mjs +110 -0
- package/bin/lib/catalog-flows.mjs +35 -2
- package/bin/lib/locales/en.json +4 -0
- package/bin/lib/locales/zh.json +4 -0
- package/bin/lib/marketplace.mjs +18 -0
- package/bin/lib/ui-server.mjs +176 -21
- package/bin/lib/workspace-tree.mjs +3 -0
- package/builtin/nodes/display_table.md +31 -0
- package/builtin/web-ui/dist/assets/index-B7-hwwU7.css +1 -0
- package/builtin/web-ui/dist/assets/index-Cchb13X1.js +218 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-B0FRh8GY.js +0 -214
- package/builtin/web-ui/dist/assets/index-xdncUuHG.css +0 -1
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
var x2=Object.defineProperty;var w2=(e,t,n)=>t in e?x2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Tn=(e,t,n)=>w2(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 hd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Na(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u1={exports:{}},hm={},d1={exports:{}},_t={};/**
|
|
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 ef=Symbol.for("react.element"),v2=Symbol.for("react.portal"),b2=Symbol.for("react.fragment"),k2=Symbol.for("react.strict_mode"),S2=Symbol.for("react.profiler"),N2=Symbol.for("react.provider"),j2=Symbol.for("react.context"),C2=Symbol.for("react.forward_ref"),E2=Symbol.for("react.suspense"),_2=Symbol.for("react.memo"),P2=Symbol.for("react.lazy"),i0=Symbol.iterator;function A2(e){return e===null||typeof e!="object"?null:(e=i0&&e[i0]||e["@@iterator"],typeof e=="function"?e:null)}var f1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p1=Object.assign,h1={};function Kc(e,t,n){this.props=e,this.context=t,this.refs=h1,this.updater=n||f1}Kc.prototype.isReactComponent={};Kc.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")};Kc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function m1(){}m1.prototype=Kc.prototype;function Tw(e,t,n){this.props=e,this.context=t,this.refs=h1,this.updater=n||f1}var Rw=Tw.prototype=new m1;Rw.constructor=Tw;p1(Rw,Kc.prototype);Rw.isPureReactComponent=!0;var o0=Array.isArray,g1=Object.prototype.hasOwnProperty,Lw={current:null},y1={key:!0,ref:!0,__self:!0,__source:!0};function x1(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)g1.call(t,r)&&!y1.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:ef,type:e,key:i,ref:a,props:s,_owner:Lw.current}}function I2(e,t){return{$$typeof:ef,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ow(e){return typeof e=="object"&&e!==null&&e.$$typeof===ef}function T2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var a0=/\/+/g;function Sg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?T2(""+e.key):t.toString(36)}function Dp(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 ef:case v2:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+Sg(a,0):r,o0(s)?(n="",e!=null&&(n=e.replace(a0,"$&/")+"/"),Dp(s,t,n,"",function(d){return d})):s!=null&&(Ow(s)&&(s=I2(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(a0,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",o0(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Sg(i,l);a+=Dp(i,t,n,c,s)}else if(c=A2(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Sg(i,l++),a+=Dp(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 qf(e,t,n){if(e==null)return e;var r=[],s=0;return Dp(e,r,"","",function(i){return t.call(n,i,s++)}),r}function R2(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 zr={current:null},Fp={transition:null},L2={ReactCurrentDispatcher:zr,ReactCurrentBatchConfig:Fp,ReactCurrentOwner:Lw};function w1(){throw Error("act(...) is not supported in production builds of React.")}_t.Children={map:qf,forEach:function(e,t,n){qf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return qf(e,function(){t++}),t},toArray:function(e){return qf(e,function(t){return t})||[]},only:function(e){if(!Ow(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};_t.Component=Kc;_t.Fragment=b2;_t.Profiler=S2;_t.PureComponent=Tw;_t.StrictMode=k2;_t.Suspense=E2;_t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L2;_t.act=w1;_t.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=p1({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Lw.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)g1.call(t,c)&&!y1.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:ef,type:e.type,key:s,ref:i,props:r,_owner:a}};_t.createContext=function(e){return e={$$typeof:j2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:N2,_context:e},e.Consumer=e};_t.createElement=x1;_t.createFactory=function(e){var t=x1.bind(null,e);return t.type=e,t};_t.createRef=function(){return{current:null}};_t.forwardRef=function(e){return{$$typeof:C2,render:e}};_t.isValidElement=Ow;_t.lazy=function(e){return{$$typeof:P2,_payload:{_status:-1,_result:e},_init:R2}};_t.memo=function(e,t){return{$$typeof:_2,type:e,compare:t===void 0?null:t}};_t.startTransition=function(e){var t=Fp.transition;Fp.transition={};try{e()}finally{Fp.transition=t}};_t.unstable_act=w1;_t.useCallback=function(e,t){return zr.current.useCallback(e,t)};_t.useContext=function(e){return zr.current.useContext(e)};_t.useDebugValue=function(){};_t.useDeferredValue=function(e){return zr.current.useDeferredValue(e)};_t.useEffect=function(e,t){return zr.current.useEffect(e,t)};_t.useId=function(){return zr.current.useId()};_t.useImperativeHandle=function(e,t,n){return zr.current.useImperativeHandle(e,t,n)};_t.useInsertionEffect=function(e,t){return zr.current.useInsertionEffect(e,t)};_t.useLayoutEffect=function(e,t){return zr.current.useLayoutEffect(e,t)};_t.useMemo=function(e,t){return zr.current.useMemo(e,t)};_t.useReducer=function(e,t,n){return zr.current.useReducer(e,t,n)};_t.useRef=function(e){return zr.current.useRef(e)};_t.useState=function(e){return zr.current.useState(e)};_t.useSyncExternalStore=function(e,t,n){return zr.current.useSyncExternalStore(e,t,n)};_t.useTransition=function(){return zr.current.useTransition()};_t.version="18.3.1";d1.exports=_t;var m=d1.exports;const Ze=Na(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 O2=m,M2=Symbol.for("react.element"),$2=Symbol.for("react.fragment"),D2=Object.prototype.hasOwnProperty,F2=O2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,z2={key:!0,ref:!0,__self:!0,__source:!0};function v1(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)D2.call(t,r)&&!z2.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:M2,type:e,key:i,ref:a,props:s,_owner:F2.current}}hm.Fragment=$2;hm.jsx=v1;hm.jsxs=v1;u1.exports=hm;var o=u1.exports,Uy={},b1={exports:{}},Es={},k1={exports:{}},S1={};/**
|
|
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,T){var E=P.length;P.push(T);e:for(;0<E;){var J=E-1>>>1,Q=P[J];if(0<s(Q,T))P[J]=T,P[E]=Q,E=J;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var T=P[0],E=P.pop();if(E!==T){P[0]=E;e:for(var J=0,Q=P.length,H=Q>>>1;J<H;){var te=2*(J+1)-1,le=P[te],ue=te+1,de=P[ue];if(0>s(le,E))ue<Q&&0>s(de,le)?(P[J]=de,P[ue]=E,J=ue):(P[J]=le,P[te]=E,J=te);else if(ue<Q&&0>s(de,E))P[J]=de,P[ue]=E,J=ue;else break e}}return T}function s(P,T){var E=P.sortIndex-T.sortIndex;return E!==0?E:P.id-T.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=[],u=1,f=null,p=3,h=!1,g=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=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 T=n(d);T!==null;){if(T.callback===null)r(d);else if(T.startTime<=P)r(d),T.sortIndex=T.expirationTime,t(c,T);else break;T=n(d)}}function N(P){if(k=!1,w(P),!g)if(n(c)!==null)g=!0,I(C);else{var T=n(d);T!==null&&z(N,T.startTime-P)}}function C(P,T){g=!1,k&&(k=!1,y(R),R=-1),h=!0;var E=p;try{for(w(T),f=n(c);f!==null&&(!(f.expirationTime>T)||P&&!D());){var J=f.callback;if(typeof J=="function"){f.callback=null,p=f.priorityLevel;var Q=J(f.expirationTime<=T);T=e.unstable_now(),typeof Q=="function"?f.callback=Q:f===n(c)&&r(c),w(T)}else r(c);f=n(c)}if(f!==null)var H=!0;else{var te=n(d);te!==null&&z(N,te.startTime-T),H=!1}return H}finally{f=null,p=E,h=!1}}var S=!1,A=null,R=-1,M=5,V=-1;function D(){return!(e.unstable_now()-V<M)}function O(){if(A!==null){var P=e.unstable_now();V=P;var T=!0;try{T=A(!0,P)}finally{T?K():(S=!1,A=null)}}else S=!1}var K;if(typeof v=="function")K=function(){v(O)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,L=$.port2;$.port1.onmessage=O,K=function(){L.postMessage(null)}}else K=function(){b(O,0)};function I(P){A=P,S||(S=!0,K())}function z(P,T){R=b(function(){P(e.unstable_now())},T)}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"):M=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 T=3;break;default:T=p}var E=p;p=T;try{return P()}finally{p=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,T){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var E=p;p=P;try{return T()}finally{p=E}},e.unstable_scheduleCallback=function(P,T,E){var J=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?J+E:J):E=J,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=E+Q,P={id:u++,callback:T,priorityLevel:P,startTime:E,expirationTime:Q,sortIndex:-1},E>J?(P.sortIndex=E,t(d,P),n(c)===null&&P===n(d)&&(k?(y(R),R=-1):k=!0,z(N,E-J))):(P.sortIndex=Q,t(c,P),g||h||(g=!0,I(C))),P},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(P){var T=p;return function(){var E=p;p=T;try{return P.apply(this,arguments)}finally{p=E}}}})(S1);k1.exports=S1;var B2=k1.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 H2=m,js=B2;function Se(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 N1=new Set,md={};function xl(e,t){jc(e,t),jc(e+"Capture",t)}function jc(e,t){for(md[e]=t,e=0;e<t.length;e++)N1.add(t[e])}var wo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wy=Object.prototype.hasOwnProperty,U2=/^[: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]*$/,l0={},c0={};function W2(e){return Wy.call(c0,e)?!0:Wy.call(l0,e)?!1:U2.test(e)?c0[e]=!0:(l0[e]=!0,!1)}function V2(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 K2(e,t,n,r){if(t===null||typeof t>"u"||V2(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 Br(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 kr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){kr[e]=new Br(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];kr[t]=new Br(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){kr[e]=new Br(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){kr[e]=new Br(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){kr[e]=new Br(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){kr[e]=new Br(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){kr[e]=new Br(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){kr[e]=new Br(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){kr[e]=new Br(e,5,!1,e.toLowerCase(),null,!1,!1)});var Mw=/[\-:]([a-z])/g;function $w(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(Mw,$w);kr[t]=new Br(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(Mw,$w);kr[t]=new Br(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(Mw,$w);kr[t]=new Br(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){kr[e]=new Br(e,1,!1,e.toLowerCase(),null,!1,!1)});kr.xlinkHref=new Br("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){kr[e]=new Br(e,1,!1,e.toLowerCase(),null,!0,!0)});function Dw(e,t,n,r){var s=kr.hasOwnProperty(t)?kr[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(K2(t,n,s,r)&&(n=null),r||s===null?W2(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 Co=H2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Yf=Symbol.for("react.element"),Gl=Symbol.for("react.portal"),Jl=Symbol.for("react.fragment"),Fw=Symbol.for("react.strict_mode"),Vy=Symbol.for("react.profiler"),j1=Symbol.for("react.provider"),C1=Symbol.for("react.context"),zw=Symbol.for("react.forward_ref"),Ky=Symbol.for("react.suspense"),qy=Symbol.for("react.suspense_list"),Bw=Symbol.for("react.memo"),Go=Symbol.for("react.lazy"),E1=Symbol.for("react.offscreen"),u0=Symbol.iterator;function wu(e){return e===null||typeof e!="object"?null:(e=u0&&e[u0]||e["@@iterator"],typeof e=="function"?e:null)}var En=Object.assign,Ng;function Fu(e){if(Ng===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ng=t&&t[1]||""}return`
|
|
34
|
-
`+Ng+e}var jg=!1;function Cg(e,t){if(!e||jg)return"";jg=!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{jg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Fu(e):""}function q2(e){switch(e.tag){case 5:return Fu(e.type);case 16:return Fu("Lazy");case 13:return Fu("Suspense");case 19:return Fu("SuspenseList");case 0:case 2:case 15:return e=Cg(e.type,!1),e;case 11:return e=Cg(e.type.render,!1),e;case 1:return e=Cg(e.type,!0),e;default:return""}}function Yy(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 Jl:return"Fragment";case Gl:return"Portal";case Vy:return"Profiler";case Fw:return"StrictMode";case Ky:return"Suspense";case qy:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case C1:return(e.displayName||"Context")+".Consumer";case j1: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 Bw:return t=e.displayName||null,t!==null?t:Yy(e.type)||"Memo";case Go:t=e._payload,e=e._init;try{return Yy(e(t))}catch{}}return null}function Y2(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 Yy(t);case 8:return t===Fw?"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 ya(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function G2(e){var t=_1(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 Gf(e){e._valueTracker||(e._valueTracker=G2(e))}function P1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=_1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function lh(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 Gy(e,t){var n=t.checked;return En({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function d0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ya(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 A1(e,t){t=t.checked,t!=null&&Dw(e,"checked",t,!1)}function Jy(e,t){A1(e,t);var n=ya(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")?Xy(e,t.type,n):t.hasOwnProperty("defaultValue")&&Xy(e,t.type,ya(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function f0(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 Xy(e,t,n){(t!=="number"||lh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zu=Array.isArray;function hc(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=""+ya(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 Qy(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Se(91));return En({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function p0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Se(92));if(zu(n)){if(1<n.length)throw Error(Se(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ya(n)}}function I1(e,t){var n=ya(t.value),r=ya(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 h0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function T1(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 Zy(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?T1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Jf,R1=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(Jf=Jf||document.createElement("div"),Jf.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Jf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function gd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gu={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},J2=["Webkit","ms","Moz","O"];Object.keys(Gu).forEach(function(e){J2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Gu[t]=Gu[e]})});function L1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Gu.hasOwnProperty(e)&&Gu[e]?(""+t).trim():t+"px"}function O1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=L1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var X2=En({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 ex(e,t){if(t){if(X2[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Se(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Se(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Se(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Se(62))}}function tx(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 nx=null;function Hw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rx=null,mc=null,gc=null;function m0(e){if(e=rf(e)){if(typeof rx!="function")throw Error(Se(280));var t=e.stateNode;t&&(t=wm(t),rx(e.stateNode,e.type,t))}}function M1(e){mc?gc?gc.push(e):gc=[e]:mc=e}function $1(){if(mc){var e=mc,t=gc;if(gc=mc=null,m0(e),t)for(e=0;e<t.length;e++)m0(t[e])}}function D1(e,t){return e(t)}function F1(){}var Eg=!1;function z1(e,t,n){if(Eg)return e(t,n);Eg=!0;try{return D1(e,t,n)}finally{Eg=!1,(mc!==null||gc!==null)&&(F1(),$1())}}function yd(e,t){var n=e.stateNode;if(n===null)return null;var r=wm(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(Se(231,t,typeof n));return n}var sx=!1;if(wo)try{var vu={};Object.defineProperty(vu,"passive",{get:function(){sx=!0}}),window.addEventListener("test",vu,vu),window.removeEventListener("test",vu,vu)}catch{sx=!1}function Q2(e,t,n,r,s,i,a,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var Ju=!1,ch=null,uh=!1,ix=null,Z2={onError:function(e){Ju=!0,ch=e}};function eR(e,t,n,r,s,i,a,l,c){Ju=!1,ch=null,Q2.apply(Z2,arguments)}function tR(e,t,n,r,s,i,a,l,c){if(eR.apply(this,arguments),Ju){if(Ju){var d=ch;Ju=!1,ch=null}else throw Error(Se(198));uh||(uh=!0,ix=d)}}function wl(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 B1(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 g0(e){if(wl(e)!==e)throw Error(Se(188))}function nR(e){var t=e.alternate;if(!t){if(t=wl(e),t===null)throw Error(Se(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 g0(s),e;if(i===r)return g0(s),t;i=i.sibling}throw Error(Se(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(Se(189))}}if(n.alternate!==r)throw Error(Se(190))}if(n.tag!==3)throw Error(Se(188));return n.stateNode.current===n?e:t}function H1(e){return e=nR(e),e!==null?U1(e):null}function U1(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=U1(e);if(t!==null)return t;e=e.sibling}return null}var W1=js.unstable_scheduleCallback,y0=js.unstable_cancelCallback,rR=js.unstable_shouldYield,sR=js.unstable_requestPaint,zn=js.unstable_now,iR=js.unstable_getCurrentPriorityLevel,Uw=js.unstable_ImmediatePriority,V1=js.unstable_UserBlockingPriority,dh=js.unstable_NormalPriority,oR=js.unstable_LowPriority,K1=js.unstable_IdlePriority,mm=null,Hi=null;function aR(e){if(Hi&&typeof Hi.onCommitFiberRoot=="function")try{Hi.onCommitFiberRoot(mm,e,void 0,(e.current.flags&128)===128)}catch{}}var gi=Math.clz32?Math.clz32:uR,lR=Math.log,cR=Math.LN2;function uR(e){return e>>>=0,e===0?32:31-(lR(e)/cR|0)|0}var Xf=64,Qf=4194304;function Bu(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 fh(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=Bu(l):(i&=a,i!==0&&(r=Bu(i)))}else a=n&~s,a!==0?r=Bu(a):i!==0&&(r=Bu(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-gi(t),s=1<<n,r|=e[n],t&=~s;return r}function dR(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 fR(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-gi(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=dR(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function ox(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function q1(){var e=Xf;return Xf<<=1,!(Xf&4194240)&&(Xf=64),e}function _g(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function tf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-gi(t),e[t]=n}function pR(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-gi(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Ww(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-gi(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var qt=0;function Y1(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var G1,Vw,J1,X1,Q1,ax=!1,Zf=[],ia=null,oa=null,aa=null,xd=new Map,wd=new Map,Qo=[],hR="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 x0(e,t){switch(e){case"focusin":case"focusout":ia=null;break;case"dragenter":case"dragleave":oa=null;break;case"mouseover":case"mouseout":aa=null;break;case"pointerover":case"pointerout":xd.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":wd.delete(t.pointerId)}}function bu(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=rf(t),t!==null&&Vw(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 ia=bu(ia,e,t,n,r,s),!0;case"dragenter":return oa=bu(oa,e,t,n,r,s),!0;case"mouseover":return aa=bu(aa,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return xd.set(i,bu(xd.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,wd.set(i,bu(wd.get(i)||null,e,t,n,r,s)),!0}return!1}function Z1(e){var t=Xa(e.target);if(t!==null){var n=wl(t);if(n!==null){if(t=n.tag,t===13){if(t=B1(n),t!==null){e.blockedOn=t,Q1(e.priority,function(){J1(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 zp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=lx(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);nx=r,n.target.dispatchEvent(r),nx=null}else return t=rf(n),t!==null&&Vw(t),e.blockedOn=n,!1;t.shift()}return!0}function w0(e,t,n){zp(e)&&n.delete(t)}function gR(){ax=!1,ia!==null&&zp(ia)&&(ia=null),oa!==null&&zp(oa)&&(oa=null),aa!==null&&zp(aa)&&(aa=null),xd.forEach(w0),wd.forEach(w0)}function ku(e,t){e.blockedOn===t&&(e.blockedOn=null,ax||(ax=!0,js.unstable_scheduleCallback(js.unstable_NormalPriority,gR)))}function vd(e){function t(s){return ku(s,e)}if(0<Zf.length){ku(Zf[0],e);for(var n=1;n<Zf.length;n++){var r=Zf[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ia!==null&&ku(ia,e),oa!==null&&ku(oa,e),aa!==null&&ku(aa,e),xd.forEach(t),wd.forEach(t),n=0;n<Qo.length;n++)r=Qo[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qo.length&&(n=Qo[0],n.blockedOn===null);)Z1(n),n.blockedOn===null&&Qo.shift()}var yc=Co.ReactCurrentBatchConfig,ph=!0;function yR(e,t,n,r){var s=qt,i=yc.transition;yc.transition=null;try{qt=1,Kw(e,t,n,r)}finally{qt=s,yc.transition=i}}function xR(e,t,n,r){var s=qt,i=yc.transition;yc.transition=null;try{qt=4,Kw(e,t,n,r)}finally{qt=s,yc.transition=i}}function Kw(e,t,n,r){if(ph){var s=lx(e,t,n,r);if(s===null)Dg(e,t,r,hh,n),x0(e,r);else if(mR(s,e,t,n,r))r.stopPropagation();else if(x0(e,r),t&4&&-1<hR.indexOf(e)){for(;s!==null;){var i=rf(s);if(i!==null&&G1(i),i=lx(e,t,n,r),i===null&&Dg(e,t,r,hh,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Dg(e,t,r,null,n)}}var hh=null;function lx(e,t,n,r){if(hh=null,e=Hw(r),e=Xa(e),e!==null)if(t=wl(e),t===null)e=null;else if(n=t.tag,n===13){if(e=B1(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 hh=e,null}function eC(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(iR()){case Uw:return 1;case V1:return 4;case dh:case oR:return 16;case K1:return 536870912;default:return 16}default:return 16}}var ta=null,qw=null,Bp=null;function tC(){if(Bp)return Bp;var e,t=qw,n=t.length,r,s="value"in ta?ta.value:ta.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 Bp=s.slice(e,1<r?1-r:void 0)}function Hp(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 ep(){return!0}function v0(){return!1}function _s(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)?ep:v0,this.isPropagationStopped=v0,this}return En(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=ep)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ep)},persist:function(){},isPersistent:ep}),t}var qc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yw=_s(qc),nf=En({},qc,{view:0,detail:0}),wR=_s(nf),Pg,Ag,Su,gm=En({},nf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gw,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!==Su&&(Su&&e.type==="mousemove"?(Pg=e.screenX-Su.screenX,Ag=e.screenY-Su.screenY):Ag=Pg=0,Su=e),Pg)},movementY:function(e){return"movementY"in e?e.movementY:Ag}}),b0=_s(gm),vR=En({},gm,{dataTransfer:0}),bR=_s(vR),kR=En({},nf,{relatedTarget:0}),Ig=_s(kR),SR=En({},qc,{animationName:0,elapsedTime:0,pseudoElement:0}),NR=_s(SR),jR=En({},qc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),CR=_s(jR),ER=En({},qc,{data:0}),k0=_s(ER),_R={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},PR={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"},AR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=AR[e])?!!t[e]:!1}function Gw(){return IR}var TR=En({},nf,{key:function(e){if(e.key){var t=_R[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Hp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?PR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gw,charCode:function(e){return e.type==="keypress"?Hp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),RR=_s(TR),LR=En({},gm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),S0=_s(LR),OR=En({},nf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gw}),MR=_s(OR),$R=En({},qc,{propertyName:0,elapsedTime:0,pseudoElement:0}),DR=_s($R),FR=En({},gm,{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}),zR=_s(FR),BR=[9,13,27,32],Jw=wo&&"CompositionEvent"in window,Xu=null;wo&&"documentMode"in document&&(Xu=document.documentMode);var HR=wo&&"TextEvent"in window&&!Xu,nC=wo&&(!Jw||Xu&&8<Xu&&11>=Xu),N0=" ",j0=!1;function rC(e,t){switch(e){case"keyup":return BR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xl=!1;function UR(e,t){switch(e){case"compositionend":return sC(t);case"keypress":return t.which!==32?null:(j0=!0,N0);case"textInput":return e=t.data,e===N0&&j0?null:e;default:return null}}function WR(e,t){if(Xl)return e==="compositionend"||!Jw&&rC(e,t)?(e=tC(),Bp=qw=ta=null,Xl=!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 nC&&t.locale!=="ko"?null:t.data;default:return null}}var VR={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 C0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!VR[e.type]:t==="textarea"}function iC(e,t,n,r){M1(r),t=mh(t,"onChange"),0<t.length&&(n=new Yw("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Qu=null,bd=null;function KR(e){gC(e,0)}function ym(e){var t=ec(e);if(P1(t))return e}function qR(e,t){if(e==="change")return t}var oC=!1;if(wo){var Tg;if(wo){var Rg="oninput"in document;if(!Rg){var E0=document.createElement("div");E0.setAttribute("oninput","return;"),Rg=typeof E0.oninput=="function"}Tg=Rg}else Tg=!1;oC=Tg&&(!document.documentMode||9<document.documentMode)}function _0(){Qu&&(Qu.detachEvent("onpropertychange",aC),bd=Qu=null)}function aC(e){if(e.propertyName==="value"&&ym(bd)){var t=[];iC(t,bd,e,Hw(e)),z1(KR,t)}}function YR(e,t,n){e==="focusin"?(_0(),Qu=t,bd=n,Qu.attachEvent("onpropertychange",aC)):e==="focusout"&&_0()}function GR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ym(bd)}function JR(e,t){if(e==="click")return ym(t)}function XR(e,t){if(e==="input"||e==="change")return ym(t)}function QR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xi=typeof Object.is=="function"?Object.is:QR;function kd(e,t){if(xi(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(!Wy.call(t,s)||!xi(e[s],t[s]))return!1}return!0}function P0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function A0(e,t){var n=P0(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=P0(n)}}function lC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cC(){for(var e=window,t=lh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=lh(e.document)}return t}function Xw(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 ZR(e){var t=cC(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&lC(n.ownerDocument.documentElement,n)){if(r!==null&&Xw(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=A0(n,i);var a=A0(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 eL=wo&&"documentMode"in document&&11>=document.documentMode,Ql=null,cx=null,Zu=null,ux=!1;function I0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ux||Ql==null||Ql!==lh(r)||(r=Ql,"selectionStart"in r&&Xw(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}),Zu&&kd(Zu,r)||(Zu=r,r=mh(cx,"onSelect"),0<r.length&&(t=new Yw("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ql)))}function tp(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Zl={animationend:tp("Animation","AnimationEnd"),animationiteration:tp("Animation","AnimationIteration"),animationstart:tp("Animation","AnimationStart"),transitionend:tp("Transition","TransitionEnd")},Lg={},uC={};wo&&(uC=document.createElement("div").style,"AnimationEvent"in window||(delete Zl.animationend.animation,delete Zl.animationiteration.animation,delete Zl.animationstart.animation),"TransitionEvent"in window||delete Zl.transitionend.transition);function xm(e){if(Lg[e])return Lg[e];if(!Zl[e])return e;var t=Zl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in uC)return Lg[e]=t[n];return e}var dC=xm("animationend"),fC=xm("animationiteration"),pC=xm("animationstart"),hC=xm("transitionend"),mC=new Map,T0="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 ja(e,t){mC.set(e,t),xl(t,[e])}for(var Og=0;Og<T0.length;Og++){var Mg=T0[Og],tL=Mg.toLowerCase(),nL=Mg[0].toUpperCase()+Mg.slice(1);ja(tL,"on"+nL)}ja(dC,"onAnimationEnd");ja(fC,"onAnimationIteration");ja(pC,"onAnimationStart");ja("dblclick","onDoubleClick");ja("focusin","onFocus");ja("focusout","onBlur");ja(hC,"onTransitionEnd");jc("onMouseEnter",["mouseout","mouseover"]);jc("onMouseLeave",["mouseout","mouseover"]);jc("onPointerEnter",["pointerout","pointerover"]);jc("onPointerLeave",["pointerout","pointerover"]);xl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));xl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));xl("onBeforeInput",["compositionend","keypress","textInput","paste"]);xl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));xl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));xl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hu="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(" "),rL=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hu));function R0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,tR(r,t,void 0,e),e.currentTarget=null}function gC(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;R0(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;R0(s,l,d),i=c}}}if(uh)throw e=ix,uh=!1,ix=null,e}function gn(e,t){var n=t[mx];n===void 0&&(n=t[mx]=new Set);var r=e+"__bubble";n.has(r)||(yC(t,e,2,!1),n.add(r))}function $g(e,t,n){var r=0;t&&(r|=4),yC(n,e,r,t)}var np="_reactListening"+Math.random().toString(36).slice(2);function Sd(e){if(!e[np]){e[np]=!0,N1.forEach(function(n){n!=="selectionchange"&&(rL.has(n)||$g(n,!1,e),$g(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[np]||(t[np]=!0,$g("selectionchange",!1,t))}}function yC(e,t,n,r){switch(eC(t)){case 1:var s=yR;break;case 4:s=xR;break;default:s=Kw}n=s.bind(null,t,n,e),s=void 0,!sx||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 Dg(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=Xa(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}z1(function(){var d=i,u=Hw(n),f=[];e:{var p=mC.get(e);if(p!==void 0){var h=Yw,g=e;switch(e){case"keypress":if(Hp(n)===0)break e;case"keydown":case"keyup":h=RR;break;case"focusin":g="focus",h=Ig;break;case"focusout":g="blur",h=Ig;break;case"beforeblur":case"afterblur":h=Ig;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=b0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=bR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=MR;break;case dC:case fC:case pC:h=NR;break;case hC:h=DR;break;case"scroll":h=wR;break;case"wheel":h=zR;break;case"copy":case"cut":case"paste":h=CR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=S0}var k=(t&4)!==0,b=!k&&e==="scroll",y=k?p!==null?p+"Capture":null:p;k=[];for(var v=d,w;v!==null;){w=v;var N=w.stateNode;if(w.tag===5&&N!==null&&(w=N,y!==null&&(N=yd(v,y),N!=null&&k.push(Nd(v,N,w)))),b)break;v=v.return}0<k.length&&(p=new h(p,g,null,n,u),f.push({event:p,listeners:k}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==nx&&(g=n.relatedTarget||n.fromElement)&&(Xa(g)||g[vo]))break e;if((h||p)&&(p=u.window===u?u:(p=u.ownerDocument)?p.defaultView||p.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=d,g=g?Xa(g):null,g!==null&&(b=wl(g),g!==b||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=d),h!==g)){if(k=b0,N="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(k=S0,N="onPointerLeave",y="onPointerEnter",v="pointer"),b=h==null?p:ec(h),w=g==null?p:ec(g),p=new k(N,v+"leave",h,n,u),p.target=b,p.relatedTarget=w,N=null,Xa(u)===d&&(k=new k(y,v+"enter",g,n,u),k.target=w,k.relatedTarget=b,N=k),b=N,h&&g)t:{for(k=h,y=g,v=0,w=k;w;w=Fl(w))v++;for(w=0,N=y;N;N=Fl(N))w++;for(;0<v-w;)k=Fl(k),v--;for(;0<w-v;)y=Fl(y),w--;for(;v--;){if(k===y||y!==null&&k===y.alternate)break t;k=Fl(k),y=Fl(y)}k=null}else k=null;h!==null&&L0(f,p,h,k,!1),g!==null&&b!==null&&L0(f,b,g,k,!0)}}e:{if(p=d?ec(d):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var C=qR;else if(C0(p))if(oC)C=XR;else{C=GR;var S=YR}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=JR);if(C&&(C=C(e,d))){iC(f,C,n,u);break e}S&&S(e,p,d),e==="focusout"&&(S=p._wrapperState)&&S.controlled&&p.type==="number"&&Xy(p,"number",p.value)}switch(S=d?ec(d):window,e){case"focusin":(C0(S)||S.contentEditable==="true")&&(Ql=S,cx=d,Zu=null);break;case"focusout":Zu=cx=Ql=null;break;case"mousedown":ux=!0;break;case"contextmenu":case"mouseup":case"dragend":ux=!1,I0(f,n,u);break;case"selectionchange":if(eL)break;case"keydown":case"keyup":I0(f,n,u)}var A;if(Jw)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else Xl?rC(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(nC&&n.locale!=="ko"&&(Xl||R!=="onCompositionStart"?R==="onCompositionEnd"&&Xl&&(A=tC()):(ta=u,qw="value"in ta?ta.value:ta.textContent,Xl=!0)),S=mh(d,R),0<S.length&&(R=new k0(R,e,null,n,u),f.push({event:R,listeners:S}),A?R.data=A:(A=sC(n),A!==null&&(R.data=A)))),(A=HR?UR(e,n):WR(e,n))&&(d=mh(d,"onBeforeInput"),0<d.length&&(u=new k0("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:d}),u.data=A))}gC(f,t)})}function Nd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function mh(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=yd(e,n),i!=null&&r.unshift(Nd(e,i,s)),i=yd(e,t),i!=null&&r.push(Nd(e,i,s))),e=e.return}return r}function Fl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function L0(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=yd(n,i),c!=null&&a.unshift(Nd(n,c,l))):s||(c=yd(n,i),c!=null&&a.push(Nd(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var sL=/\r\n?/g,iL=/\u0000|\uFFFD/g;function O0(e){return(typeof e=="string"?e:""+e).replace(sL,`
|
|
38
|
-
`).replace(iL,"")}function rp(e,t,n){if(t=O0(t),O0(e)!==t&&n)throw Error(Se(425))}function gh(){}var dx=null,fx=null;function px(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 hx=typeof setTimeout=="function"?setTimeout:void 0,oL=typeof clearTimeout=="function"?clearTimeout:void 0,M0=typeof Promise=="function"?Promise:void 0,aL=typeof queueMicrotask=="function"?queueMicrotask:typeof M0<"u"?function(e){return M0.resolve(null).then(e).catch(lL)}:hx;function lL(e){setTimeout(function(){throw e})}function Fg(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),vd(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);vd(t)}function la(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 $0(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 Yc=Math.random().toString(36).slice(2),Di="__reactFiber$"+Yc,jd="__reactProps$"+Yc,vo="__reactContainer$"+Yc,mx="__reactEvents$"+Yc,cL="__reactListeners$"+Yc,uL="__reactHandles$"+Yc;function Xa(e){var t=e[Di];if(t)return t;for(var n=e.parentNode;n;){if(t=n[vo]||n[Di]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=$0(e);e!==null;){if(n=e[Di])return n;e=$0(e)}return t}e=n,n=e.parentNode}return null}function rf(e){return e=e[Di]||e[vo],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ec(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Se(33))}function wm(e){return e[jd]||null}var gx=[],tc=-1;function Ca(e){return{current:e}}function xn(e){0>tc||(e.current=gx[tc],gx[tc]=null,tc--)}function dn(e,t){tc++,gx[tc]=e.current,e.current=t}var xa={},Tr=Ca(xa),rs=Ca(!1),al=xa;function Cc(e,t){var n=e.type.contextTypes;if(!n)return xa;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 ss(e){return e=e.childContextTypes,e!=null}function yh(){xn(rs),xn(Tr)}function D0(e,t,n){if(Tr.current!==xa)throw Error(Se(168));dn(Tr,t),dn(rs,n)}function xC(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(Se(108,Y2(e)||"Unknown",s));return En({},n,r)}function xh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xa,al=Tr.current,dn(Tr,e),dn(rs,rs.current),!0}function F0(e,t,n){var r=e.stateNode;if(!r)throw Error(Se(169));n?(e=xC(e,t,al),r.__reactInternalMemoizedMergedChildContext=e,xn(rs),xn(Tr),dn(Tr,e)):xn(rs),dn(rs,n)}var uo=null,vm=!1,zg=!1;function wC(e){uo===null?uo=[e]:uo.push(e)}function dL(e){vm=!0,wC(e)}function Ea(){if(!zg&&uo!==null){zg=!0;var e=0,t=qt;try{var n=uo;for(qt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}uo=null,vm=!1}catch(s){throw uo!==null&&(uo=uo.slice(e+1)),W1(Uw,Ea),s}finally{qt=t,zg=!1}}return null}var nc=[],rc=0,wh=null,vh=0,$s=[],Ds=0,ll=null,ho=1,mo="";function qa(e,t){nc[rc++]=vh,nc[rc++]=wh,wh=e,vh=t}function vC(e,t,n){$s[Ds++]=ho,$s[Ds++]=mo,$s[Ds++]=ll,ll=e;var r=ho;e=mo;var s=32-gi(r)-1;r&=~(1<<s),n+=1;var i=32-gi(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,ho=1<<32-gi(t)+s|n<<s|r,mo=i+e}else ho=1<<i|n<<s|r,mo=e}function Qw(e){e.return!==null&&(qa(e,1),vC(e,1,0))}function Zw(e){for(;e===wh;)wh=nc[--rc],nc[rc]=null,vh=nc[--rc],nc[rc]=null;for(;e===ll;)ll=$s[--Ds],$s[Ds]=null,mo=$s[--Ds],$s[Ds]=null,ho=$s[--Ds],$s[Ds]=null}var Ss=null,bs=null,Sn=!1,di=null;function bC(e,t){var n=Bs(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 z0(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,Ss=e,bs=la(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ss=e,bs=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ll!==null?{id:ho,overflow:mo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Bs(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ss=e,bs=null,!0):!1;default:return!1}}function yx(e){return(e.mode&1)!==0&&(e.flags&128)===0}function xx(e){if(Sn){var t=bs;if(t){var n=t;if(!z0(e,t)){if(yx(e))throw Error(Se(418));t=la(n.nextSibling);var r=Ss;t&&z0(e,t)?bC(r,n):(e.flags=e.flags&-4097|2,Sn=!1,Ss=e)}}else{if(yx(e))throw Error(Se(418));e.flags=e.flags&-4097|2,Sn=!1,Ss=e}}}function B0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ss=e}function sp(e){if(e!==Ss)return!1;if(!Sn)return B0(e),Sn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!px(e.type,e.memoizedProps)),t&&(t=bs)){if(yx(e))throw kC(),Error(Se(418));for(;t;)bC(e,t),t=la(t.nextSibling)}if(B0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Se(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){bs=la(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}bs=null}}else bs=Ss?la(e.stateNode.nextSibling):null;return!0}function kC(){for(var e=bs;e;)e=la(e.nextSibling)}function Ec(){bs=Ss=null,Sn=!1}function ev(e){di===null?di=[e]:di.push(e)}var fL=Co.ReactCurrentBatchConfig;function Nu(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(Se(309));var r=n.stateNode}if(!r)throw Error(Se(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(Se(284));if(!n._owner)throw Error(Se(290,e))}return e}function ip(e,t){throw e=Object.prototype.toString.call(t),Error(Se(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function H0(e){var t=e._init;return t(e._payload)}function SC(e){function t(y,v){if(e){var w=y.deletions;w===null?(y.deletions=[v],y.flags|=16):w.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function s(y,v){return y=fa(y,v),y.index=0,y.sibling=null,y}function i(y,v,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<v?(y.flags|=2,v):w):(y.flags|=2,v)):(y.flags|=1048576,v)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,v,w,N){return v===null||v.tag!==6?(v=qg(w,y.mode,N),v.return=y,v):(v=s(v,w),v.return=y,v)}function c(y,v,w,N){var C=w.type;return C===Jl?u(y,v,w.props.children,N,w.key):v!==null&&(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Go&&H0(C)===v.type)?(N=s(v,w.props),N.ref=Nu(y,v,w),N.return=y,N):(N=Gp(w.type,w.key,w.props,null,y.mode,N),N.ref=Nu(y,v,w),N.return=y,N)}function d(y,v,w,N){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=Yg(w,y.mode,N),v.return=y,v):(v=s(v,w.children||[]),v.return=y,v)}function u(y,v,w,N,C){return v===null||v.tag!==7?(v=nl(w,y.mode,N,C),v.return=y,v):(v=s(v,w),v.return=y,v)}function f(y,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=qg(""+v,y.mode,w),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Yf:return w=Gp(v.type,v.key,v.props,null,y.mode,w),w.ref=Nu(y,null,v),w.return=y,w;case Gl:return v=Yg(v,y.mode,w),v.return=y,v;case Go:var N=v._init;return f(y,N(v._payload),w)}if(zu(v)||wu(v))return v=nl(v,y.mode,w,null),v.return=y,v;ip(y,v)}return null}function p(y,v,w,N){var C=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:l(y,v,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Yf:return w.key===C?c(y,v,w,N):null;case Gl:return w.key===C?d(y,v,w,N):null;case Go:return C=w._init,p(y,v,C(w._payload),N)}if(zu(w)||wu(w))return C!==null?null:u(y,v,w,N,null);ip(y,w)}return null}function h(y,v,w,N,C){if(typeof N=="string"&&N!==""||typeof N=="number")return y=y.get(w)||null,l(v,y,""+N,C);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Yf:return y=y.get(N.key===null?w:N.key)||null,c(v,y,N,C);case Gl:return y=y.get(N.key===null?w:N.key)||null,d(v,y,N,C);case Go:var S=N._init;return h(y,v,w,S(N._payload),C)}if(zu(N)||wu(N))return y=y.get(w)||null,u(v,y,N,C,null);ip(v,N)}return null}function g(y,v,w,N){for(var C=null,S=null,A=v,R=v=0,M=null;A!==null&&R<w.length;R++){A.index>R?(M=A,A=null):M=A.sibling;var V=p(y,A,w[R],N);if(V===null){A===null&&(A=M);break}e&&A&&V.alternate===null&&t(y,A),v=i(V,v,R),S===null?C=V:S.sibling=V,S=V,A=M}if(R===w.length)return n(y,A),Sn&&qa(y,R),C;if(A===null){for(;R<w.length;R++)A=f(y,w[R],N),A!==null&&(v=i(A,v,R),S===null?C=A:S.sibling=A,S=A);return Sn&&qa(y,R),C}for(A=r(y,A);R<w.length;R++)M=h(A,y,R,w[R],N),M!==null&&(e&&M.alternate!==null&&A.delete(M.key===null?R:M.key),v=i(M,v,R),S===null?C=M:S.sibling=M,S=M);return e&&A.forEach(function(D){return t(y,D)}),Sn&&qa(y,R),C}function k(y,v,w,N){var C=wu(w);if(typeof C!="function")throw Error(Se(150));if(w=C.call(w),w==null)throw Error(Se(151));for(var S=C=null,A=v,R=v=0,M=null,V=w.next();A!==null&&!V.done;R++,V=w.next()){A.index>R?(M=A,A=null):M=A.sibling;var D=p(y,A,V.value,N);if(D===null){A===null&&(A=M);break}e&&A&&D.alternate===null&&t(y,A),v=i(D,v,R),S===null?C=D:S.sibling=D,S=D,A=M}if(V.done)return n(y,A),Sn&&qa(y,R),C;if(A===null){for(;!V.done;R++,V=w.next())V=f(y,V.value,N),V!==null&&(v=i(V,v,R),S===null?C=V:S.sibling=V,S=V);return Sn&&qa(y,R),C}for(A=r(y,A);!V.done;R++,V=w.next())V=h(A,y,R,V.value,N),V!==null&&(e&&V.alternate!==null&&A.delete(V.key===null?R:V.key),v=i(V,v,R),S===null?C=V:S.sibling=V,S=V);return e&&A.forEach(function(O){return t(y,O)}),Sn&&qa(y,R),C}function b(y,v,w,N){if(typeof w=="object"&&w!==null&&w.type===Jl&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Yf:e:{for(var C=w.key,S=v;S!==null;){if(S.key===C){if(C=w.type,C===Jl){if(S.tag===7){n(y,S.sibling),v=s(S,w.props.children),v.return=y,y=v;break e}}else if(S.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Go&&H0(C)===S.type){n(y,S.sibling),v=s(S,w.props),v.ref=Nu(y,S,w),v.return=y,y=v;break e}n(y,S);break}else t(y,S);S=S.sibling}w.type===Jl?(v=nl(w.props.children,y.mode,N,w.key),v.return=y,y=v):(N=Gp(w.type,w.key,w.props,null,y.mode,N),N.ref=Nu(y,v,w),N.return=y,y=N)}return a(y);case Gl:e:{for(S=w.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(y,v.sibling),v=s(v,w.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=Yg(w,y.mode,N),v.return=y,y=v}return a(y);case Go:return S=w._init,b(y,v,S(w._payload),N)}if(zu(w))return g(y,v,w,N);if(wu(w))return k(y,v,w,N);ip(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(y,v.sibling),v=s(v,w),v.return=y,y=v):(n(y,v),v=qg(w,y.mode,N),v.return=y,y=v),a(y)):n(y,v)}return b}var _c=SC(!0),NC=SC(!1),bh=Ca(null),kh=null,sc=null,tv=null;function nv(){tv=sc=kh=null}function rv(e){var t=bh.current;xn(bh),e._currentValue=t}function wx(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 xc(e,t){kh=e,tv=sc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Qr=!0),e.firstContext=null)}function Us(e){var t=e._currentValue;if(tv!==e)if(e={context:e,memoizedValue:t,next:null},sc===null){if(kh===null)throw Error(Se(308));sc=e,kh.dependencies={lanes:0,firstContext:e}}else sc=sc.next=e;return t}var Qa=null;function sv(e){Qa===null?Qa=[e]:Qa.push(e)}function jC(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,sv(t)):(n.next=s.next,s.next=n),t.interleaved=n,bo(e,r)}function bo(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 Jo=!1;function iv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function CC(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 xo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ca(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ot&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,bo(e,n)}return s=r.interleaved,s===null?(t.next=t,sv(r)):(t.next=s.next,s.next=t),r.interleaved=t,bo(e,n)}function Up(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,Ww(e,n)}}function U0(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 Sh(e,t,n,r){var s=e.updateQueue;Jo=!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 u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==a&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;a=0,u=d=c=null,l=i;do{var p=l.lane,h=l.eventTime;if((r&p)===p){u!==null&&(u=u.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,k=l;switch(p=t,h=n,k.tag){case 1:if(g=k.payload,typeof g=="function"){f=g.call(h,f,p);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=k.payload,p=typeof g=="function"?g.call(h,f,p):g,p==null)break e;f=En({},f,p);break e;case 2:Jo=!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},u===null?(d=u=h,c=f):u=u.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(u===null&&(c=f),s.baseState=c,s.firstBaseUpdate=d,s.lastBaseUpdate=u,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);ul|=a,e.lanes=a,e.memoizedState=f}}function W0(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(Se(191,s));s.call(r)}}}var sf={},Ui=Ca(sf),Cd=Ca(sf),Ed=Ca(sf);function Za(e){if(e===sf)throw Error(Se(174));return e}function ov(e,t){switch(dn(Ed,t),dn(Cd,e),dn(Ui,sf),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Zy(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Zy(t,e)}xn(Ui),dn(Ui,t)}function Pc(){xn(Ui),xn(Cd),xn(Ed)}function EC(e){Za(Ed.current);var t=Za(Ui.current),n=Zy(t,e.type);t!==n&&(dn(Cd,e),dn(Ui,n))}function av(e){Cd.current===e&&(xn(Ui),xn(Cd))}var jn=Ca(0);function Nh(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 Bg=[];function lv(){for(var e=0;e<Bg.length;e++)Bg[e]._workInProgressVersionPrimary=null;Bg.length=0}var Wp=Co.ReactCurrentDispatcher,Hg=Co.ReactCurrentBatchConfig,cl=0,Cn=null,tr=null,ar=null,jh=!1,ed=!1,_d=0,pL=0;function _r(){throw Error(Se(321))}function cv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xi(e[n],t[n]))return!1;return!0}function uv(e,t,n,r,s,i){if(cl=i,Cn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Wp.current=e===null||e.memoizedState===null?yL:xL,e=n(r,s),ed){i=0;do{if(ed=!1,_d=0,25<=i)throw Error(Se(301));i+=1,ar=tr=null,t.updateQueue=null,Wp.current=wL,e=n(r,s)}while(ed)}if(Wp.current=Ch,t=tr!==null&&tr.next!==null,cl=0,ar=tr=Cn=null,jh=!1,t)throw Error(Se(300));return e}function dv(){var e=_d!==0;return _d=0,e}function Li(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ar===null?Cn.memoizedState=ar=e:ar=ar.next=e,ar}function Ws(){if(tr===null){var e=Cn.alternate;e=e!==null?e.memoizedState:null}else e=tr.next;var t=ar===null?Cn.memoizedState:ar.next;if(t!==null)ar=t,tr=e;else{if(e===null)throw Error(Se(310));tr=e,e={memoizedState:tr.memoizedState,baseState:tr.baseState,baseQueue:tr.baseQueue,queue:tr.queue,next:null},ar===null?Cn.memoizedState=ar=e:ar=ar.next=e}return ar}function Pd(e,t){return typeof t=="function"?t(e):t}function Ug(e){var t=Ws(),n=t.queue;if(n===null)throw Error(Se(311));n.lastRenderedReducer=e;var r=tr,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 u=d.lane;if((cl&u)===u)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 f={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=f,a=r):c=c.next=f,Cn.lanes|=u,ul|=u}d=d.next}while(d!==null&&d!==i);c===null?a=r:c.next=l,xi(r,t.memoizedState)||(Qr=!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,Cn.lanes|=i,ul|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Wg(e){var t=Ws(),n=t.queue;if(n===null)throw Error(Se(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);xi(i,t.memoizedState)||(Qr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function _C(){}function PC(e,t){var n=Cn,r=Ws(),s=t(),i=!xi(r.memoizedState,s);if(i&&(r.memoizedState=s,Qr=!0),r=r.queue,fv(TC.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||ar!==null&&ar.memoizedState.tag&1){if(n.flags|=2048,Ad(9,IC.bind(null,n,r,s,t),void 0,null),cr===null)throw Error(Se(349));cl&30||AC(n,t,s)}return s}function AC(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Cn.updateQueue,t===null?(t={lastEffect:null,stores:null},Cn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function IC(e,t,n,r){t.value=n,t.getSnapshot=r,RC(t)&&LC(e)}function TC(e,t,n){return n(function(){RC(t)&&LC(e)})}function RC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xi(e,n)}catch{return!0}}function LC(e){var t=bo(e,1);t!==null&&yi(t,e,1,-1)}function V0(e){var t=Li();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Pd,lastRenderedState:e},t.queue=e,e=e.dispatch=gL.bind(null,Cn,e),[t.memoizedState,e]}function Ad(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Cn.updateQueue,t===null?(t={lastEffect:null,stores:null},Cn.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 OC(){return Ws().memoizedState}function Vp(e,t,n,r){var s=Li();Cn.flags|=e,s.memoizedState=Ad(1|t,n,void 0,r===void 0?null:r)}function bm(e,t,n,r){var s=Ws();r=r===void 0?null:r;var i=void 0;if(tr!==null){var a=tr.memoizedState;if(i=a.destroy,r!==null&&cv(r,a.deps)){s.memoizedState=Ad(t,n,i,r);return}}Cn.flags|=e,s.memoizedState=Ad(1|t,n,i,r)}function K0(e,t){return Vp(8390656,8,e,t)}function fv(e,t){return bm(2048,8,e,t)}function MC(e,t){return bm(4,2,e,t)}function $C(e,t){return bm(4,4,e,t)}function DC(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 FC(e,t,n){return n=n!=null?n.concat([e]):null,bm(4,4,DC.bind(null,t,e),n)}function pv(){}function zC(e,t){var n=Ws();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function BC(e,t){var n=Ws();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function HC(e,t,n){return cl&21?(xi(n,t)||(n=q1(),Cn.lanes|=n,ul|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Qr=!0),e.memoizedState=n)}function hL(e,t){var n=qt;qt=n!==0&&4>n?n:4,e(!0);var r=Hg.transition;Hg.transition={};try{e(!1),t()}finally{qt=n,Hg.transition=r}}function UC(){return Ws().memoizedState}function mL(e,t,n){var r=da(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},WC(e))VC(t,n);else if(n=jC(e,t,n,r),n!==null){var s=Fr();yi(n,e,r,s),KC(n,t,r)}}function gL(e,t,n){var r=da(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(WC(e))VC(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,xi(l,a)){var c=t.interleaved;c===null?(s.next=s,sv(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=jC(e,t,s,r),n!==null&&(s=Fr(),yi(n,e,r,s),KC(n,t,r))}}function WC(e){var t=e.alternate;return e===Cn||t!==null&&t===Cn}function VC(e,t){ed=jh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function KC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ww(e,n)}}var Ch={readContext:Us,useCallback:_r,useContext:_r,useEffect:_r,useImperativeHandle:_r,useInsertionEffect:_r,useLayoutEffect:_r,useMemo:_r,useReducer:_r,useRef:_r,useState:_r,useDebugValue:_r,useDeferredValue:_r,useTransition:_r,useMutableSource:_r,useSyncExternalStore:_r,useId:_r,unstable_isNewReconciler:!1},yL={readContext:Us,useCallback:function(e,t){return Li().memoizedState=[e,t===void 0?null:t],e},useContext:Us,useEffect:K0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Vp(4194308,4,DC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Vp(4194308,4,e,t)},useInsertionEffect:function(e,t){return Vp(4,2,e,t)},useMemo:function(e,t){var n=Li();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Li();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,Cn,e),[r.memoizedState,e]},useRef:function(e){var t=Li();return e={current:e},t.memoizedState=e},useState:V0,useDebugValue:pv,useDeferredValue:function(e){return Li().memoizedState=e},useTransition:function(){var e=V0(!1),t=e[0];return e=hL.bind(null,e[1]),Li().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Cn,s=Li();if(Sn){if(n===void 0)throw Error(Se(407));n=n()}else{if(n=t(),cr===null)throw Error(Se(349));cl&30||AC(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,K0(TC.bind(null,r,i,e),[e]),r.flags|=2048,Ad(9,IC.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Li(),t=cr.identifierPrefix;if(Sn){var n=mo,r=ho;n=(r&~(1<<32-gi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=_d++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=pL++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},xL={readContext:Us,useCallback:zC,useContext:Us,useEffect:fv,useImperativeHandle:FC,useInsertionEffect:MC,useLayoutEffect:$C,useMemo:BC,useReducer:Ug,useRef:OC,useState:function(){return Ug(Pd)},useDebugValue:pv,useDeferredValue:function(e){var t=Ws();return HC(t,tr.memoizedState,e)},useTransition:function(){var e=Ug(Pd)[0],t=Ws().memoizedState;return[e,t]},useMutableSource:_C,useSyncExternalStore:PC,useId:UC,unstable_isNewReconciler:!1},wL={readContext:Us,useCallback:zC,useContext:Us,useEffect:fv,useImperativeHandle:FC,useInsertionEffect:MC,useLayoutEffect:$C,useMemo:BC,useReducer:Wg,useRef:OC,useState:function(){return Wg(Pd)},useDebugValue:pv,useDeferredValue:function(e){var t=Ws();return tr===null?t.memoizedState=e:HC(t,tr.memoizedState,e)},useTransition:function(){var e=Wg(Pd)[0],t=Ws().memoizedState;return[e,t]},useMutableSource:_C,useSyncExternalStore:PC,useId:UC,unstable_isNewReconciler:!1};function li(e,t){if(e&&e.defaultProps){t=En({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function vx(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:En({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var km={isMounted:function(e){return(e=e._reactInternals)?wl(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Fr(),s=da(e),i=xo(r,s);i.payload=t,n!=null&&(i.callback=n),t=ca(e,i,s),t!==null&&(yi(t,e,s,r),Up(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Fr(),s=da(e),i=xo(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ca(e,i,s),t!==null&&(yi(t,e,s,r),Up(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Fr(),r=da(e),s=xo(n,r);s.tag=2,t!=null&&(s.callback=t),t=ca(e,s,r),t!==null&&(yi(t,e,r,n),Up(t,e,r))}};function q0(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?!kd(n,r)||!kd(s,i):!0}function qC(e,t,n){var r=!1,s=xa,i=t.contextType;return typeof i=="object"&&i!==null?i=Us(i):(s=ss(t)?al:Tr.current,r=t.contextTypes,i=(r=r!=null)?Cc(e,s):xa),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=km,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Y0(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&&km.enqueueReplaceState(t,t.state,null)}function bx(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},iv(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Us(i):(i=ss(t)?al:Tr.current,s.context=Cc(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(vx(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&&km.enqueueReplaceState(s,s.state,null),Sh(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Ac(e,t){try{var n="",r=t;do n+=q2(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 Vg(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function kx(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var vL=typeof WeakMap=="function"?WeakMap:Map;function YC(e,t,n){n=xo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){_h||(_h=!0,Tx=r),kx(e,t)},n}function GC(e,t,n){n=xo(-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(){kx(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){kx(e,t),typeof r!="function"&&(ua===null?ua=new Set([this]):ua.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function G0(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new vL;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=LL.bind(null,e,t,n),t.then(e,e))}function J0(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 X0(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=xo(-1,1),t.tag=2,ca(n,t,1))),n.lanes|=1),e)}var bL=Co.ReactCurrentOwner,Qr=!1;function $r(e,t,n,r){t.child=e===null?NC(t,null,n,r):_c(t,e.child,n,r)}function Q0(e,t,n,r,s){n=n.render;var i=t.ref;return xc(t,s),r=uv(e,t,n,r,i,s),n=dv(),e!==null&&!Qr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ko(e,t,s)):(Sn&&n&&Qw(t),t.flags|=1,$r(e,t,r,s),t.child)}function Z0(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!bv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,JC(e,t,i,r,s)):(e=Gp(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:kd,n(a,r)&&e.ref===t.ref)return ko(e,t,s)}return t.flags|=1,e=fa(i,r),e.ref=t.ref,e.return=t,t.child=e}function JC(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(kd(i,r)&&e.ref===t.ref)if(Qr=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Qr=!0);else return t.lanes=e.lanes,ko(e,t,s)}return Sx(e,t,n,r,s)}function XC(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},dn(oc,ys),ys|=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,dn(oc,ys),ys|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,dn(oc,ys),ys|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,dn(oc,ys),ys|=r;return $r(e,t,s,n),t.child}function QC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Sx(e,t,n,r,s){var i=ss(n)?al:Tr.current;return i=Cc(t,i),xc(t,s),n=uv(e,t,n,r,i,s),r=dv(),e!==null&&!Qr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ko(e,t,s)):(Sn&&r&&Qw(t),t.flags|=1,$r(e,t,n,s),t.child)}function ek(e,t,n,r,s){if(ss(n)){var i=!0;xh(t)}else i=!1;if(xc(t,s),t.stateNode===null)Kp(e,t),qC(t,n,r),bx(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=Us(d):(d=ss(n)?al:Tr.current,d=Cc(t,d));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==d)&&Y0(t,a,r,d),Jo=!1;var p=t.memoizedState;a.state=p,Sh(t,r,a,s),c=t.memoizedState,l!==r||p!==c||rs.current||Jo?(typeof u=="function"&&(vx(t,n,u,r),c=t.memoizedState),(l=Jo||q0(t,n,l,r,p,c,d))?(f||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,CC(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:li(t.type,l),a.props=d,f=t.pendingProps,p=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Us(c):(c=ss(n)?al:Tr.current,c=Cc(t,c));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==f||p!==c)&&Y0(t,a,r,c),Jo=!1,p=t.memoizedState,a.state=p,Sh(t,r,a,s);var g=t.memoizedState;l!==f||p!==g||rs.current||Jo?(typeof h=="function"&&(vx(t,n,h,r),g=t.memoizedState),(d=Jo||q0(t,n,d,r,p,g,c)||!1)?(u||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 Nx(e,t,n,r,i,s)}function Nx(e,t,n,r,s,i){QC(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&F0(t,n,!1),ko(e,t,i);r=t.stateNode,bL.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=_c(t,e.child,null,i),t.child=_c(t,null,l,i)):$r(e,t,l,i),t.memoizedState=r.state,s&&F0(t,n,!0),t.child}function ZC(e){var t=e.stateNode;t.pendingContext?D0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&D0(e,t.context,!1),ov(e,t.containerInfo)}function tk(e,t,n,r,s){return Ec(),ev(s),t.flags|=256,$r(e,t,n,r),t.child}var jx={dehydrated:null,treeContext:null,retryLane:0};function Cx(e){return{baseLanes:e,cachePool:null,transitions:null}}function eE(e,t,n){var r=t.pendingProps,s=jn.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),dn(jn,s&1),e===null)return xx(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=jm(a,r,0,null),e=nl(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Cx(n),t.memoizedState=jx,e):hv(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return kL(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=fa(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=fa(l,i):(i=nl(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?Cx(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=jx,r}return i=e.child,e=i.sibling,r=fa(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 hv(e,t){return t=jm({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function op(e,t,n,r){return r!==null&&ev(r),_c(t,e.child,null,n),e=hv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function kL(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Vg(Error(Se(422))),op(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=jm({mode:"visible",children:r.children},s,0,null),i=nl(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&_c(t,e.child,null,a),t.child.memoizedState=Cx(a),t.memoizedState=jx,i);if(!(t.mode&1))return op(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Se(419)),r=Vg(i,r,void 0),op(e,t,a,r)}if(l=(a&e.childLanes)!==0,Qr||l){if(r=cr,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,bo(e,s),yi(r,e,s,-1))}return vv(),r=Vg(Error(Se(421))),op(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=OL.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,bs=la(s.nextSibling),Ss=t,Sn=!0,di=null,e!==null&&($s[Ds++]=ho,$s[Ds++]=mo,$s[Ds++]=ll,ho=e.id,mo=e.overflow,ll=t),t=hv(t,r.children),t.flags|=4096,t)}function nk(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),wx(e.return,t,n)}function Kg(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 tE(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if($r(e,t,r.children,n),r=jn.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&&nk(e,n,t);else if(e.tag===19)nk(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(dn(jn,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&&Nh(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Kg(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&&Nh(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Kg(t,!0,n,null,i);break;case"together":Kg(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Kp(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ko(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ul|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Se(153));if(t.child!==null){for(e=t.child,n=fa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=fa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function SL(e,t,n){switch(t.tag){case 3:ZC(t),Ec();break;case 5:EC(t);break;case 1:ss(t.type)&&xh(t);break;case 4:ov(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;dn(bh,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(dn(jn,jn.current&1),t.flags|=128,null):n&t.child.childLanes?eE(e,t,n):(dn(jn,jn.current&1),e=ko(e,t,n),e!==null?e.sibling:null);dn(jn,jn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return tE(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),dn(jn,jn.current),r)break;return null;case 22:case 23:return t.lanes=0,XC(e,t,n)}return ko(e,t,n)}var nE,Ex,rE,sE;nE=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}};Ex=function(){};rE=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Za(Ui.current);var i=null;switch(n){case"input":s=Gy(e,s),r=Gy(e,r),i=[];break;case"select":s=En({},s,{value:void 0}),r=En({},r,{value:void 0}),i=[];break;case"textarea":s=Qy(e,s),r=Qy(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=gh)}ex(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"&&(md.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"&&(md.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&gn("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)}};sE=function(e,t,n,r){n!==r&&(t.flags|=4)};function ju(e,t){if(!Sn)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 Pr(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 NL(e,t,n){var r=t.pendingProps;switch(Zw(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pr(t),null;case 1:return ss(t.type)&&yh(),Pr(t),null;case 3:return r=t.stateNode,Pc(),xn(rs),xn(Tr),lv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(sp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,di!==null&&(Ox(di),di=null))),Ex(e,t),Pr(t),null;case 5:av(t);var s=Za(Ed.current);if(n=t.type,e!==null&&t.stateNode!=null)rE(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Se(166));return Pr(t),null}if(e=Za(Ui.current),sp(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Di]=t,r[jd]=i,e=(t.mode&1)!==0,n){case"dialog":gn("cancel",r),gn("close",r);break;case"iframe":case"object":case"embed":gn("load",r);break;case"video":case"audio":for(s=0;s<Hu.length;s++)gn(Hu[s],r);break;case"source":gn("error",r);break;case"img":case"image":case"link":gn("error",r),gn("load",r);break;case"details":gn("toggle",r);break;case"input":d0(r,i),gn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},gn("invalid",r);break;case"textarea":p0(r,i),gn("invalid",r)}ex(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&&rp(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&rp(r.textContent,l,e),s=["children",""+l]):md.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&gn("scroll",r)}switch(n){case"input":Gf(r),f0(r,i,!0);break;case"textarea":Gf(r),h0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=gh)}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=T1(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[Di]=t,e[jd]=r,nE(e,t,!1,!1),t.stateNode=e;e:{switch(a=tx(n,r),n){case"dialog":gn("cancel",e),gn("close",e),s=r;break;case"iframe":case"object":case"embed":gn("load",e),s=r;break;case"video":case"audio":for(s=0;s<Hu.length;s++)gn(Hu[s],e);s=r;break;case"source":gn("error",e),s=r;break;case"img":case"image":case"link":gn("error",e),gn("load",e),s=r;break;case"details":gn("toggle",e),s=r;break;case"input":d0(e,r),s=Gy(e,r),gn("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=En({},r,{value:void 0}),gn("invalid",e);break;case"textarea":p0(e,r),s=Qy(e,r),gn("invalid",e);break;default:s=r}ex(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?O1(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&R1(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&gd(e,c):typeof c=="number"&&gd(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(md.hasOwnProperty(i)?c!=null&&i==="onScroll"&&gn("scroll",e):c!=null&&Dw(e,i,c,a))}switch(n){case"input":Gf(e),f0(e,r,!1);break;case"textarea":Gf(e),h0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ya(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?hc(e,!!r.multiple,i,!1):r.defaultValue!=null&&hc(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=gh)}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 Pr(t),null;case 6:if(e&&t.stateNode!=null)sE(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Se(166));if(n=Za(Ed.current),Za(Ui.current),sp(t)){if(r=t.stateNode,n=t.memoizedProps,r[Di]=t,(i=r.nodeValue!==n)&&(e=Ss,e!==null))switch(e.tag){case 3:rp(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&rp(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Di]=t,t.stateNode=r}return Pr(t),null;case 13:if(xn(jn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Sn&&bs!==null&&t.mode&1&&!(t.flags&128))kC(),Ec(),t.flags|=98560,i=!1;else if(i=sp(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Se(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Se(317));i[Di]=t}else Ec(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pr(t),i=!1}else di!==null&&(Ox(di),di=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||jn.current&1?rr===0&&(rr=3):vv())),t.updateQueue!==null&&(t.flags|=4),Pr(t),null);case 4:return Pc(),Ex(e,t),e===null&&Sd(t.stateNode.containerInfo),Pr(t),null;case 10:return rv(t.type._context),Pr(t),null;case 17:return ss(t.type)&&yh(),Pr(t),null;case 19:if(xn(jn),i=t.memoizedState,i===null)return Pr(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)ju(i,!1);else{if(rr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Nh(e),a!==null){for(t.flags|=128,ju(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 dn(jn,jn.current&1|2),t.child}e=e.sibling}i.tail!==null&&zn()>Ic&&(t.flags|=128,r=!0,ju(i,!1),t.lanes=4194304)}else{if(!r)if(e=Nh(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ju(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Sn)return Pr(t),null}else 2*zn()-i.renderingStartTime>Ic&&n!==1073741824&&(t.flags|=128,r=!0,ju(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=zn(),t.sibling=null,n=jn.current,dn(jn,r?n&1|2:n&1),t):(Pr(t),null);case 22:case 23:return wv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ys&1073741824&&(Pr(t),t.subtreeFlags&6&&(t.flags|=8192)):Pr(t),null;case 24:return null;case 25:return null}throw Error(Se(156,t.tag))}function jL(e,t){switch(Zw(t),t.tag){case 1:return ss(t.type)&&yh(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Pc(),xn(rs),xn(Tr),lv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return av(t),null;case 13:if(xn(jn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Se(340));Ec()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xn(jn),null;case 4:return Pc(),null;case 10:return rv(t.type._context),null;case 22:case 23:return wv(),null;case 24:return null;default:return null}}var ap=!1,Ar=!1,CL=typeof WeakSet=="function"?WeakSet:Set,Be=null;function ic(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Rn(e,t,r)}else n.current=null}function _x(e,t,n){try{n()}catch(r){Rn(e,t,r)}}var rk=!1;function EL(e,t){if(dx=ph,e=cC(),Xw(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,u=0,f=e,p=null;t:for(;;){for(var h;f!==n||s!==0&&f.nodeType!==3||(l=a+s),f!==i||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++d===s&&(l=a),p===i&&++u===r&&(c=a),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(fx={focusedElem:e,selectionRange:n},ph=!1,Be=t;Be!==null;)if(t=Be,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Be=e;else for(;Be!==null;){t=Be;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 k=g.memoizedProps,b=g.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?k:li(t.type,k),b);y.__reactInternalSnapshotBeforeUpdate=v}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(Se(163))}}catch(N){Rn(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,Be=e;break}Be=t.return}return g=rk,rk=!1,g}function td(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 Sm(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 Px(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 iE(e){var t=e.alternate;t!==null&&(e.alternate=null,iE(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Di],delete t[jd],delete t[mx],delete t[cL],delete t[uL])),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 oE(e){return e.tag===5||e.tag===3||e.tag===4}function sk(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||oE(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 Ax(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=gh));else if(r!==4&&(e=e.child,e!==null))for(Ax(e,t,n),e=e.sibling;e!==null;)Ax(e,t,n),e=e.sibling}function Ix(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(Ix(e,t,n),e=e.sibling;e!==null;)Ix(e,t,n),e=e.sibling}var wr=null,ci=!1;function Wo(e,t,n){for(n=n.child;n!==null;)aE(e,t,n),n=n.sibling}function aE(e,t,n){if(Hi&&typeof Hi.onCommitFiberUnmount=="function")try{Hi.onCommitFiberUnmount(mm,n)}catch{}switch(n.tag){case 5:Ar||ic(n,t);case 6:var r=wr,s=ci;wr=null,Wo(e,t,n),wr=r,ci=s,wr!==null&&(ci?(e=wr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wr.removeChild(n.stateNode));break;case 18:wr!==null&&(ci?(e=wr,n=n.stateNode,e.nodeType===8?Fg(e.parentNode,n):e.nodeType===1&&Fg(e,n),vd(e)):Fg(wr,n.stateNode));break;case 4:r=wr,s=ci,wr=n.stateNode.containerInfo,ci=!0,Wo(e,t,n),wr=r,ci=s;break;case 0:case 11:case 14:case 15:if(!Ar&&(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)}Wo(e,t,n);break;case 1:if(!Ar&&(ic(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Rn(n,t,l)}Wo(e,t,n);break;case 21:Wo(e,t,n);break;case 22:n.mode&1?(Ar=(r=Ar)||n.memoizedState!==null,Wo(e,t,n),Ar=r):Wo(e,t,n);break;default:Wo(e,t,n)}}function ik(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new CL),t.forEach(function(r){var s=ML.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function oi(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:wr=l.stateNode,ci=!1;break e;case 3:wr=l.stateNode.containerInfo,ci=!0;break e;case 4:wr=l.stateNode.containerInfo,ci=!0;break e}l=l.return}if(wr===null)throw Error(Se(160));aE(i,a,s),wr=null,ci=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(d){Rn(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)lE(t,e),t=t.sibling}function lE(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(oi(t,e),Ti(e),r&4){try{td(3,e,e.return),Sm(3,e)}catch(k){Rn(e,e.return,k)}try{td(5,e,e.return)}catch(k){Rn(e,e.return,k)}}break;case 1:oi(t,e),Ti(e),r&512&&n!==null&&ic(n,n.return);break;case 5:if(oi(t,e),Ti(e),r&512&&n!==null&&ic(n,n.return),e.flags&32){var s=e.stateNode;try{gd(s,"")}catch(k){Rn(e,e.return,k)}}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&&A1(s,i),tx(l,a);var d=tx(l,i);for(a=0;a<c.length;a+=2){var u=c[a],f=c[a+1];u==="style"?O1(s,f):u==="dangerouslySetInnerHTML"?R1(s,f):u==="children"?gd(s,f):Dw(s,u,f,d)}switch(l){case"input":Jy(s,i);break;case"textarea":I1(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?hc(s,!!i.multiple,h,!1):p!==!!i.multiple&&(i.defaultValue!=null?hc(s,!!i.multiple,i.defaultValue,!0):hc(s,!!i.multiple,i.multiple?[]:"",!1))}s[jd]=i}catch(k){Rn(e,e.return,k)}}break;case 6:if(oi(t,e),Ti(e),r&4){if(e.stateNode===null)throw Error(Se(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(k){Rn(e,e.return,k)}}break;case 3:if(oi(t,e),Ti(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{vd(t.containerInfo)}catch(k){Rn(e,e.return,k)}break;case 4:oi(t,e),Ti(e);break;case 13:oi(t,e),Ti(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(yv=zn())),r&4&&ik(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(Ar=(d=Ar)||u,oi(t,e),Ar=d):oi(t,e),Ti(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(Be=e,u=e.child;u!==null;){for(f=Be=u;Be!==null;){switch(p=Be,h=p.child,p.tag){case 0:case 11:case 14:case 15:td(4,p,p.return);break;case 1:ic(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(k){Rn(r,n,k)}}break;case 5:ic(p,p.return);break;case 22:if(p.memoizedState!==null){ak(f);continue}}h!==null?(h.return=p,Be=h):ak(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{s=f.stateNode,d?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=L1("display",a))}catch(k){Rn(e,e.return,k)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(k){Rn(e,e.return,k)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:oi(t,e),Ti(e),r&4&&ik(e);break;case 21:break;default:oi(t,e),Ti(e)}}function Ti(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(oE(n)){var r=n;break e}n=n.return}throw Error(Se(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(gd(s,""),r.flags&=-33);var i=sk(e);Ix(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=sk(e);Ax(e,l,a);break;default:throw Error(Se(161))}}catch(c){Rn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _L(e,t,n){Be=e,cE(e)}function cE(e,t,n){for(var r=(e.mode&1)!==0;Be!==null;){var s=Be,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||ap;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Ar;l=ap;var d=Ar;if(ap=a,(Ar=c)&&!d)for(Be=s;Be!==null;)a=Be,c=a.child,a.tag===22&&a.memoizedState!==null?lk(s):c!==null?(c.return=a,Be=c):lk(s);for(;i!==null;)Be=i,cE(i),i=i.sibling;Be=s,ap=l,Ar=d}ok(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Be=i):ok(e)}}function ok(e){for(;Be!==null;){var t=Be;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ar||Sm(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ar)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:li(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&W0(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}W0(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 u=d.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&vd(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Se(163))}Ar||t.flags&512&&Px(t)}catch(p){Rn(t,t.return,p)}}if(t===e){Be=null;break}if(n=t.sibling,n!==null){n.return=t.return,Be=n;break}Be=t.return}}function ak(e){for(;Be!==null;){var t=Be;if(t===e){Be=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Be=n;break}Be=t.return}}function lk(e){for(;Be!==null;){var t=Be;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sm(4,t)}catch(c){Rn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){Rn(t,s,c)}}var i=t.return;try{Px(t)}catch(c){Rn(t,i,c)}break;case 5:var a=t.return;try{Px(t)}catch(c){Rn(t,a,c)}}}catch(c){Rn(t,t.return,c)}if(t===e){Be=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Be=l;break}Be=t.return}}var PL=Math.ceil,Eh=Co.ReactCurrentDispatcher,mv=Co.ReactCurrentOwner,Hs=Co.ReactCurrentBatchConfig,Ot=0,cr=null,Yn=null,vr=0,ys=0,oc=Ca(0),rr=0,Id=null,ul=0,Nm=0,gv=0,nd=null,Jr=null,yv=0,Ic=1/0,co=null,_h=!1,Tx=null,ua=null,lp=!1,na=null,Ph=0,rd=0,Rx=null,qp=-1,Yp=0;function Fr(){return Ot&6?zn():qp!==-1?qp:qp=zn()}function da(e){return e.mode&1?Ot&2&&vr!==0?vr&-vr:fL.transition!==null?(Yp===0&&(Yp=q1()),Yp):(e=qt,e!==0||(e=window.event,e=e===void 0?16:eC(e.type)),e):1}function yi(e,t,n,r){if(50<rd)throw rd=0,Rx=null,Error(Se(185));tf(e,n,r),(!(Ot&2)||e!==cr)&&(e===cr&&(!(Ot&2)&&(Nm|=n),rr===4&&Zo(e,vr)),is(e,r),n===1&&Ot===0&&!(t.mode&1)&&(Ic=zn()+500,vm&&Ea()))}function is(e,t){var n=e.callbackNode;fR(e,t);var r=fh(e,e===cr?vr:0);if(r===0)n!==null&&y0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&y0(n),t===1)e.tag===0?dL(ck.bind(null,e)):wC(ck.bind(null,e)),aL(function(){!(Ot&6)&&Ea()}),n=null;else{switch(Y1(r)){case 1:n=Uw;break;case 4:n=V1;break;case 16:n=dh;break;case 536870912:n=K1;break;default:n=dh}n=yE(n,uE.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function uE(e,t){if(qp=-1,Yp=0,Ot&6)throw Error(Se(327));var n=e.callbackNode;if(wc()&&e.callbackNode!==n)return null;var r=fh(e,e===cr?vr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Ah(e,r);else{t=r;var s=Ot;Ot|=2;var i=fE();(cr!==e||vr!==t)&&(co=null,Ic=zn()+500,tl(e,t));do try{TL();break}catch(l){dE(e,l)}while(!0);nv(),Eh.current=i,Ot=s,Yn!==null?t=0:(cr=null,vr=0,t=rr)}if(t!==0){if(t===2&&(s=ox(e),s!==0&&(r=s,t=Lx(e,s))),t===1)throw n=Id,tl(e,0),Zo(e,r),is(e,zn()),n;if(t===6)Zo(e,r);else{if(s=e.current.alternate,!(r&30)&&!AL(s)&&(t=Ah(e,r),t===2&&(i=ox(e),i!==0&&(r=i,t=Lx(e,i))),t===1))throw n=Id,tl(e,0),Zo(e,r),is(e,zn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(Se(345));case 2:Ya(e,Jr,co);break;case 3:if(Zo(e,r),(r&130023424)===r&&(t=yv+500-zn(),10<t)){if(fh(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Fr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=hx(Ya.bind(null,e,Jr,co),t);break}Ya(e,Jr,co);break;case 4:if(Zo(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-gi(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=zn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*PL(r/1960))-r,10<r){e.timeoutHandle=hx(Ya.bind(null,e,Jr,co),r);break}Ya(e,Jr,co);break;case 5:Ya(e,Jr,co);break;default:throw Error(Se(329))}}}return is(e,zn()),e.callbackNode===n?uE.bind(null,e):null}function Lx(e,t){var n=nd;return e.current.memoizedState.isDehydrated&&(tl(e,t).flags|=256),e=Ah(e,t),e!==2&&(t=Jr,Jr=n,t!==null&&Ox(t)),e}function Ox(e){Jr===null?Jr=e:Jr.push.apply(Jr,e)}function AL(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(!xi(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 Zo(e,t){for(t&=~gv,t&=~Nm,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-gi(t),r=1<<n;e[n]=-1,t&=~r}}function ck(e){if(Ot&6)throw Error(Se(327));wc();var t=fh(e,0);if(!(t&1))return is(e,zn()),null;var n=Ah(e,t);if(e.tag!==0&&n===2){var r=ox(e);r!==0&&(t=r,n=Lx(e,r))}if(n===1)throw n=Id,tl(e,0),Zo(e,t),is(e,zn()),n;if(n===6)throw Error(Se(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ya(e,Jr,co),is(e,zn()),null}function xv(e,t){var n=Ot;Ot|=1;try{return e(t)}finally{Ot=n,Ot===0&&(Ic=zn()+500,vm&&Ea())}}function dl(e){na!==null&&na.tag===0&&!(Ot&6)&&wc();var t=Ot;Ot|=1;var n=Hs.transition,r=qt;try{if(Hs.transition=null,qt=1,e)return e()}finally{qt=r,Hs.transition=n,Ot=t,!(Ot&6)&&Ea()}}function wv(){ys=oc.current,xn(oc)}function tl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,oL(n)),Yn!==null)for(n=Yn.return;n!==null;){var r=n;switch(Zw(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&yh();break;case 3:Pc(),xn(rs),xn(Tr),lv();break;case 5:av(r);break;case 4:Pc();break;case 13:xn(jn);break;case 19:xn(jn);break;case 10:rv(r.type._context);break;case 22:case 23:wv()}n=n.return}if(cr=e,Yn=e=fa(e.current,null),vr=ys=t,rr=0,Id=null,gv=Nm=ul=0,Jr=nd=null,Qa!==null){for(t=0;t<Qa.length;t++)if(n=Qa[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}Qa=null}return e}function dE(e,t){do{var n=Yn;try{if(nv(),Wp.current=Ch,jh){for(var r=Cn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}jh=!1}if(cl=0,ar=tr=Cn=null,ed=!1,_d=0,mv.current=null,n===null||n.return===null){rr=1,Id=t,Yn=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=vr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var p=u.alternate;p?(u.updateQueue=p.updateQueue,u.memoizedState=p.memoizedState,u.lanes=p.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=J0(a);if(h!==null){h.flags&=-257,X0(h,a,l,i,t),h.mode&1&&G0(i,d,t),t=h,c=d;var g=t.updateQueue;if(g===null){var k=new Set;k.add(c),t.updateQueue=k}else g.add(c);break e}else{if(!(t&1)){G0(i,d,t),vv();break e}c=Error(Se(426))}}else if(Sn&&l.mode&1){var b=J0(a);if(b!==null){!(b.flags&65536)&&(b.flags|=256),X0(b,a,l,i,t),ev(Ac(c,l));break e}}i=c=Ac(c,l),rr!==4&&(rr=2),nd===null?nd=[i]:nd.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=YC(i,c,t);U0(i,y);break e;case 1:l=c;var v=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(ua===null||!ua.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=GC(i,l,t);U0(i,N);break e}}i=i.return}while(i!==null)}hE(n)}catch(C){t=C,Yn===n&&n!==null&&(Yn=n=n.return);continue}break}while(!0)}function fE(){var e=Eh.current;return Eh.current=Ch,e===null?Ch:e}function vv(){(rr===0||rr===3||rr===2)&&(rr=4),cr===null||!(ul&268435455)&&!(Nm&268435455)||Zo(cr,vr)}function Ah(e,t){var n=Ot;Ot|=2;var r=fE();(cr!==e||vr!==t)&&(co=null,tl(e,t));do try{IL();break}catch(s){dE(e,s)}while(!0);if(nv(),Ot=n,Eh.current=r,Yn!==null)throw Error(Se(261));return cr=null,vr=0,rr}function IL(){for(;Yn!==null;)pE(Yn)}function TL(){for(;Yn!==null&&!rR();)pE(Yn)}function pE(e){var t=gE(e.alternate,e,ys);e.memoizedProps=e.pendingProps,t===null?hE(e):Yn=t,mv.current=null}function hE(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=jL(n,t),n!==null){n.flags&=32767,Yn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{rr=6,Yn=null;return}}else if(n=NL(n,t,ys),n!==null){Yn=n;return}if(t=t.sibling,t!==null){Yn=t;return}Yn=t=e}while(t!==null);rr===0&&(rr=5)}function Ya(e,t,n){var r=qt,s=Hs.transition;try{Hs.transition=null,qt=1,RL(e,t,n,r)}finally{Hs.transition=s,qt=r}return null}function RL(e,t,n,r){do wc();while(na!==null);if(Ot&6)throw Error(Se(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(Se(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(pR(e,i),e===cr&&(Yn=cr=null,vr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||lp||(lp=!0,yE(dh,function(){return wc(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Hs.transition,Hs.transition=null;var a=qt;qt=1;var l=Ot;Ot|=4,mv.current=null,EL(e,n),lE(n,e),ZR(fx),ph=!!dx,fx=dx=null,e.current=n,_L(n),sR(),Ot=l,qt=a,Hs.transition=i}else e.current=n;if(lp&&(lp=!1,na=e,Ph=s),i=e.pendingLanes,i===0&&(ua=null),aR(n.stateNode),is(e,zn()),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(_h)throw _h=!1,e=Tx,Tx=null,e;return Ph&1&&e.tag!==0&&wc(),i=e.pendingLanes,i&1?e===Rx?rd++:(rd=0,Rx=e):rd=0,Ea(),null}function wc(){if(na!==null){var e=Y1(Ph),t=Hs.transition,n=qt;try{if(Hs.transition=null,qt=16>e?16:e,na===null)var r=!1;else{if(e=na,na=null,Ph=0,Ot&6)throw Error(Se(331));var s=Ot;for(Ot|=4,Be=e.current;Be!==null;){var i=Be,a=i.child;if(Be.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(Be=d;Be!==null;){var u=Be;switch(u.tag){case 0:case 11:case 15:td(8,u,i)}var f=u.child;if(f!==null)f.return=u,Be=f;else for(;Be!==null;){u=Be;var p=u.sibling,h=u.return;if(iE(u),u===d){Be=null;break}if(p!==null){p.return=h,Be=p;break}Be=h}}}var g=i.alternate;if(g!==null){var k=g.child;if(k!==null){g.child=null;do{var b=k.sibling;k.sibling=null,k=b}while(k!==null)}}Be=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,Be=a;else e:for(;Be!==null;){if(i=Be,i.flags&2048)switch(i.tag){case 0:case 11:case 15:td(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,Be=y;break e}Be=i.return}}var v=e.current;for(Be=v;Be!==null;){a=Be;var w=a.child;if(a.subtreeFlags&2064&&w!==null)w.return=a,Be=w;else e:for(a=v;Be!==null;){if(l=Be,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Sm(9,l)}}catch(C){Rn(l,l.return,C)}if(l===a){Be=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,Be=N;break e}Be=l.return}}if(Ot=s,Ea(),Hi&&typeof Hi.onPostCommitFiberRoot=="function")try{Hi.onPostCommitFiberRoot(mm,e)}catch{}r=!0}return r}finally{qt=n,Hs.transition=t}}return!1}function uk(e,t,n){t=Ac(n,t),t=YC(e,t,1),e=ca(e,t,1),t=Fr(),e!==null&&(tf(e,1,t),is(e,t))}function Rn(e,t,n){if(e.tag===3)uk(e,e,n);else for(;t!==null;){if(t.tag===3){uk(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ua===null||!ua.has(r))){e=Ac(n,e),e=GC(t,e,1),t=ca(t,e,1),e=Fr(),t!==null&&(tf(t,1,e),is(t,e));break}}t=t.return}}function LL(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Fr(),e.pingedLanes|=e.suspendedLanes&n,cr===e&&(vr&n)===n&&(rr===4||rr===3&&(vr&130023424)===vr&&500>zn()-yv?tl(e,0):gv|=n),is(e,t)}function mE(e,t){t===0&&(e.mode&1?(t=Qf,Qf<<=1,!(Qf&130023424)&&(Qf=4194304)):t=1);var n=Fr();e=bo(e,t),e!==null&&(tf(e,t,n),is(e,n))}function OL(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),mE(e,n)}function ML(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(Se(314))}r!==null&&r.delete(t),mE(e,n)}var gE;gE=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||rs.current)Qr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Qr=!1,SL(e,t,n);Qr=!!(e.flags&131072)}else Qr=!1,Sn&&t.flags&1048576&&vC(t,vh,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Kp(e,t),e=t.pendingProps;var s=Cc(t,Tr.current);xc(t,n),s=uv(null,t,r,e,s,n);var i=dv();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,ss(r)?(i=!0,xh(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,iv(t),s.updater=km,t.stateNode=s,s._reactInternals=t,bx(t,r,e,n),t=Nx(null,t,r,!0,i,n)):(t.tag=0,Sn&&i&&Qw(t),$r(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Kp(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=DL(r),e=li(r,e),s){case 0:t=Sx(null,t,r,e,n);break e;case 1:t=ek(null,t,r,e,n);break e;case 11:t=Q0(null,t,r,e,n);break e;case 14:t=Z0(null,t,r,li(r.type,e),n);break e}throw Error(Se(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:li(r,s),Sx(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:li(r,s),ek(e,t,r,s,n);case 3:e:{if(ZC(t),e===null)throw Error(Se(387));r=t.pendingProps,i=t.memoizedState,s=i.element,CC(e,t),Sh(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=Ac(Error(Se(423)),t),t=tk(e,t,r,n,s);break e}else if(r!==s){s=Ac(Error(Se(424)),t),t=tk(e,t,r,n,s);break e}else for(bs=la(t.stateNode.containerInfo.firstChild),Ss=t,Sn=!0,di=null,n=NC(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ec(),r===s){t=ko(e,t,n);break e}$r(e,t,r,n)}t=t.child}return t;case 5:return EC(t),e===null&&xx(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,px(r,s)?a=null:i!==null&&px(r,i)&&(t.flags|=32),QC(e,t),$r(e,t,a,n),t.child;case 6:return e===null&&xx(t),null;case 13:return eE(e,t,n);case 4:return ov(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=_c(t,null,r,n):$r(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:li(r,s),Q0(e,t,r,s,n);case 7:return $r(e,t,t.pendingProps,n),t.child;case 8:return $r(e,t,t.pendingProps.children,n),t.child;case 12:return $r(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,dn(bh,r._currentValue),r._currentValue=a,i!==null)if(xi(i.value,a)){if(i.children===s.children&&!rs.current){t=ko(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=xo(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),wx(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(Se(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),wx(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}$r(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,xc(t,n),s=Us(s),r=r(s),t.flags|=1,$r(e,t,r,n),t.child;case 14:return r=t.type,s=li(r,t.pendingProps),s=li(r.type,s),Z0(e,t,r,s,n);case 15:return JC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:li(r,s),Kp(e,t),t.tag=1,ss(r)?(e=!0,xh(t)):e=!1,xc(t,n),qC(t,r,s),bx(t,r,s,n),Nx(null,t,r,!0,e,n);case 19:return tE(e,t,n);case 22:return XC(e,t,n)}throw Error(Se(156,t.tag))};function yE(e,t){return W1(e,t)}function $L(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 Bs(e,t,n,r){return new $L(e,t,n,r)}function bv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function DL(e){if(typeof e=="function")return bv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===zw)return 11;if(e===Bw)return 14}return 2}function fa(e,t){var n=e.alternate;return n===null?(n=Bs(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 Gp(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")bv(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Jl:return nl(n.children,s,i,t);case Fw:a=8,s|=8;break;case Vy:return e=Bs(12,n,t,s|2),e.elementType=Vy,e.lanes=i,e;case Ky:return e=Bs(13,n,t,s),e.elementType=Ky,e.lanes=i,e;case qy:return e=Bs(19,n,t,s),e.elementType=qy,e.lanes=i,e;case E1:return jm(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case j1:a=10;break e;case C1:a=9;break e;case zw:a=11;break e;case Bw:a=14;break e;case Go:a=16,r=null;break e}throw Error(Se(130,e==null?e:typeof e,""))}return t=Bs(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function nl(e,t,n,r){return e=Bs(7,e,r,t),e.lanes=n,e}function jm(e,t,n,r){return e=Bs(22,e,r,t),e.elementType=E1,e.lanes=n,e.stateNode={isHidden:!1},e}function qg(e,t,n){return e=Bs(6,e,null,t),e.lanes=n,e}function Yg(e,t,n){return t=Bs(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function FL(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 kv(e,t,n,r,s,i,a,l,c){return e=new FL(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Bs(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},iv(i),e}function zL(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Gl,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function xE(e){if(!e)return xa;e=e._reactInternals;e:{if(wl(e)!==e||e.tag!==1)throw Error(Se(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ss(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Se(171))}if(e.tag===1){var n=e.type;if(ss(n))return xC(e,n,t)}return t}function wE(e,t,n,r,s,i,a,l,c){return e=kv(n,r,!0,e,s,i,a,l,c),e.context=xE(null),n=e.current,r=Fr(),s=da(n),i=xo(r,s),i.callback=t??null,ca(n,i,s),e.current.lanes=s,tf(e,s,r),is(e,r),e}function Cm(e,t,n,r){var s=t.current,i=Fr(),a=da(s);return n=xE(n),t.context===null?t.context=n:t.pendingContext=n,t=xo(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ca(s,t,a),e!==null&&(yi(e,s,a,i),Up(e,s,a)),a}function Ih(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 dk(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Sv(e,t){dk(e,t),(e=e.alternate)&&dk(e,t)}function BL(){return null}var vE=typeof reportError=="function"?reportError:function(e){console.error(e)};function Nv(e){this._internalRoot=e}Em.prototype.render=Nv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Se(409));Cm(e,t,null,null)};Em.prototype.unmount=Nv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dl(function(){Cm(null,e,null,null)}),t[vo]=null}};function Em(e){this._internalRoot=e}Em.prototype.unstable_scheduleHydration=function(e){if(e){var t=X1();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qo.length&&t!==0&&t<Qo[n].priority;n++);Qo.splice(n,0,e),n===0&&Z1(e)}};function jv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _m(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function fk(){}function HL(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var d=Ih(a);i.call(d)}}var a=wE(t,r,e,0,null,!1,!1,"",fk);return e._reactRootContainer=a,e[vo]=a.current,Sd(e.nodeType===8?e.parentNode:e),dl(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=Ih(c);l.call(d)}}var c=kv(e,0,!1,null,null,!1,!1,"",fk);return e._reactRootContainer=c,e[vo]=c.current,Sd(e.nodeType===8?e.parentNode:e),dl(function(){Cm(t,c,n,r)}),c}function Pm(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=Ih(a);l.call(c)}}Cm(t,a,e,s)}else a=HL(n,t,e,s,r);return Ih(a)}G1=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Bu(t.pendingLanes);n!==0&&(Ww(t,n|1),is(t,zn()),!(Ot&6)&&(Ic=zn()+500,Ea()))}break;case 13:dl(function(){var r=bo(e,1);if(r!==null){var s=Fr();yi(r,e,1,s)}}),Sv(e,1)}};Vw=function(e){if(e.tag===13){var t=bo(e,134217728);if(t!==null){var n=Fr();yi(t,e,134217728,n)}Sv(e,134217728)}};J1=function(e){if(e.tag===13){var t=da(e),n=bo(e,t);if(n!==null){var r=Fr();yi(n,e,t,r)}Sv(e,t)}};X1=function(){return qt};Q1=function(e,t){var n=qt;try{return qt=e,t()}finally{qt=n}};rx=function(e,t,n){switch(t){case"input":if(Jy(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=wm(r);if(!s)throw Error(Se(90));P1(r),Jy(r,s)}}}break;case"textarea":I1(e,n);break;case"select":t=n.value,t!=null&&hc(e,!!n.multiple,t,!1)}};D1=xv;F1=dl;var UL={usingClientEntryPoint:!1,Events:[rf,ec,wm,M1,$1,xv]},Cu={findFiberByHostInstance:Xa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},WL={bundleType:Cu.bundleType,version:Cu.version,rendererPackageName:Cu.rendererPackageName,rendererConfig:Cu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Co.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=H1(e),e===null?null:e.stateNode},findFiberByHostInstance:Cu.findFiberByHostInstance||BL,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 cp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cp.isDisabled&&cp.supportsFiber)try{mm=cp.inject(WL),Hi=cp}catch{}}Es.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=UL;Es.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!jv(t))throw Error(Se(200));return zL(e,t,null,n)};Es.createRoot=function(e,t){if(!jv(e))throw Error(Se(299));var n=!1,r="",s=vE;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=kv(e,1,!1,null,null,n,!1,r,s),e[vo]=t.current,Sd(e.nodeType===8?e.parentNode:e),new Nv(t)};Es.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(Se(188)):(e=Object.keys(e).join(","),Error(Se(268,e)));return e=H1(t),e=e===null?null:e.stateNode,e};Es.flushSync=function(e){return dl(e)};Es.hydrate=function(e,t,n){if(!_m(t))throw Error(Se(200));return Pm(null,e,t,!0,n)};Es.hydrateRoot=function(e,t,n){if(!jv(e))throw Error(Se(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=vE;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=wE(t,null,e,1,n??null,s,!1,i,a),e[vo]=t.current,Sd(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 Em(t)};Es.render=function(e,t,n){if(!_m(t))throw Error(Se(200));return Pm(null,e,t,!1,n)};Es.unmountComponentAtNode=function(e){if(!_m(e))throw Error(Se(40));return e._reactRootContainer?(dl(function(){Pm(null,null,e,!1,function(){e._reactRootContainer=null,e[vo]=null})}),!0):!1};Es.unstable_batchedUpdates=xv;Es.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!_m(n))throw Error(Se(200));if(e==null||e._reactInternals===void 0)throw Error(Se(38));return Pm(e,t,n,!1,r)};Es.version="18.3.1-next-f1338f8080-20240426";function bE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bE)}catch(e){console.error(e)}}bE(),b1.exports=Es;var Xr=b1.exports,pk=Xr;Uy.createRoot=pk.createRoot,Uy.hydrateRoot=pk.hydrateRoot;const kE=m.createContext(null);function Mx(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function VL(){const e=Mx(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function KL({children:e}){const[t,n]=m.useState(VL);m.useEffect(()=>{const i=()=>n(Mx(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=Mx(l.pathname),d=l.search||"";window.history.pushState({},"",c+d),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(kE.Provider,{value:s,children:e})}function vl(){const e=m.useContext(kE);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function qL(){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 hk={};function $x(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&hk[t[0]]||(typeof t[0]=="string"&&(hk[t[0]]=new Date),qL(...t))}const SE=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function mk(e,t,n){e.loadNamespaces(t,SE(e,n))}function gk(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,SE(e,r))}function YL(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 GL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?($x("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}}):YL(e,t,n)}const JL=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,XL={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},QL=e=>XL[e],ZL=e=>e.replace(JL,QL);let Dx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ZL};function eO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Dx={...Dx,...e}}function tO(){return Dx}let NE;function nO(e){NE=e}function rO(){return NE}const sO={type:"3rdParty",init(e){eO(e.options.react),nO(e)}},iO=m.createContext();class oO{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const aO=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function pn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(iO)||{},i=n||r||rO();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new oO),!i){$x("You will need to pass in an i18next instance by using initReactI18next");const w=(C,S)=>typeof S=="string"?S:S&&typeof S=="object"&&typeof S.defaultValue=="string"?S.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&&$x("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...tO(),...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 u=(i.isInitialized||i.initializedStoreOnce)&&d.every(w=>GL(w,i,a));function f(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?d:d[0],c)}const[p,h]=m.useState(f);let g=d.join();t.lng&&(g=`${t.lng}${g}`);const k=aO(g),b=m.useRef(!0);m.useEffect(()=>{const{bindI18n:w,bindI18nStore:N}=a;b.current=!0,!u&&!l&&(t.lng?gk(i,t.lng,d,()=>{b.current&&h(f)}):mk(i,d,()=>{b.current&&h(f)})),u&&k&&k!==g&&b.current&&h(f);function C(){b.current&&h(f)}return w&&i&&i.on(w,C),N&&i&&i.store.on(N,C),()=>{b.current=!1,w&&i&&w.split(" ").forEach(S=>i.off(S,C)),N&&i&&N.split(" ").forEach(S=>i.store.off(S,C))}},[i,g]);const y=m.useRef(!0);m.useEffect(()=>{b.current&&!y.current&&h(f),y.current=!1},[i,c]);const v=[p,i,u];if(v.t=p,v.i18n=i,v.ready=u,u||!u&&!l)return v;throw new Promise(w=>{t.lng?gk(i,t.lng,d,()=>w()):mk(i,d,()=>w())})}const jE="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",lO=[{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:"/settings",labelKey:"common:nav.settings",icon:"settings"}],cO=[{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 uO(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function dO({authUser:e,onLogout:t}){const{path:n,navigate:r}=vl(),{t:s}=pn(),[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:jE,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:lO.map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(uO(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)||""}),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&&cO.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 CE="agentflow.pipelineRecent",fO=50,pO=15;function hO(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function EE(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(CE);return e?hO(e).filter(t=>t&&typeof t.flowId=="string"&&(t.flowSource==="user"||t.flowSource==="builtin"||t.flowSource==="workspace")&&t.kind==="opened"&&typeof t.at=="number"):[]}function up(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=EE(),i=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(a=>!(a.flowId===e&&a.flowSource===t))].slice(0,fO);try{localStorage.setItem(CE,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==="builtin")?"builtin":n[0].source??"user"}function Fx(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 u=Math.floor(a/24);return u<7?t("flow:time.daysAgo",{n:u}):`${l.getMonth()+1}/${l.getDate()}`}function gO(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 yO(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,pO)}var xs=Uint8Array,ac=Uint16Array,xO=Int32Array,_E=new xs([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]),PE=new xs([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]),wO=new xs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),AE=function(e,t){for(var n=new ac(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new xO(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}},IE=AE(_E,2),TE=IE.b,vO=IE.r;TE[28]=258,vO[258]=28;var bO=AE(PE,0),kO=bO.b,zx=new ac(32768);for(var yn=0;yn<32768;++yn){var Vo=(yn&43690)>>1|(yn&21845)<<1;Vo=(Vo&52428)>>2|(Vo&13107)<<2,Vo=(Vo&61680)>>4|(Vo&3855)<<4,zx[yn]=((Vo&65280)>>8|(Vo&255)<<8)>>1}var sd=function(e,t,n){for(var r=e.length,s=0,i=new ac(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new ac(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new ac(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var d=s<<4|e[s],u=t-e[s],f=a[e[s]-1]++<<u,p=f|(1<<u)-1;f<=p;++f)l[zx[f]>>c]=d}else for(l=new ac(r),s=0;s<r;++s)e[s]&&(l[s]=zx[a[e[s]-1]++]>>15-e[s]);return l},of=new xs(288);for(var yn=0;yn<144;++yn)of[yn]=8;for(var yn=144;yn<256;++yn)of[yn]=9;for(var yn=256;yn<280;++yn)of[yn]=7;for(var yn=280;yn<288;++yn)of[yn]=8;var RE=new xs(32);for(var yn=0;yn<32;++yn)RE[yn]=5;var SO=sd(of,9,1),NO=sd(RE,5,1),Gg=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ai=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Jg=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},jO=function(e){return(e+7)/8|0},Cv=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new xs(e.subarray(t,n))},CO=["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"],Ms=function(e,t,n){var r=new Error(t||CO[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ms),!n)throw r;return r},EO=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new xs(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new xs(s*3));var d=function(pe){var ve=n.length;if(pe>ve){var je=new xs(Math.max(ve*2,pe));je.set(n),n=je}},u=t.f||0,f=t.p||0,p=t.b||0,h=t.l,g=t.d,k=t.m,b=t.n,y=s*8;do{if(!h){u=ai(e,f,1);var v=ai(e,f+1,3);if(f+=3,v)if(v==1)h=SO,g=NO,k=9,b=5;else if(v==2){var S=ai(e,f,31)+257,A=ai(e,f+10,15)+4,R=S+ai(e,f+5,31)+1;f+=14;for(var M=new xs(R),V=new xs(19),D=0;D<A;++D)V[wO[D]]=ai(e,f+D*3,7);f+=A*3;for(var O=Gg(V),K=(1<<O)-1,$=sd(V,O,1),D=0;D<R;){var L=$[ai(e,f,K)];f+=L&15;var w=L>>4;if(w<16)M[D++]=w;else{var I=0,z=0;for(w==16?(z=3+ai(e,f,3),f+=2,I=M[D-1]):w==17?(z=3+ai(e,f,7),f+=3):w==18&&(z=11+ai(e,f,127),f+=7);z--;)M[D++]=I}}var P=M.subarray(0,S),T=M.subarray(S);k=Gg(P),b=Gg(T),h=sd(P,k,1),g=sd(T,b,1)}else Ms(1);else{var w=jO(f)+4,N=e[w-4]|e[w-3]<<8,C=w+N;if(C>s){c&&Ms(0);break}l&&d(p+N),n.set(e.subarray(w,C),p),t.b=p+=N,t.p=f=C*8,t.f=u;continue}if(f>y){c&&Ms(0);break}}l&&d(p+131072);for(var E=(1<<k)-1,J=(1<<b)-1,Q=f;;Q=f){var I=h[Jg(e,f)&E],H=I>>4;if(f+=I&15,f>y){c&&Ms(0);break}if(I||Ms(2),H<256)n[p++]=H;else if(H==256){Q=f,h=null;break}else{var te=H-254;if(H>264){var D=H-257,le=_E[D];te=ai(e,f,(1<<le)-1)+TE[D],f+=le}var ue=g[Jg(e,f)&J],de=ue>>4;ue||Ms(3),f+=ue&15;var T=kO[de];if(de>3){var le=PE[de];T+=Jg(e,f)&(1<<le)-1,f+=le}if(f>y){c&&Ms(0);break}l&&d(p+131072);var ce=p+te;if(p<T){var fe=i-T,se=Math.min(T,ce);for(fe+p<0&&Ms(3);p<se;++p)n[p]=r[fe+p]}for(;p<ce;++p)n[p]=n[p-T]}}t.l=h,t.p=Q,t.b=p,t.f=u,h&&(u=1,t.m=k,t.d=g,t.n=b)}while(!u);return p!=n.length&&a?Cv(n,0,p):n.subarray(0,p)},_O=new xs(0),Fi=function(e,t){return e[t]|e[t+1]<<8},fi=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Xg=function(e,t){return fi(e,t)+fi(e,t+4)*4294967296};function PO(e,t){return EO(e,{i:2},t&&t.out,t&&t.dictionary)}var Bx=typeof TextDecoder<"u"&&new TextDecoder,AO=0;try{Bx.decode(_O,{stream:!0}),AO=1}catch{}var IO=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:Cv(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 TO(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(Bx)return Bx.decode(e);var s=IO(e),i=s.s,n=s.r;return n.length&&Ms(8),i}}var RO=function(e,t){return t+30+Fi(e,t+26)+Fi(e,t+28)},LO=function(e,t,n){var r=Fi(e,t+28),s=TO(e.subarray(t+46,t+46+r),!(Fi(e,t+8)&2048)),i=t+46+r,a=fi(e,t+20),l=n&&a==4294967295?OO(e,i):[a,fi(e,t+24),fi(e,t+42)],c=l[0],d=l[1],u=l[2];return[Fi(e,t+10),c,d,s,i+Fi(e,t+30)+Fi(e,t+32),u]},OO=function(e,t){for(;Fi(e,t)!=1;t+=4+Fi(e,t+2));return[Xg(e,t+12),Xg(e,t+4),Xg(e,t+20)]};function MO(e,t){for(var n={},r=e.length-22;fi(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Ms(13);var s=Fi(e,r+8);if(!s)return{};var i=fi(e,r+16),a=i==4294967295||s==65535;if(a){var l=fi(e,r-12);a=fi(e,l)==101075792,a&&(s=fi(e,l+32),i=fi(e,l+48))}for(var c=0;c<s;++c){var d=LO(e,i,a),u=d[0],f=d[1],p=d[2],h=d[3],g=d[4],k=d[5],b=RO(e,k);i=g,u?u==8?n[h]=PO(e.subarray(b,b+f),{out:new xs(p)}):Ms(14,"unknown compression type "+u):n[h]=Cv(e,b,b+f)}return n}const $O=8*1024*1024,DO=500;function FO(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 zO(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function BO(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 HO=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function UO(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=MO(t),r=new Map;let s=0,i=0;for(const[c,d]of Object.entries(n)){if(c.endsWith("/"))continue;const u=FO(c);if(!u||zO(u))continue;const f=(d==null?void 0:d.length)??0;if(s+=f,s>$O||(i+=1,i>DO))return null;r.set(u,f)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const d=BO(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 HO.test(l)?l:null}catch{return null}}const Qg=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function WO({file:e,onClose:t,onImported:n}){const{t:r}=pn(),s=m.useId(),i=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(""),[d,u]=m.useState("user"),[f,p]=m.useState(!1),[h,g]=m.useState(""),[k,b]=m.useState(null),y=k??e;m.useEffect(()=>{const C=requestAnimationFrame(()=>{var S;return(S=i.current)==null?void 0:S.focus()});return()=>cancelAnimationFrame(C)},[]),m.useEffect(()=>{let C=!1;return(async()=>{const S=y.name||"",A=S.toLowerCase();let R="";if(A.endsWith(".zip")){if(R=await UO(y)||"",!R){const M=S.replace(/\.zip$/i,"");Qg.test(M)&&(R=M)}}else if(A.endsWith(".yaml")||A.endsWith(".yml")){const M=S.replace(/\.ya?ml$/i,"");Qg.test(M)&&(R=M)}C||c(R)})(),()=>{C=!0}},[y]);const v=l.trim(),w=v.length>0&&Qg.test(v);async function N(C){if(C.preventDefault(),!(!w||f)){p(!0),g("");try{const S=new FormData;S.set("flowId",v),S.set("targetSpace",d),S.set("file",y,y.name);const A=await fetch("/api/flows/import",{method:"POST",body:S}),R=await A.json().catch(()=>({}));if(!A.ok){g(typeof R.error=="string"?R.error:r("project:importModal.importFailed"));return}n({id:R.flowId,source:R.flowSource??"user"})}catch(S){g(String((S==null?void 0:S.message)||S))}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 A;const S=(A=C.target.files)==null?void 0:A[0];S&&b(S),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":v.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:f,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!w||f,children:r(f?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const VO=/^[a-zA-Z][a-zA-Z0-9_-]*$/,yk="af:newPipelineGuide";function KO({open:e,onClose:t,onCreated:n}){const{t:r}=pn(),s=m.useId(),i=m.useRef(null),[a,l]=m.useState(""),[c,d]=m.useState(""),[u,f]=m.useState("user"),[p,h]=m.useState(!1),[g,k]=m.useState(""),[b,y]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),d(""),f("user"),k(""),h(!1),localStorage.getItem(yk)==="true"&&y(!0);const A=requestAnimationFrame(()=>{var R;return(R=i.current)==null?void 0:R.focus()});return()=>cancelAnimationFrame(A)},[e]);const v=()=>{localStorage.removeItem(yk),y(!1)};if(!e)return null;const w=a.trim(),N=w.length>0&&VO.test(w);async function C(S){if(S.preventDefault(),!(!N||p)){h(!0),k(""),v();try{const A=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:w,description:c.trim(),targetSpace:u})}),R=await A.json().catch(()=>({}));if(!A.ok){k(typeof R.error=="string"?R.error:r("project:newPipelineModal.createFailed"));return}n({id:R.flowId,source:R.flowSource??"user"})}catch(A){k(String((A==null?void 0:A.message)||A))}finally{h(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:S=>{S.target===S.currentTarget&&(v(),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:S=>S.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:()=>{v(),t()},"aria-label":r("project:newPipelineModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),b?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:v,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:S=>l(S.target.value),"aria-invalid":w.length>0&&!N}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(b?"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(b?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:S=>d(S.target.value)}),b?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:()=>{v(),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":b?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const LE="agentflow.pipelineViewPreference";function OE(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function ME(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(LE)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function qO(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(LE,JSON.stringify(e))}catch{}}function Th(e){return e==="pipeline"?"pipeline":"workspace"}function YO(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function $E(e,t,n,r=!1){if(!e)return;const s=ME();s[OE(e,t,r)]={view:Th(n),at:Date.now()},qO(s)}function GO(e,t="workspace"){if(!(e!=null&&e.id))return Th(t);const r=ME()[OE(e.id,e.source??"user",!!e.archived)],s=Th((r==null?void 0:r.view)||t);return s==="pipeline"&&!YO(e)?"workspace":s}function Ev(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"),`/${Th(t)==="pipeline"?"flow":"workspace"}?${n.toString()}`}function dp(e,t="workspace"){return Ev(e,GO(e,t))}function JO({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,u]=m.useState([]),[f,p]=m.useState(""),[h,g]=m.useState(""),[k,b]=m.useState(""),y=m.useCallback(async()=>{g("");try{const[S,A]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),R=await S.json().catch(()=>({}));S.ok&&n({available:!!R.available,version:typeof R.version=="string"?R.version:"",loggedIn:!!R.loggedIn,user:typeof R.user=="string"?R.user:"",error:typeof R.error=="string"?R.error:""});const M=await A.json().catch(()=>({}));if(!A.ok)throw new Error(typeof M.error=="string"?M.error:"HTTP "+A.status);s(Array.isArray(M.skills)?M.skills:[])}catch(S){g(String(S.message||S))}},[]);m.useEffect(()=>{y()},[y]);const v=m.useCallback(async()=>{const S=i.trim();if(S){p("search"),g(""),b("");try{const A=await fetch(`/api/skillhub/search?q=${encodeURIComponent(S)}&mode=${encodeURIComponent(l)}`),R=await A.json().catch(()=>({}));if(!A.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+A.status);u(Array.isArray(R.items)?R.items:[])}catch(A){g(String(A.message||A))}finally{p("")}}},[i,l]),w=m.useCallback(async(S,A=!1)=>{const R=S&&typeof S=="object"?S:null,M=String(R?R.slug||R.name||R.collection||R.skillId||R.id:S||"").trim();if(M){p(`install:${M}`),g(""),b("");try{const V=R?{slug:R.slug||"",skillId:R.skillId||"",collection:R.collection||"",collectionName:R.collection&&R.name||"",target:"global",agent:"codex",force:A}:{slug:M,target:"global",agent:"codex",force:A},D=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)}),O=await D.json().catch(()=>({}));if(!D.ok)throw new Error(typeof O.error=="string"?O.error:"HTTP "+D.status);b(A?`已更新 ${M}`:`已安装 ${M}`),await y(),typeof e=="function"&&await e()}catch(V){g(String(V.message||V))}finally{p("")}}},[y,e]),N=m.useCallback(async S=>{const A=String(S||"").trim();if(A){p(`uninstall:${A}`),g(""),b("");try{const R=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:A,target:"global",agent:"codex"})}),M=await R.json().catch(()=>({}));if(!R.ok)throw new Error(typeof M.error=="string"?M.error:"HTTP "+R.status);b(`已卸载 ${A}`),await y(),typeof e=="function"&&await e()}catch(R){g(String(R.message||R))}finally{p("")}}},[y,e]),C=m.useCallback(async()=>{p("update-cli"),g(""),b("");try{const S=await fetch("/api/skillhub/update",{method:"POST"}),A=await S.json().catch(()=>({}));if(!S.ok)throw new Error(typeof A.error=="string"?A.error:"HTTP "+S.status);b("SkillHub CLI 已更新"),await y()}catch(S){g(String(S.message||S))}finally{p("")}},[y]);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:y,disabled:!!f,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:C,disabled:!!f,children:f==="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:S=>{c(S.target.value),u([])},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:S=>a(S.target.value),onKeyDown:S=>{S.key==="Enter"&&v()},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:()=>v(),disabled:!i.trim()||f==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),f==="search"?"搜索中…":"搜索"]})]}),h?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:h}):null,k?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:k}):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(S=>o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:S.name}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[S.agent||"codex"," · ",S.kind||"skill"]})]}),o.jsxs("div",{className:"af-set-skillhub-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>w(S.name,!0),disabled:!!f,children:"更新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>N(S.name),disabled:!!f,children:"卸载"})]})]},`${S.agent}:${S.path}:${S.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(S=>{const A=S.slug||S.name,R=S.kind==="collection"||S.collection,M=!R&&r.some(V=>V.name===A||V.name===S.name);return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:S.name||A}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[R?`collection:${S.collection}`:A,S.skillId?` · id:${S.skillId}`:"",S.version?` · ${S.version}`:""]}),S.summary?o.jsx("p",{className:"af-set-skillhub-summary",children:S.summary}):null]}),o.jsx("button",{type:"button",className:M?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>w(S,M),disabled:!!f,children:M?"更新":R?"安装合集":"安装"})]},S.id||A)})})]})]})]})}function pa(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 XO(e){return{version:1,collections:pa({collections:e})}}function wa(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 DE(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 FE(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function zE(e,t,n){const r=wa(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 QO(e,t,n){const r=String(e||"").trim().toLowerCase(),s=pa({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return wa(s,t)}function BE(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(d=>d.key).filter(Boolean),i=String(t||"").trim().toLowerCase(),a=pa({collections:r}),l=QO(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const d=localStorage.getItem(e);if(d!==null){const u=JSON.parse(d);if(Array.isArray(u)){const f=new Set(s),p=u.map(String).filter(y=>f.has(y));if(s.length>0&&p.length===s.length)return c;const h=new Set(p),g=new Set(l),k=l.length>0&&l.every(y=>h.has(y)),b=a.some(y=>{if(!y.builtin||y.id===i||y.name.toLowerCase()===i)return!1;const v=wa(y,n);return v.length>0&&v.every(w=>h.has(w))});return l.length>0&&b&&!k?c:p}}}catch{}return c}function Eu(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 ZO(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 Hx(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function HE(e){const t=e.source??"user";return t==="builtin"?`builtin/pipelines / ${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 eM="project:defaultCardDesc";function UE(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(eM)}function tM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fn({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(`(${tM(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 nM(e,t,n){const r=[String(e.id),UE(e,n),HE(e),Hx(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function rM(e,t,n){return t?nM(e,t,n).includes(t):!0}function sM(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 Zg(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function xk(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 wk(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const iM=["all","agent","control","provide","marketplace"],oM=["all","agent","control","provide"];function fp(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function kn(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 _u(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function zl({resourceKind:e=""}){var ds,Un,fs,pr,qs,Er,ps,hs;const{t}=pn(),{navigate:n,path:r}=vl(),[s,i]=m.useState(e||"all"),[a,l]=m.useState([]),[c,d]=m.useState([]),[u,f]=m.useState([]),[p,h]=m.useState([]),[g,k]=m.useState([]),[b,y]=m.useState(""),[v,w]=m.useState(!1),[N,C]=m.useState([]),[S,A]=m.useState(""),[R,M]=m.useState(""),[V,D]=m.useState(!1),[O,K]=m.useState(!1),[$,L]=m.useState(!1),[I,z]=m.useState(null),[P,T]=m.useState(!1),[E,J]=m.useState(""),[Q,H]=m.useState(!0),[te,le]=m.useState("all"),[ue,de]=m.useState(""),[ce,fe]=m.useState("overview"),[se,pe]=m.useState({}),[ve,je]=m.useState(""),[Ve,at]=m.useState({}),[Je,jt]=m.useState(""),[De,Ce]=m.useState(""),[Jt,Bn]=m.useState({}),[Xt,_n]=m.useState(""),[Nr,ur]=m.useState(""),[oe,we]=m.useState(""),[Ge,st]=m.useState(!1),et=m.useRef(0),It=m.useRef(0),On=m.useCallback(async()=>{const q=++It.current;A("");try{const ke=await fetch("/api/flows");if(q!==It.current)return;if(!ke.ok)throw new Error("HTTP "+ke.status);const Me=await ke.json();if(q!==It.current)return;l(Array.isArray(Me)?Me:[])}catch(ke){if(q!==It.current)return;l([]),A(String(ke.message||ke))}try{const ke=await fetch("/api/pipeline-recent-runs");if(q!==It.current)return;if(ke.ok){const Me=await ke.json();if(q!==It.current)return;C(Array.isArray(Me.runs)?Me.runs:[])}else C([])}catch{if(q!==It.current)return;C([])}D(!0)},[]),Mt=m.useCallback(async()=>{M(""),K(!1);try{const[q,ke,Me,qe]=await Promise.all([fetch("/api/nodes"),fetch("/api/skills"),fetch("/api/skill-collections"),fetch("/api/marketplace/flow-snippets")]),vt=await q.json().catch(()=>({})),An=await ke.json().catch(()=>({})),$t=await Me.json().catch(()=>({})),bt=await qe.json().catch(()=>({}));if(!q.ok)throw new Error(vt.error||"Nodes HTTP "+q.status);if(!ke.ok)throw new Error(An.error||"Skills HTTP "+ke.status);if(!Me.ok)throw new Error($t.error||"Collections HTTP "+Me.status);if(!qe.ok)throw new Error(bt.error||"Flow snippets HTTP "+qe.status);d(Array.isArray(vt.nodes)?vt.nodes:Array.isArray(vt)?vt:[]),f(Array.isArray(An.skills)?An.skills:[]),k(pa($t)),h(Array.isArray(bt.snippets)?bt.snippets:[])}catch(q){d([]),f([]),h([]),k([]),M(String(q.message||q))}finally{K(!0)}},[]);m.useEffect(()=>{D(!1),On(),Mt()},[On,Mt]),m.useEffect(()=>{let q=!1;return fetch("/api/ui-context").then(ke=>ke.json()).then(ke=>{q||st(!!ke.hideCommunityLinks)}).catch(()=>{}),()=>{q=!0}},[]);const Mn=m.useCallback(async q=>{const ke=pa({collections:q});w(!0),M("");try{const Me=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(XO(ke))}),qe=await Me.json().catch(()=>({}));if(!Me.ok)throw new Error(qe.error||"Collections HTTP "+Me.status);k(pa(qe))}catch(Me){M(String(Me.message||Me))}finally{w(!1)}},[]),Qt=m.useCallback(()=>{const q=b.trim();if(!q)return;const ke=q.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Me=new Set(g.map($t=>$t.id));let qe=ke,vt=2;for(;Me.has(qe);)qe=`${ke}-${vt++}`;const An=Date.now();Mn([...g,{id:qe,name:q,skillKeys:[],createdAt:An,updatedAt:An}]),y(""),le(`collection:${qe}`)},[b,Mn,g]),Zt=m.useCallback(q=>{const ke=g.find(qe=>qe.id===q);if(ke!=null&&ke.builtin)return;const Me=g.filter(qe=>qe.id!==q);te===`collection:${q}`&&le("all"),Mn(Me)},[te,Mn,g]),sr=m.useCallback((q,ke,Me)=>{const qe=String(ke||"").trim();if(!qe)return;const vt=Date.now(),An=g.map($t=>{if($t.id!==q)return $t;const bt=new Set($t.skillKeys||[]);return Me?bt.add(qe):bt.delete(qe),{...$t,skillKeys:Array.from(bt),updatedAt:vt}});Mn(An)},[Mn,g]),he=m.useCallback(async q=>{const ke=q==null?void 0:q.packageId,Me=q==null?void 0:q.version;if(!ke||!Me||!window.confirm(t("project:deleteMyNodeConfirm",{id:ke,version:Me})))return;const qe=kn(q);ur(qe),we(""),M("");try{const vt=new URLSearchParams({id:ke,version:Me}),An=await fetch(`/api/marketplace/node?${vt.toString()}`,{method:"DELETE"}),$t=await An.json().catch(()=>({}));if(!An.ok||($t==null?void 0:$t.ok)===!1){const bt=Array.isArray($t==null?void 0:$t.usage)&&$t.usage.length>0?` ${t("project:deleteMyNodeUsedBy",{count:$t.usage.length})}`:"";throw new Error((($t==null?void 0:$t.error)||"Delete failed")+bt)}we(t("project:deleteMyNodeSuccess",{id:ke,version:Me})),at(bt=>{const en={...bt};return delete en[qe],en}),Bn(bt=>{const en={};for(const[Ys,Or]of Object.entries(bt))Ys.startsWith(`${qe}:`)||(en[Ys]=Or);return en}),de(""),await Mt()}catch(vt){we(String(vt.message||vt))}finally{ur("")}},[Mt,t]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){i(e),le("all"),de(""),fe("overview");return}i(q=>q==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(r!=="/projects"&&r!=="/")return;const q=new URLSearchParams(window.location.search);let ke=!1;if(q.get("tab")==="nodes"){n("/nodes");return}if(q.get("tab")==="my-nodes"){n("/my-nodes");return}if(q.get("tab")==="my-flows"){n("/my-flows");return}if(q.get("tab")==="skills"){n("/skills");return}if(q.get("tab")==="archived"&&(i("archived"),q.delete("tab"),ke=!0),q.get("new")==="1"&&(L(!0),q.delete("new"),ke=!0),ke){const Me=q.toString();window.history.replaceState({},"",Me?`/projects?${Me}`:"/projects")}},[r,n]);const Te=m.useMemo(()=>yO(N,EE(),a),[N,a,r]),rn=m.useMemo(()=>Te.filter(q=>sM(E,q)),[Te,E]),lt=E.trim().toLowerCase(),vn=m.useMemo(()=>s==="archived"?a.filter(q=>q.archived):a.filter(q=>!q.archived),[a,s]),Vs=m.useMemo(()=>vn.filter(q=>rM(q,lt,t)),[vn,lt,t]),Pn=s==="nodes"||s==="my-nodes",jr=s==="my-nodes",dr=s==="my-flows",Hr=m.useMemo(()=>c.filter(q=>jr&&q.source!=="marketplace"?!1:(te==="all"||(te==="marketplace"?q.source==="marketplace":q.type===te))&&Zg(E,[q.id,q.label,q.displayName,q.description,q.type,q.source,q.packageId,q.version])),[c,jr,E,te]),Ks=m.useMemo(()=>{const q=new Map;for(const ke of g)q.set(ke.id,new Set(ke.skillKeys||[]));return q},[g]),Po=m.useMemo(()=>[{id:"all",label:"全部"},...g.map(q=>({id:`collection:${q.id}`,label:q.name,count:q.skillKeys.length,collection:q})),{id:"ungrouped",label:"未分组"}],[g]),Cr=m.useMemo(()=>u.filter(q=>{var qe;const ke=kn(q);let Me=te==="all";if(te.startsWith("collection:")){const vt=te.slice(11);Me=!!((qe=Ks.get(vt))!=null&&qe.has(ke))}else te==="ungrouped"&&(Me=!Array.from(Ks.values()).some(vt=>vt.has(ke)));return Me&&Zg(E,[q.name,q.id,q.description,q.sourceLabel,q.source,q.path])}),[u,E,te,Ks]),Xn=m.useMemo(()=>p.filter(q=>Zg(E,[q.id,q.name,q.displayName,q.description,q.version,q.packageDir,Array.isArray(q.tags)?q.tags.join(" "):""])),[p,E]),Ps=Pn||dr||s==="skills",Xe=m.useMemo(()=>Hr.find(q=>kn(q)===ue)||Hr[0]||null,[Hr,ue]),Vt=m.useMemo(()=>Cr.find(q=>kn(q)===ue)||Cr[0]||null,[Cr,ue]),sn=m.useMemo(()=>Xn.find(q=>_u(q)===ue)||Xn[0]||null,[Xn,ue]),us=Vt?se[kn(Vt)]:null,Ke=Xe?Ve[kn(Xe)]:null,Hn=Xe&&De?Jt[`${kn(Xe)}:${De}`]:null,Re=t(Pn?"project:searchNodes":dr?"project:searchFlows":s==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(s!=="skills"||!Vt)return;const q=kn(Vt);if(se[q])return;let ke=!1;return je(q),fetch(`/api/skills/detail?key=${encodeURIComponent(q)}`).then(Me=>Me.json().then(qe=>({ok:Me.ok,json:qe}))).then(({ok:Me,json:qe})=>{ke||Me&&qe.skill&&pe(vt=>({...vt,[q]:qe.skill}))}).catch(()=>{}).finally(()=>{ke||je("")}),()=>{ke=!0}},[s,Vt,se]),m.useEffect(()=>{if(!Pn||!Xe)return;const q=kn(Xe);if(Ve[q])return;let ke=!1;return jt(q),fetch(`/api/nodes/detail?id=${encodeURIComponent(Xe.id)}`).then(Me=>Me.json().then(qe=>({ok:Me.ok,json:qe}))).then(({ok:Me,json:qe})=>{ke||Me&&at(vt=>({...vt,[q]:qe}))}).catch(()=>{}).finally(()=>{ke||jt("")}),()=>{ke=!0}},[Pn,Xe,Ve]),m.useEffect(()=>{if(!Pn)return;const q=Array.isArray(Ke==null?void 0:Ke.files)?Ke.files:[];Ce(ke=>{var Me;return ke&&q.some(qe=>qe.path===ke)?ke:((Me=q[0])==null?void 0:Me.path)||""})},[Pn,Ke]),m.useEffect(()=>{if(!Pn||!Xe||!De)return;const q=`${kn(Xe)}:${De}`;if(Jt[q])return;let ke=!1;return _n(q),fetch(`/api/nodes/file?id=${encodeURIComponent(Xe.id)}&path=${encodeURIComponent(De)}`).then(Me=>Me.json().then(qe=>({ok:Me.ok,json:qe}))).then(({ok:Me,json:qe})=>{ke||Me&&Bn(vt=>({...vt,[q]:qe}))}).catch(()=>{}).finally(()=>{ke||_n("")}),()=>{ke=!0}},[Pn,Xe,De,Jt]),m.useEffect(()=>{we("")},[ue,s]);const Ft=q=>{n(dp(q,"workspace"))},As=q=>{n(dp({id:q.flowId,source:q.flowSource,archived:!!q.archived},"workspace"))},ft=m.useCallback(q=>{var ke,Me;q.preventDefault(),q.stopPropagation(),(Me=(ke=q.dataTransfer)==null?void 0:ke.types)!=null&&Me.includes("Files")&&(et.current+=1,T(!0))},[]),Ur=m.useCallback(q=>{q.preventDefault(),q.stopPropagation(),et.current-=1,et.current<=0&&(et.current=0,T(!1))},[]),fr=m.useCallback(q=>{q.preventDefault(),q.stopPropagation()},[]),on=m.useCallback(q=>{var qe,vt;q.preventDefault(),q.stopPropagation(),et.current=0,T(!1);const ke=(vt=(qe=q.dataTransfer)==null?void 0:qe.files)==null?void 0:vt[0];if(!ke)return;const Me=ke.name.toLowerCase();!Me.endsWith(".yaml")&&!Me.endsWith(".yml")&&!Me.endsWith(".zip")||z(ke)},[]);return o.jsxs("div",{className:"af-projects"+(P?" af-projects--drop-target":""),onDragEnter:ft,onDragLeave:Ur,onDragOver:fr,onDrop:on,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:s==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>i("all"),children:t("project:all")}),o.jsx("button",{type:"button",className:s==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>i("archived"),children:t("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"+(E.trim()?" af-search--has-clear":""),type:"search",placeholder:Re,"aria-label":Re,autoComplete:"off",value:E,onChange:q=>J(q.target.value),onKeyDown:q=>{q.key==="Escape"&&(J(""),q.currentTarget.blur())}}),E.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>J(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),Ps?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Mt(),children:t("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(Q?" af-icon-btn--active":""),"aria-label":t("flow:palette.toggleRecentActivity"),"aria-expanded":Q,"aria-controls":"af-recent-activity-panel",onClick:()=>H(q=>!q),children:o.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>L(!0),children:t("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:t(s==="my-nodes"?"project:myNodes":s==="my-flows"?"project:myFlows":s==="nodes"?"project:globalNodes":s==="skills"?"project:globalSkills":s==="archived"?"project:archivedPipelines":"project:activeProjects")}),o.jsx("p",{className:"af-projects-sub",children:lt?t("project:filterResult",{count:s==="nodes"||s==="my-nodes"?Hr.length:s==="my-flows"?Xn.length:s==="skills"?Cr.length:Vs.length}):s==="my-nodes"?t("project:myNodesHint",{count:Hr.length}):s==="my-flows"?t("project:myFlowsHint",{count:Xn.length}):s==="nodes"?t("project:nodesHint",{count:c.length}):s==="skills"?t("project:skillsHint",{count:u.length}):t(s==="archived"?"project:archivedHint":"project:activeHint")}),S?o.jsx("p",{className:"af-err af-projects-api-hint",children:S}):null,R&&Ps?o.jsx("p",{className:"af-err af-projects-api-hint",children:R}):null]}),Ps?o.jsxs("div",{className:"af-resource-toolbar",children:[s==="skills"?o.jsx(JO,{onChanged:Mt}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:dr?"schema":Pn?jr?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:t(dr?"project:myFlowsPurposeTitle":jr?"project:myNodesPurposeTitle":Pn?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:t(dr?"project:myFlowsPurposeDesc":jr?"project:myNodesPurposeDesc":Pn?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),dr?null:o.jsx("div",{className:"af-resource-filter-row",children:(Pn?(jr?oM:iM).map(q=>({id:q,label:t(`project:resourceFilter.${q}`)})):Po).map(q=>q.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(te===q.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{le(q.id),de("")},children:[q.label,o.jsx("em",{children:q.count}),q.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),q.collection.builtin?null:o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:v,"aria-label":`删除 ${q.collection.name}`,onClick:()=>Zt(q.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},q.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(te===q.id?" af-resource-filter--active":""),onClick:()=>{le(q.id),de("")},children:q.label},q.id))}),s==="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:b,onChange:q=>y(q.target.value),onKeyDown:q=>{q.key==="Enter"&&Qt()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!b.trim()||v,onClick:()=>Qt(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Pn?o.jsx("div",{className:"af-resource-grid",children:Hr.length>0?Hr.map(q=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Xe&&kn(q)===kn(Xe)?" af-resource-card--active":""),onClick:()=>de(kn(q)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Eu(q.type==="control"?"secondary":q.type==="provide"?"primary":"muted"),children:o.jsx(Fn,{query:E,children:q.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(Fn,{query:E,children:xk(q.source,t)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Fn,{query:E,children:q.label||q.displayName||q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Fn,{query:E,children:q.description||t("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(Fn,{query:E,children:q.id})}),o.jsx("span",{children:t("project:nodeSlots",{inputs:Object.keys(q.inputs||{}).length,outputs:Object.keys(q.outputs||{}).length})})]}),q.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(Fn,{query:E,children:`${q.packageId}${q.version?` / ${q.version}`:""}`})})]}):null]},`${q.id}:${q.source||""}:${q.packageId||""}`)):O?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:lt?t("project:noNodeMatch",{query:E.trim()}):t(jr?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):dr?o.jsx("div",{className:"af-resource-grid",children:Xn.length>0?Xn.map(q=>{const ke=q.snippet&&Array.isArray(q.snippet.instances)?q.snippet.instances:[],Me=q.snippet&&Array.isArray(q.snippet.edges)?q.snippet.edges:[],qe=Number.isFinite(Number(q.nodeCount))?Number(q.nodeCount):ke.length,vt=Number.isFinite(Number(q.edgeCount))?Number(q.edgeCount):Me.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(sn&&_u(q)===_u(sn)?" af-resource-card--active":""),onClick:()=>de(_u(q)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Eu("primary"),children:o.jsx(Fn,{query:E,children:q.version?`v${q.version}`:"flow"})}),o.jsx("span",{className:"af-resource-source",children:t("project:flowSnippet")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Fn,{query:E,children:q.displayName||q.name||q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Fn,{query:E,children:q.description||t("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:t("project:flowSnippetNodes",{nodes:qe,edges:vt})}),o.jsx("span",{children:o.jsx(Fn,{query:E,children:q.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(Fn,{query:E,children:wk(q)})})]})]},_u(q))}):O?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:lt?t("project:noFlowSnippetMatch",{query:E.trim()}):t("project:noMyFlows")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):s==="skills"?o.jsx("div",{className:"af-resource-grid",children:Cr.length>0?Cr.map(q=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Vt&&kn(q)===kn(Vt)?" af-resource-card--active":""),onClick:()=>de(kn(q)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Eu(q.source==="builtin"?"muted":"primary"),children:o.jsx(Fn,{query:E,children:q.sourceLabel||q.source||"skill"})}),o.jsx("span",{className:"af-resource-source",children:t("project:skill")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Fn,{query:E,children:q.name||q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Fn,{query:E,children:q.description||t("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(Fn,{query:E,children:q.path||q.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[g.filter(ke=>ke.skillKeys.includes(kn(q))).slice(0,3).map(ke=>o.jsx("span",{children:ke.name},ke.id)),g.filter(ke=>ke.skillKeys.includes(kn(q))).length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},q.key||`${q.source}:${q.name}`)):O?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:lt?t("project:noSkillMatch",{query:E.trim()}):t("project:noSkills")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):o.jsxs("div",{className:"af-project-grid",children:[Vs.length>0?Vs.map(q=>o.jsx("button",{type:"button",className:"af-project-card",onClick:()=>Ft(q),children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:Eu(Hx(q.source,t).tone),children:o.jsx(Fn,{query:E,children:Hx(q.source,t).label})}),q.archived?o.jsx("span",{className:Eu("muted"),children:o.jsx(Fn,{query:E,children:t("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(Fn,{query:E,children:q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Fn,{query:E,children:UE(q,t)})}),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(Fn,{query:E,children:HE(q)})})]})]})},`${q.id}:${q.source??"user"}:${q.archived?"a":""}`)):V?vn.length===0?o.jsxs("div",{className:"af-projects-empty-block",children:[o.jsx("p",{className:"af-projects-empty",children:s==="archived"?t("project:noArchived"):a.length>0?t("project:noActive"):t(S?"project:loadFailed":"project:noPipelines")}),!S&&a.length===0&&s==="all"?o.jsx("p",{className:"af-projects-empty-hint",children:t("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:t("project:noMatch",{query:E.trim()})})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:t("project:loadingPipelines")})}),o.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>L(!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:t("project:newPipeline")})]}),Ge?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"}),t("project:hubCard.eyebrow")]}),o.jsx("h3",{className:"af-hub-card__title",children:t("project:hubCard.title")}),o.jsx("p",{className:"af-hub-card__desc",children:t("project:hubCard.desc")}),o.jsxs("span",{className:"af-hub-card__cta",children:[t("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:t("project:hubCard.cliHint")})]})]})]}),Ps?o.jsx("aside",{className:"af-resource-detail","aria-label":t(Pn?"project:nodeDetail":dr?"project:flowDetail":"project:skillDetail"),children:Pn&&Xe?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:Xe.label||Xe.displayName||Xe.id}),o.jsx("p",{children:Xe.id})]})]}),o.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(q=>o.jsx("button",{type:"button",className:"af-resource-detail-tab"+(ce===q?" af-resource-detail-tab--active":""),onClick:()=>fe(q),children:t(`project:nodeDetailTabs.${q}`)},q))}),Je===kn(Xe)?o.jsx("p",{className:"af-resource-detail-desc",children:t("project:loadingResources")}):ce==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:Xe.description||((ds=Ke==null?void 0:Ke.node)==null?void 0:ds.description)||t("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailType")}),o.jsx("dd",{children:Xe.type||((Un=Ke==null?void 0:Ke.node)==null?void 0:Un.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailSource")}),o.jsx("dd",{children:xk(Xe.source,t)})]}),Xe.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailPackage")}),o.jsx("dd",{children:Xe.packageId})]}):null,Xe.version?o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailVersion")}),o.jsx("dd",{children:Xe.version})]}):null,Xe.packageDir||Ke!=null&&Ke.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailPath")}),o.jsx("dd",{children:Xe.packageDir||(Ke==null?void 0:Ke.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailEditable")}),o.jsx("dd",{children:(Ke==null?void 0:Ke.readOnly)===!1?t("project:editable"):t("project:readOnly")})]})]}),jr&&Xe.source==="marketplace"?o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:t("project:myNodeManagement")}),o.jsx("p",{children:t("project:deleteMyNodeHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:Nr===kn(Xe),onClick:()=>he(Xe),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),Nr===kn(Xe)?t("project:deletingMyNode"):t("project:deleteMyNode")]}),oe?o.jsx("p",{className:"af-resource-action-message",children:oe}):null]}):null,o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:t("project:resourceMeaning")}),o.jsx("p",{children:t("project:nodesMeaning")})]})]}):ce==="schema"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:t("project:nodeSchema")}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:t("project:nodeInputs")}),fp(((fs=Ke==null?void 0:Ke.node)==null?void 0:fs.inputs)||Xe.inputs).length>0?fp(((pr=Ke==null?void 0:Ke.node)==null?void 0:pr.inputs)||Xe.inputs).map(q=>o.jsxs("code",{children:[q.name||q.key,q.type?`: ${q.type}`:""]},q.key)):o.jsx("em",{children:t("project:noSlots")})]}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:t("project:nodeOutputs")}),fp(((qs=Ke==null?void 0:Ke.node)==null?void 0:qs.outputs)||Xe.outputs).length>0?fp(((Er=Ke==null?void 0:Ke.node)==null?void 0:Er.outputs)||Xe.outputs).map(q=>o.jsxs("code",{children:[q.name||q.key,q.type?`: ${q.type}`:""]},q.key)):o.jsx("em",{children:t("project:noSlots")})]})]}):ce==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:t("project:nodeRuntime")}),Ke!=null&&Ke.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Ke.runtime,null,2)}):o.jsx("p",{children:t("project:noRuntimeManifest")}),Ke!=null&&Ke.body?o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"af-resource-detail-subtitle",children:t("project:nodeBody")}),o.jsx("pre",{className:"af-resource-skill-preview",children:Ke.body})]}):o.jsx("p",{children:t("project:noNodeBody")})]}):ce==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:t("project:nodeFiles")}),Array.isArray(Ke==null?void 0:Ke.files)&&Ke.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:Ke.files.map(q=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(De===q.path?" af-node-file-item--active":""),onClick:()=>Ce(q.path),children:[o.jsx("span",{className:"material-symbols-outlined",children:"description"}),o.jsx("span",{children:q.path})]},q.path))}),o.jsxs("pre",{className:"af-resource-skill-preview",children:[Xt===`${kn(Xe)}:${De}`?t("project:loadingResources"):Hn!=null&&Hn.binary?t("project:binaryFile"):(Hn==null?void 0:Hn.content)||t("project:selectNodeFile"),Hn!=null&&Hn.truncated?`
|
|
43
|
-
|
|
44
|
-
${t("project:fileTruncated")}`:""]})]}):o.jsx("p",{children:t("project:noNodeFiles")})]}):o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:t("project:nodeUsage")}),Array.isArray(Ke==null?void 0:Ke.usage)&&Ke.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:Ke.usage.map(q=>o.jsxs("div",{className:"af-node-usage-item",children:[o.jsx("strong",{children:q.flowId}),o.jsxs("span",{children:[q.flowSource,q.archived?` · ${t("project:archived")}`:""]}),o.jsx("em",{children:q.instances.map(ke=>ke.label||ke.instanceId).join(", ")})]},`${q.flowSource}:${q.flowId}:${q.archived?"a":""}`))}):o.jsx("p",{children:t("project:noNodeUsage")})]})]}):dr&&sn?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:sn.displayName||sn.name||sn.id}),o.jsx("p",{children:sn.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:sn.description||t("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailVersion")}),o.jsx("dd",{children:sn.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailPath")}),o.jsx("dd",{children:wk(sn)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:t("project:flowSnippetScale")}),o.jsx("dd",{children:t("project:flowSnippetNodes",{nodes:Number.isFinite(Number(sn.nodeCount))?Number(sn.nodeCount):Array.isArray((ps=sn.snippet)==null?void 0:ps.instances)?sn.snippet.instances.length:0,edges:Number.isFinite(Number(sn.edgeCount))?Number(sn.edgeCount):Array.isArray((hs=sn.snippet)==null?void 0:hs.edges)?sn.snippet.edges.length:0})})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:t("project:resourceMeaning")}),o.jsx("p",{children:t("project:myFlowsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:t("project:flowSnippetPreview")}),o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(sn.snippet||{},null,2)})]})]}):s==="skills"&&Vt?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:Vt.name||Vt.id}),o.jsx("p",{children:Vt.sourceLabel||Vt.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Vt.description||t("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailSource")}),o.jsx("dd",{children:Vt.sourceLabel||Vt.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailPath")}),o.jsx("dd",{children:Vt.path||Vt.key})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:"Collections"}),g.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:g.map(q=>{const ke=kn(Vt),Me=q.skillKeys.includes(ke);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:Me,disabled:v,onChange:qe=>sr(q.id,ke,qe.target.checked)}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:q.name}),o.jsxs("span",{className:"af-composer-skill-option-desc",children:[q.skillKeys.length," skills"]})]})]},q.id)})})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:t("project:resourceMeaning")}),o.jsx("p",{children:t("project:skillsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:t("project:skillPreview")}),o.jsx("pre",{className:"af-resource-skill-preview",children:ve===kn(Vt)?t("project:loadingResources"):(us==null?void 0:us.body)||(us==null?void 0:us.content)||t("project:skillPreviewEmpty")})]})]}):o.jsx("p",{className:"af-activity-empty",children:t("project:selectResource")})}):o.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(Q?"":" af-activity--hidden"),"aria-hidden":!Q,"aria-label":t("project:recentActivity"),children:[o.jsxs("h2",{className:"af-activity-title",children:[o.jsx("span",{className:"af-activity-bullet"}),t("project:recentActivity")]}),o.jsx("div",{className:"af-activity-list",children:rn.length===0?o.jsx("p",{className:"af-activity-empty",children:Te.length===0?t("project:noRecentActivity"):t("project:noMatchRecent")}):rn.map(q=>o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action",onClick:()=>As(q),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(Fn,{query:E,children:q.flowId})}),o.jsx("span",{className:"af-activity-time",children:Fx(q.at,t)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:ZO(q.kind),children:q.kind==="executed"?"play_arrow":"visibility"}),o.jsxs("p",{className:"af-activity-text",children:[q.kind==="executed"?t("project:recentRun"):t("project:recentOpen")," · ",Fx(q.at,t)]})]})]},`${q.kind}-${q.flowId}-${q.flowSource}-${q.at}`))})]})]}),o.jsx(KO,{open:$,onClose:()=>L(!1),onCreated:async q=>{L(!1),await On();const ke=q.source??"user";n(dp({id:q.id,source:ke},"workspace"))}}),I?o.jsx(WO,{file:I,onClose:()=>z(null),onImported:async q=>{z(null),await On();const ke=q.source??"user";n(dp({id:q.id,source:ke},"workspace"))}},`${I.name}-${I.size}-${I.lastModified}`):null]})}function Jn(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=Jn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var aM={value:()=>{}};function Am(){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 Jp(n)}function Jp(e){this._=e}function lM(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}})}Jp.prototype=Am.prototype={constructor:Jp,on:function(e,t){var n=this._,r=lM(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=cM(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]=vk(n[s],e.name,t);else if(t==null)for(s in n)n[s]=vk(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 Jp(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 cM(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function vk(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=aM,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ux="http://www.w3.org/1999/xhtml";const bk={svg:"http://www.w3.org/2000/svg",xhtml:Ux,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Im(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),bk.hasOwnProperty(t)?{space:bk[t],local:e}:e}function uM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ux&&t.documentElement.namespaceURI===Ux?t.createElement(e):t.createElementNS(n,e)}}function dM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function WE(e){var t=Im(e);return(t.local?dM:uM)(t)}function fM(){}function _v(e){return e==null?fM:function(){return this.querySelector(e)}}function pM(e){typeof e!="function"&&(e=_v(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,u=0;u<a;++u)(c=i[u])&&(d=e.call(c,c.__data__,u,i))&&("__data__"in c&&(d.__data__=c.__data__),l[u]=d);return new Cs(r,this._parents)}function hM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function mM(){return[]}function VE(e){return e==null?mM:function(){return this.querySelectorAll(e)}}function gM(e){return function(){return hM(e.apply(this,arguments))}}function yM(e){typeof e=="function"?e=gM(e):e=VE(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 Cs(r,s)}function KE(e){return function(){return this.matches(e)}}function qE(e){return function(t){return t.matches(e)}}var xM=Array.prototype.find;function wM(e){return function(){return xM.call(this.children,e)}}function vM(){return this.firstElementChild}function bM(e){return this.select(e==null?vM:wM(typeof e=="function"?e:qE(e)))}var kM=Array.prototype.filter;function SM(){return Array.from(this.children)}function NM(e){return function(){return kM.call(this.children,e)}}function jM(e){return this.selectAll(e==null?SM:NM(typeof e=="function"?e:qE(e)))}function CM(e){typeof e!="function"&&(e=KE(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 Cs(r,this._parents)}function YE(e){return new Array(e.length)}function EM(){return new Cs(this._enter||this._groups.map(YE),this._parents)}function Rh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Rh.prototype={constructor:Rh,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 _M(e){return function(){return e}}function PM(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 Rh(e,i[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function AM(e,t,n,r,s,i,a){var l,c,d=new Map,u=t.length,f=i.length,p=new Array(u),h;for(l=0;l<u;++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<f;++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 Rh(e,i[l]);for(l=0;l<u;++l)(c=t[l])&&d.get(p[l])===c&&(s[l]=c)}function IM(e){return e.__data__}function TM(e,t){if(!arguments.length)return Array.from(this,IM);var n=t?AM:PM,r=this._parents,s=this._groups;typeof e!="function"&&(e=_M(e));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),d=0;d<i;++d){var u=r[d],f=s[d],p=f.length,h=RM(e.call(u,u&&u.__data__,d,r)),g=h.length,k=l[d]=new Array(g),b=a[d]=new Array(g),y=c[d]=new Array(p);n(u,f,k,b,y,h,t);for(var v=0,w=0,N,C;v<g;++v)if(N=k[v]){for(v>=w&&(w=v+1);!(C=b[w])&&++w<g;);N._next=C||null}}return a=new Cs(a,r),a._enter=l,a._exit=c,a}function RM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function LM(){return new Cs(this._exit||this._groups.map(YE),this._parents)}function OM(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 MM(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],u=r[c],f=d.length,p=l[c]=new Array(f),h,g=0;g<f;++g)(h=d[g]||u[g])&&(p[g]=h);for(;c<s;++c)l[c]=n[c];return new Cs(l,this._parents)}function $M(){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 DM(e){e||(e=FM);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!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,u=0;u<l;++u)(d=a[u])&&(c[u]=d);c.sort(t)}return new Cs(s,this._parents).order()}function FM(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function zM(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function BM(){return Array.from(this)}function HM(){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 UM(){let e=0;for(const t of this)++e;return e}function WM(){return!this.node()}function VM(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 KM(e){return function(){this.removeAttribute(e)}}function qM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function YM(e,t){return function(){this.setAttribute(e,t)}}function GM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function JM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function XM(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 QM(e,t){var n=Im(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?qM:KM:typeof t=="function"?n.local?XM:JM:n.local?GM:YM)(n,t))}function GE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ZM(e){return function(){this.style.removeProperty(e)}}function e$(e,t,n){return function(){this.style.setProperty(e,t,n)}}function t$(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function n$(e,t,n){return arguments.length>1?this.each((t==null?ZM:typeof t=="function"?t$:e$)(e,t,n??"")):Tc(this.node(),e)}function Tc(e,t){return e.style.getPropertyValue(t)||GE(e).getComputedStyle(e,null).getPropertyValue(t)}function r$(e){return function(){delete this[e]}}function s$(e,t){return function(){this[e]=t}}function i$(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function o$(e,t){return arguments.length>1?this.each((t==null?r$:typeof t=="function"?i$:s$)(e,t)):this.node()[e]}function JE(e){return e.trim().split(/^|\s+/)}function Pv(e){return e.classList||new XE(e)}function XE(e){this._node=e,this._names=JE(e.getAttribute("class")||"")}XE.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 QE(e,t){for(var n=Pv(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function ZE(e,t){for(var n=Pv(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function a$(e){return function(){QE(this,e)}}function l$(e){return function(){ZE(this,e)}}function c$(e,t){return function(){(t.apply(this,arguments)?QE:ZE)(this,e)}}function u$(e,t){var n=JE(e+"");if(arguments.length<2){for(var r=Pv(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?c$:t?a$:l$)(n,t))}function d$(){this.textContent=""}function f$(e){return function(){this.textContent=e}}function p$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function h$(e){return arguments.length?this.each(e==null?d$:(typeof e=="function"?p$:f$)(e)):this.node().textContent}function m$(){this.innerHTML=""}function g$(e){return function(){this.innerHTML=e}}function y$(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function x$(e){return arguments.length?this.each(e==null?m$:(typeof e=="function"?y$:g$)(e)):this.node().innerHTML}function w$(){this.nextSibling&&this.parentNode.appendChild(this)}function v$(){return this.each(w$)}function b$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function k$(){return this.each(b$)}function S$(e){var t=typeof e=="function"?e:WE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function N$(){return null}function j$(e,t){var n=typeof e=="function"?e:WE(e),r=t==null?N$:typeof t=="function"?t:_v(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function C$(){var e=this.parentNode;e&&e.removeChild(this)}function E$(){return this.each(C$)}function _$(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function P$(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function A$(e){return this.select(e?P$:_$)}function I$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function T$(e){return function(t){e.call(this,t,this.__data__)}}function R$(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 L$(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 O$(e,t,n){return function(){var r=this.__on,s,i=T$(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 M$(e,t,n){var r=R$(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,d=l.length,u;c<d;++c)for(s=0,u=l[c];s<i;++s)if((a=r[s]).type===u.type&&a.name===u.name)return u.value}return}for(l=t?O$:L$,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function e_(e,t,n){var r=GE(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 $$(e,t){return function(){return e_(this,e,t)}}function D$(e,t){return function(){return e_(this,e,t.apply(this,arguments))}}function F$(e,t){return this.each((typeof t=="function"?D$:$$)(e,t))}function*z$(){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 t_=[null];function Cs(e,t){this._groups=e,this._parents=t}function af(){return new Cs([[document.documentElement]],t_)}function B$(){return this}Cs.prototype=af.prototype={constructor:Cs,select:pM,selectAll:yM,selectChild:bM,selectChildren:jM,filter:CM,data:TM,enter:EM,exit:LM,join:OM,merge:MM,selection:B$,order:$M,sort:DM,call:zM,nodes:BM,node:HM,size:UM,empty:WM,each:VM,attr:QM,style:n$,property:o$,classed:u$,text:h$,html:x$,raise:v$,lower:k$,append:S$,insert:j$,remove:E$,clone:A$,datum:I$,on:M$,dispatch:F$,[Symbol.iterator]:z$};function ws(e){return typeof e=="string"?new Cs([[document.querySelector(e)]],[document.documentElement]):new Cs([[e]],t_)}function H$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ui(e,t){if(e=H$(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 U$={passive:!1},Td={capture:!0,passive:!1};function ey(e){e.stopImmediatePropagation()}function vc(e){e.preventDefault(),e.stopImmediatePropagation()}function n_(e){var t=e.document.documentElement,n=ws(e).on("dragstart.drag",vc,Td);"onselectstart"in t?n.on("selectstart.drag",vc,Td):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function r_(e,t){var n=e.document.documentElement,r=ws(e).on("dragstart.drag",null);t&&(r.on("click.drag",vc,Td),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 pp=e=>()=>e;function Wx(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:d,dispatch:u}){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:u}})}Wx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function W$(e){return!e.ctrlKey&&!e.button}function V$(){return this.parentNode}function K$(e,t){return t??{x:e.x,y:e.y}}function q$(){return navigator.maxTouchPoints||"ontouchstart"in this}function s_(){var e=W$,t=V$,n=K$,r=q$,s={},i=Am("start","drag","end"),a=0,l,c,d,u,f=0;function p(N){N.on("mousedown.drag",h).filter(r).on("touchstart.drag",b).on("touchmove.drag",y,U$).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(N,C){if(!(u||!e.call(this,N,C))){var S=w(this,t.call(this,N,C),N,C,"mouse");S&&(ws(N.view).on("mousemove.drag",g,Td).on("mouseup.drag",k,Td),n_(N.view),ey(N),d=!1,l=N.clientX,c=N.clientY,S("start",N))}}function g(N){if(vc(N),!d){var C=N.clientX-l,S=N.clientY-c;d=C*C+S*S>f}s.mouse("drag",N)}function k(N){ws(N.view).on("mousemove.drag mouseup.drag",null),r_(N.view,d),vc(N),s.mouse("end",N)}function b(N,C){if(e.call(this,N,C)){var S=N.changedTouches,A=t.call(this,N,C),R=S.length,M,V;for(M=0;M<R;++M)(V=w(this,A,N,C,S[M].identifier,S[M]))&&(ey(N),V("start",N,S[M]))}}function y(N){var C=N.changedTouches,S=C.length,A,R;for(A=0;A<S;++A)(R=s[C[A].identifier])&&(vc(N),R("drag",N,C[A]))}function v(N){var C=N.changedTouches,S=C.length,A,R;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),A=0;A<S;++A)(R=s[C[A].identifier])&&(ey(N),R("end",N,C[A]))}function w(N,C,S,A,R,M){var V=i.copy(),D=ui(M||S,C),O,K,$;if(($=n.call(N,new Wx("beforestart",{sourceEvent:S,target:p,identifier:R,active:a,x:D[0],y:D[1],dx:0,dy:0,dispatch:V}),A))!=null)return O=$.x-D[0]||0,K=$.y-D[1]||0,function L(I,z,P){var T=D,E;switch(I){case"start":s[R]=L,E=a++;break;case"end":delete s[R],--a;case"drag":D=ui(P||z,C),E=a;break}V.call(I,N,new Wx(I,{sourceEvent:z,subject:$,target:p,identifier:R,active:E,x:D[0]+O,y:D[1]+K,dx:D[0]-T[0],dy:D[1]-T[1],dispatch:V}),A)}}return p.filter=function(N){return arguments.length?(e=typeof N=="function"?N:pp(!!N),p):e},p.container=function(N){return arguments.length?(t=typeof N=="function"?N:pp(N),p):t},p.subject=function(N){return arguments.length?(n=typeof N=="function"?N:pp(N),p):n},p.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:pp(!!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?(f=(N=+N)*N,p):Math.sqrt(f)},p}function Av(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function i_(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function lf(){}var Rd=.7,Lh=1/Rd,bc="\\s*([+-]?\\d+)\\s*",Ld="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Y$=/^#([0-9a-f]{3,8})$/,G$=new RegExp(`^rgb\\(${bc},${bc},${bc}\\)$`),J$=new RegExp(`^rgb\\(${Wi},${Wi},${Wi}\\)$`),X$=new RegExp(`^rgba\\(${bc},${bc},${bc},${Ld}\\)$`),Q$=new RegExp(`^rgba\\(${Wi},${Wi},${Wi},${Ld}\\)$`),Z$=new RegExp(`^hsl\\(${Ld},${Wi},${Wi}\\)$`),eD=new RegExp(`^hsla\\(${Ld},${Wi},${Wi},${Ld}\\)$`),kk={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};Av(lf,fl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Sk,formatHex:Sk,formatHex8:tD,formatHsl:nD,formatRgb:Nk,toString:Nk});function Sk(){return this.rgb().formatHex()}function tD(){return this.rgb().formatHex8()}function nD(){return o_(this).formatHsl()}function Nk(){return this.rgb().formatRgb()}function fl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Y$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jk(t):n===3?new Zr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?hp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?hp(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=G$.exec(e))?new Zr(t[1],t[2],t[3],1):(t=J$.exec(e))?new Zr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=X$.exec(e))?hp(t[1],t[2],t[3],t[4]):(t=Q$.exec(e))?hp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Z$.exec(e))?_k(t[1],t[2]/100,t[3]/100,1):(t=eD.exec(e))?_k(t[1],t[2]/100,t[3]/100,t[4]):kk.hasOwnProperty(e)?jk(kk[e]):e==="transparent"?new Zr(NaN,NaN,NaN,0):null}function jk(e){return new Zr(e>>16&255,e>>8&255,e&255,1)}function hp(e,t,n,r){return r<=0&&(e=t=n=NaN),new Zr(e,t,n,r)}function rD(e){return e instanceof lf||(e=fl(e)),e?(e=e.rgb(),new Zr(e.r,e.g,e.b,e.opacity)):new Zr}function Vx(e,t,n,r){return arguments.length===1?rD(e):new Zr(e,t,n,r??1)}function Zr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Av(Zr,Vx,i_(lf,{brighter(e){return e=e==null?Lh:Math.pow(Lh,e),new Zr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Rd:Math.pow(Rd,e),new Zr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Zr(rl(this.r),rl(this.g),rl(this.b),Oh(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:Ck,formatHex:Ck,formatHex8:sD,formatRgb:Ek,toString:Ek}));function Ck(){return`#${el(this.r)}${el(this.g)}${el(this.b)}`}function sD(){return`#${el(this.r)}${el(this.g)}${el(this.b)}${el((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ek(){const e=Oh(this.opacity);return`${e===1?"rgb(":"rgba("}${rl(this.r)}, ${rl(this.g)}, ${rl(this.b)}${e===1?")":`, ${e})`}`}function Oh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function el(e){return e=rl(e),(e<16?"0":"")+e.toString(16)}function _k(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new pi(e,t,n,r)}function o_(e){if(e instanceof pi)return new pi(e.h,e.s,e.l,e.opacity);if(e instanceof lf||(e=fl(e)),!e)return new pi;if(e instanceof pi)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 pi(a,l,c,e.opacity)}function iD(e,t,n,r){return arguments.length===1?o_(e):new pi(e,t,n,r??1)}function pi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Av(pi,iD,i_(lf,{brighter(e){return e=e==null?Lh:Math.pow(Lh,e),new pi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Rd:Math.pow(Rd,e),new pi(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 Zr(ty(e>=240?e-240:e+120,s,r),ty(e,s,r),ty(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new pi(Pk(this.h),mp(this.s),mp(this.l),Oh(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=Oh(this.opacity);return`${e===1?"hsl(":"hsla("}${Pk(this.h)}, ${mp(this.s)*100}%, ${mp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Pk(e){return e=(e||0)%360,e<0?e+360:e}function mp(e){return Math.max(0,Math.min(1,e||0))}function ty(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 Iv=e=>()=>e;function oD(e,t){return function(n){return e+n*t}}function aD(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 lD(e){return(e=+e)==1?a_:function(t,n){return n-t?aD(t,n,e):Iv(isNaN(t)?n:t)}}function a_(e,t){var n=t-e;return n?oD(e,n):Iv(isNaN(e)?t:e)}const Mh=function e(t){var n=lD(t);function r(s,i){var a=n((s=Vx(s)).r,(i=Vx(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),d=a_(s.opacity,i.opacity);return function(u){return s.r=a(u),s.g=l(u),s.b=c(u),s.opacity=d(u),s+""}}return r.gamma=e,r}(1);function cD(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 uD(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function dD(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]=id(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 fD(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Mi(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function pD(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]=id(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var Kx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ny=new RegExp(Kx.source,"g");function hD(e){return function(){return e}}function mD(e){return function(t){return e(t)+""}}function l_(e,t){var n=Kx.lastIndex=ny.lastIndex=0,r,s,i,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=Kx.exec(e))&&(s=ny.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:Mi(r,s)})),n=ny.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?c[0]?mD(c[0].x):hD(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)l[(f=c[u]).i]=f.x(d);return l.join("")})}function id(e,t){var n=typeof t,r;return t==null||n==="boolean"?Iv(t):(n==="number"?Mi:n==="string"?(r=fl(t))?(t=r,Mh):l_:t instanceof fl?Mh:t instanceof Date?fD:uD(t)?cD:Array.isArray(t)?dD:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?pD:Mi)(e,t)}var Ak=180/Math.PI,qx={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)*Ak,skewX:Math.atan(c)*Ak,scaleX:a,scaleY:l}}var gp;function gD(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?qx:c_(t.a,t.b,t.c,t.d,t.e,t.f)}function yD(e){return e==null||(gp||(gp=document.createElementNS("http://www.w3.org/2000/svg","g")),gp.setAttribute("transform",e),!(e=gp.transform.baseVal.consolidate()))?qx:(e=e.matrix,c_(e.a,e.b,e.c,e.d,e.e,e.f))}function u_(e,t,n,r){function s(d){return d.length?d.pop()+" ":""}function i(d,u,f,p,h,g){if(d!==f||u!==p){var k=h.push("translate(",null,t,null,n);g.push({i:k-4,x:Mi(d,f)},{i:k-2,x:Mi(u,p)})}else(f||p)&&h.push("translate("+f+t+p+n)}function a(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(s(f)+"rotate(",null,r)-2,x:Mi(d,u)})):u&&f.push(s(f)+"rotate("+u+r)}function l(d,u,f,p){d!==u?p.push({i:f.push(s(f)+"skewX(",null,r)-2,x:Mi(d,u)}):u&&f.push(s(f)+"skewX("+u+r)}function c(d,u,f,p,h,g){if(d!==f||u!==p){var k=h.push(s(h)+"scale(",null,",",null,")");g.push({i:k-4,x:Mi(d,f)},{i:k-2,x:Mi(u,p)})}else(f!==1||p!==1)&&h.push(s(h)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),i(d.translateX,d.translateY,u.translateX,u.translateY,f,p),a(d.rotate,u.rotate,f,p),l(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(h){for(var g=-1,k=p.length,b;++g<k;)f[(b=p[g]).i]=b.x(h);return f.join("")}}}var xD=u_(gD,"px, ","px)","deg)"),wD=u_(yD,", ",")",")"),vD=1e-12;function Ik(e){return((e=Math.exp(e))+1/e)/2}function bD(e){return((e=Math.exp(e))-1/e)/2}function kD(e){return((e=Math.exp(2*e))-1)/(e+1)}const Xp=function e(t,n,r){function s(i,a){var l=i[0],c=i[1],d=i[2],u=a[0],f=a[1],p=a[2],h=u-l,g=f-c,k=h*h+g*g,b,y;if(k<vD)y=Math.log(p/d)/t,b=function(A){return[l+A*h,c+A*g,d*Math.exp(t*A*y)]};else{var v=Math.sqrt(k),w=(p*p-d*d+r*k)/(2*d*n*v),N=(p*p-d*d-r*k)/(2*p*n*v),C=Math.log(Math.sqrt(w*w+1)-w),S=Math.log(Math.sqrt(N*N+1)-N);y=(S-C)/t,b=function(A){var R=A*y,M=Ik(C),V=d/(n*v)*(M*kD(t*R+C)-bD(C));return[l+V*h,c+V*g,d*M/Ik(t*R+C)]}}return b.duration=y*1e3*t/Math.SQRT2,b}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 Rc=0,Uu=0,Pu=0,d_=1e3,$h,Wu,Dh=0,pl=0,Tm=0,Od=typeof performance=="object"&&performance.now?performance:Date,f_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Tv(){return pl||(f_(SD),pl=Od.now()+Tm)}function SD(){pl=0}function Fh(){this._call=this._time=this._next=null}Fh.prototype=p_.prototype={constructor:Fh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Tv():+n)+(t==null?0:+t),!this._next&&Wu!==this&&(Wu?Wu._next=this:$h=this,Wu=this),this._call=e,this._time=n,Yx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yx())}};function p_(e,t,n){var r=new Fh;return r.restart(e,t,n),r}function ND(){Tv(),++Rc;for(var e=$h,t;e;)(t=pl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Rc}function Tk(){pl=(Dh=Od.now())+Tm,Rc=Uu=0;try{ND()}finally{Rc=0,CD(),pl=0}}function jD(){var e=Od.now(),t=e-Dh;t>d_&&(Tm-=t,Dh=e)}function CD(){for(var e,t=$h,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:$h=n);Wu=e,Yx(r)}function Yx(e){if(!Rc){Uu&&(Uu=clearTimeout(Uu));var t=e-pl;t>24?(e<1/0&&(Uu=setTimeout(Tk,e-Od.now()-Tm)),Pu&&(Pu=clearInterval(Pu))):(Pu||(Dh=Od.now(),Pu=setInterval(jD,d_)),Rc=1,f_(Tk))}}function Rk(e,t,n){var r=new Fh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var ED=Am("start","end","cancel","interrupt"),_D=[],h_=0,Lk=1,Gx=2,Qp=3,Ok=4,Jx=5,Zp=6;function Rm(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;PD(e,n,{name:t,index:r,group:s,on:ED,tween:_D,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:h_})}function Rv(e,t){var n=bi(e,t);if(n.state>h_)throw new Error("too late; already scheduled");return n}function Ji(e,t){var n=bi(e,t);if(n.state>Qp)throw new Error("too late; already running");return n}function bi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function PD(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=p_(i,0,n.time);function i(d){n.state=Lk,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var u,f,p,h;if(n.state!==Lk)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Qp)return Rk(a);h.state===Ok?(h.state=Zp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Zp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Rk(function(){n.state===Qp&&(n.state=Ok,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=Gx,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Gx){for(n.state=Qp,s=new Array(p=n.tween.length),u=0,f=-1;u<p;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(s[++f]=h);s.length=f+1}}function l(d){for(var u=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=Jx,1),f=-1,p=s.length;++f<p;)s[f].call(e,u);n.state===Jx&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Zp,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function eh(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>Gx&&r.state<Jx,r.state=Zp,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function AD(e){return this.each(function(){eh(this,e)})}function ID(e,t){var n,r;return function(){var s=Ji(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 TD(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Ji(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 RD(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=bi(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?ID:TD)(n,e,t))}function Lv(e,t,n){var r=e._id;return e.each(function(){var s=Ji(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return bi(s,r).value[t]}}function m_(e,t){var n;return(typeof t=="number"?Mi:t instanceof fl?Mh:(n=fl(t))?(t=n,Mh):l_)(e,t)}function LD(e){return function(){this.removeAttribute(e)}}function OD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function MD(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 $D(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 DD(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 FD(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 zD(e,t){var n=Im(e),r=n==="transform"?wD:m_;return this.attrTween(e,typeof t=="function"?(n.local?FD:DD)(n,r,Lv(this,"attr."+e,t)):t==null?(n.local?OD:LD)(n):(n.local?$D:MD)(n,r,t))}function BD(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function HD(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function UD(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&HD(e,i)),n}return s._value=t,s}function WD(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&BD(e,i)),n}return s._value=t,s}function VD(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=Im(e);return this.tween(n,(r.local?UD:WD)(r,t))}function KD(e,t){return function(){Rv(this,e).delay=+t.apply(this,arguments)}}function qD(e,t){return t=+t,function(){Rv(this,e).delay=t}}function YD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?KD:qD)(t,e)):bi(this.node(),t).delay}function GD(e,t){return function(){Ji(this,e).duration=+t.apply(this,arguments)}}function JD(e,t){return t=+t,function(){Ji(this,e).duration=t}}function XD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?GD:JD)(t,e)):bi(this.node(),t).duration}function QD(e,t){if(typeof t!="function")throw new Error;return function(){Ji(this,e).ease=t}}function ZD(e){var t=this._id;return arguments.length?this.each(QD(t,e)):bi(this.node(),t).ease}function eF(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ji(this,e).ease=n}}function tF(e){if(typeof e!="function")throw new Error;return this.each(eF(this._id,e))}function nF(e){typeof e!="function"&&(e=KE(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 So(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],u=c.length,f=a[l]=new Array(u),p,h=0;h<u;++h)(p=c[h]||d[h])&&(f[h]=p);for(;l<r;++l)a[l]=t[l];return new So(a,this._parents,this._name,this._id)}function sF(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 iF(e,t,n){var r,s,i=sF(t)?Rv:Ji;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function oF(e,t){var n=this._id;return arguments.length<2?bi(this.node(),n).on.on(e):this.each(iF(n,e,t))}function aF(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function lF(){return this.on("end.remove",aF(this._id))}function cF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=_v(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),u,f,p=0;p<c;++p)(u=l[p])&&(f=e.call(u,u.__data__,p,l))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,Rm(d[p],t,n,p,d,bi(u,n)));return new So(i,this._parents,t,n)}function uF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=VE(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),h,g=bi(u,n),k=0,b=p.length;k<b;++k)(h=p[k])&&Rm(h,t,n,k,p,g);i.push(p),a.push(u)}return new So(i,a,t,n)}var dF=af.prototype.constructor;function fF(){return new dF(this._groups,this._parents)}function pF(e,t){var n,r,s;return function(){var i=Tc(this,e),a=(this.style.removeProperty(e),Tc(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function g_(e){return function(){this.style.removeProperty(e)}}function hF(e,t,n){var r,s=n+"",i;return function(){var a=Tc(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function mF(e,t,n){var r,s,i;return function(){var a=Tc(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Tc(this,e))),a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l))}}function gF(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var c=Ji(this,e),d=c.on,u=c.value[i]==null?l||(l=g_(t)):void 0;(d!==n||s!==u)&&(r=(n=d).copy()).on(a,s=u),c.on=r}}function yF(e,t,n){var r=(e+="")=="transform"?xD:m_;return t==null?this.styleTween(e,pF(e,r)).on("end.style."+e,g_(e)):typeof t=="function"?this.styleTween(e,mF(e,r,Lv(this,"style."+e,t))).each(gF(this._id,e)):this.styleTween(e,hF(e,r,t),n).on("end.style."+e,null)}function xF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function wF(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&xF(e,a,n)),r}return i._value=t,i}function vF(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,wF(e,t,n??""))}function bF(e){return function(){this.textContent=e}}function kF(e){return function(){var t=e(this);this.textContent=t??""}}function SF(e){return this.tween("text",typeof e=="function"?kF(Lv(this,"text",e)):bF(e==null?"":e+""))}function NF(e){return function(t){this.textContent=e.call(this,t)}}function jF(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&NF(s)),t}return r._value=e,r}function CF(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,jF(e))}function EF(){for(var e=this._name,t=this._id,n=y_(),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 u=bi(c,t);Rm(c,e,n,d,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new So(r,this._parents,e,n)}function _F(){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=Ji(this,r),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),d.on=t}),s===0&&i()})}var PF=0;function So(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function y_(){return++PF}var ao=af.prototype;So.prototype={constructor:So,select:cF,selectAll:uF,selectChild:ao.selectChild,selectChildren:ao.selectChildren,filter:nF,merge:rF,selection:fF,transition:EF,call:ao.call,nodes:ao.nodes,node:ao.node,size:ao.size,empty:ao.empty,each:ao.each,on:oF,attr:zD,attrTween:VD,style:yF,styleTween:vF,text:SF,textTween:CF,remove:lF,tween:RD,delay:YD,duration:XD,ease:ZD,easeVarying:tF,end:_F,[Symbol.iterator]:ao[Symbol.iterator]};function AF(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var IF={time:null,delay:0,duration:250,ease:AF};function TF(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 RF(e){var t,n;e instanceof So?(t=e._id,e=e._name):(t=y_(),(n=IF).time=Tv(),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])&&Rm(c,e,t,d,a,n||TF(c,t));return new So(r,this._parents,e,t)}af.prototype.interrupt=AD;af.prototype.transition=RF;const yp=e=>()=>e;function LF(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 go(e,t,n){this.k=e,this.x=t,this.y=n}go.prototype={constructor:go,scale:function(e){return e===1?this:new go(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new go(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 Lm=new go(1,0,0);x_.prototype=go.prototype;function x_(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Lm;return e.__zoom}function ry(e){e.stopImmediatePropagation()}function Au(e){e.preventDefault(),e.stopImmediatePropagation()}function OF(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function MF(){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 Mk(){return this.__zoom||Lm}function $F(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function DF(){return navigator.maxTouchPoints||"ontouchstart"in this}function FF(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 w_(){var e=OF,t=MF,n=FF,r=$F,s=DF,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Xp,d=Am("start","zoom","end"),u,f,p,h=500,g=150,k=0,b=10;function y($){$.property("__zoom",Mk).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",V).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",K).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function($,L,I,z){var P=$.selection?$.selection():$;P.property("__zoom",Mk),$!==P?C($,L,I,z):P.interrupt().each(function(){S(this,arguments).event(z).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},y.scaleBy=function($,L,I,z){y.scaleTo($,function(){var P=this.__zoom.k,T=typeof L=="function"?L.apply(this,arguments):L;return P*T},I,z)},y.scaleTo=function($,L,I,z){y.transform($,function(){var P=t.apply(this,arguments),T=this.__zoom,E=I==null?N(P):typeof I=="function"?I.apply(this,arguments):I,J=T.invert(E),Q=typeof L=="function"?L.apply(this,arguments):L;return n(w(v(T,Q),E,J),P,a)},I,z)},y.translateBy=function($,L,I,z){y.transform($,function(){return n(this.__zoom.translate(typeof L=="function"?L.apply(this,arguments):L,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),a)},null,z)},y.translateTo=function($,L,I,z,P){y.transform($,function(){var T=t.apply(this,arguments),E=this.__zoom,J=z==null?N(T):typeof z=="function"?z.apply(this,arguments):z;return n(Lm.translate(J[0],J[1]).scale(E.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof I=="function"?-I.apply(this,arguments):-I),T,a)},z,P)};function v($,L){return L=Math.max(i[0],Math.min(i[1],L)),L===$.k?$:new go(L,$.x,$.y)}function w($,L,I){var z=L[0]-I[0]*$.k,P=L[1]-I[1]*$.k;return z===$.x&&P===$.y?$:new go($.k,z,P)}function N($){return[(+$[0][0]+ +$[1][0])/2,(+$[0][1]+ +$[1][1])/2]}function C($,L,I,z){$.on("start.zoom",function(){S(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(z).end()}).tween("zoom",function(){var P=this,T=arguments,E=S(P,T).event(z),J=t.apply(P,T),Q=I==null?N(J):typeof I=="function"?I.apply(P,T):I,H=Math.max(J[1][0]-J[0][0],J[1][1]-J[0][1]),te=P.__zoom,le=typeof L=="function"?L.apply(P,T):L,ue=c(te.invert(Q).concat(H/te.k),le.invert(Q).concat(H/le.k));return function(de){if(de===1)de=le;else{var ce=ue(de),fe=H/ce[2];de=new go(fe,Q[0]-ce[0]*fe,Q[1]-ce[1]*fe)}E.zoom(null,de)}})}function S($,L,I){return!I&&$.__zooming||new A($,L)}function A($,L){this.that=$,this.args=L,this.active=0,this.sourceEvent=null,this.extent=t.apply($,L),this.taps=0}A.prototype={event:function($){return $&&(this.sourceEvent=$),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function($,L){return this.mouse&&$!=="mouse"&&(this.mouse[1]=L.invert(this.mouse[0])),this.touch0&&$!=="touch"&&(this.touch0[1]=L.invert(this.touch0[0])),this.touch1&&$!=="touch"&&(this.touch1[1]=L.invert(this.touch1[0])),this.that.__zoom=L,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function($){var L=ws(this.that).datum();d.call($,this.that,new LF($,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:d}),L)}};function R($,...L){if(!e.apply(this,arguments))return;var I=S(this,L).event($),z=this.__zoom,P=Math.max(i[0],Math.min(i[1],z.k*Math.pow(2,r.apply(this,arguments)))),T=ui($);if(I.wheel)(I.mouse[0][0]!==T[0]||I.mouse[0][1]!==T[1])&&(I.mouse[1]=z.invert(I.mouse[0]=T)),clearTimeout(I.wheel);else{if(z.k===P)return;I.mouse=[T,z.invert(T)],eh(this),I.start()}Au($),I.wheel=setTimeout(E,g),I.zoom("mouse",n(w(v(z,P),I.mouse[0],I.mouse[1]),I.extent,a));function E(){I.wheel=null,I.end()}}function M($,...L){if(p||!e.apply(this,arguments))return;var I=$.currentTarget,z=S(this,L,!0).event($),P=ws($.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",H,!0),T=ui($,I),E=$.clientX,J=$.clientY;n_($.view),ry($),z.mouse=[T,this.__zoom.invert(T)],eh(this),z.start();function Q(te){if(Au(te),!z.moved){var le=te.clientX-E,ue=te.clientY-J;z.moved=le*le+ue*ue>k}z.event(te).zoom("mouse",n(w(z.that.__zoom,z.mouse[0]=ui(te,I),z.mouse[1]),z.extent,a))}function H(te){P.on("mousemove.zoom mouseup.zoom",null),r_(te.view,z.moved),Au(te),z.event(te).end()}}function V($,...L){if(e.apply(this,arguments)){var I=this.__zoom,z=ui($.changedTouches?$.changedTouches[0]:$,this),P=I.invert(z),T=I.k*($.shiftKey?.5:2),E=n(w(v(I,T),z,P),t.apply(this,L),a);Au($),l>0?ws(this).transition().duration(l).call(C,E,z,$):ws(this).call(y.transform,E,z,$)}}function D($,...L){if(e.apply(this,arguments)){var I=$.touches,z=I.length,P=S(this,L,$.changedTouches.length===z).event($),T,E,J,Q;for(ry($),E=0;E<z;++E)J=I[E],Q=ui(J,this),Q=[Q,this.__zoom.invert(Q),J.identifier],P.touch0?!P.touch1&&P.touch0[2]!==Q[2]&&(P.touch1=Q,P.taps=0):(P.touch0=Q,T=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(P.taps<2&&(f=Q[0],u=setTimeout(function(){u=null},h)),eh(this),P.start())}}function O($,...L){if(this.__zooming){var I=S(this,L).event($),z=$.changedTouches,P=z.length,T,E,J,Q;for(Au($),T=0;T<P;++T)E=z[T],J=ui(E,this),I.touch0&&I.touch0[2]===E.identifier?I.touch0[0]=J:I.touch1&&I.touch1[2]===E.identifier&&(I.touch1[0]=J);if(E=I.that.__zoom,I.touch1){var H=I.touch0[0],te=I.touch0[1],le=I.touch1[0],ue=I.touch1[1],de=(de=le[0]-H[0])*de+(de=le[1]-H[1])*de,ce=(ce=ue[0]-te[0])*ce+(ce=ue[1]-te[1])*ce;E=v(E,Math.sqrt(de/ce)),J=[(H[0]+le[0])/2,(H[1]+le[1])/2],Q=[(te[0]+ue[0])/2,(te[1]+ue[1])/2]}else if(I.touch0)J=I.touch0[0],Q=I.touch0[1];else return;I.zoom("touch",n(w(E,J,Q),I.extent,a))}}function K($,...L){if(this.__zooming){var I=S(this,L).event($),z=$.changedTouches,P=z.length,T,E;for(ry($),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),T=0;T<P;++T)E=z[T],I.touch0&&I.touch0[2]===E.identifier?delete I.touch0:I.touch1&&I.touch1[2]===E.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&&(E=ui(E,this),Math.hypot(f[0]-E[0],f[1]-E[1])<b)){var J=ws(this).on("dblclick.zoom");J&&J.apply(this,arguments)}}}return y.wheelDelta=function($){return arguments.length?(r=typeof $=="function"?$:yp(+$),y):r},y.filter=function($){return arguments.length?(e=typeof $=="function"?$:yp(!!$),y):e},y.touchable=function($){return arguments.length?(s=typeof $=="function"?$:yp(!!$),y):s},y.extent=function($){return arguments.length?(t=typeof $=="function"?$:yp([[+$[0][0],+$[0][1]],[+$[1][0],+$[1][1]]]),y):t},y.scaleExtent=function($){return arguments.length?(i[0]=+$[0],i[1]=+$[1],y):[i[0],i[1]]},y.translateExtent=function($){return arguments.length?(a[0][0]=+$[0][0],a[1][0]=+$[1][0],a[0][1]=+$[0][1],a[1][1]=+$[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function($){return arguments.length?(n=$,y):n},y.duration=function($){return arguments.length?(l=+$,y):l},y.interpolate=function($){return arguments.length?(c=$,y):c},y.on=function(){var $=d.on.apply(d,arguments);return $===d?y:$},y.clickDistance=function($){return arguments.length?(k=($=+$)*$,y):Math.sqrt(k)},y.tapDistance=function($){return arguments.length?(b=+$,y):b},y}const Yi={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."},Md=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],v_=["Enter"," ","Escape"],b_={"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 Lc;(function(e){e.Strict="strict",e.Loose="loose"})(Lc||(Lc={}));var sl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(sl||(sl={}));var $d;(function(e){e.Partial="partial",e.Full="full"})($d||($d={}));const k_={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ea;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ea||(ea={}));var os;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(os||(os={}));var We;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(We||(We={}));const $k={[We.Left]:We.Right,[We.Right]:We.Left,[We.Top]:We.Bottom,[We.Bottom]:We.Top};function S_(e){return e===null?null:e?"valid":"invalid"}const N_=e=>"id"in e&&"source"in e&&"target"in e,zF=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ov=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),cf=(e,t=[0,0])=>{const{width:n,height:r}=Eo(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},BF=(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):Ov(s)?s:t.nodeLookup.get(s.id));const l=a?zh(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Om(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Mm(n)},uf=(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=Om(n,zh(s)),r=!0)}),r?Mm(n):{x:0,y:0,width:0,height:0}},Mv=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...ff(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const d of e.values()){const{measured:u,selectable:f=!0,hidden:p=!1}=d;if(a&&!f||p)continue;const h=u.width??d.width??d.initialWidth??null,g=u.height??d.height??d.initialHeight??null,k=Dd(l,Mc(d)),b=(h??0)*(g??0),y=i&&k>0;(!d.internals.handleBounds||y||k>=b||d.dragging)&&c.push(d)}return c},HF=(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 UF(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 WF({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=UF(e,a),c=uf(l),d=$v(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 j_({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},u=a.origin??r;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",Yi.error005());else{const h=l.measured.width,g=l.measured.height;h&&g&&(f=[[c,d],[c+h,d+g]])}else l&&$c(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+d],[a.extent[1][0]+c,a.extent[1][1]+d]]);const p=$c(f)?hl(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",Yi.error015())),{position:{x:p.x-c+(a.measured.width??0)*u[0],y:p.y-d+(a.measured.height??0)*u[1]},positionAbsolute:p}}async function VF({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(k=>k.id===p.parentId);(h||g)&&a.push(p)}const l=new Set(t.map(p=>p.id)),c=r.filter(p=>p.deletable!==!1),u=HF(a,c);for(const p of c)l.has(p.id)&&!u.find(g=>g.id===p.id)&&u.push(p);if(!s)return{edges:u,nodes:a};const f=await s({nodes:a,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:a}:{edges:[],nodes:[]}:f}const Oc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),hl=(e={x:0,y:0},t,n)=>({x:Oc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Oc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function C_(e,t,n){const{width:r,height:s}=Eo(n),{x:i,y:a}=n.internals.positionAbsolute;return hl(e,[[i,a],[i+r,a+s]],t)}const Dk=(e,t,n)=>e<t?Oc(Math.abs(e-t),1,t)/t:e>n?-Oc(Math.abs(e-n),1,t)/t:0,E_=(e,t,n=15,r=40)=>{const s=Dk(e.x,r,t.width-r)*n,i=Dk(e.y,r,t.height-r)*n;return[s,i]},Om=(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)}),Xx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Mm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Mc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Ov(e)?e.internals.positionAbsolute:cf(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}},zh=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Ov(e)?e.internals.positionAbsolute:cf(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)}},__=(e,t)=>Mm(Om(Xx(e),Xx(t))),Dd=(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)},Fk=e=>hi(e.width)&&hi(e.height)&&hi(e.x)&&hi(e.y),hi=e=>!isNaN(e)&&isFinite(e),KF=(e,t)=>{},df=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ff=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?df(l,a):l},Bh=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Bl(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 qF(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Bl(e,n),s=Bl(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Bl(e.top??e.y??0,n),s=Bl(e.bottom??e.y??0,n),i=Bl(e.left??e.x??0,t),a=Bl(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 YF(e,t,n,r,s,i){const{x:a,y:l}=Bh(e,[t,n,r]),{x:c,y:d}=Bh({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=s-c,f=i-d;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(u),bottom:Math.floor(f)}}const $v=(e,t,n,r,s,i)=>{const a=qF(i,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,d=Math.min(l,c),u=Oc(d,r,s),f=e.x+e.width/2,p=e.y+e.height/2,h=t/2-f*u,g=n/2-p*u,k=YF(e,h,g,u,t,n),b={left:Math.min(k.left-a.left,0),top:Math.min(k.top-a.top,0),right:Math.min(k.right-a.right,0),bottom:Math.min(k.bottom-a.bottom,0)};return{x:h-b.left+b.right,y:g-b.top+b.bottom,zoom:u}},Fd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function $c(e){return e!=null&&e!=="parent"}function Eo(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 P_(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 A_(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 zk(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function GF(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function JF(e){return{...b_,...e||{}}}function od(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=mi(e),l=ff({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:d}=n?df(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const Dv=e=>({width:e.offsetWidth,height:e.offsetHeight}),I_=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},XF=["INPUT","SELECT","TEXTAREA"];function T_(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:XF.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const R_=e=>"clientX"in e,mi=(e,t)=>{var i,a;const n=R_(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)}},Bk=(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,...Dv(a)}})};function L_({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,u=Math.abs(c-e),f=Math.abs(d-t);return[c,d,u,f]}function xp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Hk({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case We.Left:return[t-xp(t-r,i),n];case We.Right:return[t+xp(r-t,i),n];case We.Top:return[t,n-xp(n-s,i)];case We.Bottom:return[t,n+xp(s-n,i)]}}function O_({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:s,targetPosition:i=We.Top,curvature:a=.25}){const[l,c]=Hk({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[d,u]=Hk({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[f,p,h,g]=L_({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${e},${t} C${l},${c} ${d},${u} ${r},${s}`,f,p,h,g]}function M_({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 QF({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 ZF({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Om(zh(e),zh(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 Dd(a,Mm(i))>0}const e3=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,t3=(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)),zd=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||e3;let s;return N_(e)?s={...e}:s={...e,id:r(e)},t3(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function $_({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=M_({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const Uk={[We.Left]:{x:-1,y:0},[We.Right]:{x:1,y:0},[We.Top]:{x:0,y:-1},[We.Bottom]:{x:0,y:1}},n3=({source:e,sourcePosition:t=We.Bottom,target:n})=>t===We.Left||t===We.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},Wk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function r3({source:e,sourcePosition:t=We.Bottom,target:n,targetPosition:r=We.Top,center:s,offset:i,stepPosition:a}){const l=Uk[t],c=Uk[r],d={x:e.x+l.x*i,y:e.y+l.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},f=n3({source:d,sourcePosition:t,target:u}),p=f.x!==0?"x":"y",h=f[p];let g=[],k,b;const y={x:0,y:0},v={x:0,y:0},[,,w,N]=M_({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*c[p]===-1){p==="x"?(k=s.x??d.x+(u.x-d.x)*a,b=s.y??(d.y+u.y)/2):(k=s.x??(d.x+u.x)/2,b=s.y??d.y+(u.y-d.y)*a);const R=[{x:k,y:d.y},{x:k,y:u.y}],M=[{x:d.x,y:b},{x:u.x,y:b}];l[p]===h?g=p==="x"?R:M:g=p==="x"?M:R}else{const R=[{x:d.x,y:u.y}],M=[{x:u.x,y:d.y}];if(p==="x"?g=l.x===h?M:R:g=l.y===h?R:M,t===r){const $=Math.abs(e[p]-n[p]);if($<=i){const L=Math.min(i-1,i-$);l[p]===h?y[p]=(d[p]>e[p]?-1:1)*L:v[p]=(u[p]>n[p]?-1:1)*L}}if(t!==r){const $=p==="x"?"y":"x",L=l[p]===c[$],I=d[$]>u[$],z=d[$]<u[$];(l[p]===1&&(!L&&I||L&&z)||l[p]!==1&&(!L&&z||L&&I))&&(g=p==="x"?R:M)}const V={x:d.x+y.x,y:d.y+y.y},D={x:u.x+v.x,y:u.y+v.y},O=Math.max(Math.abs(V.x-g[0].x),Math.abs(D.x-g[0].x)),K=Math.max(Math.abs(V.y-g[0].y),Math.abs(D.y-g[0].y));O>=K?(k=(V.x+D.x)/2,b=g[0].y):(k=g[0].x,b=(V.y+D.y)/2)}const C={x:d.x+y.x,y:d.y+y.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...C.x!==g[0].x||C.y!==g[0].y?[C]:[],...g,...S.x!==g[g.length-1].x||S.y!==g[g.length-1].y?[S]:[],n],k,b,w,N]}function s3(e,t,n,r){const s=Math.min(Wk(e,t)/2,Wk(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,u=e.y<n.y?1:-1;return`L ${i+s*d},${a}Q ${i},${a} ${i},${a+s*u}`}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 Qx({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:s,targetPosition:i=We.Top,borderRadius:a=5,centerX:l,centerY:c,offset:d=20,stepPosition:u=.5}){const[f,p,h,g,k]=r3({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:d,stepPosition:u});let b=`M${f[0].x} ${f[0].y}`;for(let y=1;y<f.length-1;y++)b+=s3(f[y-1],f[y],f[y+1],a);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,p,h,g,k]}function Vk(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function i3(e){var f;const{sourceNode:t,targetNode:n}=e;if(!Vk(t)||!Vk(n))return null;const r=t.internals.handleBounds||Kk(t.handles),s=n.internals.handleBounds||Kk(n.handles),i=qk((r==null?void 0:r.source)??[],e.sourceHandle),a=qk(e.connectionMode===Lc.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(f=e.onError)==null||f.call(e,"008",Yi.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||We.Bottom,c=(a==null?void 0:a.position)||We.Top,d=ml(t,i,l),u=ml(n,a,c);return{sourceX:d.x,sourceY:d.y,targetX:u.x,targetY:u.y,sourcePosition:l,targetPosition:c}}function Kk(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 ml(e,t,n=We.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??Eo(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case We.Top:return{x:s+a/2,y:i};case We.Right:return{x:s+a,y:i+l/2};case We.Bottom:return{x:s+a/2,y:i+l};case We.Left:return{x:s,y:i+l/2}}}function qk(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Zx(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function o3(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=Zx(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 D_=1e3,a3=10,Fv={nodeOrigin:[0,0],nodeExtent:Md,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},l3={...Fv,checkEquality:!0};function zv(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function c3(e,t,n){const r=zv(Fv,n);for(const s of e.values())if(s.parentId)Hv(s,e,t,r);else{const i=cf(s,r.nodeOrigin),a=$c(s.extent)?s.extent:r.nodeExtent,l=hl(i,a,Eo(s));s.internals.positionAbsolute=l}}function u3(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 Bv(e){return e==="manual"}function ew(e,t,n,r={}){var u,f;const s=zv(l3,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Bv(s.zIndexMode)?D_: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=cf(p,s.nodeOrigin),k=$c(p.extent)?p.extent:s.nodeExtent,b=hl(g,k,Eo(p));h={...s.defaults,...p,measured:{width:(u=p.measured)==null?void 0:u.width,height:(f=p.measured)==null?void 0:f.height},internals:{positionAbsolute:b,handleBounds:u3(p,h),z:F_(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&&Hv(h,t,n,r,i),d||(d=p.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:d}}function d3(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 Hv(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=zv(Fv,r),d=e.parentId,u=t.get(d);if(!u){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}d3(e,n),s&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++s.i,u.internals.z=u.internals.z+s.i*a3),s&&u.internals.rootParentIndex!==void 0&&(s.i=u.internals.rootParentIndex);const f=i&&!Bv(c)?D_:0,{x:p,y:h,z:g}=f3(e,u,a,l,f,c),{positionAbsolute:k}=e.internals,b=p!==k.x||h!==k.y;(b||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:p,y:h}:k,z:g}})}function F_(e,t,n){const r=hi(e.zIndex)?e.zIndex:0;return Bv(n)?r:r+(e.selected?t:0)}function f3(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,c=Eo(e),d=cf(e,n),u=$c(e.extent)?hl(d,e.extent,c):d;let f=hl({x:a+u.x,y:l+u.y},r,c);e.extent==="parent"&&(f=C_(f,c,t));const p=F_(e,s,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=p?h+1:p}}function Uv(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)??Mc(c),u=__(d,l.rect);i.set(l.parentId,{expandedRect:u,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},d)=>{var w;const u=c.internals.positionAbsolute,f=Eo(c),p=c.origin??r,h=l.x<u.x?Math.round(Math.abs(u.x-l.x)):0,g=l.y<u.y?Math.round(Math.abs(u.y-l.y)):0,k=Math.max(f.width,Math.round(l.width)),b=Math.max(f.height,Math.round(l.height)),y=(k-f.width)*p[0],v=(b-f.height)*p[1];(h>0||g>0||y||v)&&(s.push({id:d,type:"position",position:{x:c.position.x-h+y,y:c.position.y-g+v}}),(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}})})),(f.width<l.width||f.height<l.height||h||g)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:k+(h?p[0]*h-y:0),height:b+(g?p[1]*g-v:0)}})}),s}function p3(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=[],u=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(u.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 k=Dv(h.nodeElement),b=g.measured.width!==k.width||g.measured.height!==k.height;if(!!(k.width&&k.height&&(b||!g.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),w=$c(g.extent)?g.extent:i;let{positionAbsolute:N}=g.internals;g.parentId&&g.extent==="parent"?N=C_(N,k,t.get(g.parentId)):w&&(N=hl(N,w,k));const C={...g,measured:k,internals:{...g.internals,positionAbsolute:N,handleBounds:{source:Bk("source",h.nodeElement,v,f,g.id),target:Bk("target",h.nodeElement,v,f,g.id)}}};t.set(g.id,C),g.parentId&&Hv(C,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,b&&(d.push({id:g.id,type:"dimensions",dimensions:k}),g.expandParent&&g.parentId&&p.push({id:g.id,parentId:g.parentId,rect:Mc(C,s)}))}}if(p.length>0){const h=Uv(p,t,n,s);d.push(...h)}return{changes:d,updatedInternals:c}}async function h3({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 Yk(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 z_(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}`,u=`${i}-${l}--${s}-${a}`;Yk("source",c,u,e,s,a),Yk("target",c,d,e,i,l),t.set(r.id,r)}}function B_(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:B_(n,t):!1}function Gk(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 m3(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!B_(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 sy({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[d,u]of t){const f=(a=n.get(d))==null?void 0:a.internals.userNode;f&&s.push({...f,position:u.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 g3({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=df(i,t);return{x:a.x-i.x,y:a.y-i.y}}function y3({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},u=null,f=!1,p=null,h=!1,g=!1,k=null;function b({noDragClassName:v,handleSelector:w,domNode:N,isSelectable:C,nodeId:S,nodeClickDistance:A=0}){p=ws(N);function R({x:O,y:K}){const{nodeLookup:$,nodeExtent:L,snapGrid:I,snapToGrid:z,nodeOrigin:P,onNodeDrag:T,onSelectionDrag:E,onError:J,updateNodePositions:Q}=t();i={x:O,y:K};let H=!1;const te=l.size>1,le=te&&L?Xx(uf(l)):null,ue=te&&z?g3({dragItems:l,snapGrid:I,x:O,y:K}):null;for(const[de,ce]of l){if(!$.has(de))continue;let fe={x:O-ce.distance.x,y:K-ce.distance.y};z&&(fe=ue?{x:Math.round(fe.x+ue.x),y:Math.round(fe.y+ue.y)}:df(fe,I));let se=null;if(te&&L&&!ce.extent&&le){const{positionAbsolute:je}=ce.internals,Ve=je.x-le.x+L[0][0],at=je.x+ce.measured.width-le.x2+L[1][0],Je=je.y-le.y+L[0][1],jt=je.y+ce.measured.height-le.y2+L[1][1];se=[[Ve,Je],[at,jt]]}const{position:pe,positionAbsolute:ve}=j_({nodeId:de,nextPosition:fe,nodeLookup:$,nodeExtent:se||L,nodeOrigin:P,onError:J});H=H||ce.position.x!==pe.x||ce.position.y!==pe.y,ce.position=pe,ce.internals.positionAbsolute=ve}if(g=g||H,!!H&&(Q(l,!0),k&&(r||T||!S&&E))){const[de,ce]=sy({nodeId:S,dragItems:l,nodeLookup:$});r==null||r(k,l,de,ce),T==null||T(k,de,ce),S||E==null||E(k,ce)}}async function M(){if(!u)return;const{transform:O,panBy:K,autoPanSpeed:$,autoPanOnNodeDrag:L}=t();if(!L){c=!1,cancelAnimationFrame(a);return}const[I,z]=E_(d,u,$);(I!==0||z!==0)&&(i.x=(i.x??0)-I/O[2],i.y=(i.y??0)-z/O[2],await K({x:I,y:z})&&R(i)),a=requestAnimationFrame(M)}function V(O){var te;const{nodeLookup:K,multiSelectionActive:$,nodesDraggable:L,transform:I,snapGrid:z,snapToGrid:P,selectNodesOnDrag:T,onNodeDragStart:E,onSelectionDragStart:J,unselectNodesAndEdges:Q}=t();f=!0,(!T||!C)&&!$&&S&&((te=K.get(S))!=null&&te.selected||Q()),C&&T&&S&&(e==null||e(S));const H=od(O.sourceEvent,{transform:I,snapGrid:z,snapToGrid:P,containerBounds:u});if(i=H,l=m3(K,L,H,S),l.size>0&&(n||E||!S&&J)){const[le,ue]=sy({nodeId:S,dragItems:l,nodeLookup:K});n==null||n(O.sourceEvent,l,le,ue),E==null||E(O.sourceEvent,le,ue),S||J==null||J(O.sourceEvent,ue)}}const D=s_().clickDistance(A).on("start",O=>{const{domNode:K,nodeDragThreshold:$,transform:L,snapGrid:I,snapToGrid:z}=t();u=(K==null?void 0:K.getBoundingClientRect())||null,h=!1,g=!1,k=O.sourceEvent,$===0&&V(O),i=od(O.sourceEvent,{transform:L,snapGrid:I,snapToGrid:z,containerBounds:u}),d=mi(O.sourceEvent,u)}).on("drag",O=>{const{autoPanOnNodeDrag:K,transform:$,snapGrid:L,snapToGrid:I,nodeDragThreshold:z,nodeLookup:P}=t(),T=od(O.sourceEvent,{transform:$,snapGrid:L,snapToGrid:I,containerBounds:u});if(k=O.sourceEvent,(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1||S&&!P.has(S))&&(h=!0),!h){if(!c&&K&&f&&(c=!0,M()),!f){const E=mi(O.sourceEvent,u),J=E.x-d.x,Q=E.y-d.y;Math.sqrt(J*J+Q*Q)>z&&V(O)}(i.x!==T.xSnapped||i.y!==T.ySnapped)&&l&&f&&(d=mi(O.sourceEvent,u),R(T))}}).on("end",O=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:K,updateNodePositions:$,onNodeDragStop:L,onSelectionDragStop:I}=t();if(g&&($(l,!1),g=!1),s||L||!S&&I){const[z,P]=sy({nodeId:S,dragItems:l,nodeLookup:K,dragging:!1});s==null||s(O.sourceEvent,l,z,P),L==null||L(O.sourceEvent,z,P),S||I==null||I(O.sourceEvent,P)}}}).filter(O=>{const K=O.target;return!O.button&&(!v||!Gk(K,`.${v}`,N))&&(!w||Gk(K,w,N))});p.call(D)}function y(){p==null||p.on(".drag",null)}return{update:b,destroy:y}}function x3(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())Dd(s,Mc(i))>0&&r.push(i);return r}const w3=250;function v3(e,t,n,r){var l,c;let s=[],i=1/0;const a=x3(e,n,t+w3);for(const d of a){const u=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of u){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:p,y:h}=ml(d,f,f.position,!0),g=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(s=[{...f,x:p,y:h}],i=g):g===i&&s.push({...f,x:p,y:h}))}}if(!s.length)return null;if(s.length>1){const d=r.type==="source"?"target":"source";return s.find(u=>u.type===d)??s[0]}return s[0]}function H_(e,t,n,r,s,i=!1){var d,u,f;const a=r.get(e);if(!a)return null;const l=s==="strict"?(d=a.internals.handleBounds)==null?void 0:d[t]:[...((u=a.internals.handleBounds)==null?void 0:u.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(p=>p.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...ml(a,c,c.position,!0)}:c}function U_(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function b3(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const W_=()=>!0;function k3(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:u,flowId:f,panBy:p,cancelConnection:h,onConnectStart:g,onConnect:k,onConnectEnd:b,isValidConnection:y=W_,onReconnectEnd:v,updateConnection:w,getTransform:N,getFromHandle:C,autoPanSpeed:S,dragThreshold:A=1,handleDomNode:R}){const M=I_(e.target);let V=0,D;const{x:O,y:K}=mi(e),$=U_(i,R),L=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!L||!$)return;const z=H_(s,$,r,c,t);if(!z)return;let P=mi(e,L),T=!1,E=null,J=!1,Q=null;function H(){if(!u||!L)return;const[pe,ve]=E_(P,L,S);p({x:pe,y:ve}),V=requestAnimationFrame(H)}const te={...z,nodeId:s,type:$,position:z.position},le=c.get(s);let de={inProgress:!0,isValid:null,from:ml(le,te,We.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:le,to:P,toHandle:null,toPosition:$k[te.position],toNode:null,pointer:P};function ce(){I=!0,w(de),g==null||g(e,{nodeId:s,handleId:r,handleType:$})}A===0&&ce();function fe(pe){if(!I){const{x:jt,y:De}=mi(pe),Ce=jt-O,Jt=De-K;if(!(Ce*Ce+Jt*Jt>A*A))return;ce()}if(!C()||!te){se(pe);return}const ve=N();P=mi(pe,L),D=v3(ff(P,ve,!1,[1,1]),n,c,te),T||(H(),T=!0);const je=V_(pe,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:M,lib:d,flowId:f,nodeLookup:c});Q=je.handleDomNode,E=je.connection,J=b3(!!D,je.isValid);const Ve=c.get(s),at=Ve?ml(Ve,te,We.Left,!0):de.from,Je={...de,from:at,isValid:J,to:je.toHandle&&J?Bh({x:je.toHandle.x,y:je.toHandle.y},ve):P,toHandle:je.toHandle,toPosition:J&&je.toHandle?je.toHandle.position:$k[te.position],toNode:je.toHandle?c.get(je.toHandle.nodeId):null,pointer:P};w(Je),de=Je}function se(pe){if(!("touches"in pe&&pe.touches.length>0)){if(I){(D||Q)&&E&&J&&(k==null||k(E));const{inProgress:ve,...je}=de,Ve={...je,toPosition:de.toHandle?de.toPosition:null};b==null||b(pe,Ve),i&&(v==null||v(pe,Ve))}h(),cancelAnimationFrame(V),T=!1,J=!1,E=null,Q=null,M.removeEventListener("mousemove",fe),M.removeEventListener("mouseup",se),M.removeEventListener("touchmove",fe),M.removeEventListener("touchend",se)}}M.addEventListener("mousemove",fe),M.addEventListener("mouseup",se),M.addEventListener("touchmove",fe),M.addEventListener("touchend",se)}function V_(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:c,isValidConnection:d=W_,nodeLookup:u}){const f=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}=mi(e),k=a.elementFromPoint(h,g),b=k!=null&&k.classList.contains(`${l}-flow__handle`)?k:p,y={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const v=U_(void 0,b),w=b.getAttribute("data-nodeid"),N=b.getAttribute("data-handleid"),C=b.classList.contains("connectable"),S=b.classList.contains("connectableend");if(!w||!v)return y;const A={source:f?w:r,sourceHandle:f?N:s,target:f?r:w,targetHandle:f?s:N};y.connection=A;const M=C&&S&&(n===Lc.Strict?f&&v==="source"||!f&&v==="target":w!==r||N!==s);y.isValid=M&&d(A),y.toHandle=H_(w,v,N,u,n,!0)}return y}const tw={onPointerDown:k3,isValid:V_};function S3({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=ws(e);function i({translateExtent:l,width:c,height:d,zoomStep:u=1,pannable:f=!0,zoomable:p=!0,inversePan:h=!1}){const g=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const N=n(),C=w.sourceEvent.ctrlKey&&Fd()?10:1,S=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*u,A=N[2]*Math.pow(2,S*C);t.scaleTo(A)};let k=[0,0];const b=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(k=[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],S=[C[0]-k[0],C[1]-k[1]];k=C;const A=r()*Math.max(N[2],Math.log(N[2]))*(h?-1:1),R={x:N[0]-S[0]*A,y:N[1]-S[1]*A},M=[[0,0],[c,d]];t.setViewportConstrained({x:R.x,y:R.y,zoom:N[2]},M,l)},v=w_().on("start",b).on("zoom",f?y:null).on("zoom.wheel",p?g:null);s.call(v,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:ui}}const $m=e=>({x:e.x,y:e.y,zoom:e.k}),iy=({x:e,y:t,zoom:n})=>Lm.translate(e,t).scale(n),lc=(e,t)=>e.target.closest(`.${t}`),K_=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),N3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,oy=(e,t=0,n=N3,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},q_=e=>{const t=e.ctrlKey&&Fd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function j3({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return u=>{if(lc(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&a){const b=ui(u),y=q_(u),v=f*Math.pow(2,y);r.scaleTo(n,v,b,u);return}const p=u.deltaMode===1?20:1;let h=s===sl.Vertical?0:u.deltaX*p,g=s===sl.Horizontal?0:u.deltaY*p;!Fd()&&u.shiftKey&&s!==sl.Vertical&&(h=u.deltaY*p,g=0),r.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const k=$m(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(u,k),e.panScrollTimeout=setTimeout(()=>{d==null||d(u,k),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(u,k))}}function C3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=lc(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function E3({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=$m(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 _3({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&K_(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,$m(i.transform)))}}function P3({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&&K_(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=$m(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function A3({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return f=>{var b;const p=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(lc(f,`${d}-flow__node`)||lc(f,`${d}-flow__edge`)))return!0;if(!r&&!p&&!s&&!i&&!n||a||u&&!g||lc(f,l)&&g||lc(f,c)&&(!g||s&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((b=f.touches)==null?void 0:b.length)>1)return f.preventDefault(),!1;if(!p&&!s&&!h&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const k=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&k}}function I3({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},u=e.getBoundingClientRect(),f=w_().scaleExtent([t,n]).translateExtent(r),p=ws(e).call(f);v({x:s.x,y:s.y,zoom:Oc(s.zoom,t,n)},[[0,0],[u.width,u.height]],r);const h=p.on("wheel.zoom"),g=p.on("dblclick.zoom");f.wheelDelta(q_);function k(D,O){return p?new Promise(K=>{f==null||f.interpolate((O==null?void 0:O.interpolate)==="linear"?id:Xp).transform(oy(p,O==null?void 0:O.duration,O==null?void 0:O.ease,()=>K(!0)),D)}):Promise.resolve(!1)}function b({noWheelClassName:D,noPanClassName:O,onPaneContextMenu:K,userSelectionActive:$,panOnScroll:L,panOnDrag:I,panOnScrollMode:z,panOnScrollSpeed:P,preventScrolling:T,zoomOnPinch:E,zoomOnScroll:J,zoomOnDoubleClick:Q,zoomActivationKeyPressed:H,lib:te,onTransformChange:le,connectionInProgress:ue,paneClickDistance:de,selectionOnDrag:ce}){$&&!d.isZoomingOrPanning&&y();const fe=L&&!H&&!$;f.clickDistance(ce?1/0:!hi(de)||de<0?0:de);const se=fe?j3({zoomPanValues:d,noWheelClassName:D,d3Selection:p,d3Zoom:f,panOnScrollMode:z,panOnScrollSpeed:P,zoomOnPinch:E,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):C3({noWheelClassName:D,preventScrolling:T,d3ZoomHandler:h});if(p.on("wheel.zoom",se,{passive:!1}),!$){const ve=E3({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:a});f.on("start",ve);const je=_3({zoomPanValues:d,panOnDrag:I,onPaneContextMenu:!!K,onPanZoom:i,onTransformChange:le});f.on("zoom",je);const Ve=P3({zoomPanValues:d,panOnDrag:I,panOnScroll:L,onPaneContextMenu:K,onPanZoomEnd:l,onDraggingChange:c});f.on("end",Ve)}const pe=A3({zoomActivationKeyPressed:H,panOnDrag:I,zoomOnScroll:J,panOnScroll:L,zoomOnDoubleClick:Q,zoomOnPinch:E,userSelectionActive:$,noPanClassName:O,noWheelClassName:D,lib:te,connectionInProgress:ue});f.filter(pe),Q?p.on("dblclick.zoom",g):p.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function v(D,O,K){const $=iy(D),L=f==null?void 0:f.constrain()($,O,K);return L&&await k(L),new Promise(I=>I(L))}async function w(D,O){const K=iy(D);return await k(K,O),new Promise($=>$(K))}function N(D){if(p){const O=iy(D),K=p.property("__zoom");(K.k!==D.zoom||K.x!==D.x||K.y!==D.y)&&(f==null||f.transform(p,O,null,{sync:!0}))}}function C(){const D=p?x_(p.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}function S(D,O){return p?new Promise(K=>{f==null||f.interpolate((O==null?void 0:O.interpolate)==="linear"?id:Xp).scaleTo(oy(p,O==null?void 0:O.duration,O==null?void 0:O.ease,()=>K(!0)),D)}):Promise.resolve(!1)}function A(D,O){return p?new Promise(K=>{f==null||f.interpolate((O==null?void 0:O.interpolate)==="linear"?id:Xp).scaleBy(oy(p,O==null?void 0:O.duration,O==null?void 0:O.ease,()=>K(!0)),D)}):Promise.resolve(!1)}function R(D){f==null||f.scaleExtent(D)}function M(D){f==null||f.translateExtent(D)}function V(D){const O=!hi(D)||D<0?0:D;f==null||f.clickDistance(O)}return{update:b,destroy:y,setViewport:w,setViewportConstrained:v,getViewport:C,scaleTo:S,scaleBy:A,setScaleExtent:R,setTranslateExtent:M,syncViewport:N,setClickDistance:V}}var Dc;(function(e){e.Line="line",e.Handle="handle"})(Dc||(Dc={}));function T3({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 Jk(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 Ko(e,t){return Math.max(0,t-e)}function qo(e,t){return Math.max(0,e-t)}function wp(e,t,n){return Math.max(0,t-e,e-n)}function Xk(e,t){return e?!t:t}function R3(e,t,n,r,s,i,a,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:u,isVertical:f}=t,p=u&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:k,maxWidth:b,minHeight:y,maxHeight:v}=r,{x:w,y:N,width:C,height:S,aspectRatio:A}=e;let R=Math.floor(u?h-e.pointerX:0),M=Math.floor(f?g-e.pointerY:0);const V=C+(c?-R:R),D=S+(d?-M:M),O=-i[0]*C,K=-i[1]*S;let $=wp(V,k,b),L=wp(D,y,v);if(a){let P=0,T=0;c&&R<0?P=Ko(w+R+O,a[0][0]):!c&&R>0&&(P=qo(w+V+O,a[1][0])),d&&M<0?T=Ko(N+M+K,a[0][1]):!d&&M>0&&(T=qo(N+D+K,a[1][1])),$=Math.max($,P),L=Math.max(L,T)}if(l){let P=0,T=0;c&&R>0?P=qo(w+R,l[0][0]):!c&&R<0&&(P=Ko(w+V,l[1][0])),d&&M>0?T=qo(N+M,l[0][1]):!d&&M<0&&(T=Ko(N+D,l[1][1])),$=Math.max($,P),L=Math.max(L,T)}if(s){if(u){const P=wp(V/A,y,v)*A;if($=Math.max($,P),a){let T=0;!c&&!d||c&&!d&&p?T=qo(N+K+V/A,a[1][1])*A:T=Ko(N+K+(c?R:-R)/A,a[0][1])*A,$=Math.max($,T)}if(l){let T=0;!c&&!d||c&&!d&&p?T=Ko(N+V/A,l[1][1])*A:T=qo(N+(c?R:-R)/A,l[0][1])*A,$=Math.max($,T)}}if(f){const P=wp(D*A,k,b)/A;if(L=Math.max(L,P),a){let T=0;!c&&!d||d&&!c&&p?T=qo(w+D*A+O,a[1][0])/A:T=Ko(w+(d?M:-M)*A+O,a[0][0])/A,L=Math.max(L,T)}if(l){let T=0;!c&&!d||d&&!c&&p?T=Ko(w+D*A,l[1][0])/A:T=qo(w+(d?M:-M)*A,l[0][0])/A,L=Math.max(L,T)}}}M=M+(M<0?L:-L),R=R+(R<0?$:-$),s&&(p?V>D*A?M=(Xk(c,d)?-R:R)/A:R=(Xk(c,d)?-M:M)*A:u?(M=R/A,d=c):(R=M*A,c=d));const I=c?w+R:w,z=d?N+M:N;return{width:C+(c?-R:R),height:S+(d?-M:M),x:i[0]*R*(c?-1:1)+I,y:i[1]*M*(d?-1:1)+z}}const Y_={width:0,height:0,x:0,y:0},L3={...Y_,pointerX:0,pointerY:0,aspectRatio:1};function O3(e){return[[0,0],[e.measured.width,e.measured.height]]}function M3(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 $3({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=ws(e);let a={controlDirection:Jk("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:u,keepAspectRatio:f,resizeDirection:p,onResizeStart:h,onResize:g,onResizeEnd:k,shouldResize:b}){let y={...Y_},v={...L3};a={boundaries:u,resizeDirection:p,keepAspectRatio:f,controlDirection:Jk(d)};let w,N=null,C=[],S,A,R,M=!1;const V=s_().on("start",D=>{const{nodeLookup:O,transform:K,snapGrid:$,snapToGrid:L,nodeOrigin:I,paneDomNode:z}=n();if(w=O.get(t),!w)return;N=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:T}=od(D.sourceEvent,{transform:K,snapGrid:$,snapToGrid:L,containerBounds:N});y={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},v={...y,pointerX:P,pointerY:T,aspectRatio:y.width/y.height},S=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(S=O.get(w.parentId),A=S&&w.extent==="parent"?O3(S):void 0),C=[],R=void 0;for(const[E,J]of O)if(J.parentId===t&&(C.push({id:E,position:{...J.position},extent:J.extent}),J.extent==="parent"||J.expandParent)){const Q=M3(J,w,J.origin??I);R?R=[[Math.min(Q[0][0],R[0][0]),Math.min(Q[0][1],R[0][1])],[Math.max(Q[1][0],R[1][0]),Math.max(Q[1][1],R[1][1])]]:R=Q}h==null||h(D,{...y})}).on("drag",D=>{const{transform:O,snapGrid:K,snapToGrid:$,nodeOrigin:L}=n(),I=od(D.sourceEvent,{transform:O,snapGrid:K,snapToGrid:$,containerBounds:N}),z=[];if(!w)return;const{x:P,y:T,width:E,height:J}=y,Q={},H=w.origin??L,{width:te,height:le,x:ue,y:de}=R3(v,a.controlDirection,I,a.boundaries,a.keepAspectRatio,H,A,R),ce=te!==E,fe=le!==J,se=ue!==P&&ce,pe=de!==T&&fe;if(!se&&!pe&&!ce&&!fe)return;if((se||pe||H[0]===1||H[1]===1)&&(Q.x=se?ue:y.x,Q.y=pe?de:y.y,y.x=Q.x,y.y=Q.y,C.length>0)){const at=ue-P,Je=de-T;for(const jt of C)jt.position={x:jt.position.x-at+H[0]*(te-E),y:jt.position.y-Je+H[1]*(le-J)},z.push(jt)}if((ce||fe)&&(Q.width=ce&&(!a.resizeDirection||a.resizeDirection==="horizontal")?te:y.width,Q.height=fe&&(!a.resizeDirection||a.resizeDirection==="vertical")?le:y.height,y.width=Q.width,y.height=Q.height),S&&w.expandParent){const at=H[0]*(Q.width??0);Q.x&&Q.x<at&&(y.x=at,v.x=v.x-(Q.x-at));const Je=H[1]*(Q.height??0);Q.y&&Q.y<Je&&(y.y=Je,v.y=v.y-(Q.y-Je))}const ve=T3({width:y.width,prevWidth:E,height:y.height,prevHeight:J,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),je={...y,direction:ve};(b==null?void 0:b(D,je))!==!1&&(M=!0,g==null||g(D,je),r(Q,z))}).on("end",D=>{M&&(k==null||k(D,{...y}),s==null||s({...y}),M=!1)});i.call(V)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var G_={exports:{}},J_={},X_={exports:{}},Q_={};/**
|
|
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 Fc=m;function D3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var F3=typeof Object.is=="function"?Object.is:D3,z3=Fc.useState,B3=Fc.useEffect,H3=Fc.useLayoutEffect,U3=Fc.useDebugValue;function W3(e,t){var n=t(),r=z3({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return H3(function(){s.value=n,s.getSnapshot=t,ay(s)&&i({inst:s})},[e,n,t]),B3(function(){return ay(s)&&i({inst:s}),e(function(){ay(s)&&i({inst:s})})},[e]),U3(n),n}function ay(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!F3(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:W3;Q_.useSyncExternalStore=Fc.useSyncExternalStore!==void 0?Fc.useSyncExternalStore:K3;X_.exports=Q_;var Z_=X_.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 Dm=m,q3=Z_;function Y3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var G3=typeof Object.is=="function"?Object.is:Y3,J3=q3.useSyncExternalStore,X3=Dm.useRef,Q3=Dm.useEffect,Z3=Dm.useMemo,ez=Dm.useDebugValue;J_.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=X3(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=Z3(function(){function c(h){if(!d){if(d=!0,u=h,h=r(h),s!==void 0&&a.hasValue){var g=a.value;if(s(g,h))return f=g}return f=h}if(g=f,G3(u,h))return g;var k=r(h);return s!==void 0&&s(g,k)?(u=h,g):(u=h,f=k)}var d=!1,u,f,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=J3(e,i[0],i[1]);return Q3(function(){a.hasValue=!0,a.value=l},[l]),ez(l),l};G_.exports=J_;var tz=G_.exports;const nz=Na(tz),rz={},Qk=e=>{let t;const n=new Set,r=(u,f)=>{const p=typeof u=="function"?u(t):u;if(!Object.is(p,t)){const h=t;t=f??(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:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(rz?"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},sz=e=>e?Qk(e):Qk,{useDebugValue:iz}=Ze,{useSyncExternalStoreWithSelector:oz}=nz,az=e=>e;function eP(e,t=az,n){const r=oz(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return iz(r),r}const Zk=(e,t)=>{const n=sz(e),r=(s,i=t)=>eP(n,s,i);return Object.assign(r,n),r},lz=(e,t)=>e?Zk(e,t):Zk;function Nn(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 Fm=m.createContext(null),cz=Fm.Provider,tP=Yi.error001();function Tt(e,t){const n=m.useContext(Fm);if(n===null)throw new Error(tP);return eP(n,e,t)}function wn(){const e=m.useContext(Fm);if(e===null)throw new Error(tP);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const eS={display:"none"},uz={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},nP="react-flow__node-desc",rP="react-flow__edge-desc",dz="react-flow__aria-live",fz=e=>e.ariaLiveMessage,pz=e=>e.ariaLabelConfig;function hz({rfId:e}){const t=Tt(fz);return o.jsx("div",{id:`${dz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:uz,children:t})}function mz({rfId:e,disableKeyboardA11y:t}){const n=Tt(pz);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${nP}-${e}`,style:eS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${rP}-${e}`,style:eS,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(hz,{rfId:e})]})}const zc=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Jn(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});zc.displayName="Panel";function gz({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(zc,{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 yz=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}},vp=e=>e.id;function xz(e,t){return Nn(e.selectedNodes.map(vp),t.selectedNodes.map(vp))&&Nn(e.selectedEdges.map(vp),t.selectedEdges.map(vp))}function wz({onSelectionChange:e}){const t=wn(),{selectedNodes:n,selectedEdges:r}=Tt(yz,xz);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 vz=e=>!!e.onSelectionChangeHandlers;function bz({onSelectionChange:e}){const t=Tt(vz);return e||t?o.jsx(wz,{onSelectionChange:e}):null}const nw=typeof window<"u"?m.useLayoutEffect:m.useEffect,sP=[0,0],kz={x:0,y:0,zoom:1},Sz=["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"],tS=[...Sz,"rfId"],Nz=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}),nS={translateExtent:Md,nodeOrigin:sP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function jz(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Tt(Nz,Nn),d=wn();nw(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=nS,l()}),[]);const u=m.useRef(nS);return nw(()=>{for(const f of tS){const p=e[f],h=u.current[f];p!==h&&(typeof e[f]>"u"||(f==="nodes"?t(p):f==="edges"?n(p):f==="minZoom"?r(p):f==="maxZoom"?s(p):f==="translateExtent"?i(p):f==="nodeExtent"?a(p):f==="ariaLabelConfig"?d.setState({ariaLabelConfig:JF(p)}):f==="fitView"?d.setState({fitViewQueued:p}):f==="fitViewOptions"?d.setState({fitViewOptions:p}):d.setState({[f]:p})))}u.current=e},tS.map(f=>e[f])),null}function rS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Cz(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=rS(),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=rS())!=null&&r.matches?"dark":"light"}const sS=typeof document<"u"?document:null;function Bd(e=null,t={target:sS,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(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),u=d.reduce((f,p)=>f.concat(...p),[]);return[d,u]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??sS,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const u=h=>{var b,y;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!d)&&T_(h))return!1;const k=oS(h.code,l);if(i.current.add(h[k]),iS(a,i.current,!1)){const v=((y=(b=h.composedPath)==null?void 0:b.call(h))==null?void 0:y[0])||h.target,w=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(s.current||!w)&&h.preventDefault(),r(!0)}},f=h=>{const g=oS(h.code,l);iS(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",u),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),n}function iS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function oS(e,t){return t.includes(e)?"code":"key"}const Ez=()=>{const e=wn();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=$v(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},u=n.snapGrid??s,f=n.snapToGrid??i;return ff(d,r,f,u)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=Bh(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function iP(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)_z(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 _z(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 Wv(e,t){return iP(e,t)}function oP(e,t){return iP(e,t)}function Ga(e,t){return{id:e,type:"select",selected:t}}function cc(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(Ga(i.id,a)))}return r}function aS({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 lS(e){return{id:e.id,type:"remove"}}const cS=e=>zF(e),Pz=e=>N_(e);function aP(e){return m.forwardRef(e)}function uS(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>Az(()=>n(s=>s+BigInt(1))));return nw(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function Az(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const lP=m.createContext(null);function Iz({children:e}){const t=wn(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:d,hasDefaultNodes:u,onNodesChange:f,nodeLookup:p,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let k=c;for(const y of l)k=typeof y=="function"?y(k):y;let b=aS({items:k,lookup:p});for(const y of g.values())b=y(b);u&&d(k),b.length>0?f==null||f(b):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:v,setNodes:w}=t.getState();y&&w(v)})},[]),r=uS(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:d,hasDefaultEdges:u,onEdgesChange:f,edgeLookup:p}=t.getState();let h=c;for(const g of l)h=typeof g=="function"?g(h):g;u?d(h):f&&f(aS({items:h,lookup:p}))},[]),i=uS(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(lP.Provider,{value:a,children:e})}function Tz(){const e=m.useContext(lP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Rz=e=>!!e.panZoom;function bl(){const e=Ez(),t=wn(),n=Tz(),r=Tt(Rz),s=m.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,v;const{nodeLookup:p,nodeOrigin:h}=t.getState(),g=cS(f)?f:p.get(f.id),k=g.parentId?A_(g.position,g.measured,g.parentId,p,h):g.position,b={...g,position:k,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return Mc(b)},d=(f,p,h={replace:!1})=>{a(g=>g.map(k=>{if(k.id===f){const b=typeof p=="function"?p(k):p;return h.replace&&cS(b)?b:{...k,...b}}return k}))},u=(f,p,h={replace:!1})=>{l(g=>g.map(k=>{if(k.id===f){const b=typeof p=="function"?p(k):p;return h.replace&&Pz(b)?b:{...k,...b}}return k}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var p;return(p=i(f))==null?void 0:p.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(p=>({...p}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,addNodes:f=>{const p=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...p])},addEdges:f=>{const p=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...p])},toObject:()=>{const{nodes:f=[],edges:p=[],transform:h}=t.getState(),[g,k,b]=h;return{nodes:f.map(y=>({...y})),edges:p.map(y=>({...y})),viewport:{x:g,y:k,zoom:b}}},deleteElements:async({nodes:f=[],edges:p=[]})=>{const{nodes:h,edges:g,onNodesDelete:k,onEdgesDelete:b,triggerNodeChanges:y,triggerEdgeChanges:v,onDelete:w,onBeforeDelete:N}=t.getState(),{nodes:C,edges:S}=await VF({nodesToRemove:f,edgesToRemove:p,nodes:h,edges:g,onBeforeDelete:N}),A=S.length>0,R=C.length>0;if(A){const M=S.map(lS);b==null||b(S),v(M)}if(R){const M=C.map(lS);k==null||k(C),y(M)}return(R||A)&&(w==null||w({nodes:C,edges:S})),{deletedNodes:C,deletedEdges:S}},getIntersectingNodes:(f,p=!0,h)=>{const g=Fk(f),k=g?f:c(f),b=h!==void 0;return k?(h||t.getState().nodes).filter(y=>{const v=t.getState().nodeLookup.get(y.id);if(v&&!g&&(y.id===f.id||!v.internals.positionAbsolute))return!1;const w=Mc(b?y:v),N=Dd(w,k);return p&&N>0||N>=w.width*w.height||N>=k.width*k.height}):[]},isNodeIntersecting:(f,p,h=!0)=>{const k=Fk(f)?f:c(f);if(!k)return!1;const b=Dd(k,p);return h&&b>0||b>=p.width*p.height||b>=k.width*k.height},updateNode:d,updateNodeData:(f,p,h={replace:!1})=>{d(f,g=>{const k=typeof p=="function"?p(g):p;return h.replace?{...g,data:k}:{...g,data:{...g.data,...k}}},h)},updateEdge:u,updateEdgeData:(f,p,h={replace:!1})=>{u(f,g=>{const k=typeof p=="function"?p(g):p;return h.replace?{...g,data:k}:{...g,data:{...g.data,...k}}},h)},getNodesBounds:f=>{const{nodeLookup:p,nodeOrigin:h}=t.getState();return BF(f,{nodeLookup:p,nodeOrigin:h})},getHandleConnections:({type:f,id:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${f}${p?`-${p}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:p,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${f?p?`-${f}-${p}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const p=t.getState().fitViewResolver??GF();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:p}),n.nodeQueue.push(h=>[...h]),p.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const dS=e=>e.selected,Lz=typeof window<"u"?window:void 0;function Oz({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=wn(),{deleteElements:r}=bl(),s=Bd(e,{actInsideInputWithModifier:!1}),i=Bd(t,{target:Lz});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(dS),edges:a.filter(dS)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Mz(e){const t=wn();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=Dv(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Yi.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 zm={position:"absolute",width:"100%",height:"100%",top:0,left:0},$z=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Dz({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=sl.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:u,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:h=!0,children:g,noWheelClassName:k,noPanClassName:b,onViewportChange:y,isControlledViewport:v,paneClickDistance:w,selectionOnDrag:N}){const C=wn(),S=m.useRef(null),{userSelectionActive:A,lib:R,connectionInProgress:M}=Tt($z,Nn),V=Bd(p),D=m.useRef();Mz(S);const O=m.useCallback(K=>{y==null||y({x:K[0],y:K[1],zoom:K[2]}),v||C.setState({transform:K})},[y,v]);return m.useEffect(()=>{if(S.current){D.current=I3({domNode:S.current,minZoom:u,maxZoom:f,translateExtent:d,viewport:c,onDraggingChange:I=>C.setState(z=>z.paneDragging===I?z:{paneDragging:I}),onPanZoomStart:(I,z)=>{const{onViewportChangeStart:P,onMoveStart:T}=C.getState();T==null||T(I,z),P==null||P(z)},onPanZoom:(I,z)=>{const{onViewportChange:P,onMove:T}=C.getState();T==null||T(I,z),P==null||P(z)},onPanZoomEnd:(I,z)=>{const{onViewportChangeEnd:P,onMoveEnd:T}=C.getState();T==null||T(I,z),P==null||P(z)}});const{x:K,y:$,zoom:L}=D.current.getViewport();return C.setState({panZoom:D.current,transform:[K,$,L],domNode:S.current.closest(".react-flow")}),()=>{var I;(I=D.current)==null||I.destroy()}}},[]),m.useEffect(()=>{var K;(K=D.current)==null||K.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:V,preventScrolling:h,noPanClassName:b,userSelectionActive:A,noWheelClassName:k,lib:R,onTransformChange:O,connectionInProgress:M,selectionOnDrag:N,paneClickDistance:w})},[e,t,n,r,s,i,a,l,V,h,b,A,k,R,O,M,N,w]),o.jsx("div",{className:"react-flow__renderer",ref:S,style:zm,children:g})}const Fz=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function zz(){const{userSelectionActive:e,userSelectionRect:t}=Tt(Fz,Nn);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 ly=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Bz=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Hz({isSelecting:e,selectionKeyPressed:t,selectionMode:n=$d.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:d,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:g}){const k=wn(),{userSelectionActive:b,elementsSelectable:y,dragging:v,connectionInProgress:w}=Tt(Bz,Nn),N=y&&(e||b),C=m.useRef(null),S=m.useRef(),A=m.useRef(new Set),R=m.useRef(new Set),M=m.useRef(!1),V=P=>{if(M.current||w){M.current=!1;return}c==null||c(P),k.getState().resetSelectedElements(),k.setState({nodesSelectionActive:!1})},D=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}d==null||d(P)},O=u?P=>u(P):void 0,K=P=>{M.current&&(P.stopPropagation(),M.current=!1)},$=P=>{var le,ue;const{domNode:T}=k.getState();if(S.current=T==null?void 0:T.getBoundingClientRect(),!S.current)return;const E=P.target===C.current;if(!E&&!!P.target.closest(".nokey")||!e||!(i&&E||t)||P.button!==0||!P.isPrimary)return;(ue=(le=P.target)==null?void 0:le.setPointerCapture)==null||ue.call(le,P.pointerId),M.current=!1;const{x:H,y:te}=mi(P.nativeEvent,S.current);k.setState({userSelectionRect:{width:0,height:0,startX:H,startY:te,x:H,y:te}}),E||(P.stopPropagation(),P.preventDefault())},L=P=>{const{userSelectionRect:T,transform:E,nodeLookup:J,edgeLookup:Q,connectionLookup:H,triggerNodeChanges:te,triggerEdgeChanges:le,defaultEdgeOptions:ue,resetSelectedElements:de}=k.getState();if(!S.current||!T)return;const{x:ce,y:fe}=mi(P.nativeEvent,S.current),{startX:se,startY:pe}=T;if(!M.current){const Je=t?0:s;if(Math.hypot(ce-se,fe-pe)<=Je)return;de(),a==null||a(P)}M.current=!0;const ve={startX:se,startY:pe,x:ce<se?ce:se,y:fe<pe?fe:pe,width:Math.abs(ce-se),height:Math.abs(fe-pe)},je=A.current,Ve=R.current;A.current=new Set(Mv(J,ve,E,n===$d.Partial,!0).map(Je=>Je.id)),R.current=new Set;const at=(ue==null?void 0:ue.selectable)??!0;for(const Je of A.current){const jt=H.get(Je);if(jt)for(const{edgeId:De}of jt.values()){const Ce=Q.get(De);Ce&&(Ce.selectable??at)&&R.current.add(De)}}if(!zk(je,A.current)){const Je=cc(J,A.current,!0);te(Je)}if(!zk(Ve,R.current)){const Je=cc(Q,R.current);le(Je)}k.setState({userSelectionRect:ve,userSelectionActive:!0,nodesSelectionActive:!1})},I=P=>{var T,E;P.button===0&&((E=(T=P.target)==null?void 0:T.releasePointerCapture)==null||E.call(T,P.pointerId),!b&&P.target===C.current&&k.getState().userSelectionRect&&(V==null||V(P)),k.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(l==null||l(P),k.setState({nodesSelectionActive:A.current.size>0})))},z=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:Jn(["react-flow__pane",{draggable:z,dragging:v,selection:e}]),onClick:N?void 0:ly(V,C),onContextMenu:ly(D,C),onWheel:ly(O,C),onPointerEnter:N?void 0:f,onPointerMove:N?L:p,onPointerUp:N?I:void 0,onPointerDownCapture:N?$:void 0,onClickCapture:N?K:void 0,onPointerLeave:h,ref:C,style:zm,children:[g,o.jsx(zz,{})]})}function rw({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",Yi.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):s([e])}function cP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=wn(),[c,d]=m.useState(!1),u=m.useRef();return m.useEffect(()=>{u.current=y3({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{rw({id:f,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=u.current)==null||f.destroy()}},[n,r,t,i,e,s,a]),c}const Uz=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function uP(){const e=wn();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:d,nodeOrigin:u}=e.getState(),f=new Map,p=Uz(a),h=s?i[0]:5,g=s?i[1]:5,k=n.direction.x*h*n.factor,b=n.direction.y*g*n.factor;for(const[,y]of d){if(!p(y))continue;let v={x:y.internals.positionAbsolute.x+k,y:y.internals.positionAbsolute.y+b};s&&(v=df(v,i));const{position:w,positionAbsolute:N}=j_({nodeId:y.id,nextPosition:v,nodeLookup:d,nodeExtent:r,nodeOrigin:u,onError:l});y.position=w,y.internals.positionAbsolute=N,f.set(y.id,y)}c(f)},[])}const Vv=m.createContext(null),Wz=Vv.Provider;Vv.Consumer;const dP=()=>m.useContext(Vv),Vz=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Kz=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:c,isValid:d}=a,u=(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:u,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Lc.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:u&&d}};function qz({type:e="source",position:t=We.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:d,onMouseDown:u,onTouchStart:f,...p},h){var L,I;const g=a||null,k=e==="target",b=wn(),y=dP(),{connectOnClick:v,noPanClassName:w,rfId:N}=Tt(Vz,Nn),{connectingFrom:C,connectingTo:S,clickConnecting:A,isPossibleEndHandle:R,connectionInProcess:M,clickConnectionInProcess:V,valid:D}=Tt(Kz(y,g,e),Nn);y||(I=(L=b.getState()).onError)==null||I.call(L,"010",Yi.error010());const O=z=>{const{defaultEdgeOptions:P,onConnect:T,hasDefaultEdges:E}=b.getState(),J={...P,...z};if(E){const{edges:Q,setEdges:H}=b.getState();H(zd(J,Q))}T==null||T(J),l==null||l(J)},K=z=>{if(!y)return;const P=R_(z.nativeEvent);if(s&&(P&&z.button===0||!P)){const T=b.getState();tw.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:T.autoPanOnConnect,connectionMode:T.connectionMode,connectionRadius:T.connectionRadius,domNode:T.domNode,nodeLookup:T.nodeLookup,lib:T.lib,isTarget:k,handleId:g,nodeId:y,flowId:T.rfId,panBy:T.panBy,cancelConnection:T.cancelConnection,onConnectStart:T.onConnectStart,onConnectEnd:(...E)=>{var J,Q;return(Q=(J=b.getState()).onConnectEnd)==null?void 0:Q.call(J,...E)},updateConnection:T.updateConnection,onConnect:O,isValidConnection:n||((...E)=>{var J,Q;return((Q=(J=b.getState()).isValidConnection)==null?void 0:Q.call(J,...E))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:T.autoPanSpeed,dragThreshold:T.connectionDragThreshold})}P?u==null||u(z):f==null||f(z)},$=z=>{const{onClickConnectStart:P,onClickConnectEnd:T,connectionClickStartHandle:E,connectionMode:J,isValidConnection:Q,lib:H,rfId:te,nodeLookup:le,connection:ue}=b.getState();if(!y||!E&&!s)return;if(!E){P==null||P(z.nativeEvent,{nodeId:y,handleId:g,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const de=I_(z.target),ce=n||Q,{connection:fe,isValid:se}=tw.isValid(z.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:J,fromNodeId:E.nodeId,fromHandleId:E.id||null,fromType:E.type,isValidConnection:ce,flowId:te,doc:de,lib:H,nodeLookup:le});se&&fe&&O(fe);const pe=structuredClone(ue);delete pe.inProgress,pe.toPosition=pe.toHandle?pe.toHandle.position:null,T==null||T(z,pe),b.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${N}-${y}-${g}-${e}`,className:Jn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,d,{source:!k,target:k,connectable:r,connectablestart:s,connectableend:i,clickconnecting:A,connectingfrom:C,connectingto:S,valid:D,connectionindicator:r&&(!M||R)&&(M||V?i:s)}]),onMouseDown:K,onTouchStart:K,onClick:v?$:void 0,ref:h,...p,children:c})}const ls=m.memo(aP(qz));function Yz({data:e,isConnectable:t,sourcePosition:n=We.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(ls,{type:"source",position:n,isConnectable:t})]})}function Gz({data:e,isConnectable:t,targetPosition:n=We.Top,sourcePosition:r=We.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(ls,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(ls,{type:"source",position:r,isConnectable:t})]})}function Jz(){return null}function Xz({data:e,isConnectable:t,targetPosition:n=We.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(ls,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Hh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},fS={input:Yz,default:Gz,output:Xz,group:Jz};function Qz(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 Zz=e=>{const{width:t,height:n,x:r,y:s}=uf(e.nodeLookup,{filter:i=>!!i.selected});return{width:hi(t)?t:null,height:hi(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 e5({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=wn(),{width:s,height:i,transformString:a,userSelectionActive:l}=Tt(Zz,Nn),c=uP(),d=m.useRef(null);m.useEffect(()=>{var h;n||(h=d.current)==null||h.focus({preventScroll:!0})},[n]);const u=!l&&s!==null&&i!==null;if(cP({nodeRef:d,disabled:!u}),!u)return null;const f=e?h=>{const g=r.getState().nodes.filter(k=>k.selected);e(h,g)}:void 0,p=h=>{Object.prototype.hasOwnProperty.call(Hh,h.key)&&(h.preventDefault(),c({direction:Hh[h.key],factor:h.shiftKey?4:1}))};return o.jsx("div",{className:Jn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:s,height:i}})})}const pS=typeof window<"u"?window:void 0,t5=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function fP({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:d,selectionOnDrag:u,selectionMode:f,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:k,zoomActivationKeyCode:b,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:N,panOnScrollSpeed:C,panOnScrollMode:S,zoomOnDoubleClick:A,panOnDrag:R,defaultViewport:M,translateExtent:V,minZoom:D,maxZoom:O,preventScrolling:K,onSelectionContextMenu:$,noWheelClassName:L,noPanClassName:I,disableKeyboardA11y:z,onViewportChange:P,isControlledViewport:T}){const{nodesSelectionActive:E,userSelectionActive:J}=Tt(t5,Nn),Q=Bd(d,{target:pS}),H=Bd(k,{target:pS}),te=H||R,le=H||N,ue=u&&te!==!0,de=Q||J||ue;return Oz({deleteKeyCode:c,multiSelectionKeyCode:g}),o.jsx(Dz,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:le,panOnScrollSpeed:C,panOnScrollMode:S,zoomOnDoubleClick:A,panOnDrag:!Q&&te,defaultViewport:M,translateExtent:V,minZoom:D,maxZoom:O,zoomActivationKeyCode:b,preventScrolling:K,noWheelClassName:L,noPanClassName:I,onViewportChange:P,isControlledViewport:T,paneClickDistance:l,selectionOnDrag:ue,children:o.jsxs(Hz,{onSelectionStart:p,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:te,isSelecting:!!de,selectionMode:f,selectionKeyPressed:Q,paneClickDistance:l,selectionOnDrag:ue,children:[e,E&&o.jsx(e5,{onSelectionContextMenu:$,noPanClassName:I,disableKeyboardA11y:z})]})})}fP.displayName="FlowRenderer";const n5=m.memo(fP),r5=e=>t=>e?Mv(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 s5(e){return Tt(m.useCallback(r5(e),[e]),Nn)}const i5=e=>e.updateNodeInternals;function o5(){const e=Tt(i5),[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 a5({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=wn(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),d=m.useRef(t),u=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!u||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[u,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(i.current){const f=d.current!==t,p=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(f||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 l5({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:d,nodesFocusable:u,resizeObserver:f,noDragClassName:p,noPanClassName:h,disableKeyboardA11y:g,rfId:k,nodeTypes:b,nodeClickDistance:y,onError:v}){const{node:w,internals:N,isParent:C}=Tt(ce=>{const fe=ce.nodeLookup.get(e),se=ce.parentLookup.has(e);return{node:fe,internals:fe.internals,isParent:se}},Nn);let S=w.type||"default",A=(b==null?void 0:b[S])||fS[S];A===void 0&&(v==null||v("003",Yi.error003(S)),S="default",A=(b==null?void 0:b.default)||fS.default);const R=!!(w.draggable||l&&typeof w.draggable>"u"),M=!!(w.selectable||c&&typeof w.selectable>"u"),V=!!(w.connectable||d&&typeof w.connectable>"u"),D=!!(w.focusable||u&&typeof w.focusable>"u"),O=wn(),K=P_(w),$=a5({node:w,nodeType:S,hasDimensions:K,resizeObserver:f}),L=cP({nodeRef:$,disabled:w.hidden||!R,noDragClassName:p,handleSelector:w.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:y}),I=uP();if(w.hidden)return null;const z=Eo(w),P=Qz(w),T=M||R||t||n||r||s,E=n?ce=>n(ce,{...N.userNode}):void 0,J=r?ce=>r(ce,{...N.userNode}):void 0,Q=s?ce=>s(ce,{...N.userNode}):void 0,H=i?ce=>i(ce,{...N.userNode}):void 0,te=a?ce=>a(ce,{...N.userNode}):void 0,le=ce=>{const{selectNodesOnDrag:fe,nodeDragThreshold:se}=O.getState();M&&(!fe||!R||se>0)&&rw({id:e,store:O,nodeRef:$}),t&&t(ce,{...N.userNode})},ue=ce=>{if(!(T_(ce.nativeEvent)||g)){if(v_.includes(ce.key)&&M){const fe=ce.key==="Escape";rw({id:e,store:O,unselect:fe,nodeRef:$})}else if(R&&w.selected&&Object.prototype.hasOwnProperty.call(Hh,ce.key)){ce.preventDefault();const{ariaLabelConfig:fe}=O.getState();O.setState({ariaLiveMessage:fe["node.a11yDescription.ariaLiveMessage"]({direction:ce.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),I({direction:Hh[ce.key],factor:ce.shiftKey?4:1})}}},de=()=>{var Ve;if(g||!((Ve=$.current)!=null&&Ve.matches(":focus-visible")))return;const{transform:ce,width:fe,height:se,autoPanOnNodeFocus:pe,setCenter:ve}=O.getState();if(!pe)return;Mv(new Map([[e,w]]),{x:0,y:0,width:fe,height:se},ce,!0).length>0||ve(w.position.x+z.width/2,w.position.y+z.height/2,{zoom:ce[2]})};return o.jsx("div",{className:Jn(["react-flow__node",`react-flow__node-${S}`,{[h]:R},w.className,{selected:w.selected,selectable:M,parent:C,draggable:R,dragging:L}]),ref:$,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:K?"visible":"hidden",...w.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:E,onMouseMove:J,onMouseLeave:Q,onContextMenu:H,onClick:le,onDoubleClick:te,onKeyDown:D?ue:void 0,tabIndex:D?0:void 0,onFocus:D?de:void 0,role:w.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${nP}-${k}`,"aria-label":w.ariaLabel,...w.domAttributes,children:o.jsx(Wz,{value:e,children:o.jsx(A,{id:e,data:w.data,type:S,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:w.selected??!1,selectable:M,draggable:R,deletable:w.deletable??!0,isConnectable:V,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:L,dragHandle:w.dragHandle,zIndex:N.z,parentId:w.parentId,...z})})})}var c5=m.memo(l5);const u5=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function pP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Tt(u5,Nn),a=s5(e.onlyRenderVisibleElements),l=o5();return o.jsx("div",{className:"react-flow__nodes",style:zm,children:a.map(c=>o.jsx(c5,{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))})}pP.displayName="NodeRenderer";const d5=m.memo(pP);function f5(e){return Tt(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&&ZF({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),Nn)}const p5=({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"})},h5=({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"})},hS={[os.Arrow]:p5,[os.ArrowClosed]:h5};function m5(e){const t=wn();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(hS,e)?hS[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Yi.error009(e)),null)},[e])}const g5=({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=m5(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},hP=({defaultColor:e,rfId:t})=>{const n=Tt(i=>i.edges),r=Tt(i=>i.defaultEdgeOptions),s=m.useMemo(()=>o3(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(g5,{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};hP.displayName="MarkerDefinitions";var y5=m.memo(hP);function mP({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...u}){const[f,p]=m.useState({x:1,y:0,width:0,height:0}),h=Jn(["react-flow__edge-textwrapper",d]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const k=g.current.getBBox();p({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...u,children:[s&&o.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}mP.displayName="EdgeText";const x5=m.memo(mP);function Bm({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:d=20,...u}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...u,d:e,fill:"none",className:Jn(["react-flow__edge-path",u.className])}),d?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&hi(t)&&hi(n)?o.jsx(x5,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function mS({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===We.Left||e===We.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function gP({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:s,targetPosition:i=We.Top}){const[a,l]=mS({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,d]=mS({pos:i,x1:r,y1:s,x2:e,y2:t}),[u,f,p,h]=L_({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}`,u,f,p,h]}function yP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:b,interactionWidth:y})=>{const[v,w,N]=gP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),C=e.isInternal?void 0:t;return o.jsx(Bm,{id:C,path:v,labelX:w,labelY:N,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:b,interactionWidth:y})})}const w5=yP({isInternal:!1}),xP=yP({isInternal:!0});w5.displayName="SimpleBezierEdge";xP.displayName="SimpleBezierEdgeInternal";function wP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,sourcePosition:h=We.Bottom,targetPosition:g=We.Top,markerEnd:k,markerStart:b,pathOptions:y,interactionWidth:v})=>{const[w,N,C]=Qx({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}),S=e.isInternal?void 0:t;return o.jsx(Bm,{id:S,path:w,labelX:N,labelY:C,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:k,markerStart:b,interactionWidth:v})})}const vP=wP({isInternal:!1}),bP=wP({isInternal:!0});vP.displayName="SmoothStepEdge";bP.displayName="SmoothStepEdgeInternal";function kP(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(vP,{...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 v5=kP({isInternal:!1}),SP=kP({isInternal:!0});v5.displayName="StepEdge";SP.displayName="StepEdgeInternal";function NP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:g,interactionWidth:k})=>{const[b,y,v]=$_({sourceX:n,sourceY:r,targetX:s,targetY:i}),w=e.isInternal?void 0:t;return o.jsx(Bm,{id:w,path:b,labelX:y,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:g,interactionWidth:k})})}const b5=NP({isInternal:!1}),jP=NP({isInternal:!0});b5.displayName="StraightEdge";jP.displayName="StraightEdgeInternal";function CP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=We.Bottom,targetPosition:l=We.Top,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:b,pathOptions:y,interactionWidth:v})=>{const[w,N,C]=O_({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:y==null?void 0:y.curvature}),S=e.isInternal?void 0:t;return o.jsx(Bm,{id:S,path:w,labelX:N,labelY:C,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:b,interactionWidth:v})})}const k5=CP({isInternal:!1}),EP=CP({isInternal:!0});k5.displayName="BezierEdge";EP.displayName="BezierEdgeInternal";const gS={default:EP,straight:jP,step:SP,smoothstep:bP,simplebezier:xP},yS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},S5=(e,t,n)=>n===We.Left?e-t:n===We.Right?e+t:e,N5=(e,t,n)=>n===We.Top?e-t:n===We.Bottom?e+t:e,xS="react-flow__edgeupdater";function wS({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:Jn([xS,`${xS}-${l}`]),cx:S5(t,r,e),cy:N5(n,r,e),r,stroke:"transparent",fill:"transparent"})}function j5({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:d,onReconnectStart:u,onReconnectEnd:f,setReconnecting:p,setUpdateHover:h}){const g=wn(),k=(N,C)=>{if(N.button!==0)return;const{autoPanOnConnect:S,domNode:A,connectionMode:R,connectionRadius:M,lib:V,onConnectStart:D,cancelConnection:O,nodeLookup:K,rfId:$,panBy:L,updateConnection:I}=g.getState(),z=C.type==="target",P=(J,Q)=>{p(!1),f==null||f(J,n,C.type,Q)},T=J=>d==null?void 0:d(n,J),E=(J,Q)=>{p(!0),u==null||u(N,n,C.type),D==null||D(J,Q)};tw.onPointerDown(N.nativeEvent,{autoPanOnConnect:S,connectionMode:R,connectionRadius:M,domNode:A,handleId:C.id,nodeId:C.nodeId,nodeLookup:K,isTarget:z,edgeUpdaterType:C.type,lib:V,flowId:$,cancelConnection:O,panBy:L,isValidConnection:(...J)=>{var Q,H;return((H=(Q=g.getState()).isValidConnection)==null?void 0:H.call(Q,...J))??!0},onConnect:T,onConnectStart:E,onConnectEnd:(...J)=>{var Q,H;return(H=(Q=g.getState()).onConnectEnd)==null?void 0:H.call(Q,...J)},onReconnectEnd:P,updateConnection:I,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},b=N=>k(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=N=>k(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),w=()=>h(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(wS,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:b,onMouseEnter:v,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&o.jsx(wS,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:w,type:"target"})]})}function C5({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,reconnectRadius:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,rfId:g,edgeTypes:k,noPanClassName:b,onError:y,disableKeyboardA11y:v}){let w=Tt(ve=>ve.edgeLookup.get(e));const N=Tt(ve=>ve.defaultEdgeOptions);w=N?{...N,...w}:w;let C=w.type||"default",S=(k==null?void 0:k[C])||gS[C];S===void 0&&(y==null||y("011",Yi.error011(C)),C="default",S=(k==null?void 0:k.default)||gS.default);const A=!!(w.focusable||t&&typeof w.focusable>"u"),R=typeof f<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),M=!!(w.selectable||r&&typeof w.selectable>"u"),V=m.useRef(null),[D,O]=m.useState(!1),[K,$]=m.useState(!1),L=wn(),{zIndex:I,sourceX:z,sourceY:P,targetX:T,targetY:E,sourcePosition:J,targetPosition:Q}=Tt(m.useCallback(ve=>{const je=ve.nodeLookup.get(w.source),Ve=ve.nodeLookup.get(w.target);if(!je||!Ve)return{zIndex:w.zIndex,...yS};const at=i3({id:e,sourceNode:je,targetNode:Ve,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:ve.connectionMode,onError:y});return{zIndex:QF({selected:w.selected,zIndex:w.zIndex,sourceNode:je,targetNode:Ve,elevateOnSelect:ve.elevateEdgesOnSelect,zIndexMode:ve.zIndexMode}),...at||yS}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),Nn),H=m.useMemo(()=>w.markerStart?`url('#${Zx(w.markerStart,g)}')`:void 0,[w.markerStart,g]),te=m.useMemo(()=>w.markerEnd?`url('#${Zx(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||z===null||P===null||T===null||E===null)return null;const le=ve=>{var Je;const{addSelectedEdges:je,unselectNodesAndEdges:Ve,multiSelectionActive:at}=L.getState();M&&(L.setState({nodesSelectionActive:!1}),w.selected&&at?(Ve({nodes:[],edges:[w]}),(Je=V.current)==null||Je.blur()):je([e])),s&&s(ve,w)},ue=i?ve=>{i(ve,{...w})}:void 0,de=a?ve=>{a(ve,{...w})}:void 0,ce=l?ve=>{l(ve,{...w})}:void 0,fe=c?ve=>{c(ve,{...w})}:void 0,se=d?ve=>{d(ve,{...w})}:void 0,pe=ve=>{var je;if(!v&&v_.includes(ve.key)&&M){const{unselectNodesAndEdges:Ve,addSelectedEdges:at}=L.getState();ve.key==="Escape"?((je=V.current)==null||je.blur(),Ve({edges:[w]})):at([e])}};return o.jsx("svg",{style:{zIndex:I},children:o.jsxs("g",{className:Jn(["react-flow__edge",`react-flow__edge-${C}`,w.className,b,{selected:w.selected,animated:w.animated,inactive:!M&&!s,updating:D,selectable:M}]),onClick:le,onDoubleClick:ue,onContextMenu:de,onMouseEnter:ce,onMouseMove:fe,onMouseLeave:se,onKeyDown:A?pe:void 0,tabIndex:A?0:void 0,role:w.ariaRole??(A?"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":A?`${rP}-${g}`:void 0,ref:V,...w.domAttributes,children:[!K&&o.jsx(S,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:M,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:z,sourceY:P,targetX:T,targetY:E,sourcePosition:J,targetPosition:Q,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:H,markerEnd:te,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),R&&o.jsx(j5,{edge:w,isReconnectable:R,reconnectRadius:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,sourceX:z,sourceY:P,targetX:T,targetY:E,sourcePosition:J,targetPosition:Q,setUpdateHover:O,setReconnecting:$})]})})}var E5=m.memo(C5);const _5=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function _P({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:u,reconnectRadius:f,onEdgeDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:k}){const{edgesFocusable:b,edgesReconnectable:y,elementsSelectable:v,onError:w}=Tt(_5,Nn),N=f5(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(y5,{defaultColor:e,rfId:n}),N.map(C=>o.jsx(E5,{id:C,edgesFocusable:b,edgesReconnectable:y,elementsSelectable:v,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:u,reconnectRadius:f,onDoubleClick:p,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:k},C))]})}_P.displayName="EdgeRenderer";const P5=m.memo(_P),A5=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function I5({children:e}){const t=Tt(A5);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function T5(e){const t=bl(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const R5=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function L5(e){const t=Tt(R5),n=wn();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function O5(e){return e.connection.inProgress?{...e.connection,to:ff(e.connection.to,e.transform)}:{...e.connection}}function M5(e){return O5}function $5(e){const t=M5();return Tt(t,Nn)}const D5=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function F5({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:c}=Tt(D5,Nn);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:Jn(["react-flow__connection",S_(l)]),children:o.jsx(PP,{style:t,type:n,CustomComponent:r,isValid:l})})})}const PP=({style:e,type:t=ea.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:c,to:d,toNode:u,toHandle:f,toPosition:p,pointer:h}=$5();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:S_(r),toNode:u,toHandle:f,pointer:h});let g="";const k={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:d.x,targetY:d.y,targetPosition:p};switch(t){case ea.Bezier:[g]=O_(k);break;case ea.SimpleBezier:[g]=gP(k);break;case ea.Step:[g]=Qx({...k,borderRadius:0});break;case ea.SmoothStep:[g]=Qx(k);break;default:[g]=$_(k)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};PP.displayName="ConnectionLine";const z5={};function vS(e=z5){m.useRef(e),wn(),m.useEffect(()=>{},[e])}function B5(){wn(),m.useRef(!1),m.useEffect(()=>{},[])}function AP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,onSelectionContextMenu:f,onSelectionStart:p,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:k,connectionLineComponent:b,connectionLineContainerStyle:y,selectionKeyCode:v,selectionOnDrag:w,selectionMode:N,multiSelectionKeyCode:C,panActivationKeyCode:S,zoomActivationKeyCode:A,deleteKeyCode:R,onlyRenderVisibleElements:M,elementsSelectable:V,defaultViewport:D,translateExtent:O,minZoom:K,maxZoom:$,preventScrolling:L,defaultMarkerColor:I,zoomOnScroll:z,zoomOnPinch:P,panOnScroll:T,panOnScrollSpeed:E,panOnScrollMode:J,zoomOnDoubleClick:Q,panOnDrag:H,onPaneClick:te,onPaneMouseEnter:le,onPaneMouseMove:ue,onPaneMouseLeave:de,onPaneScroll:ce,onPaneContextMenu:fe,paneClickDistance:se,nodeClickDistance:pe,onEdgeContextMenu:ve,onEdgeMouseEnter:je,onEdgeMouseMove:Ve,onEdgeMouseLeave:at,reconnectRadius:Je,onReconnect:jt,onReconnectStart:De,onReconnectEnd:Ce,noDragClassName:Jt,noWheelClassName:Bn,noPanClassName:Xt,disableKeyboardA11y:_n,nodeExtent:Nr,rfId:ur,viewport:oe,onViewportChange:we}){return vS(e),vS(t),B5(),T5(n),L5(oe),o.jsx(n5,{onPaneClick:te,onPaneMouseEnter:le,onPaneMouseMove:ue,onPaneMouseLeave:de,onPaneContextMenu:fe,onPaneScroll:ce,paneClickDistance:se,deleteKeyCode:R,selectionKeyCode:v,selectionOnDrag:w,selectionMode:N,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:S,zoomActivationKeyCode:A,elementsSelectable:V,zoomOnScroll:z,zoomOnPinch:P,zoomOnDoubleClick:Q,panOnScroll:T,panOnScrollSpeed:E,panOnScrollMode:J,panOnDrag:H,defaultViewport:D,translateExtent:O,minZoom:K,maxZoom:$,onSelectionContextMenu:f,preventScrolling:L,noDragClassName:Jt,noWheelClassName:Bn,noPanClassName:Xt,disableKeyboardA11y:_n,onViewportChange:we,isControlledViewport:!!oe,children:o.jsxs(I5,{children:[o.jsx(P5,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:jt,onReconnectStart:De,onReconnectEnd:Ce,onlyRenderVisibleElements:M,onEdgeContextMenu:ve,onEdgeMouseEnter:je,onEdgeMouseMove:Ve,onEdgeMouseLeave:at,reconnectRadius:Je,defaultMarkerColor:I,noPanClassName:Xt,disableKeyboardA11y:_n,rfId:ur}),o.jsx(F5,{style:k,type:g,component:b,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(d5,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,nodeClickDistance:pe,onlyRenderVisibleElements:M,noPanClassName:Xt,noDragClassName:Jt,disableKeyboardA11y:_n,nodeExtent:Nr,rfId:ur}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}AP.displayName="GraphView";const H5=m.memo(AP),bS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:d=2,nodeOrigin:u,nodeExtent:f,zIndexMode:p="basic"}={})=>{const h=new Map,g=new Map,k=new Map,b=new Map,y=r??t??[],v=n??e??[],w=u??[0,0],N=f??Md;z_(k,b,y);const{nodesInitialized:C}=ew(v,h,g,{nodeOrigin:w,nodeExtent:N,zIndexMode:p});let S=[0,0,1];if(a&&s&&i){const A=uf(h,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:R,y:M,zoom:V}=$v(A,s,i,c,d,(l==null?void 0:l.padding)??.1);S=[R,M,V]}return{rfId:"1",width:s??0,height:i??0,transform:S,nodes:v,nodesInitialized:C,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:b,connectionLookup:k,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:d,translateExtent:Md,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Lc.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:{...k_},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:KF,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:b_,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},U5=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:p})=>lz((h,g)=>{async function k(){const{nodeLookup:b,panZoom:y,fitViewOptions:v,fitViewResolver:w,width:N,height:C,minZoom:S,maxZoom:A}=g();y&&(await WF({nodes:b,width:N,height:C,panZoom:y,minZoom:S,maxZoom:A},v),w==null||w.resolve(!0),h({fitViewResolver:null}))}return{...bS({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:p}),setNodes:b=>{const{nodeLookup:y,parentLookup:v,nodeOrigin:w,elevateNodesOnSelect:N,fitViewQueued:C,zIndexMode:S,nodesSelectionActive:A}=g(),{nodesInitialized:R,hasSelectedNodes:M}=ew(b,y,v,{nodeOrigin:w,nodeExtent:f,elevateNodesOnSelect:N,checkEquality:!0,zIndexMode:S}),V=A&&M;C&&R?(k(),h({nodes:b,nodesInitialized:R,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:V})):h({nodes:b,nodesInitialized:R,nodesSelectionActive:V})},setEdges:b=>{const{connectionLookup:y,edgeLookup:v}=g();z_(y,v,b),h({edges:b})},setDefaultNodesAndEdges:(b,y)=>{if(b){const{setNodes:v}=g();v(b),h({hasDefaultNodes:!0})}if(y){const{setEdges:v}=g();v(y),h({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:w,domNode:N,nodeOrigin:C,nodeExtent:S,debug:A,fitViewQueued:R,zIndexMode:M}=g(),{changes:V,updatedInternals:D}=p3(b,v,w,N,C,S,M);D&&(c3(v,w,{nodeOrigin:C,nodeExtent:S,zIndexMode:M}),R?(k(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(V==null?void 0:V.length)>0&&(A&&console.log("React Flow: trigger node changes",V),y==null||y(V)))},updateNodePositions:(b,y=!1)=>{const v=[];let w=[];const{nodeLookup:N,triggerNodeChanges:C,connection:S,updateConnection:A,onNodesChangeMiddlewareMap:R}=g();for(const[M,V]of b){const D=N.get(M),O=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(V!=null&&V.position)),K={id:M,type:"position",position:O?{x:Math.max(0,V.position.x),y:Math.max(0,V.position.y)}:V.position,dragging:y};if(D&&S.inProgress&&S.fromNode.id===D.id){const $=ml(D,S.fromHandle,We.Left,!0);A({...S,from:$})}O&&D.parentId&&v.push({id:M,parentId:D.parentId,rect:{...V.internals.positionAbsolute,width:V.measured.width??0,height:V.measured.height??0}}),w.push(K)}if(v.length>0){const{parentLookup:M,nodeOrigin:V}=g(),D=Uv(v,N,M,V);w.push(...D)}for(const M of R.values())w=M(w);C(w)},triggerNodeChanges:b=>{const{onNodesChange:y,setNodes:v,nodes:w,hasDefaultNodes:N,debug:C}=g();if(b!=null&&b.length){if(N){const S=Wv(b,w);v(S)}C&&console.log("React Flow: trigger node changes",b),y==null||y(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:y,setEdges:v,edges:w,hasDefaultEdges:N,debug:C}=g();if(b!=null&&b.length){if(N){const S=oP(b,w);v(S)}C&&console.log("React Flow: trigger edge changes",b),y==null||y(b)}},addSelectedNodes:b=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:C}=g();if(y){const S=b.map(A=>Ga(A,!0));N(S);return}N(cc(w,new Set([...b]),!0)),C(cc(v))},addSelectedEdges:b=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:C}=g();if(y){const S=b.map(A=>Ga(A,!0));C(S);return}C(cc(v,new Set([...b]))),N(cc(w,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:y}={})=>{const{edges:v,nodes:w,nodeLookup:N,triggerNodeChanges:C,triggerEdgeChanges:S}=g(),A=b||w,R=y||v,M=[];for(const D of A){if(!D.selected)continue;const O=N.get(D.id);O&&(O.selected=!1),M.push(Ga(D.id,!1))}const V=[];for(const D of R)D.selected&&V.push(Ga(D.id,!1));C(M),S(V)},setMinZoom:b=>{const{panZoom:y,maxZoom:v}=g();y==null||y.setScaleExtent([b,v]),h({minZoom:b})},setMaxZoom:b=>{const{panZoom:y,minZoom:v}=g();y==null||y.setScaleExtent([v,b]),h({maxZoom:b})},setTranslateExtent:b=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(b),h({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:y,triggerNodeChanges:v,triggerEdgeChanges:w,elementsSelectable:N}=g();if(!N)return;const C=y.reduce((A,R)=>R.selected?[...A,Ga(R.id,!1)]:A,[]),S=b.reduce((A,R)=>R.selected?[...A,Ga(R.id,!1)]:A,[]);v(C),w(S)},setNodeExtent:b=>{const{nodes:y,nodeLookup:v,parentLookup:w,nodeOrigin:N,elevateNodesOnSelect:C,nodeExtent:S,zIndexMode:A}=g();b[0][0]===S[0][0]&&b[0][1]===S[0][1]&&b[1][0]===S[1][0]&&b[1][1]===S[1][1]||(ew(y,v,w,{nodeOrigin:N,nodeExtent:b,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:A}),h({nodeExtent:b}))},panBy:b=>{const{transform:y,width:v,height:w,panZoom:N,translateExtent:C}=g();return h3({delta:b,panZoom:N,transform:y,translateExtent:C,width:v,height:w})},setCenter:async(b,y,v)=>{const{width:w,height:N,maxZoom:C,panZoom:S}=g();if(!S)return Promise.resolve(!1);const A=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:C;return await S.setViewport({x:w/2-b*A,y:N/2-y*A,zoom:A},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...k_}})},updateConnection:b=>{h({connection:b})},reset:()=>h({...bS()})}},Object.is);function Kv({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:d,nodeOrigin:u,nodeExtent:f,zIndexMode:p,children:h}){const[g]=m.useState(()=>U5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:d,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:u,nodeExtent:f,zIndexMode:p}));return o.jsx(cz,{value:g,children:o.jsx(Iz,{children:h})})}function W5({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:u,nodeOrigin:f,nodeExtent:p,zIndexMode:h}){return m.useContext(Fm)?o.jsx(o.Fragment,{children:e}):o.jsx(Kv,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:d,initialMaxZoom:u,nodeOrigin:f,nodeExtent:p,zIndexMode:h,children:e})}const V5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function K5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:u,onMoveStart:f,onMoveEnd:p,onConnect:h,onConnectStart:g,onConnectEnd:k,onClickConnectStart:b,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:S,onNodeDragStart:A,onNodeDrag:R,onNodeDragStop:M,onNodesDelete:V,onEdgesDelete:D,onDelete:O,onSelectionChange:K,onSelectionDragStart:$,onSelectionDrag:L,onSelectionDragStop:I,onSelectionContextMenu:z,onSelectionStart:P,onSelectionEnd:T,onBeforeDelete:E,connectionMode:J,connectionLineType:Q=ea.Bezier,connectionLineStyle:H,connectionLineComponent:te,connectionLineContainerStyle:le,deleteKeyCode:ue="Backspace",selectionKeyCode:de="Shift",selectionOnDrag:ce=!1,selectionMode:fe=$d.Full,panActivationKeyCode:se="Space",multiSelectionKeyCode:pe=Fd()?"Meta":"Control",zoomActivationKeyCode:ve=Fd()?"Meta":"Control",snapToGrid:je,snapGrid:Ve,onlyRenderVisibleElements:at=!1,selectNodesOnDrag:Je,nodesDraggable:jt,autoPanOnNodeFocus:De,nodesConnectable:Ce,nodesFocusable:Jt,nodeOrigin:Bn=sP,edgesFocusable:Xt,edgesReconnectable:_n,elementsSelectable:Nr=!0,defaultViewport:ur=kz,minZoom:oe=.5,maxZoom:we=2,translateExtent:Ge=Md,preventScrolling:st=!0,nodeExtent:et,defaultMarkerColor:It="#b1b1b7",zoomOnScroll:On=!0,zoomOnPinch:Mt=!0,panOnScroll:Mn=!1,panOnScrollSpeed:Qt=.5,panOnScrollMode:Zt=sl.Free,zoomOnDoubleClick:sr=!0,panOnDrag:he=!0,onPaneClick:Te,onPaneMouseEnter:rn,onPaneMouseMove:lt,onPaneMouseLeave:vn,onPaneScroll:Vs,onPaneContextMenu:Pn,paneClickDistance:jr=1,nodeClickDistance:dr=0,children:Hr,onReconnect:Ks,onReconnectStart:Po,onReconnectEnd:Cr,onEdgeContextMenu:Xn,onEdgeDoubleClick:Ps,onEdgeMouseEnter:Xe,onEdgeMouseMove:Vt,onEdgeMouseLeave:sn,reconnectRadius:us=10,onNodesChange:Ke,onEdgesChange:Hn,noDragClassName:Re="nodrag",noWheelClassName:Ft="nowheel",noPanClassName:As="nopan",fitView:ft,fitViewOptions:Ur,connectOnClick:fr,attributionPosition:on,proOptions:ds,defaultEdgeOptions:Un,elevateNodesOnSelect:fs=!0,elevateEdgesOnSelect:pr=!1,disableKeyboardA11y:qs=!1,autoPanOnConnect:Er,autoPanOnNodeDrag:ps,autoPanSpeed:hs,connectionRadius:q,isValidConnection:ke,onError:Me,style:qe,id:vt,nodeDragThreshold:An,connectionDragThreshold:$t,viewport:bt,onViewportChange:en,width:Ys,height:Or,colorMode:Gs="light",debug:Js,onScroll:hr,ariaLabelConfig:Pa,zIndexMode:ir="basic",...Aa},Wr){const Ao=vt||"1",it=Cz(Gs),Qn=m.useCallback(Qi=>{Qi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),hr==null||hr(Qi)},[hr]);return o.jsx("div",{"data-testid":"rf__wrapper",...Aa,onScroll:Qn,style:{...qe,...V5},ref:Wr,className:Jn(["react-flow",s,it]),id:vt,role:"application",children:o.jsxs(W5,{nodes:e,edges:t,width:Ys,height:Or,fitView:ft,fitViewOptions:Ur,minZoom:oe,maxZoom:we,nodeOrigin:Bn,nodeExtent:et,zIndexMode:ir,children:[o.jsx(jz,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:k,onClickConnectStart:b,onClickConnectEnd:y,nodesDraggable:jt,autoPanOnNodeFocus:De,nodesConnectable:Ce,nodesFocusable:Jt,edgesFocusable:Xt,edgesReconnectable:_n,elementsSelectable:Nr,elevateNodesOnSelect:fs,elevateEdgesOnSelect:pr,minZoom:oe,maxZoom:we,nodeExtent:et,onNodesChange:Ke,onEdgesChange:Hn,snapToGrid:je,snapGrid:Ve,connectionMode:J,translateExtent:Ge,connectOnClick:fr,defaultEdgeOptions:Un,fitView:ft,fitViewOptions:Ur,onNodesDelete:V,onEdgesDelete:D,onDelete:O,onNodeDragStart:A,onNodeDrag:R,onNodeDragStop:M,onSelectionDrag:L,onSelectionDragStart:$,onSelectionDragStop:I,onMove:u,onMoveStart:f,onMoveEnd:p,noPanClassName:As,nodeOrigin:Bn,rfId:Ao,autoPanOnConnect:Er,autoPanOnNodeDrag:ps,autoPanSpeed:hs,onError:Me,connectionRadius:q,isValidConnection:ke,selectNodesOnDrag:Je,nodeDragThreshold:An,connectionDragThreshold:$t,onBeforeDelete:E,debug:Js,ariaLabelConfig:Pa,zIndexMode:ir}),o.jsx(H5,{onInit:d,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:N,onNodeContextMenu:C,onNodeDoubleClick:S,nodeTypes:i,edgeTypes:a,connectionLineType:Q,connectionLineStyle:H,connectionLineComponent:te,connectionLineContainerStyle:le,selectionKeyCode:de,selectionOnDrag:ce,selectionMode:fe,deleteKeyCode:ue,multiSelectionKeyCode:pe,panActivationKeyCode:se,zoomActivationKeyCode:ve,onlyRenderVisibleElements:at,defaultViewport:ur,translateExtent:Ge,minZoom:oe,maxZoom:we,preventScrolling:st,zoomOnScroll:On,zoomOnPinch:Mt,zoomOnDoubleClick:sr,panOnScroll:Mn,panOnScrollSpeed:Qt,panOnScrollMode:Zt,panOnDrag:he,onPaneClick:Te,onPaneMouseEnter:rn,onPaneMouseMove:lt,onPaneMouseLeave:vn,onPaneScroll:Vs,onPaneContextMenu:Pn,paneClickDistance:jr,nodeClickDistance:dr,onSelectionContextMenu:z,onSelectionStart:P,onSelectionEnd:T,onReconnect:Ks,onReconnectStart:Po,onReconnectEnd:Cr,onEdgeContextMenu:Xn,onEdgeDoubleClick:Ps,onEdgeMouseEnter:Xe,onEdgeMouseMove:Vt,onEdgeMouseLeave:sn,reconnectRadius:us,defaultMarkerColor:It,noDragClassName:Re,noWheelClassName:Ft,noPanClassName:As,rfId:Ao,disableKeyboardA11y:qs,nodeExtent:et,viewport:bt,onViewportChange:en}),o.jsx(bz,{onSelectionChange:K}),Hr,o.jsx(gz,{proOptions:ds,position:on}),o.jsx(mz,{rfId:Ao,disableKeyboardA11y:qs})]})})}var IP=aP(K5);function TP(){const e=wn();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 RP(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>Wv(s,i)),[]);return[t,n,r]}function LP(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>oP(s,i)),[]);return[t,n,r]}function q5({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:Jn(["react-flow__background-pattern",n,r])})}function Y5({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Jn(["react-flow__background-pattern","dots",t])})}var ha;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ha||(ha={}));const G5={[ha.Dots]:1,[ha.Lines]:1,[ha.Cross]:6},J5=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function OP({id:e,variant:t=ha.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:c,className:d,patternClassName:u}){const f=m.useRef(null),{transform:p,patternId:h}=Tt(J5,Nn),g=r||G5[t],k=t===ha.Dots,b=t===ha.Cross,y=Array.isArray(n)?n:[n,n],v=[y[0]*p[2]||1,y[1]*p[2]||1],w=g*p[2],N=Array.isArray(i)?i:[i,i],C=b?[w,w]:v,S=[N[0]*p[2]||1+C[0]/2,N[1]*p[2]||1+C[1]/2],A=`${h}${e||""}`;return o.jsxs("svg",{className:Jn(["react-flow__background",d]),style:{...c,...zm,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:A,x:p[0]%v[0],y:p[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:k?o.jsx(Y5,{radius:w/2,className:u}):o.jsx(q5,{dimensions:C,lineWidth:s,variant:t,className:u})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}OP.displayName="Background";const MP=m.memo(OP);function X5(){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 Q5(){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 Z5(){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 e4(){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 t4(){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 bp({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Jn(["react-flow__controls-button",t]),...n,children:e})}const n4=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function $P({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:d,children:u,position:f="bottom-left",orientation:p="vertical","aria-label":h}){const g=wn(),{isInteractive:k,minZoomReached:b,maxZoomReached:y,ariaLabelConfig:v}=Tt(n4,Nn),{zoomIn:w,zoomOut:N,fitView:C}=bl(),S=()=>{w(),i==null||i()},A=()=>{N(),a==null||a()},R=()=>{C(s),l==null||l()},M=()=>{g.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),c==null||c(!k)},V=p==="horizontal"?"horizontal":"vertical";return o.jsxs(zc,{className:Jn(["react-flow__controls",V,d]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(bp,{onClick:S,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(X5,{})}),o.jsx(bp,{onClick:A,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:b,children:o.jsx(Q5,{})})]}),n&&o.jsx(bp,{className:"react-flow__controls-fitview",onClick:R,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:o.jsx(Z5,{})}),r&&o.jsx(bp,{className:"react-flow__controls-interactive",onClick:M,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:k?o.jsx(t4,{}):o.jsx(e4,{})}),u]})}$P.displayName="Controls";const r4=m.memo($P);function s4({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:d,borderRadius:u,shapeRendering:f,selected:p,onClick:h}){const{background:g,backgroundColor:k}=i||{},b=a||g||k;return o.jsx("rect",{className:Jn(["react-flow__minimap-node",{selected:p},d]),x:t,y:n,rx:u,ry:u,width:r,height:s,style:{fill:b,stroke:l,strokeWidth:c},shapeRendering:f,onClick:h?y=>h(y,e):void 0})}const i4=m.memo(s4),o4=e=>e.nodes.map(t=>t.id),cy=e=>e instanceof Function?e:()=>e;function a4({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=i4,onClick:a}){const l=Tt(o4,Nn),c=cy(t),d=cy(e),u=cy(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(p=>o.jsx(c4,{id:p,nodeColorFunc:c,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:f},p))})}function l4({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:d,x:u,y:f,width:p,height:h}=Tt(g=>{const k=g.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};const b=k.internals.userNode,{x:y,y:v}=k.internals.positionAbsolute,{width:w,height:N}=Eo(b);return{node:b,x:y,y:v,width:w,height:N}},Nn);return!d||d.hidden||!P_(d)?null:o.jsx(l,{x:u,y:f,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 c4=m.memo(l4);var u4=m.memo(a4);const d4=200,f4=150,p4=e=>!e.hidden,h4=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?__(uf(e.nodeLookup,{filter:p4}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},m4="react-flow__minimap-desc";function DP({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:d,maskStrokeColor:u,maskStrokeWidth:f,position:p="bottom-right",onClick:h,onNodeClick:g,pannable:k=!1,zoomable:b=!1,ariaLabel:y,inversePan:v,zoomStep:w=1,offsetScale:N=5}){const C=wn(),S=m.useRef(null),{boundingRect:A,viewBB:R,rfId:M,panZoom:V,translateExtent:D,flowWidth:O,flowHeight:K,ariaLabelConfig:$}=Tt(h4,Nn),L=(e==null?void 0:e.width)??d4,I=(e==null?void 0:e.height)??f4,z=A.width/L,P=A.height/I,T=Math.max(z,P),E=T*L,J=T*I,Q=N*T,H=A.x-(E-A.width)/2-Q,te=A.y-(J-A.height)/2-Q,le=E+Q*2,ue=J+Q*2,de=`${m4}-${M}`,ce=m.useRef(0),fe=m.useRef();ce.current=T,m.useEffect(()=>{if(S.current&&V)return fe.current=S3({domNode:S.current,panZoom:V,getTransform:()=>C.getState().transform,getViewScale:()=>ce.current}),()=>{var je;(je=fe.current)==null||je.destroy()}},[V]),m.useEffect(()=>{var je;(je=fe.current)==null||je.update({translateExtent:D,width:O,height:K,inversePan:v,pannable:k,zoomStep:w,zoomable:b})},[k,b,v,w,D,O,K]);const se=h?je=>{var Je;const[Ve,at]=((Je=fe.current)==null?void 0:Je.pointer(je))||[0,0];h(je,{x:Ve,y:at})}:void 0,pe=g?m.useCallback((je,Ve)=>{const at=C.getState().nodeLookup.get(Ve).internals.userNode;g(je,at)},[]):void 0,ve=y??$["minimap.ariaLabel"];return o.jsx(zc,{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 u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*T: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:Jn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:L,height:I,viewBox:`${H} ${te} ${le} ${ue}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":de,ref:S,onClick:se,children:[ve&&o.jsx("title",{id:de,children:ve}),o.jsx(u4,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-Q},${te-Q}h${le+Q*2}v${ue+Q*2}h${-le-Q*2}z
|
|
66
|
-
M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}DP.displayName="MiniMap";const g4=m.memo(DP),y4=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,x4={[Dc.Line]:"right",[Dc.Handle]:"bottom-right"};function w4({nodeId:e,position:t,variant:n=Dc.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:c=10,maxWidth:d=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:p,autoScale:h=!0,shouldResize:g,onResizeStart:k,onResize:b,onResizeEnd:y}){const v=dP(),w=typeof e=="string"?e:v,N=wn(),C=m.useRef(null),S=n===Dc.Handle,A=Tt(m.useCallback(y4(S&&h),[S,h]),Nn),R=m.useRef(null),M=t??x4[n];m.useEffect(()=>{if(!(!C.current||!w))return R.current||(R.current=$3({domNode:C.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:D,transform:O,snapGrid:K,snapToGrid:$,nodeOrigin:L,domNode:I}=N.getState();return{nodeLookup:D,transform:O,snapGrid:K,snapToGrid:$,nodeOrigin:L,paneDomNode:I}},onChange:(D,O)=>{const{triggerNodeChanges:K,nodeLookup:$,parentLookup:L,nodeOrigin:I}=N.getState(),z=[],P={x:D.x,y:D.y},T=$.get(w);if(T&&T.expandParent&&T.parentId){const E=T.origin??I,J=D.width??T.measured.width??0,Q=D.height??T.measured.height??0,H={id:T.id,parentId:T.parentId,rect:{width:J,height:Q,...A_({x:D.x??T.position.x,y:D.y??T.position.y},{width:J,height:Q},T.parentId,$,E)}},te=Uv([H],$,L,I);z.push(...te),P.x=D.x?Math.max(E[0]*J,D.x):void 0,P.y=D.y?Math.max(E[1]*Q,D.y):void 0}if(P.x!==void 0&&P.y!==void 0){const E={id:w,type:"position",position:{...P}};z.push(E)}if(D.width!==void 0&&D.height!==void 0){const J={id:w,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};z.push(J)}for(const E of O){const J={...E,type:"position"};z.push(J)}K(z)},onEnd:({width:D,height:O})=>{const K={id:w,type:"dimensions",resizing:!1,dimensions:{width:D,height:O}};N.getState().triggerNodeChanges([K])}})),R.current.update({controlPosition:M,boundaries:{minWidth:l,minHeight:c,maxWidth:d,maxHeight:u},keepAspectRatio:f,resizeDirection:p,onResizeStart:k,onResize:b,onResizeEnd:y,shouldResize:g}),()=>{var D;(D=R.current)==null||D.destroy()}},[M,l,c,d,u,f,k,b,y,g]);const V=M.split("-");return o.jsx("div",{className:Jn(["react-flow__resize-control","nodrag",...V,n,r]),ref:C,style:{...s,scale:A,...a&&{[S?"backgroundColor":"borderColor"]:a}},children:i})}const v4=m.memo(w4);function b4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const k4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,S4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,N4={};function kS(e,t){return(N4.jsx?S4:k4).test(e)}const j4=/[ \t\n\f\r]/g;function C4(e){return typeof e=="object"?e.type==="text"?SS(e.value):!1:SS(e)}function SS(e){return e.replace(j4,"")===""}let pf=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};pf.prototype.normal={};pf.prototype.property={};pf.prototype.space=void 0;function FP(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new pf(n,r,t)}function sw(e){return e.toLowerCase()}class cs{constructor(t,n){this.attribute=n,this.property=t}}cs.prototype.attribute="";cs.prototype.booleanish=!1;cs.prototype.boolean=!1;cs.prototype.commaOrSpaceSeparated=!1;cs.prototype.commaSeparated=!1;cs.prototype.defined=!1;cs.prototype.mustUseProperty=!1;cs.prototype.number=!1;cs.prototype.overloadedBoolean=!1;cs.prototype.property="";cs.prototype.spaceSeparated=!1;cs.prototype.space=void 0;let E4=0;const xt=kl(),qn=kl(),iw=kl(),Ne=kl(),un=kl(),kc=kl(),gs=kl();function kl(){return 2**++E4}const ow=Object.freeze(Object.defineProperty({__proto__:null,boolean:xt,booleanish:qn,commaOrSpaceSeparated:gs,commaSeparated:kc,number:Ne,overloadedBoolean:iw,spaceSeparated:un},Symbol.toStringTag,{value:"Module"})),uy=Object.keys(ow);class qv extends cs{constructor(t,n,r,s){let i=-1;if(super(t,n),NS(this,"space",s),typeof r=="number")for(;++i<uy.length;){const a=uy[i];NS(this,uy[i],(r&ow[a])===ow[a])}}}qv.prototype.defined=!0;function NS(e,t,n){n&&(e[t]=n)}function Gc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new qv(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[sw(r)]=r,n[sw(i.attribute)]=r}return new pf(t,n,e.space)}const zP=Gc({properties:{ariaActiveDescendant:null,ariaAtomic:qn,ariaAutoComplete:null,ariaBusy:qn,ariaChecked:qn,ariaColCount:Ne,ariaColIndex:Ne,ariaColSpan:Ne,ariaControls:un,ariaCurrent:null,ariaDescribedBy:un,ariaDetails:null,ariaDisabled:qn,ariaDropEffect:un,ariaErrorMessage:null,ariaExpanded:qn,ariaFlowTo:un,ariaGrabbed:qn,ariaHasPopup:null,ariaHidden:qn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:un,ariaLevel:Ne,ariaLive:null,ariaModal:qn,ariaMultiLine:qn,ariaMultiSelectable:qn,ariaOrientation:null,ariaOwns:un,ariaPlaceholder:null,ariaPosInSet:Ne,ariaPressed:qn,ariaReadOnly:qn,ariaRelevant:null,ariaRequired:qn,ariaRoleDescription:un,ariaRowCount:Ne,ariaRowIndex:Ne,ariaRowSpan:Ne,ariaSelected:qn,ariaSetSize:Ne,ariaSort:null,ariaValueMax:Ne,ariaValueMin:Ne,ariaValueNow:Ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function BP(e,t){return t in e?e[t]:t}function HP(e,t){return BP(e,t.toLowerCase())}const _4=Gc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kc,acceptCharset:un,accessKey:un,action:null,allow:null,allowFullScreen:xt,allowPaymentRequest:xt,allowUserMedia:xt,alt:null,as:null,async:xt,autoCapitalize:null,autoComplete:un,autoFocus:xt,autoPlay:xt,blocking:un,capture:null,charSet:null,checked:xt,cite:null,className:un,cols:Ne,colSpan:null,content:null,contentEditable:qn,controls:xt,controlsList:un,coords:Ne|kc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xt,defer:xt,dir:null,dirName:null,disabled:xt,download:iw,draggable:qn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xt,formTarget:null,headers:un,height:Ne,hidden:iw,high:Ne,href:null,hrefLang:null,htmlFor:un,httpEquiv:un,id:null,imageSizes:null,imageSrcSet:null,inert:xt,inputMode:null,integrity:null,is:null,isMap:xt,itemId:null,itemProp:un,itemRef:un,itemScope:xt,itemType:un,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xt,low:Ne,manifest:null,max:null,maxLength:Ne,media:null,method:null,min:null,minLength:Ne,multiple:xt,muted:xt,name:null,nonce:null,noModule:xt,noValidate:xt,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:xt,optimum:Ne,pattern:null,ping:un,placeholder:null,playsInline:xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xt,referrerPolicy:null,rel:un,required:xt,reversed:xt,rows:Ne,rowSpan:Ne,sandbox:un,scope:null,scoped:xt,seamless:xt,selected:xt,shadowRootClonable:xt,shadowRootDelegatesFocus:xt,shadowRootMode:null,shape:null,size:Ne,sizes:null,slot:null,span:Ne,spellCheck:qn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ne,step:null,style:null,tabIndex:Ne,target:null,title:null,translate:null,type:null,typeMustMatch:xt,useMap:null,value:qn,width:Ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:un,axis:null,background:null,bgColor:null,border:Ne,borderColor:null,bottomMargin:Ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xt,declare:xt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ne,leftMargin:Ne,link:null,longDesc:null,lowSrc:null,marginHeight:Ne,marginWidth:Ne,noResize:xt,noHref:xt,noShade:xt,noWrap:xt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ne,rules:null,scheme:null,scrolling:qn,standby:null,summary:null,text:null,topMargin:Ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xt,disableRemotePlayback:xt,prefix:null,property:null,results:Ne,security:null,unselectable:null},space:"html",transform:HP}),P4=Gc({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:gs,accentHeight:Ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ne,amplitude:Ne,arabicForm:null,ascent:Ne,attributeName:null,attributeType:null,azimuth:Ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ne,by:null,calcMode:null,capHeight:Ne,className:un,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:Ne,diffuseConstant:Ne,direction:null,display:null,dur:null,divisor:Ne,dominantBaseline:null,download:xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ne,enableBackground:null,end:null,event:null,exponent:Ne,externalResourcesRequired:null,fill:null,fillOpacity:Ne,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:kc,g2:kc,glyphName:kc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ne,horizOriginX:Ne,horizOriginY:Ne,id:null,ideographic:Ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ne,k:Ne,k1:Ne,k2:Ne,k3:Ne,k4:Ne,kernelMatrix:gs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ne,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:Ne,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:Ne,overlineThickness:Ne,paintOrder:null,panose1:null,path:null,pathLength:Ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:un,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ne,pointsAtY:Ne,pointsAtZ:Ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gs,rev:gs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gs,requiredFeatures:gs,requiredFonts:gs,requiredFormats:gs,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:Ne,specularExponent:Ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ne,strikethroughThickness:Ne,string:null,stroke:null,strokeDashArray:gs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ne,strokeOpacity:Ne,strokeWidth:null,style:null,surfaceScale:Ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gs,tabIndex:Ne,tableValues:null,target:null,targetX:Ne,targetY:Ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ne,underlineThickness:Ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ne,values:null,vAlphabetic:Ne,vMathematical:Ne,vectorEffect:null,vHanging:Ne,vIdeographic:Ne,version:null,vertAdvY:Ne,vertOriginX:Ne,vertOriginY:Ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:BP}),UP=Gc({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()}}),WP=Gc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:HP}),VP=Gc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),A4={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"},I4=/[A-Z]/g,jS=/-[a-z]/g,T4=/^data[-\w.:]+$/i;function R4(e,t){const n=sw(t);let r=t,s=cs;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&T4.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(jS,O4);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!jS.test(i)){let a=i.replace(I4,L4);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=qv}return new s(r,t)}function L4(e){return"-"+e.toLowerCase()}function O4(e){return e.charAt(1).toUpperCase()}const M4=FP([zP,_4,UP,WP,VP],"html"),Yv=FP([zP,P4,UP,WP,VP],"svg");function $4(e){return e.join(" ").trim()}var Gv={},CS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,D4=/\n/g,F4=/^\s*/,z4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,B4=/^:\s*/,H4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,U4=/^[;\s]*/,W4=/^\s+|\s+$/g,V4=`
|
|
67
|
-
`,ES="/",_S="*",Ja="",K4="comment",q4="declaration";function Y4(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 k=g.match(D4);k&&(n+=k.length);var b=g.lastIndexOf(V4);r=~b?g.length-b:r+g.length}function i(){var g={line:n,column:r};return function(k){return k.position=new a(g),d(),k}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(g){var k=new Error(t.source+":"+n+":"+r+": "+g);if(k.reason=g,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function c(g){var k=g.exec(e);if(k){var b=k[0];return s(b),e=e.slice(b.length),k}}function d(){c(F4)}function u(g){var k;for(g=g||[];k=f();)k!==!1&&g.push(k);return g}function f(){var g=i();if(!(ES!=e.charAt(0)||_S!=e.charAt(1))){for(var k=2;Ja!=e.charAt(k)&&(_S!=e.charAt(k)||ES!=e.charAt(k+1));)++k;if(k+=2,Ja===e.charAt(k-1))return l("End of comment missing");var b=e.slice(2,k-2);return r+=2,s(b),e=e.slice(k),r+=2,g({type:K4,comment:b})}}function p(){var g=i(),k=c(z4);if(k){if(f(),!c(B4))return l("property missing ':'");var b=c(H4),y=g({type:q4,property:PS(k[0].replace(CS,Ja)),value:b?PS(b[0].replace(CS,Ja)):Ja});return c(U4),y}}function h(){var g=[];u(g);for(var k;k=p();)k!==!1&&(g.push(k),u(g));return g}return d(),h()}function PS(e){return e?e.replace(W4,Ja):Ja}var G4=Y4,J4=hd&&hd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.default=Q4;const X4=J4(G4);function Q4(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,X4.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 Hm={};Object.defineProperty(Hm,"__esModule",{value:!0});Hm.camelCase=void 0;var Z4=/^--[a-zA-Z0-9_-]+$/,eB=/-([a-z])/g,tB=/^[^-]+$/,nB=/^-(webkit|moz|ms|o|khtml)-/,rB=/^-(ms)-/,sB=function(e){return!e||tB.test(e)||Z4.test(e)},iB=function(e,t){return t.toUpperCase()},AS=function(e,t){return"".concat(t,"-")},oB=function(e,t){return t===void 0&&(t={}),sB(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(rB,AS):e=e.replace(nB,AS),e.replace(eB,iB))};Hm.camelCase=oB;var aB=hd&&hd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},lB=aB(Gv),cB=Hm;function aw(e,t){var n={};return!e||typeof e!="string"||(0,lB.default)(e,function(r,s){r&&s&&(n[(0,cB.camelCase)(r,t)]=s)}),n}aw.default=aw;var uB=aw;const dB=Na(uB),KP=qP("end"),Jv=qP("start");function qP(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 fB(e){const t=Jv(e),n=KP(e);if(t&&n)return{start:t,end:n}}function ad(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?IS(e.position):"start"in e||"end"in e?IS(e):"line"in e||"column"in e?lw(e):""}function lw(e){return TS(e&&e.line)+":"+TS(e&&e.column)}function IS(e){return lw(e&&e.start)+"-"+lw(e&&e.end)}function TS(e){return e&&typeof e=="number"?e:1}class Rr 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=ad(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}}Rr.prototype.file="";Rr.prototype.name="";Rr.prototype.reason="";Rr.prototype.message="";Rr.prototype.stack="";Rr.prototype.column=void 0;Rr.prototype.line=void 0;Rr.prototype.ancestors=void 0;Rr.prototype.cause=void 0;Rr.prototype.fatal=void 0;Rr.prototype.place=void 0;Rr.prototype.ruleId=void 0;Rr.prototype.source=void 0;const Xv={}.hasOwnProperty,pB=new Map,hB=/[A-Z]/g,mB=new Set(["table","tbody","thead","tfoot","tr"]),gB=new Set(["td","th"]),YP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yB(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=jB(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=NB(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"?Yv:M4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=GP(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function GP(e,t,n){if(t.type==="element")return xB(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return wB(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return bB(e,t,n);if(t.type==="mdxjsEsm")return vB(e,t);if(t.type==="root")return kB(e,t,n);if(t.type==="text")return SB(e,t)}function xB(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Yv,e.schema=s),e.ancestors.push(t);const i=XP(e,t.tagName,!1),a=CB(e,t);let l=Zv(e,t);return mB.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!C4(c):!0})),JP(e,a,i,t),Qv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function wB(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)}Hd(e,t.position)}function vB(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Hd(e,t.position)}function bB(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Yv,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:XP(e,t.name,!0),a=EB(e,t),l=Zv(e,t);return JP(e,a,i,t),Qv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function kB(e,t,n){const r={};return Qv(r,Zv(e,t)),e.create(t,e.Fragment,r,n)}function SB(e,t){return t.value}function JP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Qv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function NB(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 jB(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=Jv(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 CB(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Xv.call(t.properties,s)){const i=_B(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&gB.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 EB(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 Hd(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 Hd(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Zv(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:pB;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=GP(e,i,a);l!==void 0&&n.push(l)}return n}function _B(e,t,n){const r=R4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?b4(n):$4(n)),r.property==="style"){let s=typeof n=="object"?n:PB(e,String(n));return e.stylePropertyNameCase==="css"&&(s=AB(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?A4[r.property]||r.property:r.attribute,n]}}function PB(e,t){try{return dB(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Rr("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=YP+"#cannot-parse-style-attribute",s}}function XP(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=kS(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=kS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Xv.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Hd(e)}function Hd(e,t){const n=new Rr("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=YP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function AB(e){const t={};let n;for(n in e)Xv.call(e,n)&&(t[IB(n)]=e[n]);return t}function IB(e){let t=e.replace(hB,TB);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function TB(e){return"-"+e.toLowerCase()}const dy={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"]},RB={};function LB(e,t){const n=RB,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return QP(e,r,s)}function QP(e,t,n){if(OB(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 RS(e.children,t,n)}return Array.isArray(e)?RS(e,t,n):""}function RS(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=QP(e[s],t,n);return r.join("")}function OB(e){return!!(e&&typeof e=="object")}const LS=document.createElement("i");function eb(e){const t="&"+e+";";LS.innerHTML=t;const n=LS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Gi(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 Fs(e,t){return e.length>0?(Gi(e,e.length,0,t),e):t}const OS={}.hasOwnProperty;function MB(e){const t={};let n=-1;for(;++n<e.length;)$B(t,e[n]);return t}function $B(e,t){let n;for(n in t){const s=(OS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){OS.call(s,a)||(s[a]=[]);const l=i[a];DB(s[a],Array.isArray(l)?l:l?[l]:[])}}}function DB(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Gi(e,0,0,r)}function ZP(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 Sc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zi=_a(/[A-Za-z]/),ks=_a(/[\dA-Za-z]/),FB=_a(/[#-'*+\--9=?A-Z^-~]/);function cw(e){return e!==null&&(e<32||e===127)}const uw=_a(/\d/),zB=_a(/[\dA-Fa-f]/),BB=_a(/[!-/:-@[-`{-~]/);function ot(e){return e!==null&&e<-2}function as(e){return e!==null&&(e<0||e===32)}function Wt(e){return e===-2||e===-1||e===32}const HB=_a(new RegExp("\\p{P}|\\p{S}","u")),UB=_a(/\s/);function _a(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Jc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&ks(e.charCodeAt(n+1))&&ks(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 fn(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Wt(c)?(e.enter(n),l(c)):t(c)}function l(c){return Wt(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const WB={tokenize:VB};function VB(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"),fn(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 ot(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const KB={tokenize:qB},MS={tokenize:YB};function qB(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&&v();const N=t.events.length;let C=N,S;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){S=t.events[C][1].end;break}y(r);let A=N;for(;A<t.events.length;)t.events[A][1].end={...S},A++;return Gi(t.events,C+1,0,t.events.slice(N)),t.events.length=A,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(MS,u,f)(w)}function u(w){return s&&v(),y(r),p(w)}function f(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(MS,h,g)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function g(w){if(w===null){s&&v(),y(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),k(w)}function k(w){if(w===null){b(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return ot(w)?(e.consume(w),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),k)}function b(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 S=s.events.length;for(;S--;)if(s.events[S][1].start.offset<a&&(!s.events[S][1].end||s.events[S][1].end.offset>a))return;const A=t.events.length;let R=A,M,V;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(M){V=t.events[R][1].end;break}M=!0}for(y(r),S=A;S<t.events.length;)t.events[S][1].end={...V},S++;Gi(t.events,R+1,0,t.events.slice(A)),t.events.length=S}}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 v(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function YB(e,t,n){return fn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $S(e){if(e===null||as(e)||UB(e))return 1;if(HB(e))return 2}function tb(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 dw={name:"attention",resolveAll:GB,tokenize:JB};function GB(e,t){let n=-1,r,s,i,a,l,c,d,u;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 f={...e[r][1].end},p={...e[n][1].start};DS(f,-c),DS(p,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,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=Fs(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Fs(d,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),d=Fs(d,tb(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Fs(d,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,d=Fs(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Gi(e,r-1,n-r+3,d),n=r+d.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function JB(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=$S(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"),u=$S(c),f=!u||u===2&&s||n.includes(c),p=!s||s===2&&u||n.includes(r);return d._open=!!(i===42?f:f&&(s||!p)),d._close=!!(i===42?p:p&&(u||!f)),t(c)}}function DS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const XB={name:"autolink",tokenize:QB};function QB(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 zi(h)?(e.consume(h),a):h===64?n(h):d(h)}function a(h){return h===43||h===45||h===46||ks(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||ks(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||cw(h)?n(h):(e.consume(h),c)}function d(h){return h===64?(e.consume(h),u):FB(h)?(e.consume(h),d):n(h)}function u(h){return ks(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,u):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||ks(h))&&r++<63){const g=h===45?p:f;return e.consume(h),g}return n(h)}}const Um={partial:!0,tokenize:ZB};function ZB(e,t,n){return r;function r(i){return Wt(i)?fn(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||ot(i)?t(i):n(i)}}const eA={continuation:{tokenize:tH},exit:nH,name:"blockQuote",tokenize:eH};function eH(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 Wt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function tH(e,t,n){const r=this;return s;function s(a){return Wt(a)?fn(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(eA,t,n)(a)}}function nH(e){e.exit("blockQuote")}const tA={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 BB(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const nA={name:"characterReference",tokenize:sH};function sH(e,t,n){const r=this;let s=0,i,a;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,a=ks,u(f))}function d(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=zB,u):(e.enter("characterReferenceValue"),i=7,a=uw,u(f))}function u(f){if(f===59&&s){const p=e.exit("characterReferenceValue");return a===ks&&!eb(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&s++<i?(e.consume(f),u):n(f)}}const FS={partial:!0,tokenize:oH},zS={concrete:!0,name:"codeFenced",tokenize:iH};function iH(e,t,n){const r=this,s={partial:!0,tokenize:C};let i=0,a=0,l;return c;function c(S){return d(S)}function d(S){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(S)}function u(S){return S===l?(a++,e.consume(S),u):a<3?n(S):(e.exit("codeFencedFenceSequence"),Wt(S)?fn(e,f,"whitespace")(S):f(S))}function f(S){return S===null||ot(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(FS,k,N)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||ot(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(S)):Wt(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),fn(e,h,"whitespace")(S)):S===96&&S===l?n(S):(e.consume(S),p)}function h(S){return S===null||ot(S)?f(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||ot(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(S)):S===96&&S===l?n(S):(e.consume(S),g)}function k(S){return e.attempt(s,N,b)(S)}function b(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),y}function y(S){return i>0&&Wt(S)?fn(e,v,"linePrefix",i+1)(S):v(S)}function v(S){return S===null||ot(S)?e.check(FS,k,N)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||ot(S)?(e.exit("codeFlowValue"),v(S)):(e.consume(S),w)}function N(S){return e.exit("codeFenced"),t(S)}function C(S,A,R){let M=0;return V;function V(L){return S.enter("lineEnding"),S.consume(L),S.exit("lineEnding"),D}function D(L){return S.enter("codeFencedFence"),Wt(L)?fn(S,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):O(L)}function O(L){return L===l?(S.enter("codeFencedFenceSequence"),K(L)):R(L)}function K(L){return L===l?(M++,S.consume(L),K):M>=a?(S.exit("codeFencedFenceSequence"),Wt(L)?fn(S,$,"whitespace")(L):$(L)):R(L)}function $(L){return L===null||ot(L)?(S.exit("codeFencedFence"),A(L)):R(L)}}}function oH(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 fy={name:"codeIndented",tokenize:lH},aH={partial:!0,tokenize:cH};function lH(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),fn(e,i,"linePrefix",5)(d)}function i(d){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?c(d):ot(d)?e.attempt(aH,a,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||ot(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function cH(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ot(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):fn(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):ot(a)?s(a):n(a)}}const uH={name:"codeText",previous:fH,resolve:dH,tokenize:pH};function dH(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 fH(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function pH(e,t,n){let r=0,s,i;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(i=e.enter("codeTextSequence"),s=0,u(f)):ot(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(f))}function d(f){return f===null||f===32||f===96||ot(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),d)}function u(f){return f===96?(e.consume(f),s++,u):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",d(f))}}class hH{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&&Iu(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),Iu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Iu(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);Iu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Iu(this.left,n.reverse())}}}function Iu(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 rA(e){const t={};let n=-1,r,s,i,a,l,c,d;const u=new hH(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.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,mH(u,n)),n=t[n],d=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=u.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(u.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={...u.get(s)[1].start},l=u.slice(s,n),l.unshift(r),u.splice(s,n-s+1,l))}}return Gi(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function mH(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 u,f,p=-1,h=n,g=0,k=0;const b=[k];for(;h;){for(;e.get(++s)[1]!==h;);i.push(s),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),f&&a.defineSkip(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=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&&(k=p+1,b.push(k),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(a.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const y=l.slice(b[p],b[p+1]),v=i.pop();c.push([v,v+y.length-1]),e.splice(v,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 gH={resolve:xH,tokenize:wH},yH={partial:!0,tokenize:vH};function xH(e){return rA(e),e}function wH(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):ot(l)?e.check(yH,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 vH(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),fn(e,i,"linePrefix")}function i(a){if(a===null||ot(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 sA(e,t,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return f;function f(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||cw(y)?n(y):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),k(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||ot(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 k(y){return!u&&(y===null||y===41||as(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(y)):u<d&&y===40?(e.consume(y),u++,k):y===41?(e.consume(y),u--,k):y===null||y===32||y===40||cw(y)?n(y):(e.consume(y),y===92?b:k)}function b(y){return y===40||y===41||y===92?(e.consume(y),k):k(y)}}function iA(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),u}function u(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):ot(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||ot(h)||l++>999?(e.exit("chunkString"),u(h)):(e.consume(h),c||(c=!Wt(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function oA(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):ot(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),fn(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===a||p===null||ot(p)?(e.exit("chunkString"),d(p)):(e.consume(p),p===92?f:u)}function f(p){return p===a||p===92?(e.consume(p),u):u(p)}}function ld(e,t){let n;return r;function r(s){return ot(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Wt(s)?fn(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const bH={name:"definition",tokenize:SH},kH={partial:!0,tokenize:NH};function SH(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),a(h)}function a(h){return iA.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=Sc(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 as(h)?ld(e,d)(h):d(h)}function d(h){return sA(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return e.attempt(kH,f,f)(h)}function f(h){return Wt(h)?fn(e,p,"whitespace")(h):p(h)}function p(h){return h===null||ot(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function NH(e,t,n){return r;function r(l){return as(l)?ld(e,s)(l):n(l)}function s(l){return oA(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Wt(l)?fn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||ot(l)?t(l):n(l)}}const jH={name:"hardBreakEscape",tokenize:CH};function CH(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return ot(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const EH={name:"headingAtx",resolve:_H,tokenize:PH};function _H(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"},Gi(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function PH(e,t,n){let r=0;return s;function s(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&r++<6?(e.consume(u),a):u===null||as(u)?(e.exit("atxHeadingSequence"),l(u)):n(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||ot(u)?(e.exit("atxHeading"),t(u)):Wt(u)?fn(e,l,"whitespace")(u):(e.enter("atxHeadingText"),d(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),l(u))}function d(u){return u===null||u===35||as(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),d)}}const AH=["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"],BS=["pre","script","style","textarea"],IH={concrete:!0,name:"htmlFlow",resolveTo:LH,tokenize:OH},TH={partial:!0,tokenize:$H},RH={partial:!0,tokenize:MH};function LH(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 OH(e,t,n){const r=this;let s,i,a,l,c;return d;function d(H){return u(H)}function u(H){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(H),f}function f(H){return H===33?(e.consume(H),p):H===47?(e.consume(H),i=!0,k):H===63?(e.consume(H),s=3,r.interrupt?t:E):zi(H)?(e.consume(H),a=String.fromCharCode(H),b):n(H)}function p(H){return H===45?(e.consume(H),s=2,h):H===91?(e.consume(H),s=5,l=0,g):zi(H)?(e.consume(H),s=4,r.interrupt?t:E):n(H)}function h(H){return H===45?(e.consume(H),r.interrupt?t:E):n(H)}function g(H){const te="CDATA[";return H===te.charCodeAt(l++)?(e.consume(H),l===te.length?r.interrupt?t:O:g):n(H)}function k(H){return zi(H)?(e.consume(H),a=String.fromCharCode(H),b):n(H)}function b(H){if(H===null||H===47||H===62||as(H)){const te=H===47,le=a.toLowerCase();return!te&&!i&&BS.includes(le)?(s=1,r.interrupt?t(H):O(H)):AH.includes(a.toLowerCase())?(s=6,te?(e.consume(H),y):r.interrupt?t(H):O(H)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(H):i?v(H):w(H))}return H===45||ks(H)?(e.consume(H),a+=String.fromCharCode(H),b):n(H)}function y(H){return H===62?(e.consume(H),r.interrupt?t:O):n(H)}function v(H){return Wt(H)?(e.consume(H),v):V(H)}function w(H){return H===47?(e.consume(H),V):H===58||H===95||zi(H)?(e.consume(H),N):Wt(H)?(e.consume(H),w):V(H)}function N(H){return H===45||H===46||H===58||H===95||ks(H)?(e.consume(H),N):C(H)}function C(H){return H===61?(e.consume(H),S):Wt(H)?(e.consume(H),C):w(H)}function S(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(e.consume(H),c=H,A):Wt(H)?(e.consume(H),S):R(H)}function A(H){return H===c?(e.consume(H),c=null,M):H===null||ot(H)?n(H):(e.consume(H),A)}function R(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||as(H)?C(H):(e.consume(H),R)}function M(H){return H===47||H===62||Wt(H)?w(H):n(H)}function V(H){return H===62?(e.consume(H),D):n(H)}function D(H){return H===null||ot(H)?O(H):Wt(H)?(e.consume(H),D):n(H)}function O(H){return H===45&&s===2?(e.consume(H),I):H===60&&s===1?(e.consume(H),z):H===62&&s===4?(e.consume(H),J):H===63&&s===3?(e.consume(H),E):H===93&&s===5?(e.consume(H),T):ot(H)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(TH,Q,K)(H)):H===null||ot(H)?(e.exit("htmlFlowData"),K(H)):(e.consume(H),O)}function K(H){return e.check(RH,$,Q)(H)}function $(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),L}function L(H){return H===null||ot(H)?K(H):(e.enter("htmlFlowData"),O(H))}function I(H){return H===45?(e.consume(H),E):O(H)}function z(H){return H===47?(e.consume(H),a="",P):O(H)}function P(H){if(H===62){const te=a.toLowerCase();return BS.includes(te)?(e.consume(H),J):O(H)}return zi(H)&&a.length<8?(e.consume(H),a+=String.fromCharCode(H),P):O(H)}function T(H){return H===93?(e.consume(H),E):O(H)}function E(H){return H===62?(e.consume(H),J):H===45&&s===2?(e.consume(H),E):O(H)}function J(H){return H===null||ot(H)?(e.exit("htmlFlowData"),Q(H)):(e.consume(H),J)}function Q(H){return e.exit("htmlFlow"),t(H)}}function MH(e,t,n){const r=this;return s;function s(a){return ot(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 $H(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Um,t,n)}}const DH={name:"htmlText",tokenize:FH};function FH(e,t,n){const r=this;let s,i,a;return l;function l(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),c}function c(E){return E===33?(e.consume(E),d):E===47?(e.consume(E),C):E===63?(e.consume(E),w):zi(E)?(e.consume(E),R):n(E)}function d(E){return E===45?(e.consume(E),u):E===91?(e.consume(E),i=0,g):zi(E)?(e.consume(E),v):n(E)}function u(E){return E===45?(e.consume(E),h):n(E)}function f(E){return E===null?n(E):E===45?(e.consume(E),p):ot(E)?(a=f,z(E)):(e.consume(E),f)}function p(E){return E===45?(e.consume(E),h):f(E)}function h(E){return E===62?I(E):E===45?p(E):f(E)}function g(E){const J="CDATA[";return E===J.charCodeAt(i++)?(e.consume(E),i===J.length?k:g):n(E)}function k(E){return E===null?n(E):E===93?(e.consume(E),b):ot(E)?(a=k,z(E)):(e.consume(E),k)}function b(E){return E===93?(e.consume(E),y):k(E)}function y(E){return E===62?I(E):E===93?(e.consume(E),y):k(E)}function v(E){return E===null||E===62?I(E):ot(E)?(a=v,z(E)):(e.consume(E),v)}function w(E){return E===null?n(E):E===63?(e.consume(E),N):ot(E)?(a=w,z(E)):(e.consume(E),w)}function N(E){return E===62?I(E):w(E)}function C(E){return zi(E)?(e.consume(E),S):n(E)}function S(E){return E===45||ks(E)?(e.consume(E),S):A(E)}function A(E){return ot(E)?(a=A,z(E)):Wt(E)?(e.consume(E),A):I(E)}function R(E){return E===45||ks(E)?(e.consume(E),R):E===47||E===62||as(E)?M(E):n(E)}function M(E){return E===47?(e.consume(E),I):E===58||E===95||zi(E)?(e.consume(E),V):ot(E)?(a=M,z(E)):Wt(E)?(e.consume(E),M):I(E)}function V(E){return E===45||E===46||E===58||E===95||ks(E)?(e.consume(E),V):D(E)}function D(E){return E===61?(e.consume(E),O):ot(E)?(a=D,z(E)):Wt(E)?(e.consume(E),D):M(E)}function O(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),s=E,K):ot(E)?(a=O,z(E)):Wt(E)?(e.consume(E),O):(e.consume(E),$)}function K(E){return E===s?(e.consume(E),s=void 0,L):E===null?n(E):ot(E)?(a=K,z(E)):(e.consume(E),K)}function $(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||as(E)?M(E):(e.consume(E),$)}function L(E){return E===47||E===62||as(E)?M(E):n(E)}function I(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function z(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),P}function P(E){return Wt(E)?fn(e,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):T(E)}function T(E){return e.enter("htmlTextData"),a(E)}}const nb={name:"labelEnd",resolveAll:UH,resolveTo:WH,tokenize:VH},zH={tokenize:KH},BH={tokenize:qH},HH={tokenize:YH};function UH(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&&Gi(e,0,e.length,n),e}function WH(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}},u={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",d,t]],l=Fs(l,e.slice(i+1,i+r+3)),l=Fs(l,[["enter",u,t]]),l=Fs(l,tb(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Fs(l,[["exit",u,t],e[a-2],e[a-1],["exit",d,t]]),l=Fs(l,e.slice(a+1)),l=Fs(l,[["exit",c,t]]),Gi(e,i,e.length,l),e}function VH(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?f(p):(a=r.parser.defined.includes(Sc(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(zH,u,a?u:f)(p):p===91?e.attempt(BH,u,a?d:f)(p):a?u(p):f(p)}function d(p){return e.attempt(HH,u,f)(p)}function u(p){return t(p)}function f(p){return i._balanced=!0,n(p)}}function KH(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return as(f)?ld(e,i)(f):i(f)}function i(f){return f===41?u(f):sA(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return as(f)?ld(e,c)(f):u(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?oA(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function d(f){return as(f)?ld(e,u)(f):u(f)}function u(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function qH(e,t,n){const r=this;return s;function s(l){return iA.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Sc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function YH(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 GH={name:"labelStartImage",resolveAll:nb.resolveAll,tokenize:JH};function JH(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 XH={name:"labelStartLink",resolveAll:nb.resolveAll,tokenize:QH};function QH(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 py={name:"lineEnding",tokenize:ZH};function ZH(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),fn(e,t,"linePrefix")}}const th={name:"thematicBreak",tokenize:e8};function e8(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||ot(d))?(e.exit("thematicBreak"),t(d)):n(d)}function c(d){return d===s?(e.consume(d),r++,c):(e.exit("thematicBreakSequence"),Wt(d)?fn(e,l,"whitespace")(d):l(d))}}const Gr={continuation:{tokenize:s8},exit:o8,name:"list",tokenize:r8},t8={partial:!0,tokenize:a8},n8={partial:!0,tokenize:i8};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:uw(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(th,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 uw(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(Um,r.interrupt?n:u,e.attempt(t8,p,f))}function u(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function f(h){return Wt(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 s8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Um,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,fn(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Wt(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(n8,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,fn(e,e.attempt(Gr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function i8(e,t,n){const r=this;return fn(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 o8(e){e.exit(this.containerState.type)}function a8(e,t,n){const r=this;return fn(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!Wt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const HS={name:"setextUnderline",resolveTo:l8,tokenize:c8};function l8(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 c8(e,t,n){const r=this;let s;return i;function i(d){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(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"),Wt(d)?fn(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||ot(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const u8={tokenize:d8};function d8(e){const t=this,n=e.attempt(Um,r,e.attempt(this.parser.constructs.flowInitial,s,fn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(gH,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 f8={resolveAll:lA()},p8=aA("string"),h8=aA("text");function aA(e){return{resolveAll:lA(e==="text"?m8: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(u){return d(u)?i(u):l(u)}function l(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),c}function c(u){return d(u)?(n.exit("data"),i(u)):(n.consume(u),c)}function d(u){if(u===null)return!0;const f=s[u];let p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function lA(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 m8(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 g8={42:Gr,43:Gr,45:Gr,48:Gr,49:Gr,50:Gr,51:Gr,52:Gr,53:Gr,54:Gr,55:Gr,56:Gr,57:Gr,62:eA},y8={91:bH},x8={[-2]:fy,[-1]:fy,32:fy},w8={35:EH,42:th,45:[HS,th],60:IH,61:HS,95:th,96:zS,126:zS},v8={38:nA,92:tA},b8={[-5]:py,[-4]:py,[-3]:py,33:GH,38:nA,42:dw,60:[XB,DH],91:XH,92:[jH,tA],93:nb,95:dw,96:uH},k8={null:[dw,f8]},S8={null:[42,95]},N8={null:[]},j8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:S8,contentInitial:y8,disable:N8,document:g8,flow:w8,flowInitial:x8,insideSpan:k8,string:v8,text:b8},Symbol.toStringTag,{value:"Module"}));function C8(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:A(C),check:A(S),consume:v,enter:w,exit:N,interrupt:A(S,{interrupt:!0})},d={code:null,containerState:{},defineSkip:k,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:f};let u=t.tokenize.call(d,c);return t.resolveAll&&i.push(t),d;function f(D){return a=Fs(a,D),b(),a[a.length-1]!==null?[]:(R(t,0),d.events=tb(i,d.events,d),d.events)}function p(D,O){return _8(h(D),O)}function h(D){return E8(a,D)}function g(){const{_bufferIndex:D,_index:O,line:K,column:$,offset:L}=r;return{_bufferIndex:D,_index:O,line:K,column:$,offset:L}}function k(D){s[D.line]=D.column,V()}function b(){let D;for(;r._index<a.length;){const O=a[r._index];if(typeof O=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<O.length;)y(O.charCodeAt(r._bufferIndex));else y(O)}}function y(D){u=u(D)}function v(D){ot(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,V()):D!==-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=D}function w(D,O){const K=O||{};return K.type=D,K.start=g(),d.events.push(["enter",K,d]),l.push(K),K}function N(D){const O=l.pop();return O.end=g(),d.events.push(["exit",O,d]),O}function C(D,O){R(D,O.from)}function S(D,O){O.restore()}function A(D,O){return K;function K($,L,I){let z,P,T,E;return Array.isArray($)?Q($):"tokenize"in $?Q([$]):J($);function J(ue){return de;function de(ce){const fe=ce!==null&&ue[ce],se=ce!==null&&ue.null,pe=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(se)?se:se?[se]:[]];return Q(pe)(ce)}}function Q(ue){return z=ue,P=0,ue.length===0?I:H(ue[P])}function H(ue){return de;function de(ce){return E=M(),T=ue,ue.partial||(d.currentConstruct=ue),ue.name&&d.parser.constructs.disable.null.includes(ue.name)?le():ue.tokenize.call(O?Object.assign(Object.create(d),O):d,c,te,le)(ce)}}function te(ue){return D(T,E),L}function le(ue){return E.restore(),++P<z.length?H(z[P]):I}}}function R(D,O){D.resolveAll&&!i.includes(D)&&i.push(D),D.resolve&&Gi(d.events,O,d.events.length-O,D.resolve(d.events.slice(O),d)),D.resolveTo&&(d.events=D.resolveTo(d.events,d))}function M(){const D=g(),O=d.previous,K=d.currentConstruct,$=d.events.length,L=Array.from(l);return{from:$,restore:I};function I(){r=D,d.previous=O,d.currentConstruct=K,d.events.length=$,l=L,V()}}function V(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function E8(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 _8(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 P8(e){const r={constructs:MB([j8,...(e||{}).extensions||[]]),content:s(WB),defined:[],document:s(KB),flow:s(u8),lazy:{},string:s(p8),text:s(h8)};return r;function s(i){return a;function a(l){return C8(r,i,l)}}}function A8(e){for(;!rA(e););return e}const US=/[\0\t\n\r]/g;function I8(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const c=[];let d,u,f,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(US.lastIndex=f,d=US.exec(i),p=d&&d.index!==void 0?d.index:i.length,h=i.charCodeAt(p),!d){t=i.slice(f);break}if(h===10&&f===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<p&&(c.push(i.slice(f,p)),e+=p-f),h){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const T8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function R8(e){return e.replace(T8,L8)}function L8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return ZP(n.slice(i?2:1),i?16:10)}return eb(n)||e}const cA={}.hasOwnProperty;function O8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),M8(n)(A8(P8(n).document().write(I8()(e,t,!0))))}function M8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ce),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(at),blockQuote:i(se),characterEscape:M,characterReference:M,codeFenced:i(pe),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(pe,a),codeText:i(ve,a),codeTextData:M,data:M,codeFlowValue:M,definition:i(je),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Ve),hardBreakEscape:i(Je),hardBreakTrailing:i(Je),htmlFlow:i(jt,a),htmlFlowData:M,htmlText:i(jt,a),htmlTextData:M,image:i(De),label:a,link:i(Ce),listItem:i(Bn),listItemValue:p,listOrdered:i(Jt,f),listUnordered:i(Jt),paragraph:i(Xt),reference:H,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(at),strong:i(_n),thematicBreak:i(ur)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:fe,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:V,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:ue,characterReference:de,codeFenced:c(b),codeFencedFence:k,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:V,codeIndented:c(y),codeText:c(L),codeTextData:V,data:V,definition:c(),definitionDestinationString:N,definitionLabelString:v,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(K),htmlFlowData:V,htmlText:c($),htmlTextData:V,image:c(z),label:T,labelText:P,lineEnding:D,link:c(I),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:E,resourceTitleString:J,resource:Q,setextHeading:c(R),setextHeadingLineSequence:A,setextHeadingText:S,strong:c(),thematicBreak:c()}};uA(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let we={type:"root",children:[]};const Ge={stack:[we],tokenStack:[],config:t,enter:l,exit:d,buffer:a,resume:u,data:n},st=[];let et=-1;for(;++et<oe.length;)if(oe[et][1].type==="listOrdered"||oe[et][1].type==="listUnordered")if(oe[et][0]==="enter")st.push(et);else{const It=st.pop();et=s(oe,It,et)}for(et=-1;++et<oe.length;){const It=t[oe[et][0]];cA.call(It,oe[et][1].type)&&It[oe[et][1].type].call(Object.assign({sliceSerialize:oe[et][2].sliceSerialize},Ge),oe[et][1])}if(Ge.tokenStack.length>0){const It=Ge.tokenStack[Ge.tokenStack.length-1];(It[1]||WS).call(Ge,void 0,It[0])}for(we.position={start:Yo(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Yo(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},et=-1;++et<t.transforms.length;)we=t.transforms[et](we)||we;return we}function s(oe,we,Ge){let st=we-1,et=-1,It=!1,On,Mt,Mn,Qt;for(;++st<=Ge;){const Zt=oe[st];switch(Zt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Zt[0]==="enter"?et++:et--,Qt=void 0;break}case"lineEndingBlank":{Zt[0]==="enter"&&(On&&!Qt&&!et&&!Mn&&(Mn=st),Qt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qt=void 0}if(!et&&Zt[0]==="enter"&&Zt[1].type==="listItemPrefix"||et===-1&&Zt[0]==="exit"&&(Zt[1].type==="listUnordered"||Zt[1].type==="listOrdered")){if(On){let sr=st;for(Mt=void 0;sr--;){const he=oe[sr];if(he[1].type==="lineEnding"||he[1].type==="lineEndingBlank"){if(he[0]==="exit")continue;Mt&&(oe[Mt][1].type="lineEndingBlank",It=!0),he[1].type="lineEnding",Mt=sr}else if(!(he[1].type==="linePrefix"||he[1].type==="blockQuotePrefix"||he[1].type==="blockQuotePrefixWhitespace"||he[1].type==="blockQuoteMarker"||he[1].type==="listItemIndent"))break}Mn&&(!Mt||Mn<Mt)&&(On._spread=!0),On.end=Object.assign({},Mt?oe[Mt][1].start:Zt[1].end),oe.splice(Mt||st,0,["exit",On,Zt[2]]),st++,Ge++}if(Zt[1].type==="listItemPrefix"){const sr={type:"listItem",_spread:!1,start:Object.assign({},Zt[1].start),end:void 0};On=sr,oe.splice(st,0,["enter",sr,Zt[2]]),st++,Ge++,Mn=void 0,Qt=!0}}}return oe[we][1]._spread=It,Ge}function i(oe,we){return Ge;function Ge(st){l.call(this,oe(st),st),we&&we.call(this,st)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(oe,we,Ge){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([we,Ge||void 0]),oe.position={start:Yo(we.start),end:void 0}}function c(oe){return we;function we(Ge){oe&&oe.call(this,Ge),d.call(this,Ge)}}function d(oe,we){const Ge=this.stack.pop(),st=this.tokenStack.pop();if(st)st[0].type!==oe.type&&(we?we.call(this,oe,st[0]):(st[1]||WS).call(this,oe,st[0]));else throw new Error("Cannot close `"+oe.type+"` ("+ad({start:oe.start,end:oe.end})+"): it’s not open");Ge.position.end=Yo(oe.end)}function u(){return LB(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(oe){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function h(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.lang=oe}function g(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.meta=oe}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe.replace(/(\r?\n|\r)$/g,"")}function v(oe){const we=this.resume(),Ge=this.stack[this.stack.length-1];Ge.label=we,Ge.identifier=Sc(this.sliceSerialize(oe)).toLowerCase()}function w(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.title=oe}function N(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.url=oe}function C(oe){const we=this.stack[this.stack.length-1];if(!we.depth){const Ge=this.sliceSerialize(oe).length;we.depth=Ge}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function A(oe){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function M(oe){const Ge=this.stack[this.stack.length-1].children;let st=Ge[Ge.length-1];(!st||st.type!=="text")&&(st=Nr(),st.position={start:Yo(oe.start),end:void 0},Ge.push(st)),this.stack.push(st)}function V(oe){const we=this.stack.pop();we.value+=this.sliceSerialize(oe),we.position.end=Yo(oe.end)}function D(oe){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ge=we.children[we.children.length-1];Ge.position.end=Yo(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(we.type)&&(M.call(this,oe),V.call(this,oe))}function O(){this.data.atHardBreak=!0}function K(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function $(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function L(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function I(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=we,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function z(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=we,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function P(oe){const we=this.sliceSerialize(oe),Ge=this.stack[this.stack.length-2];Ge.label=R8(we),Ge.identifier=Sc(we).toLowerCase()}function T(){const oe=this.stack[this.stack.length-1],we=this.resume(),Ge=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ge.type==="link"){const st=oe.children;Ge.children=st}else Ge.alt=we}function E(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.url=oe}function J(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.title=oe}function Q(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function te(oe){const we=this.resume(),Ge=this.stack[this.stack.length-1];Ge.label=we,Ge.identifier=Sc(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function le(oe){this.data.characterReferenceType=oe.type}function ue(oe){const we=this.sliceSerialize(oe),Ge=this.data.characterReferenceType;let st;Ge?(st=ZP(we,Ge==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):st=eb(we);const et=this.stack[this.stack.length-1];et.value+=st}function de(oe){const we=this.stack.pop();we.position.end=Yo(oe.end)}function ce(oe){V.call(this,oe);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(oe)}function fe(oe){V.call(this,oe);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(oe)}function se(){return{type:"blockquote",children:[]}}function pe(){return{type:"code",lang:null,meta:null,value:""}}function ve(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ve(){return{type:"emphasis",children:[]}}function at(){return{type:"heading",depth:0,children:[]}}function Je(){return{type:"break"}}function jt(){return{type:"html",value:""}}function De(){return{type:"image",title:null,url:"",alt:null}}function Ce(){return{type:"link",title:null,url:"",children:[]}}function Jt(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Bn(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function Xt(){return{type:"paragraph",children:[]}}function _n(){return{type:"strong",children:[]}}function Nr(){return{type:"text",value:""}}function ur(){return{type:"thematicBreak"}}}function Yo(e){return{line:e.line,column:e.column,offset:e.offset}}function uA(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?uA(e,r):$8(e,r)}}function $8(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 WS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ad({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ad({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ad({start:t.start,end:t.end})+") is still open")}function D8(e){const t=this;t.parser=n;function n(r){return O8(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function F8(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 z8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function B8(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 H8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function U8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function W8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Jc(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 V8(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 K8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function dA(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 q8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dA(e,t);const s={src:Jc(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 Y8(e,t){const n={src:Jc(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 G8(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 J8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dA(e,t);const s={href:Jc(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 X8(e,t){const n={href:Jc(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 Q8(e,t,n){const r=e.all(t),s=n?Z8(n):fA(t),i={},a=[];if(typeof t.checked=="boolean"){const u=r[0];let f;u&&u.type==="element"&&u.tagName==="p"?f=u:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.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 u=r[l];(s||l!==0||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
-
`}),u.type==="element"&&u.tagName==="p"&&!s?a.push(...u.children):a.push(u)}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 Z8(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=fA(n[r])}return t}function fA(e){const t=e.spread;return t??e.children.length>1}function e6(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 t6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function n6(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 s6(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=Jv(t.children[1]),c=KP(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 i6(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 f=t.children[c],p={},h=a?a[c]:void 0;h&&(p.align=h);let g={type:"element",tagName:i,properties:p,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),d.push(g)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,u),e.applyData(t,u)}function o6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const VS=9,KS=32;function a6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(qS(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(qS(t.slice(s),s>0,!1)),i.join("")}function qS(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===VS||i===KS;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===VS||i===KS;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function l6(e,t){const n={type:"text",value:a6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function c6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const u6={blockquote:F8,break:z8,code:B8,delete:H8,emphasis:U8,footnoteReference:W8,heading:V8,html:K8,imageReference:q8,image:Y8,inlineCode:G8,linkReference:J8,link:X8,listItem:Q8,list:e6,paragraph:t6,root:n6,strong:r6,table:s6,tableCell:o6,tableRow:i6,text:l6,thematicBreak:c6,toml:kp,yaml:kp,definition:kp,footnoteDefinition:kp};function kp(){}const pA=-1,Wm=0,cd=1,Uh=2,rb=3,sb=4,ib=5,ob=6,hA=7,mA=8,YS=typeof self=="object"?self:globalThis,d6=(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 Wm:case pA:return n(a,s);case cd:{const l=n([],s);for(const c of a)l.push(r(c));return l}case Uh:{const l=n({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case rb:return n(new Date(a),s);case sb:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case ib:{const l=n(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case ob:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case hA:{const{name:l,message:c}=a;return n(new YS[l](c),s)}case mA: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 YS[i](a),s)};return r},GS=e=>d6(new Map,e)(0),Hl="",{toString:f6}={},{keys:p6}=Object,Tu=e=>{const t=typeof e;if(t!=="object"||!e)return[Wm,t];const n=f6.call(e).slice(8,-1);switch(n){case"Array":return[cd,Hl];case"Object":return[Uh,Hl];case"Date":return[rb,Hl];case"RegExp":return[sb,Hl];case"Map":return[ib,Hl];case"Set":return[ob,Hl];case"DataView":return[cd,n]}return n.includes("Array")?[cd,n]:n.includes("Error")?[hA,n]:[Uh,n]},Sp=([e,t])=>e===Wm&&(t==="function"||t==="symbol"),h6=(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]=Tu(a);switch(l){case Wm:{let u=a;switch(c){case"bigint":l=mA,u=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return s([pA],a)}return s([l,u],a)}case cd:{if(c){let p=a;return c==="DataView"?p=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(a)),s([c,[...p]],a)}const u=[],f=s([l,u],a);for(const p of a)u.push(i(p));return f}case Uh:{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 u=[],f=s([l,u],a);for(const p of p6(a))(e||!Sp(Tu(a[p])))&&u.push([i(p),i(a[p])]);return f}case rb:return s([l,a.toISOString()],a);case sb:{const{source:u,flags:f}=a;return s([l,{source:u,flags:f}],a)}case ib:{const u=[],f=s([l,u],a);for(const[p,h]of a)(e||!(Sp(Tu(p))||Sp(Tu(h))))&&u.push([i(p),i(h)]);return f}case ob:{const u=[],f=s([l,u],a);for(const p of a)(e||!Sp(Tu(p)))&&u.push(i(p));return f}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},JS=(e,{json:t,lossy:n}={})=>{const r=[];return h6(!(t||n),!!t,new Map,r)(e),r},Wh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?GS(JS(e,t)):structuredClone(e):(e,t)=>GS(JS(e,t));function m6(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 g6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function y6(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||m6,r=e.options.footnoteBackLabel||g6,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 u=e.all(d),f=String(d.identifier).toUpperCase(),p=Jc(f.toLowerCase());let h=0;const g=[],k=e.footnoteCounts.get(f);for(;k!==void 0&&++h<=k;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,h);typeof v=="string"&&(v={type:"text",value:v}),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(v)?v:[v]})}const b=u[u.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const v=b.children[b.children.length-1];v&&v.type==="text"?v.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else u.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(u,!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:{...Wh(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 gA=function(e){if(e==null)return b6;if(typeof e=="function")return Vm(e);if(typeof e=="object")return Array.isArray(e)?x6(e):w6(e);if(typeof e=="string")return v6(e);throw new Error("Expected function, string, or object as test")};function x6(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=gA(e[n]);return Vm(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function w6(e){const t=e;return Vm(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function v6(e){return Vm(t);function t(n){return n&&n.type===e}}function Vm(e){return t;function t(n,r,s){return!!(k6(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function b6(){return!0}function k6(e){return e!==null&&typeof e=="object"&&"type"in e}const yA=[],S6=!0,XS=!1,N6="skip";function j6(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=gA(s),a=r?-1:1;l(e,void 0,[])();function l(c,d,u){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=yA,g,k,b;if((!t||i(c,d,u[u.length-1]||void 0))&&(h=C6(n(c,u)),h[0]===XS))return h;if("children"in c&&c.children){const y=c;if(y.children&&h[0]!==N6)for(k=(r?y.children.length:-1)+a,b=u.concat(y);k>-1&&k<y.children.length;){const v=y.children[k];if(g=l(v,k,b)(),g[0]===XS)return g;k=typeof g[1]=="number"?g[1]:k+a}}return h}}}function C6(e){return Array.isArray(e)?e:typeof e=="number"?[S6,e]:e==null?yA:[e]}function xA(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),j6(e,i,l,s);function l(c,d){const u=d[d.length-1],f=u?u.children.indexOf(c):void 0;return a(c,f,u)}}const fw={}.hasOwnProperty,E6={};function _6(e,t){const n=t||E6,r=new Map,s=new Map,i=new Map,a={...u6,...n.handlers},l={all:d,applyData:A6,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:P6,wrap:T6};return xA(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const f=u.type==="definition"?r:s,p=String(u.identifier).toUpperCase();f.has(p)||f.set(p,u)}}),l;function c(u,f){const p=u.type,h=l.handlers[p];if(fw.call(l.handlers,p)&&h)return h(l,u,f);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in u){const{children:k,...b}=u,y=Wh(b);return y.children=l.all(u),y}return Wh(u)}return(l.options.unknownHandler||I6)(l,u,f)}function d(u){const f=[];if("children"in u){const p=u.children;let h=-1;for(;++h<p.length;){const g=l.one(p[h],u);if(g){if(h&&p[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=QS(g.value)),!Array.isArray(g)&&g.type==="element")){const k=g.children[0];k&&k.type==="text"&&(k.value=QS(k.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function P6(e,t){e.position&&(t.position=fB(e))}function A6(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,Wh(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function I6(e,t){const n=t.data||{},r="value"in t&&!(fw.call(n,"hProperties")||fw.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 T6(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 QS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ZS(e,t){const n=_6(e,t),r=n.one(e,void 0),s=y6(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 R6(e,t){return e&&"run"in e?async function(n,r){const s=ZS(n,{file:r,...t});await e.run(s,r)}:function(n,r){return ZS(n,{file:r,...e||t})}}function eN(e){if(e)throw e}var nh=Object.prototype.hasOwnProperty,wA=Object.prototype.toString,tN=Object.defineProperty,nN=Object.getOwnPropertyDescriptor,rN=function(t){return typeof Array.isArray=="function"?Array.isArray(t):wA.call(t)==="[object Array]"},sN=function(t){if(!t||wA.call(t)!=="[object Object]")return!1;var n=nh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&nh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||nh.call(t,s)},iN=function(t,n){tN&&n.name==="__proto__"?tN(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},oN=function(t,n){if(n==="__proto__")if(nh.call(t,n)){if(nN)return nN(t,n).value}else return;return t[n]},L6=function e(){var t,n,r,s,i,a,l=arguments[0],c=1,d=arguments.length,u=!1;for(typeof l=="boolean"&&(u=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=oN(l,n),s=oN(t,n),l!==s&&(u&&s&&(sN(s)||(i=rN(s)))?(i?(i=!1,a=r&&rN(r)?r:[]):a=r&&sN(r)?r:{},iN(l,{name:n,newValue:e(u,a,s)})):typeof s<"u"&&iN(l,{name:n,newValue:s}));return l};const hy=Na(L6);function pw(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 O6(){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 u=e[++i];let f=-1;if(c){a(c);return}for(;++f<s.length;)(d[f]===null||d[f]===void 0)&&(d[f]=s[f]);s=d,u?M6(u,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 M6(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 u=d;if(l&&n)throw u;return s(u)}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 Oi={basename:$6,dirname:D6,extname:F6,join:z6,sep:"/"};function $6(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');hf(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 D6(e){if(hf(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 F6(e){hf(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 z6(...e){let t=-1,n;for(;++t<e.length;)hf(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":B6(n)}function B6(e){hf(e);const t=e.codePointAt(0)===47;let n=H6(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function H6(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 hf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const U6={cwd:W6};function W6(){return"/"}function hw(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function V6(e){if(typeof e=="string")e=new URL(e);else if(!hw(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 K6(e)}function K6(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 my=["history","path","basename","stem","extname","dirname"];class vA{constructor(t){let n;t?hw(t)?n={path:t}:typeof t=="string"||q6(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":U6.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<my.length;){const i=my[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)my.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Oi.basename(this.path):void 0}set basename(t){yy(t,"basename"),gy(t,"basename"),this.path=Oi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Oi.dirname(this.path):void 0}set dirname(t){aN(this.basename,"dirname"),this.path=Oi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Oi.extname(this.path):void 0}set extname(t){if(gy(t,"extname"),aN(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=Oi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){hw(t)&&(t=V6(t)),yy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Oi.basename(this.path,this.extname):void 0}set stem(t){yy(t,"stem"),gy(t,"stem"),this.path=Oi.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 Rr(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 gy(e,t){if(e&&e.includes(Oi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Oi.sep+"`")}function yy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function aN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function q6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Y6=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},G6={}.hasOwnProperty;class ab extends Y6{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=O6()}copy(){const t=new ab;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(hy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(vy("data",this.frozen),this.namespace[t]=n,this):G6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(vy("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=Np(t),r=this.parser||this.Parser;return xy("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),xy("process",this.parser||this.Parser),wy("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=Np(t),c=r.parse(l);r.run(c,l,function(u,f,p){if(u||!f||!p)return d(u);const h=f,g=r.stringify(h,p);Q6(g)?p.value=g:p.result=g,d(u,p)});function d(u,f){u||!f?a(u):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),xy("processSync",this.parser||this.Parser),wy("processSync",this.compiler||this.Compiler),this.process(t,s),cN("processSync","process",n),r;function s(i,a){n=!0,eN(i),r=a}}run(t,n,r){lN(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=Np(n);s.run(t,c,d);function d(u,f,p){const h=f||t;u?l(u):a?a(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),cN("runSync","run",r),s;function i(a,l){eN(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=Np(n),s=this.compiler||this.Compiler;return wy("stringify",s),lN(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(vy("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[u,...f]=d;c(u,f)}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=hy(!0,s.settings,d.settings))}function l(d){let u=-1;if(d!=null)if(Array.isArray(d))for(;++u<d.length;){const f=d[u];i(f)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,u){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===d){p=f;break}if(p===-1)r.push([d,...u]);else if(u.length>0){let[h,...g]=u;const k=r[p][1];pw(k)&&pw(h)&&(h=hy(!0,k,h)),r[p]=[d,h,...g]}}}}const J6=new ab().freeze();function xy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function wy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function vy(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 lN(e){if(!pw(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function cN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Np(e){return X6(e)?e:new vA(e)}function X6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Q6(e){return typeof e=="string"||Z6(e)}function Z6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const e9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",uN=[],dN={allowDangerousHtml:!0},t9=/^(https?|ircs?|mailto|xmpp)$/i,n9=[{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 mf(e){const t=r9(e),n=s9(e);return i9(t.runSync(t.parse(n),n),e)}function r9(e){const t=e.rehypePlugins||uN,n=e.remarkPlugins||uN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...dN}:dN;return J6().use(D8).use(n).use(R6,r).use(t)}function s9(e){const t=e.children||"",n=new vA;return typeof t=="string"&&(n.value=t),n}function i9(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||o9;for(const u of n9)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+e9+u.id,void 0);return xA(e,d),yB(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(u,f,p){if(u.type==="raw"&&p&&typeof f=="number")return a?p.children.splice(f,1):p.children[f]={type:"text",value:u.value},f;if(u.type==="element"){let h;for(h in dy)if(Object.hasOwn(dy,h)&&Object.hasOwn(u.properties,h)){const g=u.properties[h],k=dy[h];(k===null||k.includes(u.tagName))&&(u.properties[h]=c(String(g||""),h,u))}}if(u.type==="element"){let h=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(u,f,p)),h&&p&&typeof f=="number")return l&&u.children?p.children.splice(f,1,...u.children):p.children.splice(f,1),f}}}function o9(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||t9.test(e.slice(0,t))?e:""}function a9(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Vh(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>Vh(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${Vh(t[r])}`).join(",")}}`}function fN(e){return Vh({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 Ud(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function pN(e){return Vh({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 hN(e,t){return!a9(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function mN(e,t=!1){const n=new Map;for(const r of e){const s=Ud(r);if(t&&n.has(s))throw new Error(`存在重复连线键: ${s}`);n.set(s,r)}return n}function l9(e,t,n,r){const s=new Map(e.map(v=>[v.id,v])),i=new Set(n.map(v=>v.id)),a=new Set,l=[],c=[],d=n.map(v=>{const w=s.get(v.id);return w?fN(w)===fN(v)?(a.add(v.id),w):(c.push(v.id),hN(v,w)):(l.push(v.id),v)}),u=mN(t),f=mN(r,!0),p=new Set,h=[],g=[],k=r.map(v=>{const w=Ud(v),N=u.get(w);return N?pN(N)===pN(v)?(p.add(w),N):(g.push(w),hN(v,N)):(h.push(w),v)}),b=e.filter(v=>!i.has(v.id)).map(v=>v.id),y=t.map(v=>Ud(v)).filter(v=>!f.has(v));return{nodes:d,edges:k,changes:{addedNodeIds:l,updatedNodeIds:c,removedNodeIds:b,addedEdgeKeys:h,updatedEdgeKeys:g,removedEdgeKeys:y},stats:{nodeAdded:l.length,nodeRemoved:b.length,nodeReused:a.size,edgeAdded:h.length,edgeRemoved:y.length,edgeReused:p.size,nextEdgeCount:f.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function bA(e){return typeof e>"u"||e===null}function c9(e){return typeof e=="object"&&e!==null}function u9(e){return Array.isArray(e)?e:bA(e)?[]:[e]}function d9(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 f9(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function p9(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var h9=bA,m9=c9,g9=u9,y9=f9,x9=p9,w9=d9,nr={isNothing:h9,isObject:m9,toArray:g9,repeat:y9,isNegativeZero:x9,extend:w9};function kA(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 Wd(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=kA(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Wd.prototype=Object.create(Error.prototype);Wd.prototype.constructor=Wd;Wd.prototype.toString=function(t){return this.name+": "+kA(this,t)};var Dr=Wd;function by(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 ky(e,t){return nr.repeat(" ",t-e.length)+e}function v9(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,u=Math.min(e.line+t.linesAfter,s.length).toString().length,f=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(a-c<0);c++)d=by(e.buffer,r[a-c],s[a-c],e.position-(r[a]-r[a-c]),f),l=nr.repeat(" ",t.indent)+ky((e.line-c+1).toString(),u)+" | "+d.str+`
|
|
82
|
-
`+l;for(d=by(e.buffer,r[a],s[a],e.position,f),l+=nr.repeat(" ",t.indent)+ky((e.line+1).toString(),u)+" | "+d.str+`
|
|
83
|
-
`,l+=nr.repeat("-",t.indent+u+3+d.pos)+`^
|
|
84
|
-
`,c=1;c<=t.linesAfter&&!(a+c>=s.length);c++)d=by(e.buffer,r[a+c],s[a+c],e.position-(r[a]-r[a+c]),f),l+=nr.repeat(" ",t.indent)+ky((e.line+c+1).toString(),u)+" | "+d.str+`
|
|
85
|
-
`;return l.replace(/\n$/,"")}var b9=v9,k9=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],S9=["scalar","sequence","mapping"];function N9(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function j9(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(k9.indexOf(n)===-1)throw new Dr('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=N9(t.styleAliases||null),S9.indexOf(this.kind)===-1)throw new Dr('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var br=j9;function gN(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 C9(){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 mw(e){return this.extend(e)}mw.prototype.extend=function(t){var n=[],r=[];if(t instanceof br)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 Dr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof br))throw new Dr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new Dr("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 Dr("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 br))throw new Dr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(mw.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=gN(s,"implicit"),s.compiledExplicit=gN(s,"explicit"),s.compiledTypeMap=C9(s.compiledImplicit,s.compiledExplicit),s};var SA=mw,NA=new br("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),jA=new br("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),CA=new br("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),EA=new SA({explicit:[NA,jA,CA]});function E9(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function _9(){return null}function P9(e){return e===null}var _A=new br("tag:yaml.org,2002:null",{kind:"scalar",resolve:E9,construct:_9,predicate:P9,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function A9(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 I9(e){return e==="true"||e==="True"||e==="TRUE"}function T9(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var PA=new br("tag:yaml.org,2002:bool",{kind:"scalar",resolve:A9,construct:I9,predicate:T9,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 R9(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function L9(e){return 48<=e&&e<=55}function O9(e){return 48<=e&&e<=57}function M9(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(!R9(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!L9(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!O9(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function $9(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 D9(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!nr.isNegativeZero(e)}var AA=new br("tag:yaml.org,2002:int",{kind:"scalar",resolve:M9,construct:$9,predicate:D9,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"]}}),F9=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function z9(e){return!(e===null||!F9.test(e)||e[e.length-1]==="_")}function B9(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 H9=/^[-+]?[0-9]+e/;function U9(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(nr.isNegativeZero(e))return"-0.0";return n=e.toString(10),H9.test(n)?n.replace("e",".e"):n}function W9(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||nr.isNegativeZero(e))}var IA=new br("tag:yaml.org,2002:float",{kind:"scalar",resolve:z9,construct:B9,predicate:W9,represent:U9,defaultStyle:"lowercase"}),TA=EA.extend({implicit:[_A,PA,AA,IA]}),RA=TA,LA=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),OA=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 V9(e){return e===null?!1:LA.exec(e)!==null||OA.exec(e)!==null}function K9(e){var t,n,r,s,i,a,l,c=0,d=null,u,f,p;if(t=LA.exec(e),t===null&&(t=OA.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]&&(u=+t[10],f=+(t[11]||0),d=(u*60+f)*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 q9(e){return e.toISOString()}var MA=new br("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:V9,construct:K9,instanceOf:Date,represent:q9});function Y9(e){return e==="<<"||e===null}var $A=new br("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Y9}),lb=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
-
\r`;function G9(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=lb;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 J9(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=lb,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 X9(e){var t="",n=0,r,s,i=e.length,a=lb;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 Q9(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var DA=new br("tag:yaml.org,2002:binary",{kind:"scalar",resolve:G9,construct:J9,predicate:Q9,represent:X9}),Z9=Object.prototype.hasOwnProperty,eU=Object.prototype.toString;function tU(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,eU.call(s)!=="[object Object]")return!1;for(i in s)if(Z9.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 nU(e){return e!==null?e:[]}var FA=new br("tag:yaml.org,2002:omap",{kind:"sequence",resolve:tU,construct:nU}),rU=Object.prototype.toString;function sU(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],rU.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function iU(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 zA=new br("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:sU,construct:iU}),oU=Object.prototype.hasOwnProperty;function aU(e){if(e===null)return!0;var t,n=e;for(t in n)if(oU.call(n,t)&&n[t]!==null)return!1;return!0}function lU(e){return e!==null?e:{}}var BA=new br("tag:yaml.org,2002:set",{kind:"mapping",resolve:aU,construct:lU}),cb=RA.extend({implicit:[MA,$A],explicit:[DA,FA,zA,BA]}),va=Object.prototype.hasOwnProperty,Kh=1,HA=2,UA=3,qh=4,Sy=1,cU=2,yN=3,uU=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,dU=/[\x85\u2028\u2029]/,fU=/[,\[\]\{\}]/,WA=/^(?:!|!!|![a-z\-]+!)$/i,VA=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function xN(e){return Object.prototype.toString.call(e)}function Vi(e){return e===10||e===13}function il(e){return e===9||e===32}function es(e){return e===9||e===32||e===10||e===13}function uc(e){return e===44||e===91||e===93||e===123||e===125}function pU(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function hU(e){return e===120?2:e===117?4:e===85?8:0}function mU(e){return 48<=e&&e<=57?e-48:-1}function wN(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 gU(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function KA(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var qA=new Array(256),YA=new Array(256);for(var Ul=0;Ul<256;Ul++)qA[Ul]=wN(Ul)?1:0,YA[Ul]=wN(Ul);function yU(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||cb,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 GA(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=b9(n),new Dr(t,n)}function Ye(e,t){throw GA(e,t)}function Yh(e,t){e.onWarning&&e.onWarning.call(null,GA(e,t))}var vN={YAML:function(t,n,r){var s,i,a;t.version!==null&&Ye(t,"duplication of %YAML directive"),r.length!==1&&Ye(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),s===null&&Ye(t,"ill-formed argument of the YAML directive"),i=parseInt(s[1],10),a=parseInt(s[2],10),i!==1&&Ye(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&Yh(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var s,i;r.length!==2&&Ye(t,"TAG directive accepts exactly two arguments"),s=r[0],i=r[1],WA.test(s)||Ye(t,"ill-formed tag handle (first argument) of the TAG directive"),va.call(t.tagMap,s)&&Ye(t,'there is a previously declared suffix for "'+s+'" tag handle'),VA.test(i)||Ye(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{Ye(t,"tag prefix is malformed: "+i)}t.tagMap[s]=i}};function ma(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||Ye(e,"expected valid JSON character");else uU.test(l)&&Ye(e,"the stream contains non-printable characters");e.result+=l}}function bN(e,t,n,r){var s,i,a,l;for(nr.isObject(n)||Ye(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],va.call(t,i)||(KA(t,i,n[i]),r[i]=!0)}function dc(e,t,n,r,s,i,a,l,c){var d,u;if(Array.isArray(s))for(s=Array.prototype.slice.call(s),d=0,u=s.length;d<u;d+=1)Array.isArray(s[d])&&Ye(e,"nested arrays are not supported inside keys"),typeof s=="object"&&xN(s[d])==="[object Object]"&&(s[d]="[object Object]");if(typeof s=="object"&&xN(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,u=i.length;d<u;d+=1)bN(e,t,i[d],n);else bN(e,t,i,n);else!e.json&&!va.call(n,s)&&va.call(t,s)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,Ye(e,"duplicated mapping key")),KA(t,s,i),delete n[s];return t}function ub(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++):Ye(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Gn(e,t,n){for(var r=0,s=e.input.charCodeAt(e.position);s!==0;){for(;il(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(Vi(s))for(ub(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&&Yh(e,"deficient indentation"),r}function Km(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||es(n)))}function db(e,t){t===1?e.result+=" ":t>1&&(e.result+=nr.repeat(`
|
|
88
|
-
`,t-1))}function xU(e,t,n){var r,s,i,a,l,c,d,u,f=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),es(h)||uc(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),es(s)||n&&uc(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),es(s)||n&&uc(s))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),es(r))break}else{if(e.position===e.lineStart&&Km(e)||n&&uc(h))break;if(Vi(h))if(c=e.line,d=e.lineStart,u=e.lineIndent,Gn(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=u;break}}l&&(ma(e,i,a,!1),db(e,e.line-c),i=a=e.position,l=!1),il(h)||(a=e.position+1),h=e.input.charCodeAt(++e.position)}return ma(e,i,a,!1),e.result?!0:(e.kind=f,e.result=p,!1)}function wU(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(ma(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 Vi(n)?(ma(e,r,s,!0),db(e,Gn(e,!1,t)),r=s=e.position):e.position===e.lineStart&&Km(e)?Ye(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);Ye(e,"unexpected end of the stream within a single quoted scalar")}function vU(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 ma(e,n,e.position,!0),e.position++,!0;if(l===92){if(ma(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),Vi(l))Gn(e,!1,t);else if(l<256&&qA[l])e.result+=YA[l],e.position++;else if((a=hU(l))>0){for(s=a,i=0;s>0;s--)l=e.input.charCodeAt(++e.position),(a=pU(l))>=0?i=(i<<4)+a:Ye(e,"expected hexadecimal character");e.result+=gU(i),e.position++}else Ye(e,"unknown escape sequence");n=r=e.position}else Vi(l)?(ma(e,n,r,!0),db(e,Gn(e,!1,t)),n=r=e.position):e.position===e.lineStart&&Km(e)?Ye(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}Ye(e,"unexpected end of the stream within a double quoted scalar")}function bU(e,t){var n=!0,r,s,i,a=e.tag,l,c=e.anchor,d,u,f,p,h,g=Object.create(null),k,b,y,v;if(v=e.input.charCodeAt(e.position),v===91)u=93,h=!1,l=[];else if(v===123)u=125,h=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),v=e.input.charCodeAt(++e.position);v!==0;){if(Gn(e,!0,t),v=e.input.charCodeAt(e.position),v===u)return e.position++,e.tag=a,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=l,!0;n?v===44&&Ye(e,"expected the node content, but found ','"):Ye(e,"missed comma between flow collection entries"),b=k=y=null,f=p=!1,v===63&&(d=e.input.charCodeAt(e.position+1),es(d)&&(f=p=!0,e.position++,Gn(e,!0,t))),r=e.line,s=e.lineStart,i=e.position,Bc(e,t,Kh,!1,!0),b=e.tag,k=e.result,Gn(e,!0,t),v=e.input.charCodeAt(e.position),(p||e.line===r)&&v===58&&(f=!0,v=e.input.charCodeAt(++e.position),Gn(e,!0,t),Bc(e,t,Kh,!1,!0),y=e.result),h?dc(e,l,g,b,k,y,r,s,i):f?l.push(dc(e,null,g,b,k,y,r,s,i)):l.push(k),Gn(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}Ye(e,"unexpected end of the stream within a flow collection")}function kU(e,t){var n,r,s=Sy,i=!1,a=!1,l=t,c=0,d=!1,u,f;if(f=e.input.charCodeAt(e.position),f===124)r=!1;else if(f===62)r=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)Sy===s?s=f===43?yN:cU:Ye(e,"repeat of a chomping mode identifier");else if((u=mU(f))>=0)u===0?Ye(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?Ye(e,"repeat of an indentation width identifier"):(l=t+u-1,a=!0);else break;if(il(f)){do f=e.input.charCodeAt(++e.position);while(il(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!Vi(f)&&f!==0)}for(;f!==0;){for(ub(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!a||e.lineIndent<l)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>l&&(l=e.lineIndent),Vi(f)){c++;continue}if(e.lineIndent<l){s===yN?e.result+=nr.repeat(`
|
|
89
|
-
`,i?1+c:c):s===Sy&&i&&(e.result+=`
|
|
90
|
-
`);break}for(r?il(f)?(d=!0,e.result+=nr.repeat(`
|
|
91
|
-
`,i?1+c:c)):d?(d=!1,e.result+=nr.repeat(`
|
|
92
|
-
`,c+1)):c===0?i&&(e.result+=" "):e.result+=nr.repeat(`
|
|
93
|
-
`,c):e.result+=nr.repeat(`
|
|
94
|
-
`,i?1+c:c),i=!0,a=!0,c=0,n=e.position;!Vi(f)&&f!==0;)f=e.input.charCodeAt(++e.position);ma(e,n,e.position,!1)}return!0}function kN(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,Ye(e,"tab characters must not be used in indentation")),!(c!==45||(a=e.input.charCodeAt(e.position+1),!es(a))));){if(l=!0,e.position++,Gn(e,!0,-1)&&e.lineIndent<=t){i.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,Bc(e,t,UA,!1,!0),i.push(e.result),Gn(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)Ye(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 SU(e,t,n){var r,s,i,a,l,c,d=e.tag,u=e.anchor,f={},p=Object.create(null),h=null,g=null,k=null,b=!1,y=!1,v;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),v=e.input.charCodeAt(e.position);v!==0;){if(!b&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ye(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,(v===63||v===58)&&es(r))v===63?(b&&(dc(e,f,p,h,g,null,a,l,c),h=g=k=null),y=!0,b=!0,s=!0):b?(b=!1,s=!0):Ye(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,v=r;else{if(a=e.line,l=e.lineStart,c=e.position,!Bc(e,n,HA,!1,!0))break;if(e.line===i){for(v=e.input.charCodeAt(e.position);il(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),es(v)||Ye(e,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(dc(e,f,p,h,g,null,a,l,c),h=g=k=null),y=!0,b=!1,s=!1,h=e.tag,g=e.result;else if(y)Ye(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=u,!0}else if(y)Ye(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=u,!0}if((e.line===i||e.lineIndent>t)&&(b&&(a=e.line,l=e.lineStart,c=e.position),Bc(e,t,qh,!0,s)&&(b?g=e.result:k=e.result),b||(dc(e,f,p,h,g,k,a,l,c),h=g=k=null),Gn(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&v!==0)Ye(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return b&&dc(e,f,p,h,g,null,a,l,c),y&&(e.tag=d,e.anchor=u,e.kind="mapping",e.result=f),y}function NU(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&&Ye(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)):Ye(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!es(a);)a===33&&(r?Ye(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),WA.test(s)||Ye(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),fU.test(i)&&Ye(e,"tag suffix cannot contain flow indicator characters")}i&&!VA.test(i)&&Ye(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{Ye(e,"tag name is malformed: "+i)}return n?e.tag=i:va.call(e.tagMap,s)?e.tag=e.tagMap[s]+i:s==="!"?e.tag="!"+i:s==="!!"?e.tag="tag:yaml.org,2002:"+i:Ye(e,'undeclared tag handle "'+s+'"'),!0}function jU(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&Ye(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!es(n)&&!uc(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Ye(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function CU(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&&!es(r)&&!uc(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Ye(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),va.call(e.anchorMap,n)||Ye(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Gn(e,!0,-1),!0}function Bc(e,t,n,r,s){var i,a,l,c=1,d=!1,u=!1,f,p,h,g,k,b;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=a=l=qh===n||UA===n,r&&Gn(e,!0,-1)&&(d=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;NU(e)||jU(e);)Gn(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||qh===n)&&(Kh===n||HA===n?k=t:k=t+1,b=e.position-e.lineStart,c===1?l&&(kN(e,b)||SU(e,b,k))||bU(e,k)?u=!0:(a&&kU(e,k)||wU(e,k)||vU(e,k)?u=!0:CU(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&Ye(e,"alias node should not have any properties")):xU(e,k,Kh===n)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(u=l&&kN(e,b))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&Ye(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,p=e.implicitTypes.length;f<p;f+=1)if(g=e.implicitTypes[f],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(va.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"],f=0,p=h.length;f<p;f+=1)if(e.tag.slice(0,h[f].tag.length)===h[f].tag){g=h[f];break}g||Ye(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&Ye(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)):Ye(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||u}function EU(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&&(Gn(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&&!es(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),s=[],r.length<1&&Ye(e,"directive name must not be less than one character in length");a!==0;){for(;il(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!Vi(a));break}if(Vi(a))break;for(n=e.position;a!==0&&!es(a);)a=e.input.charCodeAt(++e.position);s.push(e.input.slice(n,e.position))}a!==0&&ub(e),va.call(vN,r)?vN[r](e,r,s):Yh(e,'unknown document directive "'+r+'"')}if(Gn(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,Gn(e,!0,-1)):i&&Ye(e,"directives end mark is expected"),Bc(e,e.lineIndent-1,qh,!1,!0),Gn(e,!0,-1),e.checkLineBreaks&&dU.test(e.input.slice(t,e.position))&&Yh(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Km(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Gn(e,!0,-1));return}if(e.position<e.length-1)Ye(e,"end of the stream or a document separator is expected");else return}function JA(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 yU(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,Ye(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;)EU(n);return n.documents}function _U(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=JA(e,n);if(typeof t!="function")return r;for(var s=0,i=r.length;s<i;s+=1)t(r[s])}function PU(e,t){var n=JA(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Dr("expected a single document in the stream, but found more")}}var AU=_U,IU=PU,XA={loadAll:AU,load:IU},QA=Object.prototype.toString,ZA=Object.prototype.hasOwnProperty,fb=65279,TU=9,Vd=10,RU=13,LU=32,OU=33,MU=34,gw=35,$U=37,DU=38,FU=39,zU=42,eI=44,BU=45,Gh=58,HU=61,UU=62,WU=63,VU=64,tI=91,nI=93,KU=96,rI=123,qU=124,sI=125,Lr={};Lr[0]="\\0";Lr[7]="\\a";Lr[8]="\\b";Lr[9]="\\t";Lr[10]="\\n";Lr[11]="\\v";Lr[12]="\\f";Lr[13]="\\r";Lr[27]="\\e";Lr[34]='\\"';Lr[92]="\\\\";Lr[133]="\\N";Lr[160]="\\_";Lr[8232]="\\L";Lr[8233]="\\P";var YU=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],GU=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function JU(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&&ZA.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[a]=l;return n}function XU(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 Dr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+nr.repeat("0",r-t.length)+t}var QU=1,Kd=2;function ZU(e){this.schema=e.schema||cb,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=nr.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=JU(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==='"'?Kd:QU,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 SN(e,t){for(var n=nr.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 yw(e,t){return`
|
|
98
|
-
`+nr.repeat(" ",e.indent*t)}function eW(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 Jh(e){return e===LU||e===TU}function qd(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==fb||65536<=e&&e<=1114111}function NN(e){return qd(e)&&e!==fb&&e!==RU&&e!==Vd}function jN(e,t,n){var r=NN(e),s=r&&!Jh(e);return(n?r:r&&e!==eI&&e!==tI&&e!==nI&&e!==rI&&e!==sI)&&e!==gw&&!(t===Gh&&!s)||NN(t)&&!Jh(t)&&e===gw||t===Gh&&s}function tW(e){return qd(e)&&e!==fb&&!Jh(e)&&e!==BU&&e!==WU&&e!==Gh&&e!==eI&&e!==tI&&e!==nI&&e!==rI&&e!==sI&&e!==gw&&e!==DU&&e!==zU&&e!==OU&&e!==qU&&e!==HU&&e!==UU&&e!==FU&&e!==MU&&e!==$U&&e!==VU&&e!==KU}function nW(e){return!Jh(e)&&e!==Gh}function Vu(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 iI(e){var t=/^\n* /;return t.test(e)}var oI=1,xw=2,aI=3,lI=4,ql=5;function rW(e,t,n,r,s,i,a,l){var c,d=0,u=null,f=!1,p=!1,h=r!==-1,g=-1,k=tW(Vu(e,0))&&nW(Vu(e,e.length-1));if(t||a)for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Vu(e,c),!qd(d))return ql;k=k&&jN(d,u,l),u=d}else{for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Vu(e,c),d===Vd)f=!0,h&&(p=p||c-g-1>r&&e[g+1]!==" ",g=c);else if(!qd(d))return ql;k=k&&jN(d,u,l),u=d}p=p||h&&c-g-1>r&&e[g+1]!==" "}return!f&&!p?k&&!a&&!s(e)?oI:i===Kd?ql:xw:n>9&&iI(e)?ql:a?i===Kd?ql:xw:p?lI:aI}function sW(e,t,n,r,s){e.dump=function(){if(t.length===0)return e.quotingType===Kd?'""':"''";if(!e.noCompatMode&&(YU.indexOf(t)!==-1||GU.test(t)))return e.quotingType===Kd?'"'+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 eW(e,d)}switch(rW(t,l,e.indent,a,c,e.quotingType,e.forceQuotes&&!r,s)){case oI:return t;case xw:return"'"+t.replace(/'/g,"''")+"'";case aI:return"|"+CN(t,e.indent)+EN(SN(t,i));case lI:return">"+CN(t,e.indent)+EN(SN(iW(t,a),i));case ql:return'"'+oW(t)+'"';default:throw new Dr("impossible error: invalid scalar style")}}()}function CN(e,t){var n=iI(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 EN(e){return e[e.length-1]===`
|
|
103
|
-
`?e.slice(0,-1):e}function iW(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,_N(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
|
-
`:"")+_N(c,t),s=i}return r}function _N(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 oW(e){for(var t="",n=0,r,s=0;s<e.length;n>=65536?s+=2:s++)n=Vu(e,s),r=Lr[n],!r&&qd(n)?(t+=e[s],n>=65536&&(t+=e[s+1])):t+=r||XU(n);return t}function aW(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)),(No(e,t,l,!1,!1)||typeof l>"u"&&No(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=s,e.dump="["+r+"]"}function PN(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)),(No(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&No(e,t+1,null,!0,!0,!1,!0))&&((!r||s!=="")&&(s+=yw(e,t)),e.dump&&Vd===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}function lW(e,t,n){var r="",s=e.tag,i=Object.keys(n),a,l,c,d,u;for(a=0,l=i.length;a<l;a+=1)u="",r!==""&&(u+=", "),e.condenseFlow&&(u+='"'),c=i[a],d=n[c],e.replacer&&(d=e.replacer.call(n,c,d)),No(e,t,c,!1,!1)&&(e.dump.length>1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),No(e,t,d,!1,!1)&&(u+=e.dump,r+=u));e.tag=s,e.dump="{"+r+"}"}function cW(e,t,n,r){var s="",i=e.tag,a=Object.keys(n),l,c,d,u,f,p;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new Dr("sortKeys must be a boolean or a function");for(l=0,c=a.length;l<c;l+=1)p="",(!r||s!=="")&&(p+=yw(e,t)),d=a[l],u=n[d],e.replacer&&(u=e.replacer.call(n,d,u)),No(e,t+1,d,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&Vd===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,f&&(p+=yw(e,t)),No(e,t+1,u,!0,f)&&(e.dump&&Vd===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,s+=p));e.tag=i,e.dump=s||"{}"}function AN(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,QA.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(ZA.call(l.represent,c))r=l.represent[c](t,c);else throw new Dr("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function No(e,t,n,r,s,i,a){e.tag=null,e.dump=n,AN(e,n,!1)||AN(e,n,!0);var l=QA.call(e.dump),c=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var u=l==="[object Object]"||l==="[object Array]",f,p;if(u&&(f=e.duplicates.indexOf(n),p=f!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(s=!1),p&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(u&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(cW(e,t,e.dump,s),p&&(e.dump="&ref_"+f+e.dump)):(lW(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?PN(e,t-1,e.dump,s):PN(e,t,e.dump,s),p&&(e.dump="&ref_"+f+e.dump)):(aW(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&sW(e,e.dump,t,i,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Dr("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 uW(e,t){var n=[],r=[],s,i;for(ww(e,n,r),s=0,i=r.length;s<i;s+=1)t.duplicates.push(n[r[s]]);t.usedDuplicates=new Array(i)}function ww(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)ww(e[s],t,n);else for(r=Object.keys(e),s=0,i=r.length;s<i;s+=1)ww(e[r[s]],t,n)}function dW(e,t){t=t||{};var n=new ZU(t);n.noRefs||uW(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),No(n,0,r,!0,!0)?n.dump+`
|
|
110
|
-
`:""}var fW=dW,pW={dump:fW};function pb(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 hW=br,mW=SA,gW=EA,yW=TA,xW=RA,wW=cb,vW=XA.load,bW=XA.loadAll,kW=pW.dump,SW=Dr,NW={binary:DA,float:IA,map:CA,null:_A,pairs:zA,set:BA,timestamp:MA,bool:PA,int:AA,merge:$A,omap:FA,seq:jA,str:NA},jW=pb("safeLoad","load"),CW=pb("safeLoadAll","loadAll"),EW=pb("safeDump","dump"),cI={Type:hW,Schema:mW,FAILSAFE_SCHEMA:gW,JSON_SCHEMA:yW,CORE_SCHEMA:xW,DEFAULT_SCHEMA:wW,load:vW,loadAll:bW,dump:kW,YAMLException:SW,types:NW,safeLoad:jW,safeLoadAll:CW,safeDump:EW};const ba=["requirement","planning","code","test","normal"],vw={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},_W=["agent","control","provide","condition","jump","condition_jump","start","end"];function PW(e){return _W.includes(e)?e:"agent"}function AW(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function IW(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=typeof a.description=="string"&&a.description.trim()?a.description.trim():void 0,d=new Set(Object.keys(s));for(const p of i)p!=null&&p.source&&d.add(String(p.source)),p!=null&&p.target&&d.add(String(p.target));const u=Array.from(d).map(p=>{const h=s[p],g=l[p]&&typeof l[p].x=="number"&&typeof l[p].y=="number"?{x:l[p].x,y:l[p].y}:{x:0,y:0},k=(h==null?void 0:h.definitionId)??p,b=AW(k),y=(h==null?void 0:h.label)!=null?String(h.label):p,v=(h==null?void 0:h.role)!=null?String(h.role).trim():"",w=vw[v]||v,N=ba.includes(w)?w:"normal",C=(h==null?void 0:h.model)!=null?String(h.model).trim():void 0,S=(h==null?void 0:h.body)!=null?String(h.body):"",A=(h==null?void 0:h.script)!=null?String(h.script):"",R=Array.isArray(h==null?void 0:h.images)?h.images:[];return{id:p,type:PW(b),position:g,data:{label:y,definitionId:k,schemaType:b,role:N,model:C||void 0,body:S,images:R,...A.trim()!==""?{script:A}:{}}}}),f=i.filter(p=>(p==null?void 0:p.source)&&(p==null?void 0:p.target)).map((p,h)=>({id:`e-${p.source}-${p.target}-${h}`,source:String(p.source),target:String(p.target),sourceHandle:p.sourceHandle??void 0,targetHandle:p.targetHandle??void 0,markerEnd:{type:os.ArrowClosed}}));return{nodes:u,edges:f,instances:s,description:c}}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 gf(e,t){var s,i,a,l,c,d,u,f,p,h,g,k;const n=b=>{const y={type:(b==null?void 0:b.type)??"node",name:(b==null?void 0:b.name)??"",value:(b==null?void 0:b.value)??(b==null?void 0:b.default)??""};return(b==null?void 0:b.required)===!0&&(y.required=!0),(b==null?void 0:b.showOnNode)!=null&&(y.showOnNode=!!b.showOnNode),y},r={};for(const b of e){const y=t[b.id]&&typeof t[b.id]=="object"?{...t[b.id]}:{},v=((s=b.data)==null?void 0:s.definitionId)||b.id,w=((i=b.data)==null?void 0:i.inputs)??[],N=((a=b.data)==null?void 0:a.outputs)??[],C=((l=b.data)==null?void 0:l.role)!=null?String(b.data.role).trim():"",S=y.role!=null?String(y.role).trim():"",A=vw[C]||C,R=vw[S]||S,M=ba.includes(A)?A:ba.includes(R)?R:"normal",V=Array.isArray(w)?w.map(n):Array.isArray(y.input)?y.input.map(H=>n(H)):[],D=Array.isArray(N)?N.map(n):Array.isArray(y.output)?y.output.map(H=>n(H)):[],O=((c=b.data)==null?void 0:c.label)!=null?String(b.data.label):y.label!=null?String(y.label):b.id,K=(d=b.data)==null?void 0:d.body,$=K!=null?String(K):y.body!=null?String(y.body):"";let L=((u=b.data)==null?void 0:u.model)!=null&&String(b.data.model).trim()!==""?String(b.data.model).trim():y.model!=null&&String(y.model).trim()!==""?String(y.model).trim():void 0;(L===""||L==="default")&&(L=void 0);const I={...y,definitionId:v,label:O,role:M,model:L,input:V,output:D},z=((f=b.data)==null?void 0:f.marketplaceRef)||y.marketplaceRef;z?I.marketplaceRef=String(z):delete I.marketplaceRef;const P=((p=b.data)==null?void 0:p.marketplacePackageId)||y.marketplacePackageId;P?I.marketplacePackageId=String(P):delete I.marketplacePackageId;const T=((h=b.data)==null?void 0:h.marketplaceVersion)||y.marketplaceVersion;T?I.marketplaceVersion=String(T):delete I.marketplaceVersion,v.startsWith("provide_")||$.trim()===""?delete I.body:I.body=$;const E=Array.isArray((g=b.data)==null?void 0:g.images)?b.data.images:Array.isArray(y.images)?y.images:[];E.length>0?I.images=E:delete I.images;const J=(k=b.data)==null?void 0:k.script,Q=J!=null?String(J):y.script!=null?String(y.script):"";Q.trim()===""?delete I.script:I.script=Q,delete I.temperature,delete I.maxTokens,delete I.description,r[b.id]=I}return r}function ud(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function TW(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 uI(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=>ud(a)),edges:i.map(a=>ud(a)),instances:gf(r,n||{})}}function dI(e,t,n,r,s={}){var f;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,TW(p.id,a));const c=e.nodes.map(p=>{var g,k;const h=l.get(p.id);return{...ud(p),id:h,selected:!0,dragging:!1,position:{x:Number(((g=p.position)==null?void 0:g.x)||0)+i.x,y:Number(((k=p.position)==null?void 0:k.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),k=l.get(p.target);return{...ud(p),id:`e-${g}-${k}-${Date.now()}-${h}`,source:g,target:k,selected:!1}}),u={...r||{}};for(const[p,h]of l.entries()){const g=(f=e.instances)==null?void 0:f[p];g&&(u[h]={...ud(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:u,pastedNodeIds:c.map(p=>p.id)}}function IN(e,t,n,r){const s=gf(e,n),i=t.map(d=>({source:d.source,target:d.target,sourceHandle:d.sourceHandle??null,targetHandle:d.targetHandle??null})),a={};for(const d of e){const u=d.position??{x:0,y:0};a[d.id]={x:u.x,y:u.y}}const l={nodePositions:a};(r==null?void 0:r.description)!=null&&String(r.description).trim()!==""&&(l.description=String(r.description).trim());const c={instances:s,edges:i,ui:l};return cI.dump(c,{lineWidth:-1})}function RW(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 LW(e,t,n){var c,d,u;const r=new Set(e.map(f=>f.id)),s={};for(const f of e)s[f.id]=RW(f);const i=new Map,a=new Map;for(const f of t)f.target&&r.has(f.target)&&(i.has(f.target)||i.set(f.target,new Set),f.targetHandle&&i.get(f.target).add(f.targetHandle)),f.source&&r.has(f.source)&&(a.has(f.source)||a.set(f.source,new Set),f.sourceHandle&&a.get(f.source).add(f.sourceHandle));const l=[];for(const f of e){const p=((c=f.data)==null?void 0:c.definitionId)!=null?String(f.data.definitionId):"",h=s[f.id]||{inputNames:[],outputNames:[]},g=h.inputNames.length,k=h.outputNames.length;if(!(p==="control_start"||p.startsWith("provide_"))&&g>0)for(let v=0;v<g;v++){const w=`input-${v}`;if(!((d=i.get(f.id))==null?void 0:d.has(w))){const C=h.inputNames[v]||w;l.push({nodeId:f.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:C,handle:w}),key:`${f.id}-${w}-in`})}}if(!(p==="control_end")&&k>0)for(let v=0;v<k;v++){const w=`output-${v}`;if(!((u=a.get(f.id))==null?void 0:u.has(w))){const C=h.outputNames[v]||w;l.push({nodeId:f.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:C,handle:w}),key:`${f.id}-${w}-out`})}}}return l}const Xh=/\[image\s+(\d+)\]/gi;function ts(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 OW(e){return`image ${ts(e).length+1}`}function MW(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function $W(e,t){const n=ts(e),r=String(t||""),s=new Set;Xh.lastIndex=0;let i;for(;i=Xh.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function DW(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 fI(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 Qh(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 pI({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=ts(n);for(const a of r){const l=await DW(a),c=OW(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=MW(s,c)}return{body:s,images:i}}function bw(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 FW={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"]};function zW(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(FW[e]||[]).includes(s)?r:s}const BW={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"])},HW={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 UW(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function WW(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 TN(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var d,u;const i=n[s],l=n.find(f=>(f==null?void 0:f.name)&&f.name===r.name)||i;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((d=BW[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"}:{},...(u=HW[e])!=null&&u.has(r.name)?{showOnNode:!1}:{}}})}function hI(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=bw(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 Yd(e,t,n,r,s){var z,P,T,E,J,Q,H,te,le,ue,de,ce,fe,se,pe,ve,je,Ve,at,Je,jt;const i=((z=e.data)==null?void 0:z.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(De=>De.id===i),l=t[e.id];let c=[],d=[],u=((P=e.data)==null?void 0:P.label)??e.id,f,p,h,g,k;const b=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(bw)),Array.isArray(l.output)&&(d=l.output.map(bw)),l.label&&(u=String(l.label)),l.role&&typeof l.role=="string"&&(f=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&&(k=String(l.script)));const y=f??(typeof((T=e.data)==null?void 0:T.role)=="string"?e.data.role:"普通"),v=p??((E=e.data)==null?void 0:E.model)??void 0,w=(a==null?void 0:a.description)!=null?String(a.description).trim():"",N=w!==""?w:void 0,C=h??((J=e.data)==null?void 0:J.body)??"",S=Array.isArray(g)?g:Array.isArray((Q=e.data)==null?void 0:Q.images)?e.data.images:[],A=k!==void 0?k:((H=e.data)==null?void 0:H.script)!=null?String(e.data.script):"",R=String(e.id),M=(te=r==null?void 0:r[s])==null?void 0:te[R],V=(le=M==null?void 0:M.label)==null?void 0:le.label,D=M==null?void 0:M.body,O=M==null?void 0:M.description;b||(c.length===0&&((ue=a==null?void 0:a.inputs)!=null&&ue.length)&&(c=a.inputs.map(De=>({...De}))),d.length===0&&((de=a==null?void 0:a.outputs)!=null&&de.length)&&(d=a.outputs.map(De=>({...De}))));const K=WW(a,(a==null?void 0:a.id)??i),$=(l==null?void 0:l.marketplaceRef)||((ce=e.data)==null?void 0:ce.marketplaceRef)||UW(a);if(K==="agent_subAgent"&&!d.some(De=>(De==null?void 0:De.name)==="result")){const De=(fe=a==null?void 0:a.outputs)==null?void 0:fe.find(Ce=>(Ce==null?void 0:Ce.name)==="result");d=[...d,De?{...De}:{type:"text",name:"result",default:""}]}if((K==="display_markdown"||K==="display_mermaid"||K==="display_ascii"||K==="display_chart")&&!d.some(De=>(De==null?void 0:De.name)==="next")){const De=(se=a==null?void 0:a.outputs)==null?void 0:se.find(Ce=>(Ce==null?void 0:Ce.name)==="next");d=[...d,De?{...De}:{type:"node",name:"next",default:""}]}if(K==="workspace_run"){if(!c.some(De=>(De==null?void 0:De.name)==="prev")){const De=(pe=a==null?void 0:a.inputs)==null?void 0:pe.find(Ce=>(Ce==null?void 0:Ce.name)==="prev");c=[De?{...De}:{type:"node",name:"prev",default:""},...c]}if(!d.some(De=>(De==null?void 0:De.name)==="next")){const De=(ve=a==null?void 0:a.outputs)==null?void 0:ve.find(Ce=>(Ce==null?void 0:Ce.name)==="next");d=[...d,De?{...De}:{type:"node",name:"next",default:""}]}}c=TN(K,c,a==null?void 0:a.inputs),d=TN(K,d,a==null?void 0:a.outputs),K.startsWith("provide_")&&d[0]&&String(d[0].default??d[0].value??"").trim()===""&&String(C).trim()!==""&&(d=d.map((De,Ce)=>Ce===0?{...De,default:C,value:C}:De));const L=zW(K,V||u,a),I=K==="tool_nodejs"||String(A).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:V||u,displayLabel:L,definitionDisplayName:a==null?void 0:a.displayName,definitionId:K,...$?{marketplaceRef:$}:{},...l!=null&&l.marketplacePackageId||(je=e.data)!=null&&je.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((Ve=e.data)==null?void 0:Ve.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(at=e.data)!=null&&at.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((Je=e.data)==null?void 0:Je.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((jt=e.data)==null?void 0:jt.schemaType)??e.type??"agent",role:y,model:v,body:D||C,images:S,script:A,inputs:c,outputs:d,description:O||N,originalLabel:u,originalBody:C,...I?{script:A}:{}}}}function mI(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var u,f,p,h;const s=n.get(r.source),i=n.get(r.target),a=((f=(u=s==null?void 0:s.data)==null?void 0:u.outputs)==null?void 0:f.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 RN(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 LN(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function Zh(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=RN(t==null?void 0:t.sourceHandle,"output"),i=RN(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var d,u,f,p;if(c.id===n){const h=LN((d=c.data)==null?void 0:d.outputs,s);if(h!==((u=c.data)==null?void 0:u.outputs))return a=!0,{...c,data:{...c.data,outputs:h}}}if(c.id===r){const h=LN((f=c.data)==null?void 0:f.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 ON=80,VW=220;function KW(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 qW(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function jp(e,t,n){const r={nodes:Array.isArray(e)?e.map(KW):[],edges:Array.isArray(t)?t.map(qW):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function Ny(e,t){const n=[...e,t];return n.length>ON?n.slice(n.length-ON):n}function gI({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),u=m.useRef(null),f=m.useRef(null),p=m.useRef(null),h=m.useRef(!1),g=m.useCallback(()=>a(C=>C+1),[]),k=m.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),b=m.useCallback(()=>{k();const C=u.current,S=f.current;return u.current=null,f.current=null,!C||!S||C.signature===S.signature?(S&&(d.current=S),!1):(l.current=Ny(l.current,C),c.current=[],d.current=S,g(),!0)},[g,k]),y=m.useCallback((C=[],S=[],A={})=>{k(),l.current=[],c.current=[],u.current=null,f.current=null,d.current=jp(C,S,A),h.current=!1,g()},[g,k]),v=m.useCallback(C=>{h.current=!0,d.current=C,u.current=null,f.current=null,k(),s==null||s(C.value),g()},[g,k,s]),w=m.useCallback(()=>{b();const C=d.current||jp(e,t,n),S=l.current.pop();return S?(c.current=Ny(c.current,C),v(S),!0):(g(),!1)},[g,t,n,b,e,v]),N=m.useCallback(()=>{b();const C=d.current||jp(e,t,n),S=c.current.pop();return S?(l.current=Ny(l.current,C),v(S),!0):(g(),!1)},[g,t,n,b,e,v]);return m.useEffect(()=>()=>k(),[k]),m.useEffect(()=>{if(!r)return;const C=jp(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&&(u.current||(u.current=d.current),f.current=C,k(),p.current=window.setTimeout(()=>{b()},VW))},[k,t,r,n,b,e]),{canUndo:l.current.length>0||!!u.current,canRedo:c.current.length>0,resetHistory:y,undo:w,redo:N,version:i}}function Ln(e){switch(em(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function em(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 YW(e,t){const n=em(e),r=em(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const GW=new Set(["workspaceContext","skillsContext","mcpContext"]);function kw(e){const t=em(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&GW.has(n)?`${t}+${n}`:t}function yI(e){return kw(e)}function Hc(e,t){if(!e||!t||!YW(e.type,t.type))return!1;const n=kw(e),r=kw(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function JW(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 Uc(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=JW(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 lo(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function XW(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 QW(e){const t=String(e||"").trim();return t?t.match(/^marketplace:/i)?"MARKETPLACE":t:""}function ZW(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function Kn(e){e.stopPropagation()}function eV(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tV(e,t){const n=`\\[${eV(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
124
|
-
`).replace(/\n{3,}/g,`
|
|
125
|
-
|
|
126
|
-
`).trimEnd()}function jy(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function nV(e){const t=String(e||"");let n="",r=0;Xh.lastIndex=0;let s;for(;s=Xh.exec(t);)n+=jy(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${jy(s[0])}</span>`,r=s.index+s[0].length;return n+=jy(t.slice(r)),n||" "}function rV(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 xI({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:d}){var Zt,sr;const{t:u}=pn(),f=(e==null?void 0:e.inputs)??[],p=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),g=XW(e),k=QW(g),b=(e==null?void 0:e.isRunMode)??!1,y=(e==null?void 0:e.isExecuting)??!1,v=(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)||"",S=C.startsWith("provide_"),A=C==="provide_bool",R=C==="provide_str",M=C==="provide_file",V=C==="agent_subAgent",D=V&&!b,O=A?ZW(p[0]):!1,K=S?String(((Zt=p[0])==null?void 0:Zt.value)??((sr=p[0])==null?void 0:sr.default)??(e==null?void 0:e.body)??""):"",$=String((e==null?void 0:e.body)||""),L=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||u("flow:node.fallbackLabel"),I=!S&&!D&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",z=ts(e==null?void 0:e.images),P=m.useRef(!1),T=m.useRef(!1),E=m.useRef(null),J=m.useRef(null),[Q,H]=m.useState(K),[te,le]=m.useState($);m.useEffect(()=>{P.current||H(K)},[n,K]),m.useEffect(()=>{T.current||le($)},[n,$]),m.useEffect(()=>{const he=E.current;if(!he)return;const Te=rV(he,te);he.style.minHeight=`${Te}px`,he.style.height="",J.current&&(J.current.style.minHeight=`${Te}px`,J.current.style.height="")},[te]);const ue=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],de=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],ce=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],fe=((e==null?void 0:e.model)??"").trim(),se=h==="agent"&&!C.startsWith("tool_nodejs"),pe=new Set(ue.map(lo)),ve=new Set(de.map(lo)),je=new Set(ce.map(lo)),Ve=fe?fe.startsWith("cursor:")||fe.startsWith("opencode:")||fe.startsWith("claude-code:")?fe:je.has(fe)?`claude-code:${fe}`:ve.has(fe)?`opencode:${fe}`:pe.has(fe)?`cursor:${fe}`:fe:"",at=fe&&!Ve.startsWith("cursor:")&&!Ve.startsWith("opencode:")&&!Ve.startsWith("claude-code:")&&!pe.has(fe)&&!ve.has(fe)&&!je.has(fe),Je=fe.startsWith("cursor:")?fe.slice(7):fe.startsWith("opencode:")?fe.slice(9):fe.startsWith("claude-code:")?fe.slice(12):fe,jt=he=>{const Te=he.target.value;d&&d(n,Te)},De=he=>{he.stopPropagation(),r&&r(n)},Ce=he=>{he.stopPropagation(),s&&s()},Jt=he=>{he.stopPropagation(),i==null||i(n,he.target.value==="true"?"true":"false")},Bn=he=>{he.stopPropagation();const Te=he.target.value;H(Te),P.current||i==null||i(n,Te)},Xt=he=>{he.stopPropagation(),P.current=!0},_n=he=>{he.stopPropagation(),P.current=!1;const Te=he.currentTarget.value;H(Te),i==null||i(n,Te)},Nr=()=>{i==null||i(n,Q)},ur=he=>{he.stopPropagation();const Te=window.prompt("文件路径",Q);Te!=null&&(H(Te),i==null||i(n,Te))},oe=he=>{if(le(he),a==null||a(n,he),l){const Te=$W(z,he);(Te.length!==z.length||Te.some((rn,lt)=>{var vn;return rn.id!==((vn=z[lt])==null?void 0:vn.id)}))&&l(n,Te)}},we=he=>{he.stopPropagation();const Te=he.target.value;T.current?le(Te):oe(Te)},Ge=he=>{he.stopPropagation(),T.current=!0},st=he=>{he.stopPropagation(),T.current=!1;const Te=he.currentTarget.value;oe(Te)},et=()=>{oe(te)},It=async he=>{const Te=await pI({files:he,body:te,images:z});Te&&(le(Te.body),a==null||a(n,Te.body),l==null||l(n,Te.images))},On=(he,Te)=>{he.stopPropagation();const rn=z.filter(vn=>vn.id!==Te.id),lt=tV(te,Te.label);le(lt),a==null||a(n,lt),l==null||l(n,rn)},Mt=he=>{const Te=fI(he);Te.length!==0&&(he.preventDefault(),he.stopPropagation(),It(Te).catch(()=>{}))},Mn=he=>{const Te=Qh(he);Te.length!==0&&(he.preventDefault(),he.stopPropagation(),It(Te).catch(()=>{}))},Qt=()=>{const he=E.current,Te=J.current;!he||!Te||(Te.scrollTop=he.scrollTop,Te.scrollLeft=he.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":"")+(v?" af-flow-node--dim":"")+(D?" 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:k}),!b&&se&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:Kn,onMouseDown:Kn,onClick:Kn,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:Ve,onChange:jt,onPointerDown:Kn,onMouseDown:Kn,onClick:Kn,"aria-label":u("flow:node.model"),title:Je||u("flow:node.defaultModel"),children:[o.jsx("option",{value:"",children:u("flow:node.defaultModel")}),at&&o.jsx("option",{value:fe,children:fe}),ue.length>0&&o.jsx("optgroup",{label:"Cursor",children:ue.map(he=>o.jsx("option",{value:`cursor:${lo(he)}`,children:lo(he)},`c-${he}`))}),de.length>0&&o.jsx("optgroup",{label:"OpenCode",children:de.map(he=>o.jsx("option",{value:`opencode:${lo(he)}`,children:lo(he)},`o-${he}`))}),ce.length>0&&o.jsx("optgroup",{label:"Claude Code",children:ce.map(he=>o.jsx("option",{value:`claude-code:${lo(he)}`,children:lo(he)},`cc-${he}`))})]}),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:u("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"}),!b&&S&&!A&&!R&&!M&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:Ce,"aria-label":u("flow:node.expandProvide"),title:u("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!b&&o.jsx("button",{type:"button",className:"af-flow-node__delete",onClick:De,"aria-label":u("flow:node.deleteNode"),title:u("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:f.map((he,Te)=>{if(he.showOnNode===!1)return null;const rn=u("flow:node.inputTooltip",{name:he.name||`#${Te}`,type:he.type})+(he.default!=null&&he.default!==""?u("flow:node.defaultSuffix",{value:he.default}):""),lt=he.name||`#${Te+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:rn,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[lt,he.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(ls,{type:"target",position:We.Left,id:`input-${Te}`,className:"af-flow-node__handle",style:{background:Ln(he.type)},title:rn})]},`in-${Te}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[o.jsx("span",{className:"af-flow-node__title",children:L}),n?o.jsx("span",{className:"af-flow-node__subtitle",title:n,children:n}):null,A?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(O?" af-flow-node__bool-select--true":""),value:O?"true":"false",onChange:Jt,onPointerDown:Kn,onMouseDown:Kn,onClick:Kn,"aria-label":"Boolean value",title:O?"true":"false",children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):R?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:Q,onChange:Bn,onCompositionStart:Xt,onCompositionEnd:_n,onBlur:Nr,onPointerDown:Kn,onMouseDown:Kn,onClick:Kn,placeholder:"输入文本",rows:2}):M?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:Kn,onMouseDown:Kn,onClick:Kn,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:Q,onChange:Bn,onCompositionStart:Xt,onCompositionEnd:_n,onBlur:Nr,placeholder:"选择或输入文件路径",title:Q||"选择或输入文件路径"}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",onClick:ur,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):V&&!b?o.jsxs("div",{className:"af-flow-node__prompt-stack nodrag",onPointerDown:Kn,onMouseDown:Kn,onClick:Kn,children:[o.jsx("pre",{ref:J,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:nV(te)+`
|
|
127
|
-
`}}),o.jsx("textarea",{ref:E,className:"af-flow-node__prompt-editor nodrag",value:te,onChange:we,onCompositionStart:Ge,onCompositionEnd:st,onBlur:et,onPaste:Mt,onDrop:Mn,onScroll:Qt,onDragOver:he=>{Qh(he).length>0&&he.preventDefault()},placeholder:"输入 prompt",rows:2})]}):null,V&&z.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:z.map((he,Te)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:he.name,children:[o.jsx("img",{src:he.dataUrl,alt:""}),o.jsxs("span",{children:["[",he.label||`image ${Te+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",onClick:rn=>On(rn,he),onPointerDown:Kn,onMouseDown:Kn,"aria-label":`删除 ${he.label||`image ${Te+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},he.id||Te))}):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((he,Te)=>{if(he.showOnNode===!1)return null;const rn=u("flow:node.outputTooltip",{name:he.name||`#${Te}`,type:he.type})+(he.default!=null&&he.default!==""?u("flow:node.defaultSuffix",{value:he.default}):""),lt=he.name||`#${Te+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:rn,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[lt,he.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(ls,{type:"source",position:We.Right,id:`output-${Te}`,className:"af-flow-node__handle",style:{background:Ln(he.type)},title:rn})]},`out-${Te}`)})})]})]})}const yf="flowNode";function wI(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 tm(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function sV(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function iV({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=pn(),a=m.useId(),l=m.useRef(null),[c,d]=m.useState(""),[u,f]=m.useState(!1),[p,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;d(""),h(""),f(!1);const y=requestAnimationFrame(()=>{var v;return(v=l.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(y)},[e,n]),!e)return null;const g=c.trim(),k=g===n;async function b(y){if(y.preventDefault(),!(!k||u)){f(!0),h("");try{const v=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:g})}),w=await v.json().catch(()=>({}));if(!v.ok){h(typeof w.error=="string"?w.error:i("project:archiveModal.archiveFailed"));return}s()}catch(v){h(String((v==null?void 0:v.message)||v))}finally{f(!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:b,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&&!k})]}),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:u,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!k||u,children:i(u?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function MN({open:e,title:t,message:n,confirmLabel:r,cancelLabel:s,destructive:i=!1,secondaryLabel:a,secondaryDestructive:l=!1,onSecondary:c,onConfirm:d,onCancel:u}){const{t:f}=pn(),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 v(w){w.key==="Escape"&&u(),w.key==="Enter"&&d()}return window.addEventListener("keydown",v),()=>{cancelAnimationFrame(y),window.removeEventListener("keydown",v)}},[e,u,d]),!e)return null;const g=r??f("common:common.confirm","确定"),k=s??f("common:common.cancel","取消"),b=t??f("common:common.confirmTitle","请确认");return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&u()},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:b}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:u,"aria-label":k,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:u,children:k}),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 oV({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=pn(),l=m.useId(),c=m.useRef(null),[d,u]=m.useState(""),[f,p]=m.useState(!1),[h,g]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),g(""),p(!1);const v=requestAnimationFrame(()=>{var w;return(w=c.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(v)},[e,n]),!e)return null;const k=d.trim(),b=k===n;async function y(v){if(v.preventDefault(),!b||f)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:k,flowArchived:s}),signal:N.signal}),S=await C.json().catch(()=>({}));if(!C.ok){g(typeof S.error=="string"?S.error:a("project:deleteModal.deleteFailed"));return}try{for(let A=localStorage.length-1;A>=0;A--){const R=localStorage.key(A);R&&(R.startsWith(`af:composer-sessions:${n}:${r}`)||R.startsWith(`af:composer-active-session:${n}:${r}`)||R.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(R)}}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:v=>{v.target===v.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:v=>v.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:v=>u(v.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":k.length>0&&!b})]}),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:f,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!b||f,children:a(f?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function aV({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Ri({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(aV,{children:t})]},n))})}function vI({open:e,onClose:t}){const{t:n}=pn(),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=sV()?"⌘":"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(Ri,{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(Ri,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Ri,{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(Ri,{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(Ri,{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(Ri,{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(Ri,{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(Ri,{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(Ri,{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(Ri,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function lV(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 cV({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=pn(),[i,a]=m.useState(""),[l,c]=m.useState(0),d=m.useRef(null),u=m.useRef(null);m.useEffect(()=>{if(!e)return;a(""),c(0);const g=requestAnimationFrame(()=>{var k;return(k=d.current)==null?void 0:k.focus()});return()=>cancelAnimationFrame(g)},[e]);const f=m.useMemo(()=>{const g=(r||[]).map(y=>{var v,w,N;return{id:y.id,label:((v=y.data)==null?void 0:v.label)||"",definitionId:((w=y.data)==null?void 0:w.definitionId)||"",schemaType:((N=y.data)==null?void 0:N.schemaType)||""}}),k=i.trim(),b=g.map(y=>({e:y,s:lV(y,k)})).filter(y=>y.s>0);return b.sort((y,v)=>v.s-y.s||y.e.id.localeCompare(v.e.id)),b.slice(0,50).map(y=>y.e)},[r,i]);if(m.useEffect(()=>{l>=f.length&&c(0)},[f.length,l]),m.useEffect(()=>{var k;const g=(k=u.current)==null?void 0:k.querySelector(`[data-idx="${l}"]`);g&&g.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=g=>{const k=f[g];k&&(n(k.id),t())},h=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),c(k=>Math.min(f.length-1,k+1));return}if(g.key==="ArrowUp"){g.preventDefault(),c(k=>Math.max(0,k-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:f.length})]}),f.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:u,className:"af-jump-panel__list",role:"listbox",children:f.map((g,k)=>o.jsxs("li",{"data-idx":k,role:"option","aria-selected":k===l,className:"af-jump-panel__item"+(k===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(k),onMouseDown:b=>{b.preventDefault(),p(k)},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 uV({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,filePath:i,fileName:a,onSaved:l,onAiEdit:c}){const{t:d}=pn(),u=m.useId(),f=m.useRef(null),p=m.useRef(null),[h,g]=m.useState(""),[k,b]=m.useState(""),[y,v]=m.useState(!1),[w,N]=m.useState(!1),[C,S]=m.useState(!1),[A,R]=m.useState(""),[M,V]=m.useState("");if(m.useEffect(()=>{if(!e||!i)return;g(""),b(""),R(""),V(""),v(!0),N(!1),S(!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}`),T=await P.json();if(!P.ok)throw new Error(T.error||"HTTP "+P.status);g(T.content||""),b(T.content||"")}catch(P){R(P.message||String(P))}finally{v(!1)}})();const z=requestAnimationFrame(()=>{var P;return(P=f.current)==null?void 0:P.focus()});return()=>cancelAnimationFrame(z)},[e,i,n,r,s]),!e)return null;const D=h!==k;async function O(I){if(I.preventDefault(),!w){N(!0),R(""),V("");try{const z=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i}),P=await fetch(`/api/pipeline-file-save?${z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),T=await P.json();if(!P.ok)throw new Error(T.error||"HTTP "+P.status);b(h),V(d("flow:fileEdit.saved")),l&&l()}catch(z){R(z.message||String(z))}finally{N(!1)}}}async function K(){if(!(!c||C||!h)){S(!0),R("");try{const I=await c(h);typeof I=="string"&&I&&g(I)}catch(I){R(I.message||String(I))}finally{S(!1)}}}function $(){g(k),R(""),V("")}const L=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:f,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":u,tabIndex:-1,onMouseDown:I=>I.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:u,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")}):A&&!h?o.jsx("div",{className:"af-file-edit-error",children:A}):o.jsxs(o.Fragment,{children:[L&&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")})]})}),(A||M)&&!y&&o.jsx("div",{className:`af-file-edit-status${M?" af-file-edit-status--success":""}`,children:M||A}),o.jsxs("div",{className:"af-file-edit-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:$,disabled:!D||w||C,children:d("flow:fileEdit.reset")}),c&&o.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:K,disabled:C||w||!h,children:d(C?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),o.jsx("button",{type:"button",className:"af-btn-primary",onClick:O,disabled:!D||w||C,children:d(w?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const bI=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),dV=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function fV(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 pV(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 $N(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 kI(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(bI.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 SI(e){return{inputNames:$N(e==null?void 0:e.inputs),outputNames:$N(e==null?void 0:e.outputs)}}function hV(e,t,n){const r=SI(t),s=pV(e),i=[];for(const a of s)if(!kI(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 mV(e,t){const n=SI(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=kI(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 gV(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function yV(e){return e.map(t=>{const n=gV(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 xV(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 dV)bI.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function wV(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 vV(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 Cp({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:c,onImagesChange:d}){const{t:u}=pn(),f=m.useId(),p=m.useRef(null),h=m.useRef(null),[g,k]=m.useState(0),[b,y]=m.useState(0),[v,w]=m.useState(null),N=m.useMemo(()=>ts(c),[c]),C=m.useMemo(()=>hV(e,a,u),[e,a,u]),S=C.length>0,A=m.useMemo(()=>mV(e,a),[e,a]),R=m.useMemo(()=>yV(A),[A]),M=m.useMemo(()=>n?null:fV(e,g),[e,g,n]),V=m.useMemo(()=>{if(!M)return[];const I=xV(a,u);return wV(I,M.query)},[M,a,u]);m.useEffect(()=>{y(I=>{const z=Math.max(0,V.length-1);return Math.min(Math.max(0,I),z)})},[V.length]);const D=m.useCallback(()=>{const I=p.current;if(!I||!M||V.length===0){w(null);return}const z=vV(I,g);if(!z){w(null);return}const P=4,T=44,E=13.5*16,J=Math.min(V.length*T+8,E);let Q=z.bottom+P;Q+J>window.innerHeight-8&&(Q=Math.max(8,z.top-J-P));const H=288;let te=z.left;te=Math.max(8,Math.min(te,window.innerWidth-H-8)),w({top:Q,left:te})},[M,V.length,g]);m.useLayoutEffect(()=>{if(!M||V.length===0){w(null);return}const I=requestAnimationFrame(()=>D());return()=>cancelAnimationFrame(I)},[M,V.length,g,e,D]),m.useEffect(()=>{if(!M||V.length===0)return;const I=()=>D();return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[M,V.length,D]);const O=m.useCallback(I=>{if(!M)return;const{atIndex:z}=M,P=e.slice(0,z)+"${"+I+"}"+e.slice(g);t(P);const T=z+I.length+3;queueMicrotask(()=>{const E=p.current;E&&(E.focus(),E.setSelectionRange(T,T)),k(T)})},[M,e,g,t]),K=m.useCallback(()=>{const I=p.current,z=h.current;!I||!z||(z.scrollTop=I.scrollTop,z.scrollLeft=I.scrollLeft,M&&V.length>0&&queueMicrotask(()=>D()))},[M,V.length,D]),$=m.useCallback(I=>{if(!n&&M&&V.length>0&&(I.key==="ArrowDown"||I.key==="ArrowUp"||I.key==="Enter")){if(I.key==="ArrowDown")I.preventDefault(),y(z=>(z+1)%V.length);else if(I.key==="ArrowUp")I.preventDefault(),y(z=>(z-1+V.length)%V.length);else if(I.key==="Enter"&&!I.shiftKey){I.preventDefault();const z=V[b];z&&O(z.insert)}}},[n,M,V,b,O]),L=m.useCallback(async I=>{if(n||typeof d!="function")return!1;const z=await pI({files:I,body:e,images:N});return z?(t(z.body),d(z.images),queueMicrotask(()=>{const P=p.current;if(!P)return;P.focus();const T=z.body.length;P.setSelectionRange(T,T),k(T)}),!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,z)=>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 ${z+1}`,"]"]})]},I.id||z))}):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:R+`
|
|
128
|
-
`}}),o.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":S,"aria-describedby":S?f:void 0,onChange:I=>{t(I.target.value),k(I.target.selectionStart??I.target.value.length)},onSelect:I=>{const z=I.target;z instanceof HTMLTextAreaElement&&k(z.selectionStart??0)},onClick:I=>{const z=I.target;z instanceof HTMLTextAreaElement&&k(z.selectionStart??0)},onKeyUp:I=>{const z=I.target;z instanceof HTMLTextAreaElement&&k(z.selectionStart??z.value.length)},onKeyDown:$,onPaste:I=>{const z=fI(I);z.length!==0&&(I.preventDefault(),L(z).catch(()=>{}))},onDragOver:I=>{Qh(I).length>0&&I.preventDefault()},onDrop:I=>{const z=Qh(I);z.length!==0&&(I.preventDefault(),L(z).catch(()=>{}))},onScroll:K})]}),M&&V.length>0&&v?Xr.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":u("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:v.top,left:v.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:V.map((I,z)=>o.jsx("li",{role:"option","aria-selected":z===b,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(z===b?" af-composer-mention-item--active":""),onMouseDown:P=>P.preventDefault(),onMouseEnter:()=>y(z),onClick:()=>O(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,S?o.jsx("p",{id:f,className:"af-body-ph-issues",role:"status",children:C.map(I=>I.message).join(" · ")}):null]})}const NI=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Ep(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function DN({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=pn(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=f=>r(n.filter((p,h)=>h!==f)),d=(f,p,h)=>{const g=n.map((k,b)=>{if(b!==f)return k;const y={...k,[p]:h};return p==="required"&&h===!0&&(y.showOnNode=!0),y});r(g)},u=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:u})}),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((f,p)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${u}-${p}`,children:[u,"-",p]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:f.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:f.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:f.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:!!f.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:f.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"})})]},`${u}-${p}`))]}):null]})}function jI({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:d=!1,error:u,ioSlots:f}){const{t:p}=pn(),[h,g]=m.useState(!1),[k,b]=m.useState(!1),[y,v]=m.useState({status:"idle",message:""}),w=m.useCallback(O=>{t(K=>K&&{...K,...O})},[t]),{cursorList:N,opencodeList:C,claudeCodeList:S,currentNotInLists:A}=m.useMemo(()=>{const O=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],K=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],$=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],L=new Set([...O,...K,...$].map(Ep)),I=((e==null?void 0:e.model)??"").trim(),z=I.startsWith("cursor:")?I.slice(7):I.startsWith("opencode:")?I.slice(9):I.startsWith("claude-code:")?I.slice(12):I,P=I&&!L.has(z)?I:"";return{cursorList:O,opencodeList:K,claudeCodeList:$,currentNotInLists:P}},[s,e==null?void 0:e.model]);if(!e)return null;const R=String(e.script??""),M=n==="tool_nodejs"||R.trim()!=="",V=typeof c=="function"&&!i&&(e==null?void 0:e.newId),D=async()=>{if(V){v({status:"running",message:p("flow:nodeProps.publishRunning")});try{const O=await c(e,n);v({status:"success",message:O!=null&&O.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:O.definitionId}):p("flow:nodeProps.publishSuccess")})}catch(O){v({status:"error",message:String((O==null?void 0:O.message)||O)})}}};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:D,disabled:!V||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:[u?o.jsx("p",{className:"af-err af-node-props-err",children:u}):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:O=>w({newId:O.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:O=>w({label:O.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:ba.includes(e.role)?e.role:p("flow:roles.normal"),onChange:O=>w({role:O.target.value}),disabled:i,children:ba.map(O=>o.jsx("option",{value:O,children:O},O))})]}),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 O=(e.model||"").trim();return O?A||O:""})(),onChange:O=>w({model:O.target.value}),disabled:i,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),A?o.jsxs("option",{value:A,children:[A,p("flow:nodeProps.yamlValueNotInList")]}):null,N.length>0?o.jsx("optgroup",{label:"Cursor",children:N.map(O=>o.jsx("option",{value:Ep(O),children:O},`c-${O}`))}):null,C.length>0?o.jsx("optgroup",{label:"OpenCode",children:C.map(O=>o.jsx("option",{value:Ep(O),children:O},`o-${O}`))}):null,S.length>0?o.jsx("optgroup",{label:"Claude Code",children:S.map(O=>o.jsx("option",{value:`claude-code:${Ep(O)}`,children:O},`cc-${O}`))}):null]})]}),o.jsx(DN,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:O=>w({inputs:O}),disabled:i,requiredReadonly:!d}),o.jsx(DN,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:O=>w({outputs:O}),disabled:i,requiredReadonly:!d}),M?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:()=>b(!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(Cp,{value:R,onChange:O=>w({script:O}),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:f,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(Cp,{value:e.body,onChange:O=>w({body:O}),images:e.images,onImagesChange:O=>w({images:O}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:f,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})]})]}),k?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:O=>{O.target===O.currentTarget&&b(!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:()=>b(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(Cp,{value:R,onChange:O=>w({script:O}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,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:O=>{O.target===O.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(Cp,{value:e.body,onChange:O=>w({body:O}),images:e.images,onImagesChange:O=>w({images:O}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null]})}function hb(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 bV(e){const t=hb(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 CI(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function FN({text:e}){const{t}=pn(),n=e||"";return n.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(mf,{children:n})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function zN({o:e}){var r;const{t}=pn(),n=hb(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:CI(e.content||"")});if(n==="markdown"){const s=e.content||"";return s.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(mf,{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 BN(e){return bV(e)}function HN(e){var r;if(!e)return null;const t=hb(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"?CI(String(n)):String(n)}function UN({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 WN=2e4,EI="af:run-node-ctx-width";function rh(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function ra(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):ra(rh())}function kV(){try{const e=localStorage.getItem(EI);if(e==null)return ra(rh());const t=parseInt(e,10);return Number.isFinite(t)?ra(t):ra(rh())}catch{return ra(rh())}}async function VN(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 SV(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function NV({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:s}){const{t:i}=pn(),[a,l]=m.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,d]=m.useState(kV),u=m.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[f,p]=m.useState(!0),[h,g]=m.useState(""),[k,b]=m.useState([]),[y,v]=m.useState(null),[w,N]=m.useState(null),C=m.useRef(null),S=m.useRef(null),A=m.useRef(0),R=m.useRef(0);m.useLayoutEffect(()=>{const P=window.matchMedia("(max-width: 960px)"),T=()=>l(P.matches);return P.addEventListener("change",T),()=>P.removeEventListener("change",T)},[]),m.useEffect(()=>{function P(){d(T=>ra(T))}return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const M=m.useCallback(()=>{d(P=>{const T=ra(P);try{localStorage.setItem(EI,String(T))}catch{}return T})},[]),V=m.useCallback(P=>{if(a||P.button!==0)return;P.preventDefault();const T=P.currentTarget;u.current={active:!0,pointerId:P.pointerId,startX:P.clientX,startW:c},T.setPointerCapture(P.pointerId)},[a,c]),D=m.useCallback(P=>{const T=u.current;if(!T.active||P.pointerId!==T.pointerId)return;const E=T.startX-P.clientX;d(ra(T.startW+E))},[]),O=m.useCallback(P=>{const T=u.current;if(!(!T.active||P.pointerId!==T.pointerId)){T.active=!1;try{P.currentTarget.releasePointerCapture(P.pointerId)}catch{}M()}},[M]),K=m.useCallback(()=>{const P=u.current;P.active&&(P.active=!1,M())},[M]),$=m.useCallback(P=>{const T=Array.isArray(P)?P:[];b(T),v(E=>E&&T.some(J=>J.execId===E)?E:T.length>0?T[T.length-1].execId:null)},[]),L=m.useCallback(()=>{if(!e||!t)return;const P=++A.current,T=new AbortController,E=window.setTimeout(()=>T.abort(),WN);(async()=>{try{const J=await VN(t,e,n,T.signal);if(P!==A.current)return;$(Array.isArray(J.rounds)?J.rounds:[])}catch{}finally{window.clearTimeout(E)}})()},[e,t,n,$]);m.useEffect(()=>{if(!e||!t){p(!1),g(""),b([]);return}const P=++R.current;p(!0),g(""),b([]),v(null);const T=new AbortController,E=window.setTimeout(()=>T.abort(),WN);return(async()=>{try{const J=await VN(t,e,n,T.signal);if(P!==R.current)return;$(Array.isArray(J.rounds)?J.rounds:[])}catch(J){if(P!==R.current)return;const Q=(J==null?void 0:J.name)==="AbortError"?"requestTimeout":J.message||String(J);g(Q)}finally{window.clearTimeout(E),P===R.current&&p(!1)}})(),()=>{T.abort(),R.current++,A.current++}},[e,t,n,$]),m.useEffect(()=>{r&&L()},[r,L]),m.useEffect(()=>{clearInterval(S.current);const P=k.length>0?k[k.length-1]:null;return(r==="running"&&k.length===0||!!(P&&P.status==="running"))&&e&&t&&(S.current=setInterval(()=>L(),2e3)),()=>clearInterval(S.current)},[k,e,t,n,r,L]),m.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[y]);const I=k.find(P=>P.execId===y),z=a?void 0:{width:`${c}px`};return o.jsxs("aside",{className:"af-run-ctx-panel",style:z,"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:V,onPointerMove:D,onPointerUp:O,onPointerCancel:O,onLostPointerCapture:K}),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"})})]}),f&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("common:common.loading")}),h&&o.jsx("div",{className:"af-run-ctx-error",children:SV(i,h)}),!f&&!h&&k.length===0&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),k.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+CV((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 T=P.target.value;v(T==="latest"?"latest":Number(T))},children:[...k].reverse().map(P=>{const T=P.execId==="latest"?i("flow:runContext.latest"):`#${P.execId}`,E=EV(i,P.status),J=P.finishedAt?` · ${jV(P.finishedAt)}`:"";return o.jsx("option",{value:String(P.execId),children:`${T} · ${E}${J}`},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,T)=>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}-${T}`))]}),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(FN,{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,T)=>{const E=BN(P),J=HN(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}),E?o.jsx("span",{className:"af-run-ctx-format-badge",title:i("flow:runContext.detectedContentType"),children:E}):null,o.jsx(UN,{text:J,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(zN,{o:P})]},`${P.slot}-${T}`)})]}),!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(FN,{text:I.prompt}),w==="output"&&I.outputs&&I.outputs.map((P,T)=>{const E=BN(P),J=HN(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}),E?o.jsx("span",{className:"af-run-ctx-format-badge",children:E}):null,o.jsx(UN,{text:J,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(zN,{o:P})]},`${P.slot}-${T}`)})]})]})})]})}function jV(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 CV(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 EV(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 _V({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:s,nodes:i,onCliInputsChange:a,onBackToEdit:l}){const{t:c}=pn(),[d,u]=m.useState({}),[f,p]=m.useState(null),[h,g]=m.useState({}),[k,b]=m.useState(!0),[y,v]=m.useState(!1),[w,N]=m.useState(""),[C,S]=m.useState(!1),[A,R]=m.useState(null),M=m.useRef(null),V=m.useRef(!0),D=m.useRef({});m.useMemo(()=>{var E,J,Q;const T={};for(const H of r){const te=(Q=(J=(E=H.data)==null?void 0:E.outputs)==null?void 0:J[0])==null?void 0:Q.default;te!=null&&te!==""&&(T[H.id]=String(te))}return D.current=T,T},[r]);const O=m.useMemo(()=>{var E;const T={};for(const J of i){if(!((E=J.data)!=null&&E.inputs))continue;const Q=J.data.inputs;for(let H=0;H<Q.length;H++){const te=Q[H];if(!(te!=null&&te.name))continue;const le=s.find(de=>de.target===J.id&&de.targetHandle===`input-${H}`);if(!(le!=null&&le.source))continue;r.find(de=>de.id===le.source)&&(T[le.source]=te.name)}}return T},[i,s,r]);m.useEffect(()=>(V.current=!0,()=>{V.current=!1}),[]),m.useEffect(()=>{if(!e){b(!1);return}b(!0);const T=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&T.set("archived","1"),fetch(`/api/flow/run-config?${T.toString()}`).then(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{var Q;if(!V.current)return;u(E.presets||{}),p(E.activePreset||null);const J=E.activePreset&&((Q=E.presets)!=null&&Q[E.activePreset])?E.presets[E.activePreset]:{};g({...D.current,...J}),b(!1)}).catch(()=>{V.current&&(g(D.current),b(!1))})},[e,t,n]),m.useEffect(()=>{var E;if(!a)return;const T={};for(const[J,Q]of Object.entries(h)){const H=O[J];if(!H)continue;const te=r.find(ue=>ue.id===J);if(!te)continue;(((E=te.data)==null?void 0:E.definitionId)||"").startsWith("provide_file")?T[H]={type:"file",path:Q}:T[H]={type:"str",value:Q}}a(T)},[h,O,r,a]);const K=m.useCallback((T,E)=>{g(J=>({...J,[T]:E}))},[]),$=m.useCallback(T=>{T!==f&&(p(T),T&&d[T]?g({...D.current,...d[T]}):g(D.current))},[f,d]),L=m.useCallback(async()=>{if(w.trim()){v(!0);try{const T={...d,[w.trim()]:h},E={flowId:e,flowSource:t,archived:n,presets:T,activePreset:w.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})).ok&&(u(T),p(w.trim()),N(""),S(!1))}finally{v(!1)}}},[e,t,n,d,h,w]),I=m.useCallback(async()=>{if(f){v(!0);try{const T={...d};delete T[f];const E=Object.keys(T)[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:T,activePreset:E})})).ok&&(u(T),p(E),E&&T[E]?g({...D.current,...T[E]}):g(D.current))}finally{v(!1)}}},[e,t,n,d,f]),z=m.useCallback(async()=>{if(f){v(!0);try{const T={...d,[f]:h};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:T,activePreset:f})})).ok&&u(T)}finally{v(!1)}}},[e,t,n,d,f,h]),P=Object.keys(d);return P.length>0,k?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:f||"",onChange:T=>$(T.target.value||null),disabled:y,children:[o.jsx("option",{value:"",children:c("flow:runConfig.default")}),P.map(T=>o.jsx("option",{value:T,children:T},T))]}),o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>S(!0),disabled:y,title:c("flow:runConfig.newPreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),f&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:z,disabled:y,title:c("flow:runConfig.savePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),f&&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:T=>N(T.target.value),disabled:y}),o.jsxs("div",{className:"af-run-config-save-actions",children:[o.jsx("button",{type:"button",className:"af-btn-primary",onClick:L,disabled:y||!w.trim(),children:c(y?"common.saving":"common.save")}),o.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{S(!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(T=>{var de,ce;const E=((de=T.data)==null?void 0:de.definitionId)||"",J=E.startsWith("provide_file"),Q=E==="provide_bool",H=((ce=T.data)==null?void 0:ce.label)||T.id,te=T.id,le=h[te]||"",ue=["true","1","yes","on"].includes(String(le).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"+(J?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:J?"description":Q?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-config-input-label",children:H}),Q?null:o.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>R({instanceId:te,label:H,content:le}),"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:te}),Q?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ue?" af-run-config-bool-toggle--true":""),onClick:()=>K(te,ue?"false":"true"),"aria-pressed":ue,children:ue?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-config-input-field",value:le,onChange:fe=>K(te,fe.target.value),placeholder:c(J?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},te)})})]}),A&&Xr.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:A.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>R(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:M,className:"af-provide-edit-modal__textarea",defaultValue:A.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:()=>{!A||!M.current||(K(A.instanceId,M.current.value),R(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:()=>R(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),c("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const _I={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"]},PV={"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 AV(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function IV(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 TV(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 KN(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(_I))if(r.includes(e))return n;return"other"}function RV({event:e,defaultExpanded:t}){const[n,r]=m.useState(!!t),s=PV[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]),u=m.useCallback(f=>{f.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(f=>!f),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:IV(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:u,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 LV({open:e,onClose:t,flowId:n}){var R;const[r,s]=m.useState([]),[i,a]=m.useState(!1),[l,c]=m.useState(null),[d,u]=m.useState(null),[f,p]=m.useState(!1),[h,g]=m.useState(!0),[k,b]=m.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[y,v]=m.useState(""),w=m.useRef(null),N=m.useCallback(async()=>{a(!0);try{const M=h&&n?`?flowId=${encodeURIComponent(n)}`:"",D=await(await fetch(`/api/composer-logs${M}`)).json();s(Array.isArray(D.sessions)?D.sessions:[])}catch{s([])}finally{a(!1)}},[n,h]),C=m.useCallback(async M=>{if(!M){u(null);return}p(!0);try{const D=await(await fetch(`/api/composer-logs/${encodeURIComponent(M)}`)).json();u(D)}catch{u(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 S=m.useMemo(()=>{const M=(d==null?void 0:d.events)||[],V=y.trim().toLowerCase();return M.filter(D=>{const O=KN(D.tag,D.payload);return!k[O]&&O!=="other"?!1:V?[D.tag,JSON.stringify(D.payload||"")].join(" ").toLowerCase().includes(V):!0})},[d,k,y]),A=m.useMemo(()=>{const M=(d==null?void 0:d.events)||[],V={};for(const D of M){const O=KN(D.tag,D.payload);V[O]=(V[O]||0)+1}return V},[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:M=>g(M.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(M=>{const V=l===M.sessionId;return o.jsxs("div",{onClick:()=>c(M.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:V?"rgba(124,77,255,0.18)":"transparent",borderLeft:V?"3px solid #7c4dff":"3px solid transparent"},children:[o.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:TV(M.mtime)}),o.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:M.flowId||"(no flow)"}),M.promptPreview&&o.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:M.promptPreview}),o.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[AV(M.size)," · ",M.model||"default"]})]},M.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(_I).map(M=>o.jsxs("button",{type:"button",onClick:()=>b(V=>({...V,[M]:!V[M]})),style:{background:k[M]?"rgba(124,77,255,0.25)":"transparent",color:k[M]?"#e8deff":"#6a6a6a",border:`1px solid ${k[M]?"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:[M," ",A[M]!=null?`(${A[M]})`:""]},M)),o.jsx("input",{type:"text",placeholder:"search…",value:y,onChange:M=>v(M.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"}),f&&!d&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&S.length===0&&o.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",((R=d.events)==null?void 0:R.length)||0," total)"]}),S.map((M,V)=>o.jsx(RV,{event:M,defaultExpanded:M.tag==="error"},`${M.ts}_${V}`))]})]})]})]}):null}const OV="0.1.37";function qN(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 Cy(e,t){return t==="running"?qN(e):e==null||!Number.isFinite(e)||e<=0?"--":qN(e)}const PI=m.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function MV(e){const{setNodes:t}=bl(),{modelLists:n,onModelChange:r}=m.useContext(PI),s=m.useCallback(d=>{t(u=>u.filter(f=>f.id!==d))},[t]),i=m.useCallback(()=>{var p,h,g,k,b,y,v,w;const d=((p=e.data)==null?void 0:p.definitionId)||"",u=((h=e.data)==null?void 0:h.label)||e.id,f=((b=(k=(g=e.data)==null?void 0:g.outputs)==null?void 0:k[0])==null?void 0:b.value)||((w=(v=(y=e.data)==null?void 0:y.outputs)==null?void 0:v[0])==null?void 0:w.default)||"";window.__provideEditContent={instanceId:e.id,label:u,definitionId:d,content:f},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),a=m.useCallback((d,u)=>{t(f=>f.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((k,b)=>b===0?{...k,default:u,value:u}:k):[{type:"bool",name:"value",default:u,value:u}];return{...p,data:{...p.data,body:"",outputs:h}}}))},[t]),l=m.useCallback((d,u)=>{t(f=>f.map(p=>p.id===d?{...p,data:{...p.data,body:u}}:p))},[t]),c=m.useCallback((d,u)=>{t(f=>f.map(p=>p.id===d?{...p,data:{...p.data,images:ts(u)}}:p))},[t]);return o.jsx(xI,{...e,deleteNode:s,onProvideExpand:i,onProvideValueChange:a,onNodeBodyChange:l,onNodeImagesChange:c,modelLists:n,onModelChange:r})}const $V={[yf]:MV},Ku=["CONTROL","TOOL","PROVIDE","AGENT"],DV=1200,YN="af-flow-node--sync-flash",GN="af-flow-edge--sync-flash";function JN(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function XN(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function mb(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 FV(e){const t=mb(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function _p(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 AI(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function II(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Ey(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 QN(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 ZN(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 zV(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function BV(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 TI(e,t,n,r,s){const i=FV(e),a={id:t,type:yf,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 Yd(a,r,s)}function ej(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=Uc(i,e.sourceHandle||"output-0","source"),c=Uc(a,e.targetHandle||"input-0","target");return!l||!c?!1:Hc(l,c)}function HV(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=Uc(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:yI(a)}:null}function UV(e,t,n){var a;const r=TI(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"?Hc(n.slot,c):Hc(c,n.slot))return{slot:c,slotIndex:l,hydrated:r}}return null}function WV(e,t){return t?e.map((n,r)=>{const s=UV(n,e,t);if(!s)return null;const i=mb(n);return{def:n,order:r,category:i,categoryRank:Ku.indexOf(i),slot:s.slot,slotIndex:s.slotIndex,displayLabel:AI(s.hydrated.data||n),description:II(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 VV=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function KV(e){const t=new Set,n=[];let r;const s=new RegExp(VV.source,"g");for(;(r=s.exec(e))!==null;){const i=r[1];t.has(i)||(t.add(i),n.push(i))}return n}function tj(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 fo(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function Pp(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(fo),d=a.map(fo);return l.map(fo).includes(s)&&!c.includes(s)&&!d.includes(s)?`claude-code:${s}`:d.includes(s)&&!c.includes(s)?`opencode:${s}`:s}function qV(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function _y(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 YV({steps:e}){const{t}=pn();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:qV(s)}):null]}):null})]},n.index)})})}function GV(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 JV(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 XV(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 QV(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 nj({thread:e,liveSegments:t,running:n,className:r="",autoScroll:s=!0}){const{t:i}=pn(),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(rj,{segments:c.segments,running:!1})},`composer-a-${d}`)),o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(rj,{segments:t,running:n})})]})}function rj({segments:e,running:t=!1}){const{t:n}=pn(),r=e.filter(f=>f.kind==="assistant").map(f=>f.text).join(""),s=e.filter(f=>f.kind==="result").map(f=>f.text).join(""),i=GV(r,s),a=e.filter(f=>f.kind==="error").map(f=>f.text).join(`
|
|
131
|
-
`),l=e.filter(f=>f.kind!=="error"),c=i?l.filter(f=>f.kind!=="result"):l,d=JV(c),u=!!(d.length>0||a);return o.jsxs(o.Fragment,{children:[d.map((f,p)=>o.jsxs("section",{className:QV(f.kind),children:[o.jsx("div",{className:"af-composer-ai-block-label",children:XV(f.kind,n)}),o.jsx("div",{className:"af-composer-ai-block-body",children:f.text})]},`${f.kind}-${p}`)),t&&!u?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 ZV({fitViewEpoch:e}){const{fitView:t}=bl(),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 e7({onReady:e}){const t=TP();return m.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function sj(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}const sh=1500,ij=500,t7=262144,n7=2e3;function Py(e){return typeof e!="string"?"":e.length<=n7?e:`[log line truncated, ${e.length} chars]`}const r7=sh;function s7(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:Py(s)}}catch{return{ts:n,type:"info",text:Py(s)}}return{ts:n,type:"log",text:Py(`[${r}] ${s}`)}}function oj(e){if(!e)return[];const t=[],n=e.split(`
|
|
132
|
-
`);for(let r=n.length-1;r>=0&&t.length<r7;r--){const s=n[r];if(!s)continue;const i=s7(s);i&&t.push(i)}return t.reverse(),t}function i7(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 o7(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 a7({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:s,onEdgesChange:i,onConnect:a,onConnectStart:l,onConnectEnd:c,isValidConnection:d,onNodesDelete:u,onNodeClick:f,onNodeDoubleClick:p,onEdgeClick:h,onFlowInit:g,onDrop:k,onDragOver:b,hideMinimapAndControls:y,bottomSlot:v}){const{t:w}=pn(),N=!s,C=N||t==="pan"?!0:[1,2],S=N?!1:t==="select",A="af-flow-canvas"+(N?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),R=m.useCallback(()=>{},[]),M=m.useMemo(()=>{const V=new Map(n.map(L=>[L.id,L])),D=new Set(n.filter(L=>L.selected).map(L=>L.id)),O=D.size>0,K=(L,I)=>{const z=/^#([0-9a-f]{6})$/i.exec(L);if(!z)return L;const P=parseInt(z[1],16);return`rgba(${P>>16&255}, ${P>>8&255}, ${P&255}, ${I})`},$="#ff5169";return r.map(L=>{var pe,ve,je,Ve;const I=V.get(L.source),z=V.get(L.target),P=/^output-(\d+)$/.exec(L.sourceHandle||""),T=/^input-(\d+)$/.exec(L.targetHandle||""),E=I&&P?(ve=(pe=I.data)==null?void 0:pe.outputs)==null?void 0:ve[parseInt(P[1],10)]:null,J=z&&T?(Ve=(je=z.data)==null?void 0:je.inputs)==null?void 0:Ve[parseInt(T[1],10)]:null,Q=E!=null&&E.type?Ln(E.type):null,H=J!=null&&J.type?Ln(J.type):null,te=Q&&H&&Q!==H,le=O&&(D.has(L.source)||D.has(L.target)),ue=L.style||{};if(te){const at=L.selected?.95:le?.85:.78,Je=K($,at);return{...L,className:((L.className||"")+" af-flow-edge--type-mismatch"+(le?" af-flow-edge--adjacent":"")).trim(),style:{...ue,stroke:Je,strokeWidth:le?2.75:2.5,strokeDasharray:"6 4"},markerEnd:L.markerEnd&&typeof L.markerEnd=="object"?{...L.markerEnd,color:Je}:{type:os.ArrowClosed,color:Je}}}const de=Q||H;if(!de)return le?{...L,className:((L.className||"")+" af-flow-edge--adjacent").trim(),style:{...ue,strokeWidth:2.5}}:L;const ce=le||L.selected?.7:.38,fe=K(de,ce),se=le?2.5:ue.strokeWidth??2;return{...L,className:((L.className||"")+(le?" af-flow-edge--adjacent":"")).trim(),style:{...ue,stroke:fe,strokeWidth:se},markerEnd:L.markerEnd&&typeof L.markerEnd=="object"?{...L.markerEnd,color:fe}:{type:os.ArrowClosed,color:fe}}})},[n,r]);return o.jsxs(IP,{className:A,nodes:n,edges:M,onNodesChange:s||R,onEdgesChange:i||R,onConnect:N?void 0:a,onConnectStart:N?void 0:l,onConnectEnd:N?void 0:c,isValidConnection:N?void 0:d,onNodesDelete:N?void 0:u,onNodeClick:f,onNodeDoubleClick:N?void 0:p,onEdgeClick:N?void 0:h,onInit:g,onDrop:N?void 0:k,onDragOver:N?void 0:b,nodeTypes:$V,selectionOnDrag:S,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(MP,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),o.jsx(zc,{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(g4,{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:V=>{var O;const D=(((O=V.data)==null?void 0:O.schemaType)??"agent").toLowerCase();return D==="control"?"rgba(237, 108, 2, 0.85)":D==="provide"?"rgba(0, 228, 117, 0.35)":D==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),o.jsx("div",{className:"af-flow-bottom-unified__center",children:v}),y?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:o.jsx(r4,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!y&&o.jsx(zc,{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:V,color:D})=>o.jsxs("span",{className:"af-pin-legend__item",children:[o.jsx("span",{className:"af-pin-legend__dot",style:{background:D}}),o.jsx("span",{className:"af-pin-legend__label",children:V})]},V))}),o.jsx(ZV,{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 aj(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 l7(e){return e==="builtin"?"workspace":e??"user"}function Wl(e,t){return t(e==="builtin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}const RI="af:run-console-height",dd=230,Ru={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},Ap={};function ih(e){if(!Number.isFinite(e))return dd;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function c7(){try{const e=localStorage.getItem(RI);if(e==null)return dd;const t=parseInt(e,10);return Number.isFinite(t)?ih(t):dd}catch{return dd}}function u7(){var n0,r0;const{t:e,i18n:t}=pn(),{navigate:n,path:r}=vl(),s=m.useRef(null),i=m.useCallback(x=>{s.current=typeof x=="function"?x:null},[]),[a,l]=m.useState([]),[c,d]=m.useState(""),[u,f]=m.useState(null),[p,h]=m.useState(0),[g,k]=m.useState(""),[b,y]=m.useState(""),[v,w]=m.useState(""),[N,C]=m.useState(""),[S,A]=m.useState(!1),[R,M]=m.useState(""),[V,D]=m.useState(!1),[O,K]=m.useState(""),[$,L]=m.useState(!1),[I,z]=m.useState(!1),[P,T]=m.useState(!1),[E,J]=m.useState(null),[Q,H]=m.useState(!1),[te,le]=m.useState(!1),ue=m.useRef(!1),[de,ce]=m.useState([]),[fe,se]=m.useState(""),[pe,ve]=m.useState("nodes"),je=m.useRef(null),[Ve,at]=m.useState([]),[Je,jt]=m.useState(!1),[De,Ce]=m.useState(""),[Jt,Bn]=m.useState(!1),[Xt,_n]=m.useState({name:"",id:"",description:""}),[Nr,ur]=m.useState(!1),[oe,we]=m.useState(""),[Ge,st]=m.useState(""),et=m.useRef(null),[It,On]=m.useState([]),[Mt,Mn]=m.useState(!1),[Qt,Zt]=m.useState(""),[sr,he]=m.useState(""),[Te,rn]=m.useState(null),[lt,vn]=m.useState(null),[Vs,Pn]=m.useState([]),[jr,dr]=m.useState(""),[Hr,Ks]=m.useState(!1),Po=m.useCallback(x=>{et.current&&window.clearTimeout(et.current),st(x),et.current=window.setTimeout(()=>{st(""),et.current=null},3800)},[]),Cr=m.useCallback(x=>{const j=String(x||"").trim();j&&window.requestAnimationFrame(()=>{var F;(F=s.current)==null||F.call(s,j)})},[]);m.useEffect(()=>()=>{et.current&&window.clearTimeout(et.current)},[]);const[Xn,Ps]=m.useState(!1),[Xe,Vt]=m.useState({files:[]}),[sn,us]=m.useState(!1),[Ke,Hn]=m.useState(!0);m.useEffect(()=>{let x=!1;const j=()=>{fetch("/api/flows",{method:"HEAD"}).then(U=>{x||Hn(U.ok)}).catch(()=>{x||Hn(!1)})};j();const F=window.setInterval(j,5e3);return()=>{x=!0,window.clearInterval(F)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/dev-info").then(j=>j.json()).then(j=>{x||ke(!!(j!=null&&j.isDev))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{u!=null&&u.id&&$E(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[Re,Ft]=m.useState("edit"),[As,ft]=m.useState([]),Ur=m.useRef(0),[fr,on]=m.useState(new Set),[ds,Un]=m.useState({}),[fs,pr]=m.useState(null),[qs,Er]=m.useState(0),[ps,hs]=m.useState(!1),[q,ke]=m.useState(!1),[Me,qe]=m.useState(!1),[vt,An]=m.useState(c7),$t=m.useRef({active:!1,pointerId:-1,startY:0,startH:dd}),[bt,en]=m.useState(null),[Ys,Or]=m.useState(null),[Gs,Js]=m.useState({}),hr=m.useRef(Gs);m.useEffect(()=>{hr.current=Gs},[Gs]);const[Pa,ir]=m.useState(!1),[Aa,Wr]=m.useState(!1),[Ao,it]=m.useState({}),[Qn,Qi]=m.useState({}),[Ia,mr]=m.useState(null),[In,$n]=m.useState(Ru),[Sf,Nf]=m.useState(!1),[Xs,nu]=m.useState(!1),[Ta,Io]=m.useState(""),[Qs,Sl]=m.useState(""),[zt,Nl]=m.useState(Ap),[bn,To]=m.useState(null),Zi=m.useRef(0),Zs=m.useRef(null),Ra=m.useRef(null),jl=m.useRef(!0),Ro=m.useRef(!1),[Dn,La]=m.useState(null),[Lo,Oa]=m.useState(null),[ru,eo]=m.useState(!1),[Ct,Oo]=m.useState(""),[su,Mo]=m.useState(!1),eg=m.useRef(null),[ms,to]=m.useState(null),[$o,Ma]=m.useState(!1),[iu,Cl]=m.useState(null),[ei,Wn]=m.useState(!1),[ti,El]=m.useState(null),$a=m.useRef(null),[gr,Do]=m.useState(""),[Da,ni]=m.useState(0),[Fa,za]=m.useState(0),[tg,Si]=m.useState("pan"),[_l,Is]=m.useState(!1),[Fo,Ts]=m.useState(!1),ou=m.useRef(null),au=m.useRef(null),Ba=m.useRef(null),[ng,rg]=m.useState(0),[mt,Pl]=m.useState(null),[sg,Al]=m.useState(""),[ut,Il]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[no,jf]=m.useState(""),[lu,ig]=m.useState(""),[Rs,og]=m.useState([]),[Ni,Vn]=m.useState([]),[Cf,Ef]=m.useState(!1),[Tl,_f]=m.useState([]),[cu,_]=m.useState(!1),[B,G]=m.useState(()=>new Set),[X,Z]=m.useState(!1),re=m.useRef(null),ae=m.useRef(null),[me,xe]=m.useState({}),_e=m.useCallback(x=>{if(!x)return null;const j=x.id,F=x.source??"user",U=x.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${j}:${F}${U?":"+U:""}`,activeKey:`af:composer-active-session:${j}:${F}${U?":"+U:""}`}},[]),pt=m.useCallback(x=>{if(!x)return"";const j=x.id,F=x.source??"user",U=x.archived?"archived":"";return`af:composer-skills:pipeline:${j}:${F}${U?":"+U:""}`},[]),Bt=m.useCallback(x=>{const j=_e(x);if(!j)return{sessions:[],activeSessionId:null};try{const F=localStorage.getItem(j.sessionsKey);if(!F)return{sessions:[],activeSessionId:null};const U=JSON.parse(F);if(!Array.isArray(U))return{sessions:[],activeSessionId:null};const W=U.filter(ee=>ee&&typeof ee.id=="string").map(ee=>({...ee,running:!1,statusLine:ee.running?e("flow:composer.pageRefreshReset"):ee.statusLine,steps:[]}));let Y=null;try{Y=localStorage.getItem(j.activeKey),Y&&!W.some(ee=>ee.id===Y)&&(Y=null)}catch{Y=null}return{sessions:W,activeSessionId:Y}}catch{return{sessions:[],activeSessionId:null}}},[_e]),tt=m.useCallback((x,j,F)=>{const U=_e(x);if(U)try{localStorage.setItem(U.sessionsKey,JSON.stringify(j)),F?localStorage.setItem(U.activeKey,F):localStorage.removeItem(U.activeKey)}catch{}},[_e]),Dt=m.useRef(0),hn=m.useRef({sessions:[],activeSessionId:null,flowKey:null}),[Ht,an]=m.useState([]),[Qe,kt]=m.useState(null),Pe=m.useMemo(()=>pt(u),[pt,u]),[ht,Ls]=m.useState(""),Ee=m.useMemo(()=>{if(!u)return null;const x=u.id,j=u.source??"user",F=u.archived?"archived":"";return`${x}:${j}${F?":"+F:""}`},[u]),yt=m.useRef(!1);m.useEffect(()=>{if(!Ee){an([]),kt(null),hn.current={sessions:[],activeSessionId:null,flowKey:null};return}const x=hn.current;if(x.flowKey===Ee)return;x.flowKey=Ee,yt.current&&x.sessions.length>0&&tt(u,x.sessions,x.activeSessionId);const{sessions:j,activeSessionId:F}=Bt(u);if(j.length===0){const U=`session-1-${Date.now()}`,W={id:U,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};x.sessions=[W],x.activeSessionId=U,an([W]),kt(U)}else{const U=j[j.length-1];if(U&&(!U.thread||U.thread.length===0))Dt.current=_y(j),x.sessions=j,x.activeSessionId=U.id,an(j),kt(U.id);else{const Y=_y(j)+1;Dt.current=Y;const ee=`session-${Y}-${Date.now()}`,ne={id:ee,label:e("flow:composer.conversationLabel",{n:Y}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},ge=[...j,ne];x.sessions=ge,x.activeSessionId=ee,an(ge),kt(ee)}}yt.current=!0},[Ee,u,Bt,tt]);const Ue=m.useMemo(()=>Ht.find(x=>x.id===Qe)||null,[Ht,Qe]),Fe=(Ue==null?void 0:Ue.running)??!1,Le=(Ue==null?void 0:Ue.statusLine)??"",St=(Ue==null?void 0:Ue.segments)??[],Kt=(Ue==null?void 0:Ue.thread)??[],Et=(Ue==null?void 0:Ue.steps)??[];Ue==null||Ue.outputDismissed;const Ae=(Ue==null?void 0:Ue.phaseContext)??null,Ut=m.useRef([]),[Yt,Zn]=m.useState(!1),ji=m.useRef(null),ro=m.useRef(null);m.useEffect(()=>{const x=ro.current;x&&requestAnimationFrame(()=>{x.scrollTop=x.scrollHeight})},[Kt,St]);const so=m.useRef(null),ri=m.useRef(!1),ag=m.useRef(null),Pf=m.useCallback(x=>{const j=++Dt.current,F=`session-${j}-${Date.now()}`,U={id:F,label:x||e("flow:composer.conversationLabel",{n:j}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return an(W=>[...W,U]),kt(F),F},[]);m.useEffect(()=>{!u||!yt.current||(hn.current.sessions=Ht,hn.current.activeSessionId=Qe,tt(u,Ht,Qe))},[Ht,Qe,u,tt]),m.useEffect(()=>{Dt.current=Math.max(Dt.current,_y(Ht))},[Ht]);const Pb=m.useCallback(x=>{var j;so.current===x&&((j=ji.current)==null||j.abort()),an(F=>{const U=F.filter(Y=>Y.id!==x);if(F.some((Y,ee)=>Y.id===x&&F.findIndex(ne=>ne.id===Qe)===ee)||Qe===x){const Y=U;Y.length>0?kt(Y[Y.length-1].id):setTimeout(()=>{Dt.current=0;const ee=++Dt.current,ne=`session-${ee}-${Date.now()}`,ge={id:ne,label:e("flow:composer.conversationLabel",{n:ee}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};an(ye=>[...ye,ge]),kt(ne)},0)}return U})},[Qe]),Vr=m.useCallback(x=>{an(j=>{const F=j.findIndex(Y=>Y.id===Qe);if(F<0)return j;const U={...j[F]};x(U);const W=[...j];return W[F]=U,W})},[Qe]),Ab=m.useCallback(x=>{Vr(j=>{j.running=x})},[Vr]),Ci=m.useCallback(x=>{Vr(j=>{j.statusLine=x})},[Vr]),Ei=m.useCallback(x=>{Vr(j=>{typeof x=="function"?j.segments=x(j.segments):j.segments=x})},[Vr]),Ib=m.useCallback(x=>{Vr(j=>{typeof x=="function"?j.thread=x(j.thread):j.thread=x})},[Vr]),uu=m.useCallback(x=>{Vr(j=>{typeof x=="function"?j.steps=x(j.steps):j.steps=x})},[Vr]),Tb=m.useCallback(x=>{Vr(j=>{j.outputDismissed=x})},[Vr]),du=m.useCallback(x=>{Vr(j=>{j.phaseContext=typeof x=="function"?x(j.phaseContext):x})},[Vr]),Rb=m.useCallback(x=>{kt(x),an(j=>{const F=j.findIndex(W=>W.id===x);if(F<0||!j[F].outputDismissed)return j;const U=[...j];return U[F]={...j[F],outputDismissed:!1},U})},[]);m.useEffect(()=>{Ut.current=St},[St]);const yr=m.useRef({}),Lb=m.useRef(!1),Ha=m.useRef(null),zo=m.useRef(null),Rl=m.useRef(!1),lg=m.useRef(0),Af=m.useRef(""),[Pt,gt,NT]=RP([]),[mn,tn,jT]=LP([]),_i=m.useRef(Pt),Ll=m.useRef(mn),Ob=m.useRef(null),cg=m.useRef(null),Mb=m.useRef(null),If=m.useRef(null),[Kr,io]=m.useState(null),CT=m.useCallback(x=>{var j;yr.current=(j=x==null?void 0:x.extra)!=null&&j.instances&&typeof x.extra.instances=="object"?x.extra.instances:{},gt(Array.isArray(x==null?void 0:x.nodes)?x.nodes:[]),tn(Array.isArray(x==null?void 0:x.edges)?x.edges:[]),io(null)},[tn,gt]),ET=m.useMemo(()=>({instances:yr.current}),[mn,Pt]),{resetHistory:$b,undo:Db,redo:Fb}=gI({nodes:Pt,edges:mn,extra:ET,enabled:!!u&&Rl.current&&Re==="edit",onRestore:CT}),si=m.useMemo(()=>Pt.filter(x=>{var j;return(((j=x.data)==null?void 0:j.definitionId)||"").startsWith("provide_")}),[Pt]),Ol=m.useMemo(()=>{var j;const x={};for(const F of Pt){if(!((j=F.data)!=null&&j.inputs))continue;const U=F.data.inputs;for(let W=0;W<U.length;W++){const Y=U[W];if(!(Y!=null&&Y.name))continue;const ee=mn.find(ge=>ge.target===F.id&&ge.targetHandle===`input-${W}`);if(!(ee!=null&&ee.source))continue;si.find(ge=>ge.id===ee.source)&&(x[ee.source]=Y.name)}}return x},[Pt,mn,si]),fu=m.useMemo(()=>{if(Re==="edit"||fr.size===0)return null;const x=new Set(fr);for(const j of mn)fr.has(j.source)&&x.add(j.target),fr.has(j.target)&&x.add(j.source);return x},[Re,fr,mn]),_T=m.useMemo(()=>Re==="edit"?Pt:Pt.map(x=>{var j,F;return{...x,draggable:!1,connectable:!1,data:{...x.data,isRunMode:!0,isExecuting:fr.has(x.id),nodeStatus:((j=ds[x.id])==null?void 0:j.status)??null,nodeElapsed:((F=ds[x.id])==null?void 0:F.elapsed)??null,isDim:fu?!fu.has(x.id):!1}}}),[Re,Pt,fr,ds,fu]),PT=m.useMemo(()=>fu?mn.map(x=>{const j=fr.has(x.source)||fr.has(x.target),F=x.className?x.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",U=j?"af-flow-edge--focus":"af-flow-edge--dim";return{...x,className:(F?F+" ":"")+U}}):mn,[mn,fr,fu]);m.useEffect(()=>{if(!u){Qi({}),mr(null),$n(Ru),Nl(Ap),To(null),Io(""),Sl("");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(j=>j.json()).then(j=>{Qi(j.presets||{}),mr(j.activePreset||null)}).catch(()=>{Qi({}),mr(null)})},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const Bo=m.useCallback(x=>{Zi.current+=1,$n(x)},[]),Ho=m.useCallback(async(x,j={})=>{if(!x)return;const F=!!j.quiet,U=!!j.force,W=Zi.current;F||(Nf(!0),Io(""),Sl(""));const Y=new URLSearchParams({flowId:x.id,flowSource:x.source||"user"});x.archived&&Y.set("archived","1");try{const ee=await fetch(`/api/flow/schedule?${Y.toString()}`),ne=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(ne.error||`HTTP ${ee.status}`);if(!U&&Zi.current!==W)return;$n({...Ru,...ne.schedule||{}}),Nl(ne.state&&typeof ne.state=="object"?ne.state:Ap),To(ne.status||null)}catch(ee){if(!U&&Zi.current!==W)return;$n(Ru),Nl(Ap),To(null),Io(String(ee.message||ee))}finally{Nf(!1)}},[]);m.useEffect(()=>{if(!u)return;let x=!1;return(async()=>{await Ho(u)})(),()=>{x=!0}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,Ho]),m.useEffect(()=>{var F,U,W,Y;if(!Ia||!Qn[Ia]||si.length===0)return;const x=Qn[Ia],j={};for(const ee of si){const ne=Ol[ee.id];if(!ne)continue;const ge=((F=ee.data)==null?void 0:F.definitionId)||"",ye=x[ee.id]??((Y=(W=(U=ee.data)==null?void 0:U.outputs)==null?void 0:W[0])==null?void 0:Y.default)??"";ge.startsWith("provide_file")?j[ne]={type:"file",path:ye}:j[ne]={type:"str",value:ye}}Object.keys(j).length>0&&Js(j)},[Ia,Qn,si,Ol]);const AT=m.useCallback(()=>{if(!ti||!$a.current)return;const x=$a.current.value;gt(j=>j.map(F=>{var U,W;return F.id!==ti.instanceId?F:{...F,data:{...F.data,outputs:((W=(U=F.data)==null?void 0:U.outputs)==null?void 0:W.map((Y,ee)=>ee===0?{...Y,default:x}:Y))||[{type:"text",name:"value",default:x}]}}})),El(null)},[ti,gt]),nt=m.useMemo(()=>{const x=Pt.filter(j=>j.selected);return x.length===1?x[0]:null},[Pt]),Pi=m.useMemo(()=>u?LW(Pt,mn,e):[],[u,Pt,mn,e]),IT=m.useMemo(()=>Pi.map(x=>x.key).join("|"),[Pi]),zb=m.useMemo(()=>Pi.some(x=>String((x==null?void 0:x.level)||"warning").toLowerCase()==="error"),[Pi]);m.useLayoutEffect(()=>{H(Pi.length>0&&!zb)},[IT,u==null?void 0:u.id,u==null?void 0:u.source,Pi.length,zb]),Ba.current=nt,m.useEffect(()=>{_i.current=Pt},[Pt]),m.useEffect(()=>{Ll.current=mn},[mn]),m.useEffect(()=>{Mb.current=Kr},[Kr]),m.useEffect(()=>{if(!Kr)return;const x=F=>{F.key==="Escape"&&io(null)},j=F=>{var U,W;(W=(U=F.target)==null?void 0:U.closest)!=null&&W.call(U,".af-connect-node-menu")||io(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",j),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",j)}},[Kr]),m.useEffect(()=>()=>{zo.current!=null&&(clearTimeout(zo.current),zo.current=null)},[]);const ug=m.useMemo(()=>{var j;if(!nt)return null;const x=(j=nt.data)==null?void 0:j.definitionId;return de.find(F=>F.id===x)??null},[nt,de]),dg=m.useMemo(()=>{const x={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const j of de){const F=mb(j);x[F].push(j)}for(const j of Ku)x[j].sort((F,U)=>F.id.localeCompare(U.id));return x},[de]),Tf=m.useMemo(()=>{const x=fe.trim().toLowerCase();if(!x)return dg;const j={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const F of Ku)j[F]=dg[F].filter(U=>BV(U,x));return j},[dg,fe]),TT=m.useMemo(()=>Ku.reduce((x,j)=>x+Tf[j].length,0),[Tf]),Rf=m.useMemo(()=>de.filter(x=>{const j=String(x.id??""),F=String(x.source??"");return j.startsWith("marketplace:")||F==="marketplace"||F==="collection"}),[de]),Bb=m.useMemo(()=>{const x=new Set;for(const j of Rf){const F=String(j.id??"");if(F&&(x.add(F),F.startsWith("marketplace:"))){const U=F.slice(12),[W]=U.split("@");W&&x.add(`marketplace:${W}`)}}return x},[Rf]),Lf=m.useCallback(async()=>{d("");try{const x=await fetch("/api/flows");if(!x.ok)throw new Error("HTTP "+x.status);l(await x.json())}catch(x){d(String(x.message||x))}},[]);m.useEffect(()=>{Lf()},[Lf]),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 j=()=>{fetch("/api/model-lists").then(U=>U.json()).then(U=>{x||Il({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(()=>{})};j();const F=setTimeout(j,4e3);return()=>{x=!0,clearTimeout(F)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skills").then(j=>j.json()).then(j=>{if(x)return;const F=Array.isArray(j.skills)?j.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):""})):[];og(F),Ef(!0)}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skill-collections").then(j=>j.json()).then(j=>{x||(_f(pa(j)),_(!0))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{if(Ls(""),!(!Cf||!cu)){if(!Pe){Vn([]);return}Vn(BE(Pe,"pipeline",Rs,Tl)),Ls(Pe)}},[Tl,cu,Rs,Cf,Pe]),m.useEffect(()=>{if(!(ht!==Pe||!Pe))try{localStorage.setItem(Pe,JSON.stringify(Ni))}catch{}},[Ni,Pe,ht]);const Hb=m.useCallback(async x=>{const j=x.source??"user",F=!!x.archived,U=new URLSearchParams({flowId:x.id,flowSource:j});F&&U.set("archived","1");const W=new URLSearchParams({flowId:x.id,flowSource:j});F&&W.set("archived","1"),W.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[Y,ee]=await Promise.all([fetch("/api/flow?"+U.toString()),fetch("/api/nodes?"+W.toString())]),ne=await Y.json();if(!Y.ok||ne.error)throw new Error(ne.error||e("flow:nodePropsError.loadFlowFailed"));const ge=await ee.json();if(!ee.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const ye=Array.isArray(ge)?ge:Array.isArray(ge==null?void 0:ge.nodes)?ge.nodes:[],$e=!Array.isArray(ge)&&(ge==null?void 0:ge.pipelineTranslations)||{},ie=IW(ne.flowYaml||"");if(ie.error)throw new Error(ie.error);const Ie={...ie.instances||{}},be=ie.nodes.map(ln=>Yd(ln,Ie,ye,$e,x.id)),rt=mI(ie.edges,be);return{flowSource:j,paletteList:ye,instances:Ie,flowDescriptionText:ie.description??"",nodes:be,edges:rt}},[t.language,e]),Os=m.useCallback(async(x,j={})=>{const F=!!j.preserveComposer,U=F&&!!j.incrementalSync;Rl.current=!1,lg.current+=1,f(x),y(""),F||(w(""),se(""),vn(null),k(""),M(""),K(""),Do(""),Ib([]),Ei([]),uu([]),Tb(!1),du(null),Si("pan")),U||(yr.current={},gt([]),tn([])),aj(x);try{const W=await Hb(x);if(ce(W.paletteList),yr.current=W.instances,k(W.flowDescriptionText),M(x.id||""),U){const Y=_i.current,ee=Ll.current;try{const ne=l9(Y,ee,W.nodes,W.edges),ge=new Set([...ne.changes.addedNodeIds,...ne.changes.updatedNodeIds]),ye=new Set([...ne.changes.addedEdgeKeys,...ne.changes.updatedEdgeKeys]),$e=ge.size>0?ne.nodes.map(Ie=>ge.has(Ie.id)?{...Ie,className:JN(Ie.className,YN)}:Ie):ne.nodes,ie=ye.size>0?ne.edges.map(Ie=>ye.has(Ud(Ie))?{...Ie,className:JN(Ie.className,GN)}:Ie):ne.edges;gt($e),tn(ie),zo.current!=null&&(clearTimeout(zo.current),zo.current=null),(ge.size>0||ye.size>0)&&(zo.current=window.setTimeout(()=>{zo.current=null,ge.size>0&>(Ie=>Ie.map(be=>{if(!ge.has(be.id))return be;const rt=XN(be.className,YN);return rt===String(be.className||"")?be:{...be,className:rt}})),ye.size>0&&tn(Ie=>Ie.map(be=>{if(!ye.has(Ud(be)))return be;const rt=XN(be.className,GN);return rt===String(be.className||"")?be:{...be,className:rt}}))},DV))}catch{gt(W.nodes),tn(W.edges)}}else gt(W.nodes),tn(W.edges),h(Y=>Y+1);up(x.id,W.flowSource),rg(Y=>Y+1),$b(W.nodes,W.edges,{instances:W.instances});try{Af.current=IN(W.nodes,W.edges,W.instances,{description:W.flowDescriptionText})}catch{Af.current=""}Rl.current=!0}catch(W){y(String(W.message||W))}},[Hb,$b,gt,tn]),Of=m.useCallback(async()=>{if(!(u!=null&&u.id))return;const x=u.source??"user",j=new URLSearchParams({flowId:u.id,flowSource:x});u.archived&&j.set("archived","1"),j.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const F=await fetch("/api/nodes?"+j.toString()),U=await F.json();if(!F.ok)throw new Error((U==null?void 0:U.error)||e("flow:nodePropsError.loadNodesFailed"));const W=Array.isArray(U)?U:Array.isArray(U==null?void 0:U.nodes)?U.nodes:[];ce(W)},[u,e,t.language]),fg=m.useCallback(async()=>{Mn(!0),Zt("");try{const x=await fetch("/api/marketplace/nodes"),j=await x.json().catch(()=>({}));if(!x.ok)throw new Error((j==null?void 0:j.error)||"Failed to load marketplace nodes");On(Array.isArray(j==null?void 0:j.nodes)?j.nodes:[])}catch(x){Zt(String(x.message||x)),On([])}finally{Mn(!1)}},[]),Mf=m.useCallback(async()=>{jt(!0),Ce("");try{const x=await fetch("/api/marketplace/flow-snippets"),j=await x.json().catch(()=>({}));if(!x.ok)throw new Error((j==null?void 0:j.error)||"Failed to load flow snippets");at(Array.isArray(j==null?void 0:j.snippets)?j.snippets:[])}catch(x){Ce(String(x.message||x)),at([])}finally{jt(!1)}},[]);m.useEffect(()=>{u&&(fg(),Mf())},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,fg,Mf]);const RT=m.useCallback(async x=>{if(!u||!x)return;const j=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`;if(j){he(j),Zt("");try{const F=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:j})}),U=await F.json().catch(()=>({}));if(!F.ok||(U==null?void 0:U.ok)===!1)throw new Error((U==null?void 0:U.error)||"Failed to install marketplace node");await Of()}catch(F){Zt(String(F.message||F))}finally{he("")}}},[u,Of]),LT=m.useCallback(async(x,j)=>{const F={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:j,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(F)}),W=await U.json();if(!U.ok||(W==null?void 0:W.ok)===!1)throw new Error((W==null?void 0:W.error)||"Publish failed");return await Of(),W},[Of,u]),Ub=m.useCallback(async()=>{var U;if(!u||ue.current)return;const x=u.id,j=u.source??"user",F=((U=Ba.current)==null?void 0:U.id)??null;ue.current=!0,le(!0);try{await Os({id:x,source:j,archived:u.archived},{preserveComposer:!0,incrementalSync:!0}),F&>(W=>W.map(Y=>({...Y,selected:Y.id===F})))}finally{ue.current=!1,le(!1)}},[u,u==null?void 0:u.archived,Os,gt]);m.useEffect(()=>{if(Lb.current||a.length===0)return;const x=new URLSearchParams(window.location.search),j=x.get("flowId");if(!j)return;const F=x.get("flowSource")??"user",U=x.get("flowArchived")==="1",W=a.find(Y=>Y.id===j&&(Y.source??"user")===F&&!!Y.archived===U);W&&(Lb.current=!0,Os(W))},[a,Os]);const $f=m.useRef(0);m.useEffect(()=>{if(!u)return;const x=u.id,j=u.source??"user",F=!!u.archived;$f.current=0;let U=!1;const W=async()=>{var ne;if(U)return;const ee=new URLSearchParams({flowId:x,flowSource:j,v:String($f.current)});F&&ee.set("archived","1");try{const ge=await fetch("/api/flow-editor-sync-poll?"+ee.toString());if(!ge.ok||U)return;const ye=await ge.json();if(U)return;if(ye.changed){$f.current=ye.version;const $e=((ne=Ba.current)==null?void 0:ne.id)??null;await Os({id:x,source:j,archived:F},{preserveComposer:!0,incrementalSync:!0}),await Ho({id:x,source:j,archived:F},{quiet:!0,force:!0}),$e&>(ie=>ie.map(Ie=>({...Ie,selected:Ie.id===$e})))}else $f.current=ye.version}catch{}},Y=window.setInterval(W,2e3);return W(),()=>{U=!0,window.clearInterval(Y)}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,Os,Ho,gt]);const OT=m.useMemo(()=>v?v.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":v===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[v]);m.useEffect(()=>{if(!v)return;v===e("flow:status.saved")||v.startsWith(e("flow:status.runInTerminal"));const x=v.startsWith(e("flow:status.runInTerminal"))?5200:2800,j=window.setTimeout(()=>w(""),x);return()=>clearTimeout(j)},[v,e]),m.useEffect(()=>{C("")},[u==null?void 0:u.id,u==null?void 0:u.source]),m.useEffect(()=>{const x=()=>{window.__provideEditContent&&(El(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",x),()=>window.removeEventListener("provide-expand",x)},[]),m.useEffect(()=>{var ne,ge,ye,$e,ie,Ie,be;if(!nt){Pl(null);return}const x=yr.current[nt.id]||{},{inputs:j,outputs:F}=hI(nt),U=String(((ne=nt.data)==null?void 0:ne.definitionId)??nt.id??""),W=((ge=nt.data)==null?void 0:ge.script)!=null?String(nt.data.script):void 0,Y=x.script!=null?String(x.script):void 0,ee=U==="tool_nodejs"||W&&W.trim()!==""||Y&&Y.trim()!==""?String(W??Y??""):"";Pl({id:nt.id,newId:nt.id,label:String(((ye=nt.data)==null?void 0:ye.label)??nt.id),role:(($e=nt.data)==null?void 0:$e.role)??"普通",model:String(((ie=nt.data)==null?void 0:ie.model)??x.model??""),body:String(((Ie=nt.data)==null?void 0:Ie.body)??x.body??""),images:ts(((be=nt.data)==null?void 0:be.images)??x.images),script:ee,inputs:j,outputs:F})},[nt==null?void 0:nt.id,ng]),m.useEffect(()=>{u&&(nt||(au.current=null,vn(x=>x==="node"?null:x)))},[u,nt==null?void 0:nt.id]);const Df=m.useCallback(()=>{au.current=null,vn(x=>x==="settings"||x==="history"?x:"node")},[]),MT=m.useCallback((x,j)=>{x.metaKey||x.ctrlKey||x.shiftKey||Re!=="edit"&&Or((j==null?void 0:j.id)??null)},[Re]),$T=m.useCallback((x,j)=>{Re==="edit"&&(x.preventDefault(),gt(F=>F.map(U=>({...U,selected:U.id===j.id}))),tn(F=>F.map(U=>({...U,selected:!1}))),Df())},[Df,Re,tn,gt]),DT=m.useCallback((x,j)=>{if(Re!=="edit")return;const F=x.metaKey||x.ctrlKey||x.shiftKey;tn(U=>U.map(W=>W.id===j.id?{...W,selected:!W.selected||!F}:F?W:{...W,selected:!1})),F||gt(U=>U.map(W=>({...W,selected:!1})))},[Re,tn,gt]),FT=m.useCallback(x=>ej(x,_i.current),[]),zT=m.useCallback(x=>{if(!ej(x,_i.current)){w("端口类型不匹配,已取消连线");return}io(null),gt(j=>Zh(j,x)),tn(j=>{const F=j.filter(U=>!(U.target===x.target&&U.targetHandle===x.targetHandle));return zd({...x,markerEnd:{type:os.ArrowClosed}},F)})},[tn,gt]),BT=m.useCallback((x,j)=>{cg.current=HV(j,_i.current),io(null)},[]),HT=m.useCallback((x,j)=>{var be,rt,ln,Gt;const F=cg.current;if(cg.current=null,!u||!F||j!=null&&j.toNode)return;const U=WV(de,F);if(U.length===0){w(`没有匹配 ${F.slotType} 端口的节点`);return}const W=((rt=(be=x==null?void 0:x.changedTouches)==null?void 0:be[0])==null?void 0:rt.clientX)??(x==null?void 0:x.clientX),Y=((Gt=(ln=x==null?void 0:x.changedTouches)==null?void 0:ln[0])==null?void 0:Gt.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(W)||!Number.isFinite(Y))return;const ee=Ha.current,ne=document.querySelector(".af-pipeline-flow .react-flow");if(!ee||!ne)return;const ge=ne.getBoundingClientRect(),ye=320,$e=Math.min(440,104+U.length*58),ie=Math.max(12,Math.min(W-ge.left,ge.width-ye-12)),Ie=Math.max(12,Math.min(Y-ge.top,ge.height-$e-12));io({left:ie,top:Ie,flowPosition:ee.screenToFlowPosition({x:W,y:Y}),draft:F,candidates:U,query:""})},[de,u]),UT=m.useCallback(x=>{for(const j of x)delete yr.current[j.id]},[]),WT=m.useCallback(x=>{Ha.current=x},[]),VT=m.useCallback(x=>{gt(F=>F.map(U=>({...U,selected:U.id===x}))),tn(F=>F.map(U=>({...U,selected:!1}))),Df();const j=()=>{var ge,ye,$e;const F=Ha.current;if(!(F!=null&&F.getNode))return;const U=F.getNode(x);if(!U)return;const W=(ge=F.getInternalNode)==null?void 0:ge.call(F,x),Y=((ye=W==null?void 0:W.measured)==null?void 0:ye.width)??(W==null?void 0:W.width)??U.width??200,ee=(($e=W==null?void 0:W.measured)==null?void 0:$e.height)??(W==null?void 0:W.height)??U.height??88,{zoom:ne}=F.getViewport();F.setCenter(U.position.x+Y/2,U.position.y+ee/2,{zoom:sj(ne),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(j))},[gt,tn,Df]),KT=m.useCallback(x=>{gt(F=>F.map(U=>({...U,selected:U.id===x}))),tn(F=>F.map(U=>({...U,selected:!1})));const j=()=>{var ye,$e,ie;const F=Ha.current;if(!(F!=null&&F.getNode))return;const U=F.getNode(x);if(!U)return;const W=(ye=F.getInternalNode)==null?void 0:ye.call(F,x),Y=(($e=W==null?void 0:W.measured)==null?void 0:$e.width)??(W==null?void 0:W.width)??U.width??200,ee=((ie=W==null?void 0:W.measured)==null?void 0:ie.height)??(W==null?void 0:W.height)??U.height??88,{zoom:ne}=F.getViewport(),ge=sj(ne);F.setCenter(U.position.x+Y/2,U.position.y+ee/2,{zoom:ge,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(j))},[gt,tn]),Ml=m.useCallback((x,j)=>{const F=`node-${Date.now()}`;return TI(x,F,j,yr.current,de)},[de]),Wb=m.useCallback(x=>{if(!u||!x)return;let j={x:180,y:160};const F=Ha.current,U=document.querySelector(".af-pipeline-flow .react-flow");if(F&&U){const W=U.getBoundingClientRect();j=F.screenToFlowPosition({x:W.left+W.width*.45,y:W.top+W.height*.38})}gt(W=>[...W,Ml(x,j)])},[u,gt,Ml]),qT=m.useCallback(x=>{const j=Mb.current;if(!u||!j||!(x!=null&&x.def))return;const F=Ml(x.def,j.flowPosition),U=j.draft.handleType==="source"?{source:j.draft.nodeId,sourceHandle:j.draft.handleId,target:F.id,targetHandle:`input-${x.slotIndex}`}:{source:F.id,sourceHandle:`output-${x.slotIndex}`,target:j.draft.nodeId,targetHandle:j.draft.handleId};gt(W=>Zh([...W,F],U)),tn(W=>{const Y=W.filter(ee=>!(ee.target===U.target&&ee.targetHandle===U.targetHandle));return zd({...U,markerEnd:{type:os.ArrowClosed}},Y)}),io(null)},[u,Ml,gt,tn]),YT=m.useCallback(x=>{x.preventDefault(),x.dataTransfer.dropEffect="move"},[]),GT=m.useCallback(x=>{var ee;if(x.preventDefault(),!u)return;const j=Ha.current;if(!j)return;const F=j.screenToFlowPosition({x:x.clientX,y:x.clientY}),U=x.dataTransfer.getData("application/agentflow-snippet");if(U){const ne=Ve.find(ge=>`${ge.id}@${ge.version}`===U);ne&&((ee=If.current)==null||ee.call(If,ne,F));return}const W=x.dataTransfer.getData("application/agentflow-node");if(!W)return;const Y=de.find(ne=>ne.id===W);Y&>(ne=>[...ne,Ml(Y,F)])},[u,de,Ve,gt,Ml]),Ai=m.useCallback(async(x,j)=>{if(!u)return;const F=IN(x,j,yr.current,{description:g});if(F!==Af.current){w(e("flow:status.saving"));try{const U=l7(u.source),W=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:U,flowYaml:F,...u.archived?{flowArchived:!0}:{}})}),Y=await W.json();if(!W.ok||!Y.success)throw new Error(Y.error||e("flow:status.saveFailed"));if(Af.current=F,w(e("flow:status.saved")),u.source==="builtin"&&U==="workspace"){const ee={id:u.id,source:"workspace",path:void 0};f(ee),aj(ee),up(u.id,"workspace")}}catch(U){w(e("flow:status.saveFailed")+": "+(U.message||U))}}},[u,g]);m.useEffect(()=>{if(!u||!Rl.current||Re!=="edit"||u.archived)return;const x=lg.current,j=setTimeout(()=>{x===lg.current&&Rl.current&&Ai(_i.current,Ll.current)},400);return()=>clearTimeout(j)},[Pt,mn,g,Re,u,Ai]);const Ff=m.useCallback(async x=>{if(!u||u.archived)return;const j=u.source??"user";if(!(j!=="user"&&j!=="workspace")&&j!==x){A(!0),C("");try{const F=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,fromSource:j,toSource:x})}),U=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof U.error=="string"?U.error:e("flow:composer.requestFailed"));const W=U.flowSource==="workspace"||U.flowSource==="user"?U.flowSource:x;let Y={id:u.id,source:W,archived:u.archived};try{const ee=await fetch("/api/flows");if(ee.ok){const ne=await ee.json(),ge=Array.isArray(ne)?ne.find(ye=>ye.id===u.id&&(ye.source??"user")===W&&!!ye.archived==!!u.archived):null;ge&&(Y=ge)}}catch{}await Os(Y,{preserveComposer:!0}),up(u.id,W)}catch(F){C(String(F.message||F))}finally{A(!1)}}},[u,Os]),pg=m.useCallback(async()=>{if(u){nu(!0),Io(""),Sl("");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:In})}),j=await x.json().catch(()=>({}));if(!x.ok||!j.success)throw new Error(j.error||"Failed to save schedule");$n({...Ru,...j.schedule||{}}),Sl(e("flow:schedule.saved")),await Ho(u,{quiet:!0,force:!0})}catch(x){Io(String(x.message||x))}finally{nu(!1)}}},[u,In,Ho,e]),JT=m.useCallback(async()=>{u&&(await Ai(_i.current,Ll.current),!u.archived&&u.source!=="builtin"&&await pg())},[u,Ai,pg]),zf=m.useCallback(async()=>{if(!u||!R.trim())return;const x=R.trim();if(x===u.id){K("");return}D(!0),K("");try{const j=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",newFlowId:x})}),F=await j.json().catch(()=>({}));if(!j.ok)throw new Error(typeof F.error=="string"?F.error:e("flow:composer.requestFailed"));let U={id:F.flowId,source:F.flowSource??u.source,archived:u.archived};try{const W=await fetch("/api/flows");if(W.ok){const Y=await W.json(),ee=Array.isArray(Y)?Y.find(ne=>ne.id===F.flowId&&(ne.source??"user")===(F.flowSource??u.source)):null;ee&&(U=ee)}}catch{}await Os(U,{preserveComposer:!0}),up(F.flowId,F.flowSource??u.source)}catch(j){K(String(j.message||j))}finally{D(!1)}},[u,R,Os]),Vb=m.useCallback(x=>{navigator.clipboard.writeText(x).then(()=>{L(!0),setTimeout(()=>L(!1),2e3)}).catch(()=>{})},[]),hg=m.useCallback(()=>{Ai(Pt,mn)},[Ai,Pt,mn]),XT=m.useCallback((x,j)=>{const F=j.trim()===""||j==="default"?void 0:j.trim(),U=Pt.map(W=>W.id===x?{...W,data:{...W.data,model:F}}:W);gt(U),Ai(U,mn)},[Pt,mn,gt,Ai]),Bf=m.useCallback(()=>{var rt,ln;if(!mt||!u||!nt)return!1;const x=nt.id,j=mt.newId.trim();if(Al(""),!NI.test(j))return Al(e("flow:nodePropsError.invalidInstanceId")),!1;if(Pt.some(Gt=>Gt.id===j&&Gt.id!==x))return Al(e("flow:nodePropsError.duplicateInstanceId")),!1;const F=mt.role.trim(),U=ba.includes(F)?F:"普通",W=mt.model.trim(),Y=Gt=>(Array.isArray(Gt)?Gt:[]).map(Rt=>({type:String((Rt==null?void 0:Rt.type)??"节点").trim()||"节点",name:String((Rt==null?void 0:Rt.name)??""),default:String((Rt==null?void 0:Rt.default)??""),required:!!(Rt!=null&&Rt.required),showOnNode:(Rt==null?void 0:Rt.showOnNode)!=null?Rt.showOnNode!==!1:!!(Rt!=null&&Rt.required)||String((Rt==null?void 0:Rt.type)??"节点").trim().toLowerCase()==="node"})),ee=Y(mt.inputs),ne=Y(mt.outputs),ge=String(((rt=nt.data)==null?void 0:rt.definitionId)??j),ye=ge.startsWith("provide_"),$e={...nt.data,label:mt.label.trim()||j,role:U,model:W===""||W==="default"?void 0:W,body:ye?"":mt.body,images:ye?[]:ts(mt.images),inputs:ee,outputs:ye&&Array.isArray((ln=nt.data)==null?void 0:ln.outputs)?nt.data.outputs:ne},ie=String(mt.script??"").trim();ge==="tool_nodejs"||ie!==""?$e.script=String(mt.script??""):delete $e.script;let Ie,be=mn;if(j!==x){const Gt={...yr.current},Rt={...Gt[x]||{}};delete Gt[x],Gt[j]=Rt,yr.current=Gt,Ie=Pt.map(ct=>ct.id!==x?ct:{...ct,id:j,selected:!0,data:$e}),be=mn.map((ct,Oe)=>({...ct,source:ct.source===x?j:ct.source,target:ct.target===x?j:ct.target,id:`e-${ct.source===x?j:ct.source}-${ct.target===x?j:ct.target}-${Oe}`}))}else Ie=Pt.map(Gt=>Gt.id===x?{...Gt,data:$e}:Gt);return gt(Ie),tn(be),Cr(j),Ai(Ie,be),!0},[mt,u,nt,Pt,mn,gt,tn,Cr,Ai]),mg=m.useCallback(()=>{var ln,Gt;if(!mt||!u||!nt)return!1;const x=nt.id,j=mt.role.trim(),F=ba.includes(j)?j:"普通",U=mt.model.trim(),W=Rt=>(Array.isArray(Rt)?Rt:[]).map(ct=>({type:String((ct==null?void 0:ct.type)??"节点").trim()||"节点",name:String((ct==null?void 0:ct.name)??""),default:String((ct==null?void 0:ct.default)??""),required:!!(ct!=null&&ct.required),showOnNode:(ct==null?void 0:ct.showOnNode)!=null?ct.showOnNode!==!1:!!(ct!=null&&ct.required)||String((ct==null?void 0:ct.type)??"节点").trim().toLowerCase()==="node"})),Y=W(mt.inputs),ee=W(mt.outputs),ne=String(((ln=nt.data)==null?void 0:ln.definitionId)??x),ge=ne.startsWith("provide_"),ye=mt.label.trim()||x,$e=U===""||U==="default"?void 0:U,ie={...nt.data,label:ye,role:F,model:$e,body:ge?"":mt.body,images:ge?[]:ts(mt.images),inputs:Y,outputs:ge&&Array.isArray((Gt=nt.data)==null?void 0:Gt.outputs)?nt.data.outputs:ee},Ie=String(mt.script??"").trim();ne==="tool_nodejs"||Ie!==""?ie.script=String(mt.script??""):delete ie.script;const be=nt.data||{};return(be.label!==ie.label||be.role!==ie.role||be.model!==ie.model||be.body!==ie.body||JSON.stringify(ts(be.images))!==JSON.stringify(ie.images)||(be.script??void 0)!==(ie.script??void 0)||JSON.stringify(be.inputs||[])!==JSON.stringify(Y)||JSON.stringify(be.outputs||[])!==JSON.stringify(ee))&&(gt(Rt=>Rt.map(ct=>ct.id===x?{...ct,data:ie}:ct)),Cr(x)),!0},[mt,u,nt,gt,Cr]),Kb=m.useRef(mg);m.useEffect(()=>{Kb.current=mg},[mg]),m.useEffect(()=>{if(!mt||!u||!Rl.current||Re!=="edit")return;const x=setTimeout(()=>{Kb.current()},400);return()=>clearTimeout(x)},[mt,u,Re]);const QT=m.useCallback(()=>{if(!(!mt||!nt)){if(mt.newId.trim()===nt.id){Al("");return}Bf()}},[mt,nt,Bf]);m.useEffect(()=>{const x=j=>{var ee,ne,ge;if(Re!=="edit")return;const F=wI(j.target);if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="s"){if(lt==="node"&&nt&&mt){j.preventDefault(),j.stopPropagation(),Bf()||hg();return}if(F)return;j.preventDefault(),j.stopPropagation(),hg();return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"){j.preventDefault(),j.stopPropagation(),Ts(ye=>!ye);return}if(Fo)return;if(_l){if(j.key==="Escape"){j.preventDefault(),Is(!1);return}if(tm(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),Is(!1);return}(j.key==="v"||j.key==="V"||j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey&&j.preventDefault();return}if(F)return;const U=j.key.toLowerCase(),W=(j.metaKey||j.ctrlKey)&&!j.shiftKey&&U==="z",Y=(j.metaKey||j.ctrlKey)&&(j.shiftKey&&U==="z"||U==="y");if(W||Y){j.preventDefault(),j.stopPropagation();const ye=W?Db():Fb();w(ye?W?"Undo canvas change":"Redo canvas change":W?"Nothing to undo":"Nothing to redo");return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="c"){const ye=uI(_i.current,Ll.current,yr.current);ye&&(j.preventDefault(),j.stopPropagation(),Ob.current=ye,w(`Copied ${ye.nodes.length} node${ye.nodes.length>1?"s":""}`));return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="v"){const ye=dI(Ob.current,_i.current,Ll.current,yr.current);ye&&(j.preventDefault(),j.stopPropagation(),yr.current=ye.instances,gt(ye.nodes),tn(ye.edges),w(`Pasted ${ye.pastedNodeIds.length} node${ye.pastedNodeIds.length>1?"s":""}`));return}if((j.key==="a"||j.key==="A")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),j.stopPropagation(),(ee=je.current)==null||ee.focus(),(ge=(ne=je.current)==null?void 0:ne.select)==null||ge.call(ne);return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="a"){j.preventDefault(),j.stopPropagation(),gt(ye=>ye.map($e=>({...$e,selected:!0}))),tn(ye=>ye.map($e=>({...$e,selected:!1})));return}if(tm(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),Is(ye=>!ye);return}if((j.key==="v"||j.key==="V")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),Si("select");return}if((j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),Si("pan");return}};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[hg,_l,Fo,lt,nt,mt,Bf,Re,Db,Fb]),m.useEffect(()=>{if(Re!=="running"||fs==null)return;let x=Math.floor((Date.now()-fs)/1e3);const j=setInterval(()=>{const F=Date.now()-fs,U=Math.floor(F/1e3);U!==x&&(x=U,Er(F))},500);return()=>clearInterval(j)},[Re,fs]),m.useEffect(()=>{const x=Ra.current;!x||!x.parentElement||jl.current&&(Ro.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Ro.current=!1}))},[As]),m.useEffect(()=>{const x=Ra.current;if(!x)return;const j=x.parentElement;if(!j)return;const F=()=>{if(Ro.current)return;const U=j.scrollHeight-j.scrollTop-j.clientHeight;jl.current=U<40};return j.addEventListener("scroll",F,{passive:!0}),()=>j.removeEventListener("scroll",F)},[ps,Re]),m.useEffect(()=>{if(Re==="edit"||!ps)return;jl.current=!0;const x=Ra.current;x&&(Ro.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Ro.current=!1}))},[Re,ps]),m.useEffect(()=>{As.length>sh+ij&&ft(x=>x.length>sh+ij?x.slice(-sh):x)},[As]);const ZT=m.useCallback(x=>{if(x.button!==0)return;x.preventDefault();const j=x.currentTarget;$t.current={active:!0,pointerId:x.pointerId,startY:x.clientY,startH:vt},j.setPointerCapture(x.pointerId)},[vt]),e2=m.useCallback(x=>{const j=$t.current;if(!j.active||x.pointerId!==j.pointerId)return;const F=j.startY-x.clientY;An(ih(j.startH+F))},[]),Hf=m.useCallback(()=>{An(x=>{const j=ih(x);try{localStorage.setItem(RI,String(j))}catch{}return j})},[]),qb=m.useCallback(x=>{const j=$t.current;if(!(!j.active||x.pointerId!==j.pointerId)){j.active=!1;try{x.currentTarget.releasePointerCapture(x.pointerId)}catch{}Hf()}},[Hf]),t2=m.useCallback(()=>{const x=$t.current;x.active&&(x.active=!1,Hf())},[Hf]);m.useEffect(()=>{function x(){An(j=>ih(j))}return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const Ii=m.useCallback(async(x={})=>{if(!u)return;const j=x.runUuid!=null&&String(x.runUuid).trim()?String(x.runUuid).trim():null,F=x.cliInputsOverride??hr.current,U=!!x.prepareOnly;if(Ft(U?"ready":"running"),ft(U?[]:[{ts:new Date().toISOString(),type:"info",text:j?e("flow:run.connectingApiResume",{uuid:j}):e("flow:run.connectingApi")}]),on(new Set),Un({}),hs(!U),vn(null),j||en(null),U)return;if(!j){const Y=Date.now();pr(Y),Er(0)}const W=new AbortController;Zs.current=W;try{const Y=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",...j?{uuid:j}:{},cliInputs:F}),signal:W.signal});if(!Y.ok){const ie=await Y.json().catch(()=>({error:e("flow:composer.requestFailed")}));ft(Ie=>[...Ie,{ts:new Date().toISOString(),type:"error",text:ie.error||e("flow:composer.requestFailed")}]),Ft("error");return}if(ft(ie=>[...ie,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!Y.body){ft(ie=>[...ie,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),Ft("error");return}const ee=Y.body.getReader(),ne=new TextDecoder;let ge="";const ye=ie=>{const Ie=ie.ts||new Date().toISOString();if(ie.type==="event")if(ie.event==="node-start")on(be=>new Set(be).add(ie.instanceId)),Un(be=>({...be,[ie.instanceId]:{status:"running",startMs:Date.now()}})),ft(be=>[...be,{ts:Ie,type:"node-start",text:ie.label?e("flow:run.nodeStartWithLabel",{instanceId:ie.instanceId,label:ie.label}):e("flow:run.nodeStart",{instanceId:ie.instanceId})}]);else if(ie.event==="node-done"){on(rt=>{const ln=new Set(rt);return ln.delete(ie.instanceId),ln});const be=ie.elapsed??null;Un(rt=>({...rt,[ie.instanceId]:{status:"success",elapsed:be}})),ft(rt=>[...rt,{ts:Ie,type:"node-done",text:be?e("flow:run.nodeDoneWithElapsed",{instanceId:ie.instanceId,elapsed:be}):e("flow:run.nodeDone",{instanceId:ie.instanceId})}])}else if(ie.event==="node-failed")on(be=>{const rt=new Set(be);return rt.delete(ie.instanceId),rt}),Un(be=>({...be,[ie.instanceId]:{status:"failed",elapsed:ie.elapsed??null}})),ft(be=>[...be,{ts:Ie,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:ie.instanceId})}]);else if(ie.event==="apply-start"){if(ie.uuid&&en(String(ie.uuid)),typeof ie.runStartTime=="number"&&ie.runStartTime>0)pr(ie.runStartTime),Er(Math.max(0,Date.now()-ie.runStartTime));else if(typeof ie.totalExecutedMs=="number"&&ie.totalExecutedMs>0){const be=Date.now()-ie.totalExecutedMs;pr(be),Er(ie.totalExecutedMs)}ft(be=>[...be,{ts:Ie,type:"info",text:e("flow:run.pipelineStart",{uuid:ie.uuid||"?"})}])}else ie.event==="apply-done"?ft(be=>[...be,{ts:Ie,type:"info",text:ie.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:ie.totalElapsed}):e("flow:run.pipelineDone")}]):ie.event==="apply-paused"?ft(be=>[...be,{ts:Ie,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(ie.pendingNodes||[]).join(", ")})}]):ft(be=>[...be,{ts:Ie,type:"event",text:`[${ie.event}] ${JSON.stringify(ie)}`}]);else ie.type==="user-check-content"?(La({instanceId:ie.instanceId,execId:ie.execId??1,inputPath:ie.inputPath,outputPath:ie.outputPath,content:ie.content||""}),Oa(ie.content||""),eo(!1),Oo(""),Mo(!1),ft(be=>[...be,{ts:Ie,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:ie.instanceId})}])):ie.type==="user-ask-prompt"?(to({instanceId:ie.instanceId,execId:ie.execId??1,question:ie.question||"",options:Array.isArray(ie.options)?ie.options:[]}),Ma(!1),ft(be=>[...be,{ts:Ie,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:ie.instanceId,defaultValue:`等待用户选择 (${ie.instanceId})`})}])):ie.type==="tool-print-content"?(Cl({instanceId:ie.instanceId,execId:ie.execId??1,content:ie.content||"",createdAt:Date.now()}),Wn(!1)):ie.type==="log"?ft(be=>[...be,{ts:Ie,type:"log",text:ie.text!=null?String(ie.text):""}]):ie.type==="error"?ft(be=>[...be,{ts:Ie,type:"error",text:ie.message||e("flow:run.unknownError")}]):ie.type==="done"?ft(be=>[...be,{ts:Ie,type:"done",text:e("flow:run.executionEnd",{exitCode:ie.exitCode??"?"})}]):ft(be=>[...be,{ts:Ie,type:"log",text:JSON.stringify(ie)}])},$e=ie=>{if(ie.trim())try{ye(JSON.parse(ie))}catch{ft(Ie=>[...Ie,{ts:new Date().toISOString(),type:"log",text:ie}])}};for(;;){const{done:ie,value:Ie}=await ee.read();ge+=ne.decode(Ie??new Uint8Array,{stream:!ie});const be=ge.split(`
|
|
133
|
-
`);ge=be.pop()??"";for(const rt of be)$e(rt);if(ie)break}ge.trim()&&$e(ge),Ft("done")}catch(Y){Y.name==="AbortError"?(ft(ee=>[...ee,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),Ft("stopped")):(ft(ee=>[...ee,{ts:new Date().toISOString(),type:"error",text:Y.message||e("flow:run.unknownError")}]),Ft("error"))}finally{Zs.current=null,on(new Set)}},[u]),[n2,gg]=m.useState(!1),r2=m.useCallback(()=>{gg(!0)},[]),s2=m.useCallback(async()=>{if(gg(!1),Zs.current&&(Zs.current.abort(),Zs.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{}Ft("stopped"),on(new Set)},[u]),Ua=m.useCallback(()=>{Ft("edit"),on(new Set),Un({}),Or(null),en(null)},[]),[i2,Uf]=m.useState(!1),o2=m.useCallback(async()=>{if(Uf(!1),Zs.current&&(Zs.current.abort(),Zs.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{}Ua()},[u,Ua]),a2=m.useCallback(()=>{Uf(!1),n("/projects")},[n]),l2=m.useCallback(x=>{const j=x.runId!=null&&String(x.runId).trim()?String(x.runId).trim():null,F=x.flowId!=null&&String(x.flowId).trim()?String(x.flowId).trim():(u==null?void 0:u.id)!=null?String(u.id):null;en(j);const U=x.status||"unknown";let W="stopped";U==="success"?W="done":U==="failed"?W="error":U==="running"?W="running":W="stopped",Ft(W);const Y=typeof x.at=="number"?x.at:null;if(W==="running"&&Y!=null?(pr(Y),Er(Math.max(0,Date.now()-Y))):Y!=null&&typeof x.endedAt=="number"&&x.endedAt>Y?(pr(null),Er(x.endedAt-Y)):(pr(null),Er(Math.max(0,x.durationMs??0))),ft([]),on(new Set),Un({}),Or(null),vn(null),hs(!1),j&&F){const ee=new URLSearchParams({flowId:F,runId:j});fetch(`/api/run-node-statuses?${ee}`).then(ne=>ne.json()).then(ne=>{const ge=ne.statuses&&typeof ne.statuses=="object"?ne.statuses:{},ye={};for(const[$e,ie]of Object.entries(ge))ie&&typeof ie=="object"&&typeof ie.status=="string"&&(ye[$e]={status:ie.status,...ie.elapsed!=null&&String(ie.elapsed).trim()!==""?{elapsed:String(ie.elapsed)}:{}});Un(ye)}).catch(()=>{})}},[u==null?void 0:u.id]);m.useEffect(()=>{if(!(u!=null&&u.id)||Re!=="edit")return;let x=!1;return(async()=>{try{const j=await fetch("/api/pipeline-recent-runs"),F=await j.json();if(x||!j.ok)return;const W=(Array.isArray(F.runs)?F.runs:[]).find(ne=>ne.flowId===u.id&&ne.status==="running");if(!W||x)return;const Y=W.runId||null;en(Y),Ft("running"),hs(!0),pr(W.at||Date.now()),Ur.current=0;const ee=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${Y},已恢复运行视图`}];if(Y){const ne=new URLSearchParams({flowId:u.id,runId:Y}),ye=await(await fetch(`/api/run-node-statuses?${ne}`)).json();if(x)return;const $e=ye.statuses&&typeof ye.statuses=="object"?ye.statuses:{},ie={},Ie=new Set;for(const[be,rt]of Object.entries($e))rt&&typeof rt=="object"&&typeof rt.status=="string"&&(ie[be]={status:rt.status,...rt.elapsed!=null&&String(rt.elapsed).trim()!==""?{elapsed:String(rt.elapsed)}:{}},rt.status==="running"&&Ie.add(be));Un(ie),on(Ie);try{const be=new URLSearchParams({flowId:u.id,runId:Y,sinceBytes:"0",tailBytes:"262144"}),rt=await fetch(`/api/run-log?${be}`);if(rt.ok){const ln=await rt.json();if(!x){Ur.current=Number(ln.bytes||0);const Gt=oj(typeof ln.text=="string"?ln.text:"");ft([...Gt,...ee]);return}}}catch{}}ft(ee)}catch{}})(),()=>{x=!0}},[u==null?void 0:u.id]),m.useEffect(()=>{if(Re==="edit"||!(u!=null&&u.id)||!bt)return;let x=!1,j=null;const F=async()=>{try{const U=new URLSearchParams({flowId:u.id,runId:bt}),W=await fetch(`/api/run-node-statuses?${U}`);if(!W.ok)return;const Y=await W.json();if(x)return;const ee=Y.statuses&&typeof Y.statuses=="object"?Y.statuses:{},ne={},ge=new Set;for(const[ye,$e]of Object.entries(ee))$e&&typeof $e=="object"&&typeof $e.status=="string"&&(ne[ye]={status:$e.status,...$e.elapsed!=null&&String($e.elapsed).trim()!==""?{elapsed:String($e.elapsed)}:{}},$e.status==="running"&&ge.add(ye));Un(ye=>i7(ye,ne)?ye:ne),on(ye=>o7(ye,ge)?ye:ge);try{const ye=new URLSearchParams({flowId:u.id,runId:bt,sinceBytes:String(Ur.current||0),tailBytes:String(t7)}),$e=await fetch(`/api/run-log?${ye}`);if($e.ok){const ie=await $e.json();if(x)return;const Ie=Number(ie.bytes||0),be=typeof ie.text=="string"?ie.text:"";if(be){const rt=oj(be);rt.length>0&&ft(ln=>[...ln,...rt])}Ur.current=Ie}}catch{}try{const ye=await fetch("/api/pipeline-recent-runs");if(!ye.ok)return;const $e=await ye.json();if(x)return;const Ie=(Array.isArray($e.runs)?$e.runs:[]).find(be=>be.flowId===u.id&&be.runId===bt);if(Ie&&Ie.status){const be=Ie.status;be==="running"?Ft(rt=>rt==="running"?rt:"running"):be==="success"?Ft("done"):be==="failed"?Ft("error"):(be==="stopped"||be==="interrupted")&&Ft("stopped")}}catch{}}catch{}};return F(),j=window.setInterval(F,2500),()=>{x=!0,j&&window.clearInterval(j)}},[Re,u==null?void 0:u.id,bt]),m.useEffect(()=>{if(lt!=="history"||!u)return;let x=!1;return(async()=>{Ks(!0),dr("");try{const j=await fetch("/api/pipeline-recent-runs"),F=await j.json();if(!j.ok)throw new Error(F.error||"HTTP "+j.status);x||Pn(Array.isArray(F.runs)?F.runs:[])}catch(j){x||(dr(String(j.message||j)),Pn([]))}finally{x||Ks(!1)}})(),()=>{x=!0}},[lt,u]),m.useEffect(()=>{if(!u){Vt({files:[]});return}let x=!1;return(async()=>{us(!0);try{const j=new URLSearchParams({flowId:u.id,flowSource:u.source||"user",archived:u.archived?"1":"0"}),F=await fetch(`/api/pipeline-files?${j}`),U=await F.json();if(!F.ok)throw new Error(U.error||"HTTP "+F.status);x||Vt({files:Array.isArray(U.files)?U.files:[],path:U.path,error:U.error})}catch(j){x||Vt({files:[],error:j.message||String(j)})}finally{x||us(!1)}})(),()=>{x=!0}},[u]);const pu=m.useMemo(()=>u?Vs.filter(x=>x&&x.flowId===u.id).sort((x,j)=>j.at-x.at):[],[Vs,u]),Mr=m.useMemo(()=>{let x=0,j=0,F=0,U=0,W=0;for(const Y of pu){const ee=Y.status||"unknown";ee==="success"?x+=1:ee==="failed"?j+=1:ee==="running"?F+=1:ee==="stopped"?U+=1:ee==="interrupted"&&(W+=1)}return{success:x,failed:j,running:F,stopped:U,interrupted:W}},[pu]),hu=m.useMemo(()=>u?tj(gr,Da):null,[u,gr,Da]),ii=m.useMemo(()=>{if(!hu||!u)return[];const x=hu.query.toLowerCase(),j=W=>x?W.some(Y=>Y&&String(Y).toLowerCase().includes(x)):!0,F=Pt.map(W=>{var ye,$e;const Y=W.id,ee=String(((ye=W.data)==null?void 0:ye.label)??Y),ne=($e=W.data)!=null&&$e.definitionId?String(W.data.definitionId):"",ge=[ee!==Y?ee:"",ne&&ne!==Y?ne:""].filter(Boolean);return{id:Y,label:ee,defId:ne,subs:ge}}).filter(({id:W,label:Y,defId:ee})=>j([W,Y,ee])).sort((W,Y)=>W.id.localeCompare(Y.id)).slice(0,18).map(({id:W,label:Y,defId:ee})=>{const ne=[Y!==W?Y:null,ee||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:W,title:W,subtitle:ne}}),U=de.filter(W=>W&&W.id&&j([W.id,W.label,W.description])).sort((W,Y)=>W.id.localeCompare(Y.id)).slice(0,22).map(W=>({kind:"definition",id:W.id,title:W.id,subtitle:W.label&&W.label!==W.id?String(W.label):String(W.type||"")}));return[...F,...U]},[hu,Pt,de,u]),mu=m.useMemo(()=>{const x=ii.filter(F=>F.kind==="instance"),j=ii.filter(F=>F.kind==="definition");return{instances:x,definitions:j}},[ii]);m.useEffect(()=>{za(x=>{const j=Math.max(0,ii.length-1);return Math.min(Math.max(0,x),j)})},[ii]);const Yb=m.useMemo(()=>KV(gr),[gr]),xr=m.useMemo(()=>Pt.filter(x=>x.selected),[Pt]),yg=m.useMemo(()=>new Set(xr.map(x=>x.id)),[xr]),Wf=m.useMemo(()=>mn.filter(x=>yg.has(x.source)&&yg.has(x.target)),[mn,yg]),Gb=m.useMemo(()=>{const x=fe.trim().toLowerCase();return x?Ve.filter(j=>[j.id,j.version,j.displayName,j.name,j.description,...Array.isArray(j.tags)?j.tags:[]].filter(Boolean).some(F=>String(F).toLowerCase().includes(x))):Ve},[Ve,fe]),Jb=m.useCallback((x,j)=>{const F=String(x||"snippet-node").trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"snippet-node",U=Date.now().toString(36);let W=`${F}-${U}`,Y=2;for(;j.has(W);)W=`${F}-${U}-${Y}`,Y+=1;return j.add(W),W},[]),Xb=m.useCallback((x,j)=>{var ct;if(!u||!x)return;const F=x.snippet&&typeof x.snippet=="object"?x.snippet:{},U=F.instances&&typeof F.instances=="object"?F.instances:{},W=Object.keys(U);if(W.length===0)return;const Y=new Set(_i.current.map(Oe=>Oe.id)),ee={};for(const Oe of W)ee[Oe]=Jb(Oe,Y);const ne=(ct=F.ui)!=null&&ct.nodePositions&&typeof F.ui.nodePositions=="object"?F.ui.nodePositions:{},ge=W.map(Oe=>{const Lt=ne[Oe];return{id:Oe,x:typeof(Lt==null?void 0:Lt.x)=="number"?Lt.x:0,y:typeof(Lt==null?void 0:Lt.y)=="number"?Lt.y:0}}),ye=Math.min(...ge.map(Oe=>Oe.x)),$e=Math.min(...ge.map(Oe=>Oe.y));let ie=j||{x:180,y:160};const Ie=Ha.current,be=document.querySelector(".af-pipeline-flow .react-flow");if(!j&&Ie&&be){const Oe=be.getBoundingClientRect();ie=Ie.screenToFlowPosition({x:Oe.left+Oe.width*.48,y:Oe.top+Oe.height*.32})}const rt={};for(const Oe of W)rt[ee[Oe]]={...U[Oe]||{}};yr.current={...yr.current,...rt};const ln=W.map(Oe=>{const Lt=U[Oe]||{},er=ge.find(oo=>oo.id===Oe)||{x:0,y:0},Uo={id:ee[Oe],type:"flowNode",selected:!0,position:{x:ie.x+(er.x-ye),y:ie.y+(er.y-$e)},data:{label:Lt.label||ee[Oe],definitionId:Lt.definitionId||Oe,role:Lt.role||"normal",body:Lt.body||"",script:Lt.script||""}};return Yd(Uo,yr.current,de,{},u.id)}),Gt=new Set(W),Rt=(Array.isArray(F.edges)?F.edges:[]).filter(Oe=>Gt.has(Oe==null?void 0:Oe.source)&&Gt.has(Oe==null?void 0:Oe.target)).map((Oe,Lt)=>({id:`e-${ee[Oe.source]}-${ee[Oe.target]}-${Date.now()}-${Lt}`,source:ee[Oe.source],target:ee[Oe.target],sourceHandle:Oe.sourceHandle??void 0,targetHandle:Oe.targetHandle??void 0,markerEnd:{type:os.ArrowClosed}}));gt(Oe=>[...Oe.map(Lt=>({...Lt,selected:!1})),...ln]),tn(Oe=>[...Oe.map(Lt=>({...Lt,selected:!1})),...Rt]),w(`已添加流程片段:${x.displayName||x.id}`)},[Jb,de,u,tn,gt]);If.current=Xb;const c2=m.useCallback(()=>{var F,U;if(xr.length<2){Ce("请先在画布上选择至少两个节点。"),ve("flows");return}const x=xr[0],j=xr.length===2?`${((F=x.data)==null?void 0:F.label)||x.id} 片段`:`${((U=x.data)==null?void 0:U.label)||x.id} 等 ${xr.length} 个节点`;_n({name:j,id:j.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),we(""),Bn(!0),ve("flows")},[xr]),u2=m.useCallback(async()=>{var W,Y;if(!u||xr.length<2)return;const x=Xt.name.trim();if(!x){we("请填写片段名称。");return}const j=gf(xr,yr.current),F={};for(const ee of xr)F[ee.id]={x:((W=ee.position)==null?void 0:W.x)||0,y:((Y=ee.position)==null?void 0:Y.y)||0};const U=Wf.map(ee=>({source:ee.source,target:ee.target,sourceHandle:ee.sourceHandle??null,targetHandle:ee.targetHandle??null}));ur(!0),we("");try{const ee=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Xt.id,name:x,displayName:x,version:"1.0.0",description:Xt.description,snippet:{instances:j,edges:U,ui:{nodePositions:F}}})}),ne=await ee.json().catch(()=>({}));if(!ee.ok||(ne==null?void 0:ne.ok)===!1)throw new Error((ne==null?void 0:ne.error)||"Publish failed");Bn(!1),w(`流程片段已发布:${ne.id||x}`),Po(`流程片段已发布:${ne.id||x}`),await Mf(),ve("flows")}catch(ee){we(String(ee.message||ee))}finally{ur(!1)}},[u,xr,Wf,Xt,Mf,Po]),Vf=m.useMemo(()=>{const x=[],j=new Set;for(const W of xr)j.add(W.id),x.push({node:W,kind:"canvas"});const F=new Map(Pt.map(W=>[W.id,W])),U=new Map(de.map(W=>[W.id,W]));for(const W of Yb){if(j.has(W))continue;const Y=F.get(W);if(Y){j.add(W),x.push({node:Y,kind:"mention"});continue}const ee=U.get(W);ee&&(j.add(W),x.push({definition:ee,kind:"definition"}))}return x},[xr,Yb,Pt,de]),qr=m.useMemo(()=>{const x=Array.isArray(ut==null?void 0:ut.cursor)?ut.cursor:[],j=Array.isArray(ut==null?void 0:ut.opencode)?ut.opencode:[],F=Array.isArray(ut==null?void 0:ut.claudeCode)?ut.claudeCode:[],U=j.map(ye=>`opencode:${fo(ye)}`),W=F.map(ye=>`claude-code:${fo(ye)}`),Y=new Set([...x,...j,...F].map(fo).concat(U).concat(W)),ee=(no||"").trim(),ne=Pp(no,x,j,F),ge=ne&&!Y.has(ne)&&!Y.has(ee)?ee:"";return{cursorList:x,opencodeList:j,claudeCodeList:F,currentNotInLists:ge}},[ut,no]),xg=m.useMemo(()=>new Set(Ni),[Ni]),wg=Ni.length,Kf=m.useMemo(()=>{const x=new Map(Rs.map(Y=>[Y.key,Y])),j=new Set,F=new Set,U=Tl.map(Y=>{const ee=wa(Y,Rs).map(ne=>x.get(ne)).filter(Boolean);for(const ne of ee)j.add(ne.key),F.add(String(ne.name||ne.id||ne.key||"").trim());return{...Y,skills:ee}}).filter(Y=>Y.skills.length>0),W=Rs.filter(Y=>{const ee=String(Y.name||Y.id||Y.key||"").trim();return!j.has(Y.key)&&!F.has(ee)});return{groups:U,ungrouped:W}},[Tl,Rs]),$l=m.useCallback(()=>{const x=re.current;if(!x)return;const j=x.getBoundingClientRect(),F=Math.min(400,Math.max(300,window.innerWidth-24)),U=Math.min(Math.max(12,j.right-F),window.innerWidth-F-12),W=Math.max(140,j.top-22),Y=Math.min(360,W);xe({position:"fixed",left:`${U}px`,top:`${Math.max(12,j.top-Y-10)}px`,width:`${F}px`,maxHeight:`${Y}px`})},[]);m.useEffect(()=>{const x=Array.isArray(ut==null?void 0:ut.cursor)?ut.cursor:[],j=Array.isArray(ut==null?void 0:ut.opencode)?ut.opencode:[],F=Array.isArray(ut==null?void 0:ut.claudeCode)?ut.claudeCode:[];jf(U=>{const W=Pp(U,x,j,F);return W===U?U:W})},[ut.cursor,ut.opencode,ut.claudeCode]),m.useEffect(()=>{if(!X)return;$l();const x=F=>{var W,Y;const U=F.target;(W=re.current)!=null&&W.contains(U)||(Y=ae.current)!=null&&Y.contains(U)||Z(!1)},j=F=>{F.key==="Escape"&&Z(!1)};return window.addEventListener("resize",$l),window.addEventListener("scroll",$l,!0),document.addEventListener("pointerdown",x),document.addEventListener("keydown",j),()=>{window.removeEventListener("resize",$l),window.removeEventListener("scroll",$l,!0),document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",j)}},[X,$l]);const Wa=m.useCallback(async(x,j={})=>{var ct;if(!u||ri.current)return;const F=j.phaseContextSnapshot,U=(typeof x=="string"?x:gr).trim();if(!U)return;const W=Ut.current;ri.current=!0,Ab(!0),Ci(e("flow:composer.connecting")),vn(Oe=>Oe!=="composer"?"composer":Oe);const Y=[...Kt];if(W.length>0&&Y.push({type:"assistant",segments:[...W]}),Ib([...Y,{type:"user",text:U}]),Y.filter(Oe=>Oe.type==="user").length===0){const Oe=U.replace(/\s+/g," ").slice(0,30)+(U.length>30?"…":"");an(Lt=>Lt.map(er=>er.id===Qe?{...er,label:Oe}:er))}const ee=Y.map(Oe=>Oe.type==="user"?{role:"user",text:Oe.text}:{role:"assistant",text:(Oe.segments||[]).filter(er=>er.kind==="assistant"||er.kind==="result").map(er=>er.text).join(`
|
|
134
|
-
`)}).filter(Oe=>Oe.text),ne=F??Ae;Do(""),Ei([]),uu([]),Tb(!1);const ge=new AbortController;ji.current=ge,so.current=Qe;let ye=null;const $e=Array.isArray(ut==null?void 0:ut.cursor)?ut.cursor:[],ie=Array.isArray(ut==null?void 0:ut.opencode)?ut.opencode:[],Ie=Array.isArray(ut==null?void 0:ut.claudeCode)?ut.claudeCode:[],be=Pp(no,$e,ie,Ie),rt=Vf.filter(Oe=>Oe.kind!=="definition"&&Oe.node).map(Oe=>Oe.node.id),ln=u;let Gt=!1,Rt=!1;try{ye=setTimeout(()=>ge.abort(),12e4);const Oe={prompt:U,model:be,flowId:u.id,flowSource:u.source??"user",...u.archived?{flowArchived:!0}:{},contextInstanceIds:rt,thread:ee,selectedSkills:Ni};ne&&ne.nextPhase&&!ne.isLastPhase&&(Oe.phaseContext={phaseIndex:ne.nextPhase.index,phases:ne.phases,userPromptOriginal:ne.userPromptOriginal||U}),lu&&(Oe.phaseRole=lu);const Lt=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Oe),signal:ge.signal});if(ye&&(clearTimeout(ye),ye=null),!Lt.ok){let yu=Lt.statusText||e("flow:composer.requestFailed");try{const xu=await Lt.json();xu&&xu.error&&(yu=String(xu.error))}catch{}Ci(yu),Ei([{kind:"error",text:yu}]);return}const er=(ct=Lt.body)==null?void 0:ct.getReader();if(!er){Ci(e("flow:composer.cannotReadStream"));return}const Uo=new TextDecoder;let oo="";for(;;){const{done:yu,value:xu}=await er.read();if(yu)break;for(oo+=Uo.decode(xu,{stream:!0});;){const kg=oo.indexOf(`
|
|
135
|
-
`);if(kg<0)break;const s0=oo.slice(0,kg).trim();if(oo=oo.slice(kg+1),!s0)continue;let He;try{He=JSON.parse(s0)}catch{continue}if(He.type==="status"&&typeof He.line=="string"&&Ci(He.line),He.type==="natural"&&typeof He.text=="string"&&He.text){const cn=typeof He.kind=="string"&&He.kind?He.kind:"assistant";Ei(nn=>[...nn,{kind:cn,text:He.text}])}if(He.type==="error"&&He.message){Rt=!0;const cn=He.code?` [${He.code}]`:"",nn=String(He.message)+cn;Ci(nn),Ei(Yr=>[...Yr,{kind:"error",text:nn}])}if(He.type==="plan"&&Array.isArray(He.steps)){uu(He.steps.map(nn=>({...nn,status:"pending"})));const cn=He.steps.map((nn,Yr)=>`${Yr+1}. ${nn.description||nn.type}`).join(`
|
|
136
|
-
`);Ei(nn=>[...nn,{kind:"assistant",text:e("flow:composer.taskPlan",{count:He.steps.length,summary:cn})}])}if(He.type==="step-start"){const cn=He.index??0,nn=He.total??0,Yr=He.tier?` [${He.tier}]`:"",g2=He.model?` (${He.model})`:"";Ci(e("flow:composer.step",{current:cn+1,total:nn,description:(He.description||"")+Yr+g2})),uu(y2=>y2.map(Dl=>Dl.index===cn?{...Dl,status:"running",model:He.model,tier:He.tier,nodeRole:He.nodeRole??Dl.nodeRole,instanceId:He.instanceId??Dl.instanceId,instanceLabel:He.instanceLabel??Dl.instanceLabel}:Dl))}if(He.type==="step-progress"){const cn=He.index??0,nn=He.total??0;Ci(e("flow:composer.step",{current:cn+1,total:nn,description:He.description||""}))}if(He.type==="step-done"){const cn=He.index??0;uu(nn=>nn.map(Yr=>Yr.index===cn?{...Yr,status:He.success?"done":"error"}:Yr))}if(He.type==="phase-plan"&&Array.isArray(He.phases)){du(nn=>({...nn||{},phases:He.phases,currentPhase:He.currentPhase??0,phaseTotal:He.phaseTotal??He.phases.length,phaseName:He.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(nn==null?void 0:nn.userPromptOriginal)||U}));const cn=He.phases.map((nn,Yr)=>`${Yr+1}. ${nn.label}`).join(" → ");Ei(nn=>[...nn,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:He.phases.length,labels:cn,current:He.phaseName||""})}])}He.type==="phase-complete"&&(du(cn=>{var Yr;return{...cn||{},phases:He.phases||(cn==null?void 0:cn.phases)||[],currentPhase:He.phaseIndex??0,phaseTotal:He.phaseTotal??((Yr=He.phases)==null?void 0:Yr.length)??0,phaseName:He.phaseName||"",isLastPhase:!!He.isLastPhase,nextPhase:He.nextPhase||null,userPromptOriginal:He.userPromptOriginal||(cn==null?void 0:cn.userPromptOriginal)||U}}),!He.isLastPhase&&He.nextPhase&&Ei(cn=>[...cn,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:He.phaseName||e("flow:composer.nextPhase"),nextPhase:He.nextPhase.label})}])),He.type==="done"&&(Gt=!0,Ci(cn=>cn||e("flow:composer.done")))}}}catch(Oe){const Lt=Oe;if(Lt.name==="AbortError"){const er=e(ye?"flow:composer.connectTimeout":"flow:composer.aborted");Ci(er),Ei(Uo=>[...Uo,{kind:"error",text:er}])}else{const er=Lt.code||Lt.name||"UNKNOWN",Uo=`${Lt.message||String(Oe)} [${er}]`;Ci(Uo),Ei(oo=>[...oo,{kind:"error",text:Uo}])}}finally{if(ri.current=!1,Ab(!1),ji.current=null,so.current=null,ye&&clearTimeout(ye),Gt&&ln){const Oe={id:ln.id,source:ln.source??"user",archived:ln.archived};(async()=>(await Os(Oe,{preserveComposer:!0,incrementalSync:!0}),await Ho(Oe,{quiet:!0,force:!0})))()}}},[u,gr,no,ut,Vf,Os,Ho,Kt,Qe,Ae,lu,Ni]);ag.current=Wa;const Qb=m.useCallback(()=>{!Ae||Ae.isLastPhase||(du(null),Wa(e("flow:composer.skipRemainingPhases")))},[Ae,Wa]),Zb=m.useCallback(()=>{if(!Ae||Ae.isLastPhase||!Ae.nextPhase)return;const x=String(Ae.nextPhase.label||"").trim()||e("flow:composer.nextPhase");Wa(e("flow:composer.continuePhase",{label:x}),{phaseContextSnapshot:Ae})},[Ae,Wa]);m.useEffect(()=>{if(!Yt)return;const x=j=>{j.key==="Escape"&&Zn(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[Yt]),m.useEffect(()=>{Re!=="edit"&&Zn(!1)},[Re]),m.useLayoutEffect(()=>{const x=ou.current;if(!x)return;if(!u){x.style.height="";return}x.style.height="0px";const j=getComputedStyle(x),F=parseFloat(j.lineHeight),U=(parseFloat(j.paddingTop)||0)+(parseFloat(j.paddingBottom)||0),W=Number.isFinite(F)&&F>0?F:13*1.45,Y=U+W*2,ee=U+W*10,ne=Math.min(Math.max(x.scrollHeight,Y),ee);x.style.height=`${ne}px`},[gr,u]);const vg=m.useCallback(x=>{const j=gr,F=Da,U=tj(j,F);if(!U)return;const W=j.slice(0,U.atIndex)+`@${x} `+j.slice(F);Do(W);const Y=U.atIndex+x.length+2;queueMicrotask(()=>{const ee=ou.current;ee&&(ee.focus(),ee.setSelectionRange(Y,Y)),ni(Y)})},[gr,Da]),bg=m.useCallback(x=>{Do(j=>{const F=`@${x}`,U=j.indexOf(F);return U<0?j:j.slice(0,U)+j.slice(U+F.length)})},[]),e0=m.useCallback(x=>{x.kind==="canvas"?gt(j=>j.map(F=>F.id===x.node.id?{...F,selected:!1}:F)):x.kind==="mention"?bg(x.node.id):bg(x.definition.id)},[gt,bg]),d2=m.useCallback(()=>{vn(x=>x==="history"?null:"history")},[]),f2=m.useCallback(()=>{vn(x=>x==="settings"?null:"settings")},[]),p2=m.useCallback(()=>{vn(x=>x==="composer"?null:"composer")},[]),gu=m.useCallback(()=>{vn(x=>(x==="node"&&Ba.current&&(au.current=Ba.current.id),null))},[]),t0=m.useCallback(()=>{Is(x=>!x)},[]),h2=()=>{if(!u)return null;const x=Xs||u.archived||u.source==="builtin",j=bn!=null&&bn.running?e("flow:schedule.running"):In.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),F=bn!=null&&bn.running?"running":In.enabled?"waiting":"disabled",U=It.slice(0,12),W=u.archived||u.source==="builtin";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:gu,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:R,onChange:Y=>{M(Y.target.value),K("")},onKeyDown:Y=>{Y.key==="Enter"&&(Y.preventDefault(),zf())},onBlur:()=>{R.trim()&&R.trim()!==u.id&&zf()},placeholder:u.id,disabled:V,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:Wl(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:Wl(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]}),O?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:O}):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:g,onChange:Y=>k(Y.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:()=>Vb(u.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:$?"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:S,onClick:()=>Ff("workspace"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:S,onClick:()=>Ff("user"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),N?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:N}):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:[It.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:fg,disabled:Mt,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(Mt?"common:common.loading":"common:common.refresh")]})]}),Qt?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Qt}):null,Mt?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(Y=>{const ee=Y.definitionId||`marketplace:${Y.id}${Y.version?`@${Y.version}`:""}`,ne=Bb.has(ee)||Bb.has(`marketplace:${Y.id}`),ge=Rf.find(Ie=>String(Ie.id)===ee||String(Ie.id)===`marketplace:${Y.id}`),ye=sr===ee,$e=_p(Y.inputs||Y.input),ie=_p(Y.outputs||Y.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:Y.displayName||Y.label||Y.id}),o.jsx("span",{children:Y.version?`v${Y.version}`:ee})]}),o.jsx("p",{className:"af-pipeline-market-purpose",children:Y.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:$e.length>0?$e.map(Ie=>o.jsx("span",{className:"af-pipeline-market-chip",children:Ie},`in-${ee}-${Ie}`)):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:ie.length>0?ie.map(Ie=>o.jsx("span",{className:"af-pipeline-market-chip",children:Ie},`out-${ee}-${Ie}`)):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:()=>rn(Y),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:W||ye,onClick:()=>{ne&&ge?(Wb(ge),vn(null)):RT(Y)},children:e(ye?"flow:settings.installingNode":ne?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},ee)})}):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")})]}),Sf?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:!!In.enabled,disabled:x,onChange:Y=>Bo(ee=>({...ee,enabled:Y.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:In.cron||"",disabled:x,onChange:Y=>Bo(ee=>({...ee,cron:Y.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:In.timezone||"",disabled:x,onChange:Y=>Bo(ee=>({...ee,timezone:Y.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:In.preset||"",disabled:x,onChange:Y=>Bo(ee=>({...ee,preset:Y.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Qn).map(Y=>o.jsx("option",{value:Y,children:Y},Y))]})]})]}),o.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[o.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${F}`}),o.jsx("span",{children:In.nextRunAt?e("flow:schedule.nextRun",{time:new Date(In.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),o.jsxs("span",{children:[e("flow:schedule.runtime"),":",j]})]}),o.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[zt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(zt.lastTriggeredAt).toLocaleString()})]}):null,zt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(zt.lastSkippedAt).toLocaleString(),zt.lastSkipReason?` · ${zt.lastSkipReason}`:""]})]}):null,zt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:zt.lastRunUuid})]}):null,zt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(zt.lastExitCode)})]}):null,zt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(zt.lastFinishedAt).toLocaleString()})]}):null]}),bn!=null&&bn.lastError||zt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(bn==null?void 0:bn.lastError)||zt.lastError}):null,u.archived||u.source==="builtin"?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Ta?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Ta}):null,Qs?o.jsx("p",{className:"af-pipeline-drawer-muted",children:Qs}):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:Rf.length})]}),o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:Wl(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--${F}`,children:j})]})]}),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:Wl(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 JT(),disabled:Xs,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(Xs?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:gu,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=Te;if(!x)return null;const j=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`,F=x.displayName||x.label||x.id,U=_p(x.inputs||x.input),W=_p(x.outputs||x.output);return Xr.createPortal(o.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:Y=>{Y.target===Y.currentTarget&&rn(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:F})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>rn(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((Y,ee)=>o.jsx("span",{title:Y},`preview-in-${ee}`))}),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:F}),o.jsx("span",{children:j})]}),o.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(W.length>0?W:[""]).slice(0,4).map((Y,ee)=>o.jsx("span",{title:Y},`preview-out-${ee}`))})]})}),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(Y=>o.jsx("span",{className:"af-pipeline-market-chip",children:Y},`preview-input-${Y}`)):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:W.length>0?W.map(Y=>o.jsx("span",{className:"af-pipeline-market-chip",children:Y},`preview-output-${Y}`)):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:j})]}),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(Y=>Y.to||Y).join(", "):"-"})]})]})]})]})]})}),document.body)};return o.jsxs(Kv,{children:[o.jsx(e7,{onReady:i}),o.jsxs(PI.Provider,{value:{modelLists:ut,onModelChange:XT},children:[o.jsxs("div",{className:"af-pipeline-page"+(Re!=="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:()=>{Re==="running"?Uf(!0):Re!=="edit"?Ua():n("/projects")},"aria-label":e(Re!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(Re!=="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",OV,"-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(Ev(u,"workspace")),children:"Workspace"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[q&&o.jsx("button",{type:"button",className:"af-icon-btn"+(Me?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>qe(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"description"})}),Re==="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:Cy(qs,"running")})]}),Re==="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:Cy(qs,"stopped")})]}),(Re==="done"||Re==="error")&&o.jsxs("div",{className:"af-run-timer"+(Re==="error"?" af-run-timer--error":" af-run-timer--done"),children:[o.jsx("span",{className:"af-run-timer__label",children:Re==="error"?"FAILED":"COMPLETED"}),o.jsx("span",{className:"af-run-timer__value",children:Cy(qs,Re)})]}),Re!=="edit"&&o.jsx("button",{type:"button",className:"af-icon-btn"+(ps?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>hs(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),Re==="edit"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(lt==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!u,onClick:d2,children:o.jsx("span",{className:"material-symbols-outlined",children:"history"})}),o.jsx("button",{type:"button",className:"af-icon-btn"+(lt==="settings"?" af-icon-btn--active":""),onClick:f2,"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"+(lt==="composer"?" af-composer-topbar-btn--active":"")+(Fe?" af-composer-topbar-btn--running":""),onClick:p2,"aria-label":"AI Composer",title:"AI Composer",disabled:!u,children:"AI"}),o.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(_l?" af-icon-btn--active":""),onClick:t0,"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||u.source==="builtin"||u.source!=="user"&&u.source!=="workspace",onClick:()=>T(!0),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!u||u.source==="builtin"||u.archived||u.source!=="user"&&u.source!=="workspace",onClick:()=>z(!0),children:"Archive"})]}),Re==="running"?o.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:r2,title:e("flow:run.pauseRun"),children:[o.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):Re==="ready"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void Ii(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Ua,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Re==="stopped"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void Ii({runUuid:bt}),title:bt?e("flow:topbar.resumeTitle",{uuid:bt}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Ua,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Re==="done"||Re==="error"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void Ii(),title:e("flow:topbar.rerunTitle"),children:"Run"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Ua,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 Ii(),children:"Run"}),o.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!u,onClick:()=>ir(x=>!x),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":Pa,children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),Pa&&u&&o.jsxs("div",{className:"af-run-dropdown-menu",children:[o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var j,F,U,W,Y;ir(!1);const x={};for(const ee of si){const ne=Ol[ee.id];ne&&(x[ne]=((j=Gs[ne])==null?void 0:j.value)??((F=Gs[ne])==null?void 0:F.path)??((Y=(W=(U=ee.data)==null?void 0:U.outputs)==null?void 0:W[0])==null?void 0:Y.default)??"")}it(x),Wr(!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:()=>{ir(!1),Ii({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:()=>{ir(!1),Ii()},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys(Qn).map(x=>o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var U;ir(!1);const j=Qn[x]||{},F={};for(const W of si){const Y=Ol[W.id];if(!Y)continue;const ee=((U=W.data)==null?void 0:U.definitionId)||"",ne=j[W.id]??"";ee.startsWith("provide_file")?F[Y]={type:"file",path:ne}:F[Y]={type:"str",value:ne}}Ii({cliInputsOverride:F})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),x]},x))]})]})]})]})]}),Ge?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:Ge}),o.jsx("button",{type:"button",onClick:()=>st(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-pipeline-body"+(Re!=="edit"?" af-pipeline-body--run-mode":""),children:[Re==="edit"&<!=="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${Xn?" af-palette-workspace--expanded":""}`,children:[o.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>Ps(x=>!x),"aria-expanded":Xn,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:Xn?"expand_less":"expand_more"})]}),o.jsx("div",{className:"af-palette-workspace-path",title:u&&(u.path||Xe.path)||"",children:u?u.id:e("flow:palette2.noPipelineSelected")}),Xn&&o.jsx("div",{className:"af-palette-workspace-tree",children:sn?o.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):Xe.error?o.jsx("div",{className:"af-palette-workspace-empty",children:Xe.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:["(",Xe.files.length,")"]})]}),Xe.files.length>0?o.jsx("ul",{className:"af-palette-workspace-list",children:Xe.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:()=>J({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))}):Xe.files.filter(x=>x.type==="directory").length===0?o.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),Xe.files.filter(x=>{var j;return x.type==="directory"&&((j=x.children)==null?void 0:j.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(j=>o.jsxs("li",{className:`af-palette-workspace-item${j.type==="file"?" af-palette-workspace-item--clickable":""}`,title:j.path,onClick:j.type==="file"?()=>J({filePath:j.path,fileName:j.name}):void 0,children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:j.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:j.name}),j.type==="file"&&j.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:j.size<1024?`${j.size}B`:j.size<1024*1024?`${(j.size/1024).toFixed(1)}KB`:`${(j.size/1024/1024).toFixed(1)}MB`})]},j.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:pe==="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:je,type:"search",className:"af-palette-search-input",value:fe,onChange:x=>se(x.target.value),placeholder:(pe==="flows"?"搜索流程片段":e("flow:palette.searchNodes"))+"…","aria-label":pe==="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":pe==="nodes",className:"af-palette-tab"+(pe==="nodes"?" af-palette-tab--active":""),onClick:()=>ve("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":pe==="flows",className:"af-palette-tab"+(pe==="flows"?" af-palette-tab--active":""),onClick:()=>ve("flows"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),c?o.jsx("p",{className:"af-err af-palette-list-err",children:c}):null,o.jsx("div",{className:"af-node-palette-scroll",children:pe==="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:c2,disabled:!u||xr.length<2,title:xr.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:["已选 ",xr.length," 节点 / ",Wf.length," 连线"]})]})}),De?o.jsx("p",{className:"af-err af-palette-list-err",children:De}):null,Je?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段…"}):Gb.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:Gb.map(x=>{const j=`${x.id}@${x.version}`,F=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:()=>Xb(x),draggable:!!u,onDragStart:W=>{W.dataTransfer.setData("application/agentflow-snippet",j),W.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:F}),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"]})]})]},j)})})]}):o.jsx("p",{className:"af-palette-empty",children:fe.trim()?"无匹配流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Ku.filter(x=>Tf[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:Tf[x].map(j=>{const F=ZN(j.inputs,"input"),U=ZN(j.outputs,"output"),Y=j.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":II(j),ee=AI(j);return o.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>Wb(j),draggable:!!u,onDragStart:ne=>{ne.dataTransfer.setData("application/agentflow-node",j.id),ne.dataTransfer.effectAllowed="move"},disabled:!u,title:Y||j.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:zV(x)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:ee}),ee!==j.id?o.jsx("span",{className:"af-palette-card-id",children:j.id}):null]})]}),Y?o.jsx("span",{className:"af-palette-card-desc",children:Y}):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:[F.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[F.shown.map((ne,ge)=>o.jsxs("span",{className:"af-palette-card-port",title:QN("input",ne,ge),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Ln(ne==null?void 0:ne.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:Ey(ne,ge)})]},`in-${ge}`)),F.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",F.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,ge)=>o.jsxs("span",{className:"af-palette-card-port",title:QN("output",ne,ge),children:[o.jsx("span",{className:"af-palette-card-port-name",children:Ey(ne,ge)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Ln(ne==null?void 0:ne.type)}})]},`out-${ge}`)),U.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",U.hidden]}):null]})]})]})]},j.id)})})]},x)),u&&de.length===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,u&&de.length>0&&fe.trim()&&TT===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"+(Ke?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),o.jsx("span",{className:"af-palette-engine-label",children:e(Ke?"common:engine.online":"common:engine.offline")})]}),v?o.jsx("div",{className:"af-palette-tip"+OT,role:"status","aria-live":"polite",children:v}):null]})]}):Re!=="edit"&&u?o.jsx(_V,{flowId:u.id,flowSource:u.source||"user",flowArchived:u.archived,provideNodes:si,edges:mn,nodes:Pt,onCliInputsChange:Js,onBackToEdit:Ua}):null,o.jsxs("div",{className:"af-pipeline-main-stack",children:[o.jsxs("div",{className:"af-pipeline-canvas-col",children:[b?o.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:b}):null,u&&Pi.length>0&&!Q?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:te,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void Ub(),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:()=>H(!0),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),o.jsx("ul",{className:"af-flow-slot-warnings-list",children:Pi.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:j=>{j.preventDefault(),VT(x.nodeId)},children:x.nodeId}),'"',x.suffix]},x.key))})]}):null,u&&Pi.length>0&&Q?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:Pi.length})}),o.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:t0,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:()=>H(!1),children:e("flow:validation.show")}),o.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",disabled:te,onClick:()=>void Ub(),children:e("common:common.refresh")})]})]}):null,lt==="settings"&&u&&Re==="edit"?h2():o.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:u?o.jsxs(o.Fragment,{children:[o.jsx(a7,{fitViewEpoch:p,canvasTool:tg,nodes:_T,edges:PT,onNodesChange:Re!=="edit"?void 0:NT,onEdgesChange:Re!=="edit"?void 0:jT,onConnect:Re!=="edit"?void 0:zT,onConnectStart:Re!=="edit"?void 0:BT,onConnectEnd:Re!=="edit"?void 0:HT,isValidConnection:Re!=="edit"?void 0:FT,onNodesDelete:Re!=="edit"?void 0:UT,onNodeClick:MT,onNodeDoubleClick:$T,onEdgeClick:DT,onFlowInit:WT,onDrop:GT,onDragOver:YT,hideMinimapAndControls:!!(u&<),bottomSlot:Re==="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:Vf.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):Vf.map((x,j)=>{var ge,ye;if(x.kind==="definition"){const $e=x.definition,ie=String($e.label??$e.id),Ie=[$e.id,$e.description?String($e.description).slice(0,120):""].filter(Boolean).join(" — ");return o.jsxs("div",{className:"af-composer-node-chip af-composer-node-chip--definition",title:Ie,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:ie}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>e0(x),"aria-label":e("flow:composer.removeFromInput",{id:$e.id}),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${$e.id}`)}const F=x.node,U=x.kind,W=String(((ge=F.data)==null?void 0:ge.label)??F.id),Y=(ye=F.data)!=null&&ye.definitionId?String(F.data.definitionId):"",ee=Y&&Y!==W?`${W} · ${F.id} · ${Y}`:`${W} · ${F.id}`,ne=U==="canvas"?e("flow:composer.deselectNode",{id:F.id}):e("flow:composer.removeFromInput",{id:F.id});return o.jsxs("div",{className:"af-composer-node-chip"+(U==="mention"?" af-composer-node-chip--mention":""),title:ee,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:W}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>e0(x),"aria-label":ne,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},F.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:ou,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!u,value:gr,rows:2,onChange:x=>{Do(x.target.value),ni(x.target.selectionStart??x.target.value.length)},onSelect:x=>{const j=x.target;j instanceof HTMLTextAreaElement&&ni(j.selectionStart??0)},onKeyDown:x=>{if((x.metaKey||x.ctrlKey)&&x.key==="Enter"){x.preventDefault(),Wa();return}if(hu&&ii.length>0&&(x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="Enter")){if(x.key==="ArrowDown")x.preventDefault(),za(j=>(j+1)%ii.length);else if(x.key==="ArrowUp")x.preventDefault(),za(j=>(j-1+ii.length)%ii.length);else if(x.key==="Enter"){x.preventDefault();const j=ii[Fa];j&&vg(j.id)}}},onKeyUp:x=>{const j=x.target;j instanceof HTMLTextAreaElement&&ni(j.selectionStart??j.value.length)},onClick:x=>{const j=x.target;j instanceof HTMLTextAreaElement&&ni(j.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),hu&&u&&ii.length>0?o.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[mu.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,mu.instances.map((x,j)=>{const F=j;return o.jsx("li",{role:"option","aria-selected":F===Fa,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(F===Fa?" af-composer-mention-item--active":""),onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>za(F),onClick:()=>vg(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}`)}),mu.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,mu.definitions.map((x,j)=>{const F=mu.instances.length+j;return o.jsx("li",{role:"option","aria-selected":F===Fa,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(F===Fa?" af-composer-mention-item--active":""),onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>za(F),onClick:()=>vg(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:[Ht.length>0&&o.jsx("label",{className:"af-composer-session-field",children:o.jsxs("select",{className:"af-composer-session-select",value:Qe||"",onChange:x=>{x.target.value==="__new__"?Pf():Rb(x.target.value)},disabled:Fe,"aria-label":e("flow:composer.switchConversation"),children:[Ht.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:re,type:"button",className:"af-composer-skills-button"+(wg>0?" af-composer-skills-button--active":""),disabled:!u||Fe,"aria-haspopup":"listbox","aria-expanded":X,onClick:()=>Z(x=>!x),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:wg>0?`Skills ${wg}`:"Skills"})]}),X&&!Fe?Xr.createPortal(o.jsx("div",{ref:ae,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:me,children:Rs.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[Kf.groups.map(x=>{const j=wa(x,Rs),F=zE(x,xg,Rs),U=B.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:F==="all",disabled:j.length===0,onChange:W=>{const Y=W.target.checked;Vn(ee=>Y?DE(ee,j):FE(ee,j))}}),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,F==="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:()=>{G(W=>{const Y=new Set(W);return Y.has(x.id)?Y.delete(x.id):Y.add(x.id),Y})},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(W=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:xg.has(W.key),onChange:Y=>{const ee=Y.target.checked;Vn(ne=>ee?ne.includes(W.key)?ne:[...ne,W.key]:ne.filter(ge=>ge!==W.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:W.name}),W.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:W.description}):null]})]},`${x.id}:${W.key}`))})]},x.id)}),Kf.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:Kf.ungrouped.length})]}),Kf.ungrouped.map(x=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:xg.has(x.key),onChange:j=>{const F=j.target.checked;Vn(U=>F?U.includes(x.key)?U:[...U,x.key]:U.filter(W=>W!==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:(no||"").trim()?qr.currentNotInLists?qr.currentNotInLists:Pp(no,qr.cursorList,qr.opencodeList,qr.claudeCodeList):"",onChange:x=>jf(x.target.value),disabled:!u||Fe,"aria-label":e("flow:composer.modelAriaLabel"),children:[o.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),qr.currentNotInLists?o.jsxs("option",{value:qr.currentNotInLists,children:[qr.currentNotInLists,e("flow:composer.modelNotInList")]}):null,qr.cursorList.length>0?o.jsx("optgroup",{label:"Cursor",children:qr.cursorList.map(x=>o.jsx("option",{value:fo(x),children:x},`composer-c-${x}`))}):null,qr.opencodeList.length>0?o.jsx("optgroup",{label:"OpenCode",children:qr.opencodeList.map(x=>o.jsx("option",{value:`opencode:${fo(x)}`,children:x},`composer-o-${x}`))}):null,qr.claudeCodeList.length>0?o.jsx("optgroup",{label:"Claude Code",children:qr.claudeCodeList.map(x=>o.jsx("option",{value:`claude-code:${fo(x)}`,children:x},`composer-cc-${x}`))}):null]})]}),o.jsx("button",{type:"button",className:"af-composer-send"+(u&&gr.trim()&&!Fe?" af-composer-send--active":"")+(Fe?" af-composer-send--stop":""),disabled:!u||!Fe&&!gr.trim(),"aria-label":e(Fe?"flow:composer.stopGeneration":"flow:composer.send"),title:Fe?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var x;if(Fe){(x=ji.current)==null||x.abort();return}Wa()},children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Fe?"stop":"arrow_upward"})})]})]}),Yt?Xr.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&&Zn(!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"+(Fe?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:Le||void 0,children:Fe&&!Le?e("flow:composer.executing"):Le||e("flow:composer.ready")})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Zn(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Et.length>1&&!(Ae&&Array.isArray(Ae.phases)&&Ae.phases.length>1)?o.jsx("div",{className:"af-composer-steps-track-wrap",children:o.jsx(YV,{steps:Et})}):null,Ae&&Array.isArray(Ae.phases)&&Ae.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:Ae.phases.map((x,j)=>{const F=x.status||(j<(Ae.currentPhase??0)?"done":j===(Ae.currentPhase??0)?Fe?"running":Ae.nextPhase||Ae.isLastPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(F==="done"?" af-composer-phase-item--done":"")+(F==="running"?" af-composer-phase-item--running":"")+(F==="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:F==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:j+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||j)})}):null,o.jsx("div",{className:"af-composer-thread-dialog-scroll",children:o.jsx(nj,{thread:Kt,liveSegments:St,running:Fe})}),Ae&&!Ae.isLastPhase&&Ae.nextPhase&&!Fe?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:Ae.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:Zb,children:e("flow:composer.phaseReviewContinue",{label:Ae.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:Qb,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),Kr&&Re==="edit"?(()=>{var U;const x=String(Kr.query||"").trim().toLowerCase(),j=x?Kr.candidates.filter(W=>{var Y,ee,ne;return[(Y=W.def)==null?void 0:Y.id,W.displayLabel,W.description,(ee=W.slot)==null?void 0:ee.name,(ne=W.slot)==null?void 0:ne.type].filter(Boolean).some(ge=>String(ge).toLowerCase().includes(x))}):Kr.candidates,F=Kr.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:Kr.left,top:Kr.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:Ln((U=Kr.draft.slot)==null?void 0:U.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",Kr.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>io(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:Kr.query,onChange:W=>io(Y=>Y&&{...Y,query:W.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[j.map(W=>{var ne,ge;const Y=W.displayLabel||((ne=W.def)==null?void 0:ne.id),ee=Ey(W.slot,W.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>qT(W),title:W.description||W.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:Y}),Y!==W.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:W.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:F}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Ln((ge=W.slot)==null?void 0:ge.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:ee})]})]},`${W.def.id}-${W.slotIndex}`)}),j.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")})})]}),Re!=="edit"&&ps&&o.jsxs("div",{className:"af-run-console",style:{height:vt},children:[o.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:ZT,onPointerMove:e2,onPointerUp:qb,onPointerCancel:qb,onLostPointerCapture:t2}),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:[Re==="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:()=>hs(!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:[As.map((x,j)=>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):""})]},j)),o.jsx("div",{ref:Ra})]})]})]}),Re!=="edit"&&Ys&&u?o.jsx(NV,{instanceId:Ys,flowId:u.id,runId:bt,nodeStatus:((n0=ds[Ys])==null?void 0:n0.status)??null,onClose:()=>Or(null)}):null,lt&<!=="settings"&&u&&Re==="edit"?o.jsx("aside",{className:"af-pipeline-drawer"+(lt==="node"?" af-pipeline-drawer--wide":"")+(lt==="composer"?" af-pipeline-drawer--wide":""),"aria-label":lt==="settings"?e("flow:settings.title"):lt==="history"?e("flow:history.title"):lt==="composer"?"AI Composer":e("flow:nodeProps.title"),children:lt==="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:gu,"aria-label":e("flow:composer.closeSidebar"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Ht.length>0&&o.jsxs("div",{className:"af-composer-session-tabs",children:[Ht.map(x=>o.jsxs("button",{type:"button",ref:j=>{j&&x.id===Qe&&j.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",x.id===Qe?"af-composer-session-tab--active":"",x.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>Rb(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:j=>{j.stopPropagation(),Pb(x.id)},onKeyDown:j=>{j.key!=="Enter"&&j.key!==" "||(j.preventDefault(),j.stopPropagation(),Pb(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:()=>Pf(),title:e("flow:composer.newConversation"),children:o.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),o.jsx("div",{className:"af-composer-sidebar-status"+(Fe?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Fe&&!Le?e("flow:composer.executing"):Le||e("flow:composer.ready")}),Ae&&Array.isArray(Ae.phases)&&Ae.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:Ae.phases.map((x,j)=>{const F=x.status||(j<(Ae.currentPhase??0)?"done":j===(Ae.currentPhase??0)?Fe?"running":Ae.isLastPhase&&j===Ae.phases.length-1||Ae.nextPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(F==="done"?" af-composer-phase-item--done":"")+(F==="running"?" af-composer-phase-item--running":"")+(F==="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:F==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:j+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||j)})}):null,o.jsx("div",{className:"af-composer-sidebar-thread",ref:ro,children:o.jsx(nj,{thread:Kt,liveSegments:St,running:Fe})}),Ae&&!Ae.isLastPhase&&Ae.nextPhase&&!Fe?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:Ae.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:Zb,children:e("flow:composer.phaseReviewContinue",{label:Ae.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:Qb,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):lt==="node"&&nt?mt?o.jsx(jI,{draft:mt,setDraft:Pl,definitionId:String(((r0=nt.data)==null?void 0:r0.definitionId)??nt.id),systemPromptReadonly:String((ug==null?void 0:ug.description)??""),modelLists:ut,disabled:!u,onIdBlur:QT,onClose:gu,onPublishToMarketplace:LT,error:sg,ioSlots:{inputs:Array.isArray(mt==null?void 0:mt.inputs)?mt.inputs:[],outputs:Array.isArray(mt==null?void 0:mt.outputs)?mt.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(lt==="settings"?"flow:settings.title":"flow:history.title")}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:gu,"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:lt==="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:R,onChange:x=>{M(x.target.value),K("")},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),zf())},onBlur:()=>{R.trim()&&R.trim()!==u.id&&zf()},placeholder:u.id,disabled:V,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:Wl(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:Wl(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]}),O?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:O}):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:()=>Vb(u.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:$?"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:S,onClick:()=>Ff("workspace"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:S,onClick:()=>Ff("user"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),N?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:N}):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:g,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")}),Sf?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:!!In.enabled,disabled:Xs||u.archived||u.source==="builtin",onChange:x=>Bo(j=>({...j,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:In.cron||"",disabled:Xs||u.archived||u.source==="builtin",onChange:x=>Bo(j=>({...j,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:In.timezone||"",disabled:Xs||u.archived||u.source==="builtin",onChange:x=>Bo(j=>({...j,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:In.preset||"",disabled:Xs||u.archived||u.source==="builtin",onChange:x=>Bo(j=>({...j,preset:x.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Qn).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")})}),In.nextRunAt?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(In.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:bn!=null&&bn.running?e("flow:schedule.running"):In.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),zt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(zt.lastTriggeredAt).toLocaleString()})]}):null,zt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(zt.lastSkippedAt).toLocaleString(),zt.lastSkipReason?` · ${zt.lastSkipReason}`:""]})]}):null,zt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:zt.lastRunUuid})]}):null,zt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(zt.lastExitCode)})]}):null,zt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(zt.lastFinishedAt).toLocaleString()})]}):null]}),bn!=null&&bn.lastError||zt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(bn==null?void 0:bn.lastError)||zt.lastError}):null,u.archived||u.source==="builtin"?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Ta?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Ta}):null,Qs?o.jsx("p",{className:"af-pipeline-drawer-muted",children:Qs}):null,o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:Xs||u.archived||u.source==="builtin",onClick:pg,children:e(Xs?"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})]}),Hr?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):jr?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:jr}):pu.length===0?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):o.jsxs(o.Fragment,{children:[Mr.success+Mr.failed+Mr.running+Mr.stopped+Mr.interrupted>0?o.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[Mr.success>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:Mr.success})}):null,Mr.failed>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:Mr.failed})}):null,Mr.stopped>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:Mr.stopped})}):null,Mr.interrupted>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:Mr.interrupted})}):null,Mr.running>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:Mr.running})}):null]}):null,o.jsx("ul",{className:"af-exec-history-list",children:pu.map((x,j)=>{const F=x.status||"unknown",U=F==="success"?"af-exec-history-card--success":F==="failed"?"af-exec-history-card--failed":F==="stopped"?"af-exec-history-card--stopped":F==="interrupted"?"af-exec-history-card--interrupted":F==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",W=e(F==="success"?"flow:history.success":F==="failed"?"flow:history.failed":F==="stopped"?"flow:history.stopped":F==="interrupted"?"flow:history.interrupted":F==="running"?"flow:history.running":"flow:history.unknown"),Y=F==="success"?"check_circle":F==="failed"?"error":F==="stopped"?"stop_circle":F==="interrupted"?"sync_disabled":F==="running"?"progress_activity":"help",ee=x.runId||`${x.at}-${j}`,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:pu.length-j});return o.jsx("li",{className:"af-exec-history-list-item",children:o.jsxs("button",{type:"button",className:`af-exec-history-card ${U}`,onClick:()=>l2(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:Fx(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:Y}),W]}),o.jsxs("span",{className:"af-exec-history-card-duration",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),gO(x.durationMs,e)]})]})]})},`${u.id}-${ee}`)})})]})]})})]})}):null]}),o.jsx(MN,{open:n2,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:s2,onCancel:()=>gg(!1)}),o.jsx(MN,{open:i2,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:a2,onSecondary:o2,onCancel:()=>Uf(!1)}),o.jsx(vI,{open:_l,onClose:()=>Is(!1)}),m2(),o.jsx(cV,{open:Fo,onClose:()=>Ts(!1),onJump:KT,nodes:Pt}),o.jsx(LV,{open:Me,onClose:()=>qe(!1),flowId:(u==null?void 0:u.id)??""}),o.jsx(iV,{open:I,onClose:()=>z(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",onArchived:async()=>{z(!1),await Lf(),n("/projects?tab=archived")}}),o.jsx(oV,{open:P&&!!(u!=null&&u.id),onClose:()=>T(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),onDeleted:async()=>{T(!1),f(null),gt([]),tn([]),du(null),await Lf(),n("/projects")}}),Jt&&Xr.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:()=>Bn(!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:Xt.name,onChange:x=>{const j=x.target.value;_n(F=>({...F,name:j,id:F.id?F.id:j.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:Xt.id,onChange:x=>_n(j=>({...j,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:Xt.description,onChange:x=>_n(j=>({...j,description:x.target.value})),placeholder:"这段流程适合什么场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",xr.length," 个节点和 ",Wf.length," 条内部连线。"]}),oe?o.jsx("div",{className:"af-flow-snippet-error",children:oe}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Bn(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Nr||!Xt.name.trim(),onClick:()=>void u2(),children:Nr?"发布中…":"发布"})]})]})}),document.body),o.jsx(uV,{open:!!E,onClose:()=>J(null),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),filePath:(E==null?void 0:E.filePath)??"",fileName:(E==null?void 0:E.fileName)??"",onSaved:()=>{Vt(x=>({...x}))}})]}),Dn&&Re!=="edit"&&Xr.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:Dn.instanceId})]}),o.jsx("div",{className:"af-user-check-modal__actions",children:ru?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(!Dn||!u||!bt)return;const x=Lo||Dn.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:bt,instanceId:Dn.instanceId,content:x})})).ok?(La(F=>F&&{...F,content:x}),eo(!1),ft(F=>[...F,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):ft(F=>[...F,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{ft(j=>[...j,{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:()=>{Oa(Dn.content),eo(!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:()=>eo(!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:()=>La(null),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),o.jsx("div",{className:"af-user-check-modal__body",children:ru?o.jsx("textarea",{ref:eg,className:"af-user-check-modal__textarea",value:Lo||Dn.content,onChange:x=>Oa(x.target.value)}):o.jsx("div",{className:"af-user-check-modal__preview",children:o.jsx("pre",{children:Lo||Dn.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:Ct,onChange:x=>Oo(x.target.value),disabled:su}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:su||!Ct.trim(),onClick:()=>{!Dn||!u||!bt||!Ct.trim()||(Mo(!0),ft(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:bt,instanceId:Dn.instanceId,content:Lo||Dn.content,prompt:Ct})}).then(x=>x.json()).then(x=>{Mo(!1),x.ok&&x.content?(Oa(x.content),eo(!0),Oo(""),ft(j=>[...j,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):ft(j=>[...j,{ts:new Date().toISOString(),type:"error",text:x.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{Mo(!1),ft(x=>[...x,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[su?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(!Dn||!u||!bt)return;const x=Lo||Dn.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:bt,instanceId:Dn.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:bt,instanceId:Dn.instanceId,execId:Dn.execId})}),La(null),Oo(""),Ii({runUuid:bt})):ft(F=>[...F,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{ft(j=>[...j,{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),ms&&Re!=="edit"&&Xr.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:ms.instanceId})]}),o.jsx("div",{className:"af-user-ask-modal__actions",children:o.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>to(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:[ms.question.trim()?o.jsx("div",{className:"af-user-ask-modal__question",children:o.jsx("pre",{children:ms.question})}):null,ms.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:ms.options.map(x=>o.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:$o,onClick:async()=>{if(!(!ms||!u||!bt)){Ma(!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:bt,instanceId:ms.instanceId,execId:ms.execId,branch:x.name,selectedIndex:x.index,selectedLabel:x.label})})).ok?(to(null),Ma(!1),Ii({runUuid:bt})):(Ma(!1),ft(F=>[...F,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{Ma(!1),ft(j=>[...j,{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($o?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),iu&&Re!=="edit"&&o.jsxs("div",{className:"af-tool-print-toast"+(ei?" 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:iu.instanceId})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Wn(x=>!x),"aria-label":e(ei?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(ei?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:ei?"close_fullscreen":"open_in_full"})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Cl(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(mf,{children:iu.content})})})]}),ti&&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:ti.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>El(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:$a,className:"af-provide-edit-modal__textarea",defaultValue:ti.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:AT,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:()=>El(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),Aa&&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:()=>Wr(!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:si.length===0?o.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):o.jsx("div",{className:"af-run-params-list",children:si.map(x=>{var ge,ye;const j=Ol[x.id];if(!j)return null;const F=((ge=x.data)==null?void 0:ge.definitionId)||"",U=F.startsWith("provide_file"),W=F==="provide_bool",Y=((ye=x.data)==null?void 0:ye.label)||x.id,ee=Ao[j]??"",ne=["true","1","yes","on"].includes(String(ee).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":W?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-params-item__label",children:Y}),o.jsx("span",{className:"af-run-params-item__slot",children:j})]}),W?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ne?" af-run-config-bool-toggle--true":""),onClick:()=>it($e=>({...$e,[j]:ne?"false":"true"})),"aria-pressed":ne,children:ne?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-params-item__input",value:ee,onChange:$e=>it(ie=>({...ie,[j]:$e.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 j;const x={};for(const F of si){const U=Ol[F.id];if(!U)continue;const W=((j=F.data)==null?void 0:j.definitionId)||"",Y=Ao[U]??"";W.startsWith("provide_file")?x[U]={type:"file",path:Y}:x[U]={type:"str",value:Y}}Wr(!1),ir(!1),Ii({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:()=>Wr(!1),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})]})}const d7="modulepreload",f7=function(e){return"/"+e},lj={},p7=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=f7(c),c in lj)return;lj[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":d7,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((p,h)=>{f.addEventListener("load",p),f.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)})},h7=new Set(["echarts"]),m7=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),g7=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),y7=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function ga(e){return e&&typeof e=="object"&&!Array.isArray(e)}function gl(e,t){if(!ga(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:ga(n[r])&&ga(s)&&(n[r]=gl(n[r],s));return n}function qm(e,t){return e==null?e:Array.isArray(e)?e.map(n=>ga(n)?gl(n,t):n):ga(e)?gl(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 Sw(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)=>Sw(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||g7.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);Sw(r,`${t}.${n}`)}}}function w7(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(!m7.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function v7(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:gl(e,t)}function b7(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(!ga(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return gl(i,n)}):ga(e)?gl(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function k7(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:qm(e,n)}function cj(e,t="rgba(255, 255, 255, 0.62)"){return qm(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 S7(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:qm(e,n)}function N7(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:qm(e,t)}function j7(e,t,n){const r=b7(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>ga(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??y7,textStyle:gl(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:v7(e.tooltip),legend:k7(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?S7(e.grid,s||i):e.grid,xAxis:cj(e.xAxis),yAxis:cj(e.yAxis),radar:N7(e.radar),series:t}}function C7(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(!h7.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");Sw(n);const r=w7(n.option.series),s=n.title==null?"":String(n.title),i=j7(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 E7="af:workspace-graph:v2",Yl=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],_7=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),P7={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:""}]},A7={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}]},I7={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}]},T7="0.1.37";function R7(){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 Lu(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 L7(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 O7(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function M7(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 uj(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 LI(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 OI(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function gb(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 qu(e){const t=String(gb(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 dj(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function nm(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function Yu(e){return nm(e)}function Nw(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Ay(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 fj(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 pj(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 hj(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=Uc(s.get(n),e.sourceHandle||"output-0","source"),a=Uc(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&Hc(i,a))}function $7(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=Uc(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:yI(a)}:null}function D7(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"?Hc(t.slot,a):Hc(a,t.slot)))continue;const c=qu(n);return{def:n,order:r,category:c,categoryRank:Yl.indexOf(c),slot:a,slotIndex:i,displayLabel:Yu(n),description:Nw(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 F7(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function z7(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 B7(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Ip(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:B7(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 Iy(e,t){var f,p;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=MI(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(f=e==null?void 0:e.ui)!=null&&f.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]||{},k=g.definitionId||h,b=t.find(A=>A.id===k),y=gb(b)||k,v=t.find(A=>A.id===y)||b,w=g.marketplaceRef||OI(b),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,S=!!vs(y);return{id:h,type:yf,position:N,...C?{width:C.width,height:C.height}:{},data:{label:g.label||nm(b)||nm(v)||h,definitionId:y,...w?{marketplaceRef:w}:{},...b!=null&&b.packageId?{marketplacePackageId:b.packageId}:{},...b!=null&&b.version?{marketplaceVersion:b.version}:{},schemaType:LI(y,v||b),role:g.role||"normal",model:g.model||void 0,body:g.body||"",script:g.script||"",...S&&C?{displaySize:C}:{}}}}).map(h=>Yd(h,r,t)),u=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:os.ArrowClosed}}));return{nodes:d,edges:mI(u,d),instances:r}}function Tp(e,t,n){var l,c,d,u,f,p,h,g,k;const r=MI(gf(e,n||{})),s=t.map(b=>({source:b.source,target:b.target,sourceHandle:b.sourceHandle??null,targetHandle:b.targetHandle??null})),i={},a={};for(const b of e){i[b.id]={x:((l=b.position)==null?void 0:l.x)||0,y:((c=b.position)==null?void 0:c.y)||0};const y=!!vs((d=b.data)==null?void 0:d.definitionId),v=Number(((f=(u=b.data)==null?void 0:u.displaySize)==null?void 0:f.width)||b.width||(y?(p=b.measured)==null?void 0:p.width:0)||0),w=Number(((g=(h=b.data)==null?void 0:h.displaySize)==null?void 0:g.height)||b.height||(y?(k=b.measured)==null?void 0:k.height:0)||0);v>0&&w>0&&(a[b.id]={width:v,height:w})}return{version:1,instances:r,edges:s,ui:{nodePositions:i,nodeSizes:a}}}function MI(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!vs(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 vs(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":""}function fd(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=vs(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 $I(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 H7(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 U7(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":"article"}function fc(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 W7(e){const t=fc(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function V7(e){return fc(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function K7(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&&fc(l).length>1&&W7(t[a+1])){i();const c=fc(l),d=V7(t[a+1]),u=[];for(a+=2;a<t.length&&t[a].trim()&&fc(t[a]).length>1;)u.push(fc(t[a])),a++;n.push({type:"table",headers:c,align:d,rows:u});continue}r.push(l),a++}return i(),n}function mj({children:e}){return o.jsx(mf,{components:{p:({children:t})=>o.jsx(o.Fragment,{children:t})},children:String(e||"")})}function q7({content:e}){const t=m.useMemo(()=>K7(e),[e]);return o.jsx(o.Fragment,{children:t.map((n,r)=>n.type!=="table"?o.jsx(mf,{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(mj,{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(mj,{children:s[l]||""})},l))},i))})]})},`table-${r}`))})}function Y7(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 G7({code:e}){const t=m.useMemo(()=>Y7(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((u,f)=>{l.set(u.id,{x:24+(n?f*(r+i):f%3*(r+i)),y:24+(n?f%3*(s+a):f*(s+a))})});const c=Math.max(360,...Array.from(l.values()).map(u=>u.x+r+24)),d=Math.max(180,...Array.from(l.values()).map(u=>u.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((u,f)=>{const p=l.get(u.from),h=l.get(u.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)"},`${u.from}-${u.to}-${f}`)}),t.nodes.map(u=>{const f=l.get(u.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:f.x,y:f.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:f.x+r/2,y:f.y+s/2+5,textAnchor:"middle",children:u.label.slice(0,22)})]},u.id)})]})})}function Va({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 u=n.current;if(!u)return;const f=Math.max(1,u.scrollHeight),p=Math.max(1,u.clientHeight),h=f>p+1,g=h?Math.max(12,p/f*100):100,k=Math.max(0,100-g),b=h?Math.min(k,u.scrollTop/Math.max(1,f-p)*k):0;i({visible:h,top:b,height:g})},[]);m.useEffect(()=>{const u=requestAnimationFrame(a),f=n.current;if(!f||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(u);const p=new ResizeObserver(a);p.observe(f);for(const h of Array.from(f.children))p.observe(h);return()=>{cancelAnimationFrame(u),p.disconnect()}},[t,a]);const l=m.useCallback(u=>{const f=n.current;if(!f)return;const p=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,u))*p,a()},[a]),c=m.useCallback((u,f=0)=>{const p=r.current;if(!p)return 0;const h=p.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(u-h.top-f)/k},[s.height]),d=m.useCallback(u=>{var N,C;if(!s.visible)return;u.preventDefault(),u.stopPropagation();const f=r.current;if(!f)return;const p=f.getBoundingClientRect(),h=s.top/100*p.height,g=s.height/100*p.height,b=u.clientY>=p.top+h&&u.clientY<=p.top+h+g?u.clientY-p.top-h:g/2;l(c(u.clientY,b));const y=u.pointerId;(C=(N=u.currentTarget).setPointerCapture)==null||C.call(N,y);const v=S=>{S.preventDefault(),l(c(S.clientY,b))},w=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w)};window.addEventListener("pointermove",v),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 J7({content:e}){const t=m.useRef(null),n=m.useMemo(()=>C7(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:""}),p7(()=>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,u;i=!0,c&&window.removeEventListener("resize",c),(d=l==null?void 0:l.disconnect)==null||d.call(l),(u=a==null?void 0:a.dispose)==null||u.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 X7({data:e,htmlFrameRef:t,htmlFrameVersion:n=0}){const r=vs(e==null?void 0:e.definitionId);if(!r)return null;const s=fd(e),i=r==="html"?$I(s):s;return i.trim()?r==="html"?o.jsx(Va,{className:"af-work-display-body af-work-display-body--html",children:o.jsx("iframe",{ref:t,className:"af-work-display-html-frame",title:(e==null?void 0:e.label)||"HTML preview",sandbox:"allow-scripts allow-forms allow-modals",srcDoc:i},n)}):r==="image"?o.jsx(Va,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:i,alt:H7(e),loading:"lazy"})}):r==="markdown"?o.jsx(Va,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(q7,{content:i})}):r==="chart"?o.jsx(Va,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx(J7,{content:i})}):r==="mermaid"?o.jsxs(Va,{className:"af-work-display-body",children:[o.jsx(G7,{code:i}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:i})]}):o.jsx(Va,{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:i})}):o.jsx(Va,{className:"af-work-display-empty",children:"No display content"})}function Q7({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 Z7({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),u=String(s.candidateContent||""),f=!!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||f||p||u.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}`)),f?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:f,"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:f,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{d.current=!0},onCompositionEnd:h=>{var k;d.current=!1;const g=h.currentTarget.value;c(g),(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,g)},onChange:h=>{var k;const g=h.target.value;c(g),d.current||(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,g)},onKeyDown:h=>{var g,k;h.isComposing||(g=h.nativeEvent)!=null&&g.isComposing||h.keyCode===229||(h.metaKey||h.ctrlKey)&&h.key==="Enter"&&(h.preventDefault(),(k=t==null?void 0:t.onSendNodeChat)==null||k.call(t,e,l))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:f||!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:f||!u.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:f||!u.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 eK(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":e==="chart"?"json":"md"}function tK(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function nK(e,t){const n=vs(t==null?void 0:t.definitionId)||"markdown";return`outputs/${tK((t==null?void 0:t.label)||e||n)}.${eK(n)}`}function rK({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((N,C)=>({slot:N,idx:C})).sort((N,C)=>{var V,D,O,K;const S=String(((V=N.slot)==null?void 0:V.name)||"").trim(),A=String(((D=C.slot)==null?void 0:D.name)||"").trim();if(S==="next"&&A!=="next")return-1;if(A==="next"&&S!=="next")return 1;const R=String(((O=N.slot)==null?void 0:O.type)||"").trim(),M=String(((K=C.slot)==null?void 0:K.type)||"").trim();return R==="node"&&M!=="node"?-1:M==="node"&&R!=="node"?1:N.idx-C.idx}),l=vs(t==null?void 0:t.definitionId),c=m.useRef(null),[d,u]=m.useState(0),[f,p]=m.useState(!1),[h,g]=m.useState(!1),[k,b]=m.useState(""),y=l==="markdown"?fd(t):"";m.useEffect(()=>{if(!f)return;const N=()=>p(!1);return window.addEventListener("pointerup",N,!0),window.addEventListener("pointercancel",N,!0),window.addEventListener("mouseup",N,!0),window.addEventListener("blur",N),()=>{window.removeEventListener("pointerup",N,!0),window.removeEventListener("pointercancel",N,!0),window.removeEventListener("mouseup",N,!0),window.removeEventListener("blur",N)}},[f]),m.useEffect(()=>{h||b(String(y||""))},[y,h]);const v=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="image"?"Image":l==="chart"?"Chart":"Markdown"),w=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;return o.jsxs("div",{className:"af-work-display-card"+(w?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(f?" af-work-display-card--resizing":"")+(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:w?{width:w.width,height:w.height}:void 0,children:[o.jsx(v4,{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((N,C)=>{if(N.showOnNode===!1)return null;const S=`${4.15+C*1.75}rem`,A=N.name||`#${C+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:S},children:A}),o.jsx(ls,{type:"target",position:We.Left,id:`input-${C}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:S,background:Ln(N.type)},title:`${A} · ${N.type}`})]},`in-${C}`)}),a.map(({slot:N,idx:C},S)=>{if(N.showOnNode===!1)return null;const A=`${4.15+S*1.75}rem`,R=N.name||`#${C+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:A},children:R}),o.jsx(ls,{type:"source",position:We.Right,id:`output-${C}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:A,background:Ln(N.type)},title:`${R} · ${N.type}`})]},`out-${C}`)}),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:U7(l)}),o.jsx("strong",{children:v}),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:N=>N.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var N,C,S,A;try{(A=(S=(C=(N=c.current)==null?void 0:N.contentWindow)==null?void 0:C.history)==null?void 0:S.back)==null||A.call(S)}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 N,C,S,A;try{(A=(S=(C=(N=c.current)==null?void 0:N.contentWindow)==null?void 0:C.history)==null?void 0:S.forward)==null||A.call(S)}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:()=>u(N=>N+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:N=>N.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var N;(N=t==null?void 0:t.onSetDisplayNodeContent)==null||N.call(t,e,k,"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:()=>{b(String(y||"")),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:N=>{N.stopPropagation(),b(String(y||"")),g(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:o.jsx("span",{className:"material-symbols-outlined",children:"edit"})}):null,o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:()=>{var N;return(N=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:N.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(Q7,{value:k,onChange:b}):o.jsx(X7,{data:t,htmlFrameRef:c,htmlFrameVersion:d}),o.jsx(Z7,{nodeId:e,data:t})]})}function sK({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 u=`${2.25+d*1.75}rem`,f=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:u},children:f}),o.jsx(ls,{type:"target",position:We.Left,id:`input-${d}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:u,background:Ln(c.type)},title:`${f} · ${c.type}`})]},`in-${d}`)}),i.map((c,d)=>{if(c.showOnNode===!1)return null;const u=`${2.25+d*1.75}rem`,f=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:u},children:f}),o.jsx(ls,{type:"source",position:We.Right,id:`output-${d}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:u,background:Ln(c.type)},title:`${f} · ${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,u;c.stopPropagation(),a?(d=t==null?void 0:t.onStopWorkspaceNode)==null||d.call(t,e):(u=t==null?void 0:t.onRunWorkspaceNode)==null||u.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 iK(e){var d,u,f,p,h,g,k,b,y,v,w;const{setEdges:t,setNodes:n}=bl(),r=(d=e.data)==null?void 0:d.onSyncNodePropDraft,s=m.useCallback(N=>{n(C=>C.filter(S=>S.id!==N)),t(C=>C.filter(S=>S.source!==N&&S.target!==N))},[t,n]),i=m.useCallback((N,C)=>{n(S=>S.map(A=>A.id===N?{...A,data:{...A.data,model:C}}:A)),r==null||r(N,{model:C})},[n,r]),a=m.useCallback((N,C)=>{n(S=>S.map(A=>{var M;if(A.id!==N)return A;const R=Array.isArray((M=A.data)==null?void 0:M.outputs)&&A.data.outputs.length?A.data.outputs.map((V,D)=>D===0?{...V,default:C,value:C}:V):[{type:"bool",name:"value",default:C,value:C}];return{...A,data:{...A.data,body:"",outputs:R}}})),r==null||r(N,S=>({body:"",outputs:Array.isArray(S==null?void 0:S.outputs)&&S.outputs.length?S.outputs.map((R,M)=>M===0?{...R,default:C,value:C}:R):[{type:"bool",name:"value",default:C,value:C}]}))},[n,r]),l=m.useCallback((N,C)=>{n(S=>S.map(A=>A.id===N?{...A,data:{...A.data,body:C}}:A)),r==null||r(N,{body:C})},[n,r]),c=m.useCallback((N,C)=>{const S=ts(C);n(A=>A.map(R=>R.id===N?{...R,data:{...R.data,images:S}}:R)),r==null||r(N,{images:S})},[n,r]);return vs((u=e.data)==null?void 0:u.definitionId)?o.jsx(rK,{...e,deleteNode:s}):((f=e.data)==null?void 0:f.definitionId)==="workspace_run"?o.jsx(sK,{...e,deleteNode:s}):((p=e.data)==null?void 0:p.definitionId)==="control_load_skills"?o.jsx(hK,{...e,deleteNode:s,skills:(h=e.data)==null?void 0:h.skills,skillCollections:(g=e.data)==null?void 0:g.skillCollections,onChangeSkillKeys:(k=e.data)==null?void 0:k.onChangeLoadSkillKeys}):((b=e.data)==null?void 0:b.definitionId)==="control_load_mcp"?o.jsx(mK,{...e,deleteNode:s,servers:(y=e.data)==null?void 0:y.mcpServers,onChangeMcpNames:(v=e.data)==null?void 0:v.onChangeLoadMcpNames}):o.jsx("div",{className:"af-work-flow-node",children:o.jsx(xI,{...e,deleteNode:s,modelLists:(w=e.data)==null?void 0:w.modelLists,onModelChange:i,onProvideValueChange:a,onNodeBodyChange:l,onNodeImagesChange:c})})}const oK={[yf]:iK};function DI(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&DI(n.children,t);return t}function FI(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&FI(n.children,t));return t}function Ty(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 zI({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 f;const d=c.type==="directory",u=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:u?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:c.icon||F7(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&&!u&&((f=c.children)!=null&&f.length)?o.jsx(zI,{items:c.children,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:s,onCreateFolder:i,onDelete:a,onFileDragStart:l}):null]},c.path)})})}function aK({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 rm(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 lK(e){const t=rm((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 rm((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function cK(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function uK(e){const t=rm((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 rm((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function dK(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function gj(e){var r,s,i,a,l,c;if(!e)return null;const{inputs:t,outputs:n}=hI(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:ts((l=e.data)==null?void 0:l.images),script:String(((c=e.data)==null?void 0:c.script)??""),inputs:t,outputs:n}}function fK(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function pK(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"])fK(e[s],t[s])&&(r[s]=n[s]);return r}function hK({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:[],u=Array.isArray(i)?i:[],[f,p]=m.useState(!1),[h,g]=m.useState(""),[k,b]=m.useState(()=>new Set),y=m.useRef(null),v=m.useRef(null),[w,N]=m.useState({visible:!1,top:0,height:100}),C=m.useMemo(()=>new Set(lK(t)),[t]),S=m.useMemo(()=>new Map(d.map(L=>[L.key,L])),[d]),A=m.useMemo(()=>{const L=new Set,I=u.map(P=>{const T=wa(P,d).map(E=>S.get(E)).filter(Boolean);for(const E of T)L.add(E.key);return{...P,skills:T}}).filter(P=>P.skills.length>0),z=d.filter(P=>!L.has(P.key));return{collectionGroups:I,ungrouped:z}},[S,u,d]);m.useEffect(()=>{b(L=>{let I=!1;const z=new Set(L);for(const P of A.collectionGroups)z.has(P.id)||(z.add(P.id),I=!0);return I?z:L})},[A.collectionGroups]);const R=m.useMemo(()=>{const L=h.trim().toLowerCase();if(!L)return A;const I=P=>[P==null?void 0:P.key,P==null?void 0:P.name,P==null?void 0:P.description].map(E=>String(E||"").toLowerCase()).join(" ").includes(L);return{collectionGroups:A.collectionGroups.map(P=>{const E=[P==null?void 0:P.id,P==null?void 0:P.name,P==null?void 0:P.description].map(J=>String(J||"").toLowerCase()).join(" ").includes(L)?P.skills:P.skills.filter(I);return{...P,skills:E}}).filter(P=>P.skills.length>0),ungrouped:A.ungrouped.filter(I)}},[A,h]),M=m.useCallback((L,I)=>{const z=new Set(C);for(const P of L)I?z.add(P):z.delete(P);a==null||a(e,Array.from(z))},[e,C,a]),V=m.useCallback(L=>{b(I=>{const z=new Set(I);return z.has(L)?z.delete(L):z.add(L),z})},[]),D=m.useCallback(()=>{const L=y.current;if(!L)return;const I=Math.max(1,L.scrollHeight),z=Math.max(1,L.clientHeight),P=I>z+1,T=P?Math.max(12,z/I*100):100,E=Math.max(0,100-T),J=P?Math.min(E,L.scrollTop/Math.max(1,I-z)*E):0;N({visible:P,top:J,height:T})},[]);m.useEffect(()=>{if(!f)return;const L=requestAnimationFrame(D);return()=>cancelAnimationFrame(L)},[k,R,C.size,f,D]);const O=m.useCallback(L=>{const I=y.current;if(!I)return;const z=Math.max(0,I.scrollHeight-I.clientHeight);I.scrollTop=Math.min(1,Math.max(0,L))*z,D()},[D]),K=m.useCallback((L,I=0)=>{const z=v.current;if(!z)return 0;const P=z.getBoundingClientRect(),T=w.height/100*P.height,E=Math.max(1,P.height-T);return(L-P.top-I)/E},[w.height]),$=m.useCallback(L=>{var le,ue;if(!w.visible)return;L.preventDefault(),L.stopPropagation();const I=v.current;if(!I)return;const z=I.getBoundingClientRect(),P=w.top/100*z.height,T=w.height/100*z.height,J=L.clientY>=z.top+P&&L.clientY<=z.top+P+T?L.clientY-z.top-P:T/2;O(K(L.clientY,J));const Q=L.pointerId;(ue=(le=L.currentTarget).setPointerCapture)==null||ue.call(le,Q);const H=de=>{de.preventDefault(),O(K(de.clientY,J))},te=()=>{window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",te),window.removeEventListener("pointercancel",te)};window.addEventListener("pointermove",H),window.addEventListener("pointerup",te),window.addEventListener("pointercancel",te)},[K,O,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((L,I)=>{if(L.showOnNode===!1)return null;const z=`${2.6+I*1.7}rem`,P=L.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:z},children:P}),o.jsx(ls,{type:"target",position:We.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:z,background:Ln(L.type)},title:`${P} · ${L.type}`})]},`in-${I}`)}),c.map((L,I)=>{if(L.showOnNode===!1)return null;const z=`${2.6+I*1.7}rem`,P=L.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:z},children:P}),o.jsx(ls,{type:"source",position:We.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:z,background:Ln(L.type)},title:`${P} · ${L.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:L=>{var I;L.stopPropagation(),f||(I=t==null?void 0:t.onRefreshSkills)==null||I.call(t),p(z=>!z)},children:[o.jsx("span",{children:C.size>0?`${C.size} skills selected`:"选择 Skills"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:f?"expand_less":"expand_more"})]}),f?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:L=>L.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:L=>g(L.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:D,children:[R.collectionGroups.map(L=>{const I=L.skills.map(E=>E.key),z=I.filter(E=>C.has(E)).length,P=I.length>0&&z===I.length,T=k.has(L.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(T?" 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:E=>M(I,E.target.checked),"aria-label":`选择 ${L.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>V(L.id),"aria-expanded":!T,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:L.name}),L.description?o.jsx("em",{children:L.description}):null]})}),o.jsxs("small",{children:[z,"/",I.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>V(L.id),"aria-label":T?`展开 ${L.name}`:`收起 ${L.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:T?"chevron_right":"expand_more"})})]}),T?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:L.skills.map(E=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has(E.key),onChange:J=>M([E.key],J.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:E.name}),E.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:E.description}):null]})]},`${L.id}:${E.key}`))})]},L.id)}),R.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:R.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:R.ungrouped.map(L=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has(L.key),onChange:I=>M([L.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:L.name}),L.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:L.description}):null]})]},`ungrouped:${L.key}`))})]}):null,R.collectionGroups.length===0&&R.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:v,className:"af-work-load-skills-scrollbar"+(w.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:$,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${w.height}%`,top:`${w.top}%`}})})]}):null]})]})}function mK({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),[u,f]=m.useState(""),p=m.useMemo(()=>new Set(uK(t)),[t]),h=m.useMemo(()=>(Array.isArray(s)?s:[]).map(b=>({name:String((b==null?void 0:b.name)||""),description:String((b==null?void 0:b.description)||""),detail:String((b==null?void 0:b.url)||[b==null?void 0:b.command,...Array.isArray(b==null?void 0:b.args)?b.args:[]].filter(Boolean).join(" ")||""),type:String((b==null?void 0:b.type)||"")})).filter(b=>b.name),[s]),g=m.useMemo(()=>{const b=u.trim().toLowerCase();return b?h.filter(y=>[y.name,y.description,y.detail,y.type].join(" ").toLowerCase().includes(b)):h},[u,h]),k=m.useCallback((b,y)=>{const v=new Set(p);for(const w of b)y?v.add(w):v.delete(w);i==null||i(e,Array.from(v))},[e,p,i]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[a.map((b,y)=>{if(b.showOnNode===!1)return null;const v=`${2.6+y*1.7}rem`,w=b.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:v},children:w}),o.jsx(ls,{type:"target",position:We.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:v,background:Ln(b.type)},title:`${w} · ${b.type}`})]},`in-${y}`)}),l.map((b,y)=>{if(b.showOnNode===!1)return null;const v=`${2.6+y*1.7}rem`,w=b.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:v},children:w}),o.jsx(ls,{type:"source",position:We.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:v,background:Ln(b.type)},title:`${w} · ${b.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:b=>{var y;b.stopPropagation(),c||(y=t==null?void 0:t.onRefreshMcps)==null||y.call(t),d(v=>!v)},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:b=>b.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:u,onChange:b=>f(b.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),u?o.jsx("button",{type:"button",onClick:()=>f(""),"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(b=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:p.has(b.name),onChange:y=>k([b.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:b.name}),b.description||b.detail?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:b.description||b.detail}):null]})]},b.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 gK(){var _f,cu;const{i18n:e}=pn(),{navigate:t}=vl(),n=bl(),r=TP(),s=m.useMemo(R7,[]),[i,a]=RP([]),[l,c,d]=LP([]),u=m.useRef([]),f=m.useRef([]),p=m.useRef(null),h=m.useRef(null),g=m.useRef(null),[k,b]=m.useState(null),[y,v]=m.useState({}),w=m.useRef({}),N=m.useRef(!1),C=m.useRef(null),[S,A]=m.useState([]),[R,M]=m.useState(""),[V,D]=m.useState("nodes"),[O,K]=m.useState([]),[$,L]=m.useState(!1),[I,z]=m.useState(""),[P,T]=m.useState(!1),[E,J]=m.useState({name:"",id:"",description:""}),[Q,H]=m.useState(!1),[te,le]=m.useState(""),[ue,de]=m.useState(""),ce=m.useRef(null),[fe,se]=m.useState(!1),[pe,ve]=m.useState("nodes"),[je,Ve]=m.useState(""),[at,Je]=m.useState(0),[jt,De]=m.useState(""),[Ce,Jt]=m.useState(null),[Bn,Xt]=m.useState(""),[_n,Nr]=m.useState([]),[ur,oe]=m.useState(""),[we,Ge]=m.useState(""),[st,et]=m.useState(()=>new Set),[It,On]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[Mt,Mn]=m.useState(""),[Qt,Zt]=m.useState([]),[sr,he]=m.useState(!1),[Te,rn]=m.useState([]),[lt,vn]=m.useState([]),[Vs,Pn]=m.useState(!1),[jr,dr]=m.useState([]),Hr=m.useCallback(_=>{ce.current&&window.clearTimeout(ce.current),de(_),ce.current=window.setTimeout(()=>{de(""),ce.current=null},3800)},[]),Ks=m.useCallback(_=>{const B=String(_||"").trim();B&&window.requestAnimationFrame(()=>{r(B)})},[r]);m.useEffect(()=>()=>{ce.current&&window.clearTimeout(ce.current)},[]);const[Po,Cr]=m.useState(()=>new Set),[Xn,Ps]=m.useState(!1),Xe=m.useRef(null),Vt=m.useRef(null),sn=m.useRef(null),[us,Ke]=m.useState({}),[Hn,Re]=m.useState(""),[Ft,As]=m.useState(!1),[ft,Ur]=m.useState([]),[fr,on]=m.useState([]),[ds,Un]=m.useState("workspace"),[fs,pr]=m.useState(!1),[qs,Er]=m.useState(!0),[ps,hs]=m.useState(""),[q,ke]=m.useState({}),[Me,qe]=m.useState(!1),[vt,An]=m.useState(!1),[$t,bt]=m.useState("pan"),[en,Ys]=m.useState(null),[Or,Gs]=m.useState(""),Js=m.useRef(null),hr=m.useRef(!1),[Pa,ir]=m.useState(()=>new Set),[Aa,Wr]=m.useState({}),[Ao,it]=m.useState(""),Qn=m.useMemo(()=>L7(s),[s]),[Qi,Ia]=m.useState("");m.useEffect(()=>{s.flowId&&$E(s.flowId,s.flowSource||"user","workspace",!!s.archived)},[s]),m.useEffect(()=>{Ur([]),on([]),Un("workspace"),Er(!0)},[s]);const mr=m.useCallback(async()=>{const _=Lu(s),B=await fetch(`/api/workspace/files?${_.toString()}`),G=await B.json();if(!B.ok)throw new Error(G.error||"读取 workspace 失败");const X=G.files||[];Nr(X),et(new Set(FI(X))),oe(G.root||"")},[s]),In=m.useCallback(async()=>{L(!0),z("");try{const _=await fetch("/api/marketplace/flow-snippets"),B=await _.json().catch(()=>({}));if(!_.ok)throw new Error(B.error||"读取流程片段失败");K(Array.isArray(B.snippets)?B.snippets:[])}catch(_){z(String(_.message||_)),K([])}finally{L(!1)}},[]),$n=m.useCallback(async(_=i,B=l)=>{var re;if(!N.current)return;const G=Tp(_,B,w.current),X=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,graph:G})}),Z=await X.json();if(!X.ok)throw new Error(Z.error||"保存 workspace graph 失败");w.current=((re=Z.graph)==null?void 0:re.instances)||G.instances,v(w.current),it("Workspace graph saved")},[l,s,i]),Sf=m.useCallback(_=>{var G;const B=(G=_==null?void 0:_.extra)!=null&&G.instances&&typeof _.extra.instances=="object"?_.extra.instances:{};w.current=B,v(B),a(Array.isArray(_==null?void 0:_.nodes)?_.nodes:[]),c(Array.isArray(_==null?void 0:_.edges)?_.edges:[]),De(""),b(null)},[c,a]),Nf=m.useMemo(()=>({instances:y}),[y]),Xs=gI({nodes:i,edges:l,extra:Nf,enabled:N.current,onRestore:Sf}),{resetHistory:nu,undo:Ta,redo:Io}=Xs,Qs=m.useCallback(async()=>{N.current=!1;const _=Lu(s),B=Lu(s);B.set("lang",String(e.language||"zh").startsWith("zh")?"zh":"en");const[G,X]=await Promise.all([fetch(`/api/nodes?${B.toString()}`),fetch(`/api/workspace/graph?${_.toString()}`),mr()]),Z=await G.json(),re=await X.json();if(!G.ok)throw new Error(Z.error||"读取节点定义失败");if(!X.ok)throw new Error(re.error||"读取 workspace graph 失败");const ae=[...(Array.isArray(Z)?Z:Z.nodes||[]).filter(_e=>!_7.has(_e.id)),A7,I7,P7];A(ae);const me=re.graph||JSON.parse(localStorage.getItem(E7)||"null")||{},xe=Iy(me,ae);w.current=xe.instances,v(xe.instances),a(xe.nodes),c(xe.edges),nu(xe.nodes,xe.edges,{instances:xe.instances}),it(re.writable?"Workspace ready":"Readonly workspace"),N.current=!0},[s,e.language,mr,nu,c,a]),Sl=m.useCallback(async(_,B)=>{const G={packageId:(_==null?void 0:_.newId)||(_==null?void 0:_.id)||(_==null?void 0:_.label),label:(_==null?void 0:_.label)||(_==null?void 0:_.newId)||(_==null?void 0:_.id),version:"1.0.0",definitionId:B,body:(_==null?void 0:_.body)||"",script:(_==null?void 0:_.script)||"",inputs:Array.isArray(_==null?void 0:_.inputs)?_.inputs:[],outputs:Array.isArray(_==null?void 0:_.outputs)?_.outputs:[],flowId:s.flowId,flowSource:s.flowSource||"user",archived:!!s.archived},X=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)}),Z=await X.json().catch(()=>({}));if(!X.ok||(Z==null?void 0:Z.ok)===!1)throw new Error((Z==null?void 0:Z.error)||"Publish failed");return await Qs(),it(`Published node ${Z.definitionId||Z.id||G.packageId}`),Z},[s,Qs]),zt=m.useCallback((_="workspace")=>{pr(!0),Jt(null),Un(_||"workspace")},[]),Nl=m.useCallback(async(_="")=>{const B=String(_||Or||"").trim();if(B){hr.current=!0,Js.current&&(Js.current.abort(),Js.current=null),Gs(""),ir(new Set),Wr(G=>{const X={...G};for(const[Z,re]of Object.entries(X))(re==null?void 0:re.status)==="running"&&(X[Z]={status:"stopped"});return X[B]={status:"stopped"},X}),it(`Workspace run stopped: ${B}`),on(G=>G.map(X=>X.runNodeId===B&&X.status==="running"?{...X,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(X.messages)?X.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:X));try{await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,runNodeId:B})})}catch{}}},[s,Or]),bn=m.useCallback(async _=>{if(!_||Or)return;const B=Tp(i,l,w.current),G=`run-${Date.now()}-${String(_).replace(/[^a-z0-9_-]+/gi,"_")}`,X=`Run ${_}`,Z=new AbortController;Js.current=Z,hr.current=!1,Gs(_),ir(new Set([_])),Wr({[_]:{status:"running"}}),it(`Running ${_}...`),Un(G),on(re=>[...re.slice(-7),{id:G,label:X,runNodeId:_,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);try{await $n(i,l);const re=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:Z.signal,body:JSON.stringify({...s,graph:B,runNodeId:_,model:Mt,selectedSkills:Te,stream:!0})});if(!re.ok){const Ee=await re.json().catch(()=>({}));throw new Error(Ee.error||"Workspace run failed")}if(!re.body)throw new Error("Workspace run stream unavailable");const ae=re.body.getReader(),me=new TextDecoder;let xe="",_e=[],pt=[],Bt=_;const tt=(Ee,yt)=>{var St,Kt;const Ue=i.find(Et=>Et.id===Ee),Fe=String(((St=Ue==null?void 0:Ue.data)==null?void 0:St.label)||Ee||"").trim(),Le=String(yt||((Kt=Ue==null?void 0:Ue.data)==null?void 0:Kt.definitionId)||"").trim();return Le&&Le!==Fe?`${Fe} (${Le})`:Fe},Dt=(Ee,yt,Ue)=>{const Fe=String(Ee||"").trim();Fe&&on(Le=>Le.map(St=>{if(St.id!==G)return St;const Et=[...Array.isArray(St.steps)?St.steps:[]],Ae=Et.findIndex(ri=>ri.id===Fe),Ut={id:Fe,label:tt(Fe,yt),status:Ue};Ae>=0?Et[Ae]={...Et[Ae],...Ut}:Et.push(Ut);const Yt=Et.map((ri,ag)=>{const Pf=ri.status==="done"?"[done]":ri.status==="failed"?"[failed]":"[running]";return`${ag+1}. ${Pf} ${ri.label}`}).join(`
|
|
140
|
-
`),Zn=Array.isArray(St.messages)?St.messages:[],ji=Zn.findIndex(ri=>ri.kind==="run-summary"),ro={role:"assistant",kind:"run-summary",text:Yt||"准备运行...",at:Date.now()},so=[...Zn];return ji>=0?so[ji]=ro:so.unshift(ro),{...St,steps:Et,messages:so.slice(-160)}}))},hn=Ee=>{const yt=String(Ee||"").trim();if(!yt)return;const Ue=Bt;Bt=yt,ir(new Set([yt])),Wr(Fe=>{var Le;return{...Fe,...Ue&&Ue!==yt&&((Le=Fe[Ue])==null?void 0:Le.status)==="running"?{[Ue]:{status:"success"}}:{},[yt]:{status:"running"}}})},Ht=Ee=>{const yt=String(Ee||"").trim();yt&&(ir(Ue=>{const Fe=new Set(Ue);return Fe.delete(yt),Fe}),Wr(Ue=>({...Ue,[yt]:{status:"success"}})))},an=(Ee,yt)=>{const Ue=String(yt||"");if(!Ue.trim())return;const Fe=["assistant","thinking","result","error","prompt"].includes(Ee)?Ee:"assistant";on(Le=>Le.map(St=>{if(St.id!==G)return St;let Kt=Array.isArray(St.messages)?St.messages:[];if(Fe==="result"){const Ut=[...Kt].reverse().find(Yt=>Yt.kind==="assistant");if(String((Ut==null?void 0:Ut.text)||"").trim()===Ue.trim())return St}if(Fe==="assistant"){const Ut=Kt.findIndex(Yt=>Yt.kind==="result"&&String(Yt.text||"").trim()===Ue.trim());Ut>=0&&(Kt=Kt.filter((Yt,Zn)=>Zn!==Ut))}const Et=[...Kt],Ae=Et[Et.length-1];return Ae&&Ae.kind===Fe&&!Ae.error?Et[Et.length-1]={...Ae,text:`${Ae.text||""}${Ae.text?`
|
|
141
|
-
`:""}${Ue}`}:Et.push({role:"assistant",kind:Fe,text:Ue,...Fe==="error"?{error:!0}:{},at:Date.now()}),{...St,messages:Et.slice(-160)}}))},Qe=Ee=>{const yt=String(Ee||"");yt.trim()&&on(Ue=>Ue.map(Fe=>{var Et;if(Fe.id!==G)return Fe;const Le=Array.isArray(Fe.messages)?Fe.messages:[],St=Le.findIndex(Ae=>Ae.kind==="thinking"),Kt=[...Le];if(St>=0){const Ae=String(((Et=Kt[St])==null?void 0:Et.text)||"");Kt[St]={...Kt[St],text:`${Ae}${Ae&&!Ae.endsWith(`
|
|
142
|
-
`),""}${yt}`,at:Date.now()}}else{const Ae=Kt.findIndex(Ut=>Ut.kind==="activity");Kt.splice(Ae>=0?Ae+1:Kt.length,0,{role:"assistant",kind:"thinking",text:yt,at:Date.now()})}return{...Fe,messages:Kt.slice(-160)}}))},kt=Ee=>{const yt=M7(Ee);yt&&on(Ue=>Ue.map(Fe=>{if(Fe.id!==G)return Fe;const Le=Array.isArray(Fe.activities)?Fe.activities:[],St=Le[Le.length-1]===yt?Le:[...Le,yt].slice(-8),Kt=Array.isArray(Fe.messages)?Fe.messages:[],Et=Kt.findIndex(Yt=>Yt.kind==="activity"),Ae={role:"assistant",kind:"activity",text:St.map((Yt,Zn)=>`${Zn+1}. ${Yt}`).join(`
|
|
143
|
-
`),at:Date.now()},Ut=[...Kt];if(Et>=0)Ut[Et]=Ae;else{const Yt=Ut.findIndex(Zn=>Zn.kind==="run-summary");Ut.splice(Yt>=0?Yt+1:0,0,Ae)}return{...Fe,activities:St,messages:Ut.slice(-160)}}))},Pe=Ee=>{const yt=String((Ee==null?void 0:Ee.source)||"runner"),Ue=String((Ee==null?void 0:Ee.stream)||""),Fe=String((Ee==null?void 0:Ee.eventType)||"event"),Le=String((Ee==null?void 0:Ee.text)||"").trim();if(!Le)return;const St=`[${yt}${Ue?`:${Ue}`:""}] ${Fe}
|
|
144
|
-
${Le}`;on(Kt=>Kt.map(Et=>{if(Et.id!==G)return Et;const Ut=[...Array.isArray(Et.rawTrace)?Et.rawTrace:[],St].slice(-80),Yt=Array.isArray(Et.messages)?Et.messages:[],Zn=Yt.findIndex(so=>so.kind==="raw"),ji={role:"assistant",kind:"raw",text:Ut.join(`
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
`),at:Date.now()},ro=[...Yt];return Zn>=0?ro[Zn]=ji:ro.push(ji),{...Et,rawTrace:Ut,messages:ro.slice(-160)}}))},ht=Ee=>{on(yt=>yt.map(Ue=>Ue.id===G?{...Ue,status:Ee,endedAt:Date.now()}:Ue))},Ls=Ee=>{const yt=Iy(Ee||B,S),Ue=new Map(yt.nodes.map(Le=>[Le.id,Le])),Fe=yt.instances||{};a(Le=>{const St=new Set(Le.map(Ae=>Ae.id)),Et={...Tp(Le,f.current,w.current).instances||{}};for(const[Ae,Ut]of Object.entries(Fe)){if(!St.has(Ae))continue;const Yt=Et[Ae];vs((Ut==null?void 0:Ut.definitionId)||(Yt==null?void 0:Yt.definitionId))&&(Et[Ae]=Ut)}return w.current=Et,v(Et),Le.map(Ae=>{var Yt,Zn;const Ut=Ue.get(Ae.id);return!Ut||!vs(((Yt=Ut.data)==null?void 0:Yt.definitionId)||((Zn=Ae.data)==null?void 0:Zn.definitionId))?Ae:{...Ae,data:{...Ae.data,...Ut.data}}})})};for(;;){const{value:Ee,done:yt}=await ae.read();if(yt)break;xe+=me.decode(Ee,{stream:!0});const Ue=xe.split(`
|
|
149
|
-
`);xe=Ue.pop()||"";for(const Fe of Ue){if(!Fe.trim())continue;const Le=JSON.parse(Fe);if(Le.type==="error")throw new Error(Le.error||"Workspace run failed");if(Le.type==="stopped"){hr.current=!0,_e=Array.isArray(Le.order)?Le.order:_e;continue}if(Le.type==="node-start"&&(it(`Running ${Le.nodeId}...`),hn(Le.nodeId),Dt(Le.nodeId,Le.definitionId,"running")),Le.type==="node-done"&&(Ht(Le.nodeId),Dt(Le.nodeId,Le.definitionId,"done")),Le.type==="status"&&kt(Le.line||Le.message||""),Le.type==="paused"&&(pt=Array.isArray(Le.nodeIds)?Le.nodeIds:[]),Le.type==="natural"&&(Le.kind==="thinking"?Qe(Le.text||""):an(Le.kind,Le.text||"")),Le.type==="raw"){const St=uj(Le);St&&Qe(St),Pe(Le)}Le.type==="graph"&&Le.graph&&Ls(Le.graph),Le.type==="done"&&(Le.graph&&Ls(Le.graph),_e=Array.isArray(Le.order)?Le.order:[],pt=Array.isArray(Le.pauseNodeIds)?Le.pauseNodeIds:pt)}}if(xe.trim()){const Ee=JSON.parse(xe);if(Ee.type==="error")throw new Error(Ee.error||"Workspace run failed");if(Ee.type==="stopped"&&(hr.current=!0),Ee.type==="node-start"&&(it(`Running ${Ee.nodeId}...`),hn(Ee.nodeId),Dt(Ee.nodeId,Ee.definitionId,"running")),Ee.type==="node-done"&&(Ht(Ee.nodeId),Dt(Ee.nodeId,Ee.definitionId,"done")),Ee.type==="status"&&kt(Ee.line||Ee.message||""),Ee.type==="paused"&&(pt=Array.isArray(Ee.nodeIds)?Ee.nodeIds:[]),Ee.type==="natural"&&(Ee.kind==="thinking"?Qe(Ee.text||""):an(Ee.kind,Ee.text||"")),Ee.type==="raw"){const yt=uj(Ee);yt&&Qe(yt),Pe(Ee)}Ee.type==="graph"&&Ee.graph&&Ls(Ee.graph),Ee.type==="done"&&(Ee.graph&&Ls(Ee.graph),_e=Array.isArray(Ee.order)?Ee.order:[],pt=Array.isArray(Ee.pauseNodeIds)?Ee.pauseNodeIds:pt)}hr.current&&(ir(new Set),Wr(Ee=>{var Ue;const yt=((Ue=Object.entries(Ee).find(([,Fe])=>(Fe==null?void 0:Fe.status)==="running"))==null?void 0:Ue[0])||_;return yt?{...Ee,[yt]:{status:"stopped"}}:Ee})),it(hr.current?`Workspace run stopped: ${_}`:pt.length?`Workspace run paused at ${pt.join(", ")}`:`Workspace run done: ${_e.length?_e.join(" -> "):_}`),ht(hr.current?"stopped":pt.length?"paused":"done"),hr.current||await mr()}catch(re){if(hr.current||(re==null?void 0:re.name)==="AbortError"){ir(new Set),Wr(ae=>{var xe;const me=((xe=Object.entries(ae).find(([,_e])=>(_e==null?void 0:_e.status)==="running"))==null?void 0:xe[0])||_;return me?{...ae,[me]:{status:"stopped"}}:ae}),it(`Workspace run stopped: ${_}`),on(ae=>ae.map(me=>me.id===G?{...me,status:"stopped",endedAt:Date.now()}:me));return}ir(new Set),Wr(ae=>{var xe;const me=(xe=Object.entries(ae).find(([,_e])=>(_e==null?void 0:_e.status)==="running"))==null?void 0:xe[0];return me?{...ae,[me]:{status:"failed"}}:ae}),it(String(re.message||re)),on(ae=>ae.map(me=>me.id===G?{...me,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(me.messages)?me.messages:[],{role:"assistant",error:!0,text:String(re.message||re),at:Date.now()}].slice(-160)}:me))}finally{Js.current===Z&&(Js.current=null),Gs(""),ir(new Set)}},[Mt,l,s,mr,i,S,Or,$n,Te,c,a]),To=m.useCallback(async()=>{try{const B=await(await fetch("/api/skills")).json().catch(()=>({})),G=Array.isArray(B.skills)?B.skills.map(X=>({key:String(X.key),name:String(X.name||X.id||X.key),description:X.description?String(X.description):"",sourceLabel:X.sourceLabel?String(X.sourceLabel):""})):[];Zt(G),he(!0)}catch{he(!0)}},[]),Zi=m.useCallback(async()=>{try{const B=await(await fetch("/api/mcps")).json().catch(()=>({})),G=Array.isArray(B.servers)?B.servers.map(X=>({name:String((X==null?void 0:X.name)||""),type:String((X==null?void 0:X.type)||""),url:String((X==null?void 0:X.url)||""),command:String((X==null?void 0:X.command)||""),args:Array.isArray(X==null?void 0:X.args)?X.args.map(String):[],description:String((X==null?void 0:X.description)||"")})).filter(X=>X.name):[];dr(G)}catch{dr([])}},[]);m.useEffect(()=>{Qs().catch(_=>it(String(_.message||_))),In(),fetch("/api/model-lists").then(_=>_.json()).then(_=>On({cursor:Array.isArray(_.cursor)?_.cursor.map(String):[],opencode:Array.isArray(_.opencode)?_.opencode.map(String):[],claudeCode:Array.isArray(_.claudeCode)?_.claudeCode.map(String):[]})).catch(()=>{}),To(),Zi(),fetch("/api/skill-collections").then(_=>_.json()).then(_=>{vn(pa(_)),Pn(!0)}).catch(()=>{}),fetch("/api/auth/me").then(_=>_.json()).then(_=>Ys(_.user||null)).catch(()=>Ys(null))},[Qs,In,Zi,To,Qn]),m.useEffect(()=>{if(Ia(""),!(!sr||!Vs)){if(!Qn){rn([]);return}rn(BE(Qn,"workspace",Qt,lt)),Ia(Qn)}},[lt,Vs,Qt,sr,Qn]),m.useEffect(()=>{if(!(Qi!==Qn||!Qn))try{localStorage.setItem(Qn,JSON.stringify(Te))}catch{}},[Te,Qn,Qi]),m.useEffect(()=>{w.current=y},[y]),m.useEffect(()=>{u.current=i},[i]),m.useEffect(()=>{f.current=l},[l]),m.useEffect(()=>{g.current=k},[k]),m.useEffect(()=>{if(!k)return;const _=G=>{G.key==="Escape"&&b(null)},B=G=>{var X,Z;(Z=(X=G.target)==null?void 0:X.closest)!=null&&Z.call(X,".af-connect-node-menu")||b(null)};return document.addEventListener("keydown",_),document.addEventListener("pointerdown",B),()=>{document.removeEventListener("keydown",_),document.removeEventListener("pointerdown",B)}},[k]),m.useEffect(()=>{if(N.current)return C.current&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>{$n().catch(_=>it(String(_.message||_)))},650),()=>{C.current&&window.clearTimeout(C.current)}},[i,l,$n]);const Zs=m.useCallback((_,B)=>{const G=cK(B),X=xe=>Array.isArray(xe)?xe.map(_e=>(_e==null?void 0:_e.name)!=="skillKeys"&&(_e==null?void 0:_e.name)!=="skillsContext"&&(_e==null?void 0:_e.type)!=="text"?_e:{..._e,default:G,value:G}):[],Z=i.map(xe=>{var _e;return xe.id!==_?xe:{...xe,data:{...xe.data,body:G,inputs:X((_e=xe.data)==null?void 0:_e.inputs)}}}),re=w.current||{},ae=re[_]&&typeof re[_]=="object"?re[_]:{},me={...re,[_]:{...ae,body:G,input:X(ae.input)}};w.current=me,a(Z),v(me),Jt(xe=>!xe||xe.id!==_?xe:{...xe,body:G,inputs:X(xe.inputs)}),$n(Z,l).catch(xe=>it(String(xe.message||xe)))},[l,i,$n,a]),Ra=m.useCallback((_,B)=>{const G=dK(B),X=xe=>Array.isArray(xe)?xe.map(_e=>(_e==null?void 0:_e.name)!=="serverNames"&&(_e==null?void 0:_e.name)!=="mcpContext"&&(_e==null?void 0:_e.type)!=="text"?_e:{..._e,default:G,value:G}):[],Z=i.map(xe=>{var _e;return xe.id!==_?xe:{...xe,data:{...xe.data,body:G,inputs:X((_e=xe.data)==null?void 0:_e.inputs)}}}),re=w.current||{},ae=re[_]&&typeof re[_]=="object"?re[_]:{},me={...re,[_]:{...ae,body:G,input:X(ae.input)}};w.current=me,a(Z),v(me),Jt(xe=>!xe||xe.id!==_?xe:{...xe,body:G,inputs:X(xe.inputs)}),$n(Z,l).catch(xe=>it(String(xe.message||xe)))},[l,i,$n,a]),jl=m.useCallback(_=>{const B=String(_||"").trim();B&&(hs(G=>G===B?"":B),ke(G=>({...G,[B]:G[B]||{sessionId:`nodechat_${Date.now()}_${B.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),Ro=m.useCallback((_,B)=>{const G=String(_||"").trim();G&&ke(X=>({...X,[G]:{...X[G]||{sessionId:`nodechat_${Date.now()}_${G.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(B||""),error:""}}))},[]),Dn=m.useCallback((_,B,G="replace",X={})=>{var an;const Z=String(_||"").trim();if(!Z)return;const re=u.current.find(Qe=>Qe.id===Z),ae=vs((an=re==null?void 0:re.data)==null?void 0:an.definitionId),me=ae==="html"?$I(B):String(B||""),xe=re?fd(re.data):"",_e=G==="append"&&String(xe||"").trim()?`${String(xe).replace(/\s+$/g,"")}
|
|
150
|
-
|
|
151
|
-
${me.trim()}`:me,pt=ae==="image"?"src":"content",Bt=Qe=>{let kt=!1;return(Array.isArray(Qe)?Qe:[]).map(ht=>{const Ls=String((ht==null?void 0:ht.name)||""),Ee=String((ht==null?void 0:ht.type)||"");return!kt&&(Ls===pt||Ls==="filePath"||Ee==="text")?(kt=!0,{...ht,default:_e,value:_e}):ht})},tt=u.current.map(Qe=>{var kt,Pe;return Qe.id!==Z?Qe:{...Qe,data:{...Qe.data,body:_e,inputs:Bt((kt=Qe.data)==null?void 0:kt.inputs),outputs:Bt((Pe=Qe.data)==null?void 0:Pe.outputs)}}}),Dt=w.current||{},hn=Dt[Z]&&typeof Dt[Z]=="object"?Dt[Z]:{},Ht={...Dt,[Z]:{...hn,body:_e,input:Bt(hn.input),output:Bt(hn.output)}};w.current=Ht,a(tt),v(Ht),Jt(Qe=>(Qe==null?void 0:Qe.id)===Z?{...Qe,body:_e}:Qe),(X==null?void 0:X.logChat)!==!1&&ke(Qe=>{var kt;return{...Qe,[Z]:{...Qe[Z]||{},candidateContent:"",messages:[...(kt=Qe[Z])!=null&&kt.messages&&Array.isArray(Qe[Z].messages)?Qe[Z].messages:[],{role:"assistant",text:G==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),$n(tt,f.current).catch(Qe=>it(String(Qe.message||Qe))),it(String((X==null?void 0:X.statusMessage)||"")||(G==="append"?"已追加节点内容":"已替换节点内容"))},[$n,a]),La=m.useCallback((_,B="replace")=>{var Z;const G=String(_||"").trim(),X=String(((Z=q[G])==null?void 0:Z.candidateContent)||"").trim();!G||!X||Dn(G,X,B)},[q,Dn]),Lo=m.useCallback(async(_,B=void 0)=>{var _e,pt,Bt;const G=String(_||"").trim();if(!G)return;const X=q[G]||{},Z=String(B!==void 0?B:X.draft||"").trim();if(!Z||X.running)return;const re=u.current.find(tt=>tt.id===G);if(!re)return;const ae={role:"user",text:Z,at:Date.now()},me=Array.isArray(X.messages)?X.messages:[],xe=X.sessionId||`nodechat_${Date.now()}_${G.replace(/[^a-z0-9_-]+/gi,"_")}`;ke(tt=>({...tt,[G]:{...X,sessionId:xe,messages:[...me,ae],draft:"",running:!0,error:""}}));try{const tt=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,sessionId:xe,node:{id:G,label:((_e=re.data)==null?void 0:_e.label)||G,definitionId:((pt=re.data)==null?void 0:pt.definitionId)||""},nodeKind:vs((Bt=re.data)==null?void 0:Bt.definitionId)||"markdown",currentContent:fd(re.data),messages:me,message:Z,model:Mt})}),Dt=await tt.json().catch(()=>({}));if(!tt.ok)throw new Error(Dt.error||"节点微调失败");const hn=String(Dt.candidateContent||Dt.reply||"").trim();ke(Ht=>{var an;return{...Ht,[G]:{...Ht[G]||{},sessionId:String(Dt.sessionId||xe),running:!1,candidateContent:hn,messages:[...(an=Ht[G])!=null&&an.messages&&Array.isArray(Ht[G].messages)?Ht[G].messages:[...me,ae],{role:"assistant",text:hn||"已生成候选内容。",at:Date.now()}]}}})}catch(tt){const Dt=String(tt.message||tt);ke(hn=>({...hn,[G]:{...hn[G]||{},running:!1,error:Dt}})),it(Dt)}},[Mt,s,q]),Oa=m.useCallback(async(_,B)=>{const G=fd(B);if(!String(G||"").trim()){it("展示节点没有可保存内容");return}const X=nK(_,B),Z=window.prompt("保存到 workspace 相对路径",X);if(Z)try{const re=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:Z,content:G})}),ae=await re.json().catch(()=>({}));if(!re.ok)throw new Error(ae.error||"保存文件失败");const me=ae.path||Z,xe=Lu(s);xe.set("path",me);const _e=await fetch(`/api/workspace/file?${xe.toString()}`);if(!_e.ok){const pt=await _e.json().catch(()=>({}));throw new Error(pt.error||`保存后读取失败:${me}`)}await mr(),et(pt=>{const Bt=new Set(pt);for(const tt of Ty(me))Bt.delete(tt);return Bt}),it(`已保存 ${me}`)}catch(re){it(String(re.message||re))}},[s,mr]),ru=m.useCallback((_,B)=>{const G=String(_||"");G&&Jt(X=>{if(!X||X.id!==G)return X;const Z=typeof B=="function"?B(X):B;return!Z||typeof Z!="object"?X:{...X,...Z}})},[]),eo=m.useMemo(()=>i.map(_=>{var B,G;return{..._,data:{..._.data,selected:_.selected===!0,modelLists:It,showBodyPreview:!0,isExecuting:Pa.has(_.id),nodeStatus:((B=Aa[_.id])==null?void 0:B.status)??null,nodeElapsed:((G=Aa[_.id])==null?void 0:G.elapsed)??null,onRunWorkspaceNode:bn,onStopWorkspaceNode:Nl,runningRunNodeId:Or,skills:Qt,skillCollections:lt,onChangeLoadSkillKeys:Zs,onRefreshSkills:To,mcpServers:jr,onChangeLoadMcpNames:Ra,onRefreshMcps:Zi,onSaveDisplayNodeToFile:Oa,nodeChatActive:ps===_.id,nodeChat:q[_.id]||null,onSetDisplayNodeContent:Dn,onToggleNodeChat:jl,onCloseNodeChat:()=>hs(""),onUpdateNodeChatDraft:Ro,onSendNodeChat:Lo,onApplyNodeChatCandidate:La,onSyncNodePropDraft:ru}}}),[ps,La,Ra,Zs,jr,It,q,i,Zi,To,bn,Or,Oa,Lo,Dn,lt,Qt,Nl,ru,jl,Ro,Pa,Aa]),Ct=m.useMemo(()=>i.find(_=>_.id===jt)||null,[i,jt]),Oo=m.useRef({id:"",draft:null}),su=m.useMemo(()=>{const _=gj(Ct);return _?JSON.stringify(_):""},[Ct]);m.useEffect(()=>{if(!Ct){Oo.current={id:"",draft:null},Jt(null),Xt("");return}const _=gj(Ct),B=Oo.current;Oo.current={id:Ct.id,draft:_},Jt(G=>!G||G.id!==Ct.id||B.id!==Ct.id||!B.draft?_:pK(G,B.draft,_)),Xt("")},[Ct==null?void 0:Ct.id,su]);const Mo=m.useCallback((_=!1)=>{var an,Qe;if(!Ce||!Ct)return!1;const B=Ct.id,G=String(Ce.newId||"").trim(),X=_?G:B;if(Xt(""),_){if(!NI.test(X))return Xt("Invalid instance id"),!1;if(i.some(kt=>kt.id===X&&kt.id!==B))return Xt("Duplicate instance id"),!1}const Z=String(Ce.role||"").trim(),re=ba.includes(Z)?Z:"normal",ae=String(Ce.model||"").trim(),me=kt=>(Array.isArray(kt)?kt:[]).map(Pe=>({type:String((Pe==null?void 0:Pe.type)??"node").trim()||"node",name:String((Pe==null?void 0:Pe.name)??""),default:String((Pe==null?void 0:Pe.default)??""),required:!!(Pe!=null&&Pe.required),showOnNode:(Pe==null?void 0:Pe.showOnNode)!=null?Pe.showOnNode!==!1:!!(Pe!=null&&Pe.required)||String((Pe==null?void 0:Pe.type)??"node").trim().toLowerCase()==="node"})),xe=String(((an=Ct.data)==null?void 0:an.definitionId)??X),_e=xe.startsWith("provide_"),pt={...Ct.data,label:String(Ce.label||"").trim()||X,role:re,model:ae===""||ae==="default"?void 0:ae,body:_e?"":String(Ce.body??""),images:_e?[]:ts(Ce.images),inputs:me(Ce.inputs),outputs:_e&&Array.isArray((Qe=Ct.data)==null?void 0:Qe.outputs)?Ct.data.outputs:me(Ce.outputs)},Bt=String(Ce.script??"").trim();xe==="tool_nodejs"||Bt!==""?pt.script=String(Ce.script??""):delete pt.script;const tt=Ct.data||{};if(!(X!==B||tt.label!==pt.label||tt.role!==pt.role||tt.model!==pt.model||tt.body!==pt.body||JSON.stringify(ts(tt.images))!==JSON.stringify(pt.images)||(tt.script??void 0)!==(pt.script??void 0)||JSON.stringify(tt.inputs||[])!==JSON.stringify(pt.inputs||[])||JSON.stringify(tt.outputs||[])!==JSON.stringify(pt.outputs||[])))return!0;let hn=i.map(kt=>kt.id===B?{...kt,id:X,selected:!0,data:pt}:kt),Ht=l;if(X!==B){const kt={...w.current},Pe={...kt[B]||{}};delete kt[B],kt[X]=Pe,w.current=kt,v(kt),Ht=l.map((ht,Ls)=>({...ht,source:ht.source===B?X:ht.source,target:ht.target===B?X:ht.target,id:`we-${ht.source===B?X:ht.source}-${ht.target===B?X:ht.target}-${Ls}`})),De(X)}return a(hn),c(Ht),Ks(X),!0},[l,Ce,i,Ct,c,a,Ks]);m.useEffect(()=>{if(!Ce||!Ct)return;const _=window.setTimeout(()=>{Mo(!1)},350);return()=>window.clearTimeout(_)},[Ce==null?void 0:Ce.label,Ce==null?void 0:Ce.role,Ce==null?void 0:Ce.model,Ce==null?void 0:Ce.body,JSON.stringify((Ce==null?void 0:Ce.images)||[]),Ce==null?void 0:Ce.script,JSON.stringify((Ce==null?void 0:Ce.inputs)||[]),JSON.stringify((Ce==null?void 0:Ce.outputs)||[]),Mo,Ct==null?void 0:Ct.id]);const eg=m.useMemo(()=>{const _=new Map(eo.map(B=>[B.id,B]));return l.map(B=>{var _e,pt,Bt,tt;const G=_.get(B.source),X=_.get(B.target),Z=/^output-(\d+)$/.exec(B.sourceHandle||""),re=/^input-(\d+)$/.exec(B.targetHandle||""),ae=G&&Z?(pt=(_e=G.data)==null?void 0:_e.outputs)==null?void 0:pt[parseInt(Z[1],10)]:null,me=X&&re?(tt=(Bt=X.data)==null?void 0:Bt.inputs)==null?void 0:tt[parseInt(re[1],10)]:null,xe=ae!=null&&ae.type?Ln(ae.type):me!=null&&me.type?Ln(me.type):"";return xe?{...B,style:{...B.style||{},stroke:xe,strokeWidth:2},markerEnd:{type:os.ArrowClosed,color:xe}}:B})},[l,eo]),ms=m.useMemo(()=>{const _=R.trim().toLowerCase(),B={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const G of S)_&&![G.id,G.label,G.displayName,G.description].some(X=>String(X||"").toLowerCase().includes(_))||B[qu(G)].push(G);for(const G of Yl)B[G].sort((X,Z)=>X.id.localeCompare(Z.id));return B},[S,R]),to=m.useMemo(()=>{const _=je.trim().toLowerCase();return S.filter(B=>!_||[B.id,B.label,B.displayName,B.description].some(G=>String(G||"").toLowerCase().includes(_))).sort((B,G)=>{const X=Yl.indexOf(qu(B)),Z=Yl.indexOf(qu(G));return X!==Z?X-Z:Yu(B).localeCompare(Yu(G))}).slice(0,30)},[S,je]),$o=m.useMemo(()=>{const _=je.trim().toLowerCase();return O.filter(B=>!_||[B.id,B.version,B.displayName,B.name,B.description,...Array.isArray(B.tags)?B.tags:[]].some(G=>String(G||"").toLowerCase().includes(_))).sort((B,G)=>String(B.displayName||B.name||B.id).localeCompare(String(G.displayName||G.name||G.id))).slice(0,30)},[O,je]);m.useEffect(()=>{Je(0)},[je,fe,pe]),m.useEffect(()=>{if(!fe)return;const _=window.setTimeout(()=>{var B;return(B=sn.current)==null?void 0:B.focus()},0);return()=>window.clearTimeout(_)},[fe]);const Ma=m.useMemo(()=>{const _=we.trim().toLowerCase();return _?DI(_n).filter(B=>B.path.toLowerCase().includes(_)):_n},[we,_n]),iu=[...(It.cursor||[]).map(_=>({label:`Cursor · ${_.split(" - ")[0]}`,value:`cursor:${_.split(" - ")[0]}`})),...(It.opencode||[]).map(_=>({label:`OpenCode · ${_.split(" - ")[0]}`,value:`opencode:${_.split(" - ")[0]}`})),...(It.claudeCode||[]).map(_=>({label:`Claude · ${_.split(" - ")[0]}`,value:`claude-code:${_.split(" - ")[0]}`}))],Cl=m.useMemo(()=>new Set(Te),[Te]),ei=m.useMemo(()=>{const _=new Map(Qt.map(re=>[re.key,re])),B=new Set,G=new Set,X=lt.map(re=>{const ae=wa(re,Qt).map(me=>_.get(me)).filter(Boolean);for(const me of ae)B.add(me.key),G.add(String(me.name||me.id||me.key||"").trim());return{...re,skills:ae}}).filter(re=>re.skills.length>0),Z=Qt.filter(re=>{const ae=String(re.name||re.id||re.key||"").trim();return!B.has(re.key)&&!G.has(ae)});return{groups:X,ungrouped:Z}},[lt,Qt]);m.useEffect(()=>{Cr(_=>{let B=!1;const G=new Set(_);for(const X of ei.groups)G.has(X.id)||(G.add(X.id),B=!0);return B?G:_})},[ei.groups]);const Wn=m.useMemo(()=>{const _=i.filter(B=>B.selected);return _.length>0?_:jt?i.filter(B=>B.id===jt):[]},[i,jt]),ti=m.useMemo(()=>Wn.map(_=>_.id),[Wn]),El=m.useMemo(()=>{const _=String((en==null?void 0:en.username)||(en==null?void 0:en.userId)||"").trim();return _?_.slice(0,1).toUpperCase():"?"},[en]),$a=m.useMemo(()=>new Set(ti),[ti]),gr=m.useMemo(()=>l.filter(_=>$a.has(_.source)&&$a.has(_.target)),[l,$a]),Do=m.useMemo(()=>{const _=R.trim().toLowerCase();return _?O.filter(B=>[B.id,B.version,B.displayName,B.name,B.description,...Array.isArray(B.tags)?B.tags:[]].filter(Boolean).some(G=>String(G).toLowerCase().includes(_))):O},[O,R]),Da=m.useCallback((_,B)=>{const G=String(_||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let X=`${G}_${Date.now().toString(36)}`,Z=2;for(;B.has(X);)X=`${G}_${Date.now().toString(36)}_${Z}`,Z+=1;return B.add(X),X},[]),ni=m.useCallback((_,B)=>{var kt;const G=_!=null&&_.snippet&&typeof _.snippet=="object"?_.snippet:{},X=G.instances&&typeof G.instances=="object"?G.instances:{},Z=Object.keys(X);if(Z.length===0)return;const re=new Set(u.current.map(Pe=>Pe.id)),ae={};for(const Pe of Z)ae[Pe]=Da(Pe,re);const me=(kt=G.ui)!=null&&kt.nodePositions&&typeof G.ui.nodePositions=="object"?G.ui.nodePositions:{},xe=Z.map(Pe=>{const ht=me[Pe];return{id:Pe,x:typeof(ht==null?void 0:ht.x)=="number"?ht.x:0,y:typeof(ht==null?void 0:ht.y)=="number"?ht.y:0}}),_e=Math.min(...xe.map(Pe=>Pe.x)),pt=Math.min(...xe.map(Pe=>Pe.y));let Bt=B||{x:360+u.current.length*24,y:180+u.current.length*18};if(!B){const Pe=document.querySelector(".af-workspace-canvas .react-flow");if(Pe){const ht=Pe.getBoundingClientRect();Bt=n.screenToFlowPosition({x:ht.left+ht.width*.48,y:ht.top+ht.height*.32})}}const tt={},Dt={};for(const Pe of xe){const ht=ae[Pe.id];tt[ht]={...X[Pe.id]||{}},Dt[ht]={x:Bt.x+(Pe.x-_e),y:Bt.y+(Pe.y-pt)}}const hn=new Set(Z),Ht=(Array.isArray(G.edges)?G.edges:[]).filter(Pe=>hn.has(Pe==null?void 0:Pe.source)&&hn.has(Pe==null?void 0:Pe.target)).map(Pe=>({source:ae[Pe.source],target:ae[Pe.target],sourceHandle:Pe.sourceHandle??null,targetHandle:Pe.targetHandle??null})),an=Iy({instances:tt,edges:Ht,ui:{nodePositions:Dt}},S),Qe=an.nodes.map(Pe=>({...Pe,selected:!0}));w.current={...w.current,...an.instances},v(w.current),a(Pe=>[...Pe.map(ht=>({...ht,selected:!1})),...Qe]),c(Pe=>[...Pe.map(ht=>({...ht,selected:!1})),...an.edges]),it(`已添加流程片段:${_.displayName||_.id}`)},[Da,S,n,c,a]),Fa=m.useCallback(()=>{var G,X;if(Wn.length<2){z("请先在 workspace 画布上选择至少两个节点。"),D("flows");return}const _=Wn[0],B=Wn.length===2?`${((G=_.data)==null?void 0:G.label)||_.id} 片段`:`${((X=_.data)==null?void 0:X.label)||_.id} 等 ${Wn.length} 个节点`;J({name:B,id:B.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),le(""),T(!0),D("flows")},[Wn]),za=m.useCallback(async()=>{var X,Z;if(Wn.length<2)return;const _=E.name.trim();if(!_){le("请填写片段名称。");return}const B={};for(const re of Wn)B[re.id]={x:((X=re.position)==null?void 0:X.x)||0,y:((Z=re.position)==null?void 0:Z.y)||0};const G=gr.map(re=>({source:re.source,target:re.target,sourceHandle:re.sourceHandle??null,targetHandle:re.targetHandle??null}));H(!0),le("");try{const re=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:E.id,name:_,displayName:_,version:"1.0.0",description:E.description,snippet:{instances:gf(Wn,w.current),edges:G,ui:{nodePositions:B}}})}),ae=await re.json().catch(()=>({}));if(!re.ok||ae.ok===!1)throw new Error(ae.error||"发布流程片段失败");T(!1),it(`流程片段已发布:${ae.id||_}`),Hr(`流程片段已发布:${ae.id||_}`),await In(),D("flows")}catch(re){le(String(re.message||re))}finally{H(!1)}},[In,E,gr,Wn,Hr]),tg=m.useCallback(_=>{a(B=>B.map(G=>G.id===_?{...G,selected:!1}:G)),De(B=>B===_?"":B)},[a]),Si=m.useCallback(()=>{const _=Xe.current;if(!_)return;const B=_.getBoundingClientRect(),G=Math.min(420,Math.max(320,B.width+160)),X=12,Z=Math.max(180,B.top-X*2),re=Math.min(560,Z);Ke({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-G-12,B.left)),top:Math.max(X,B.top-re-X),width:G,maxHeight:re,zIndex:1e4})},[]);m.useEffect(()=>{if(!Xn)return;Si();const _=G=>{var Z,re;const X=G.target;(Z=Xe.current)!=null&&Z.contains(X)||(re=Vt.current)!=null&&re.contains(X)||Ps(!1)},B=G=>{G.key==="Escape"&&Ps(!1)};return window.addEventListener("pointerdown",_),window.addEventListener("keydown",B),window.addEventListener("resize",Si),window.addEventListener("scroll",Si,!0),()=>{window.removeEventListener("pointerdown",_),window.removeEventListener("keydown",B),window.removeEventListener("resize",Si),window.removeEventListener("scroll",Si,!0)}},[Xn,Si]);const _l=m.useCallback(_=>{var G,X;const B=new Map;for(const Z of _||[])(Z==null?void 0:Z.type)==="dimensions"&&((G=Z.dimensions)!=null&&G.width)&&((X=Z.dimensions)!=null&&X.height)&&B.set(Z.id,{width:Math.round(Number(Z.dimensions.width)),height:Math.round(Number(Z.dimensions.height))});a(Z=>Wv(_,Z).map(re=>{var me;const ae=B.get(re.id);return ae?vs((me=re.data)==null?void 0:me.definitionId)?{...re,width:ae.width,height:ae.height,data:{...re.data,displaySize:ae}}:{...re,width:ae.width,height:ae.height}:re}))},[a]),Is=m.useCallback(()=>{const _=document.querySelector(".af-workspace-canvas .react-flow");if(_){const B=_.getBoundingClientRect();return n.screenToFlowPosition({x:B.left+B.width*.48,y:B.top+B.height*.32})}return{x:360+i.length*36,y:180+i.length*28}},[i.length,n]),Fo=m.useCallback(()=>{var _,B,G;if(Ct){const X=Number(((_=Ct.measured)==null?void 0:_.width)||Ct.width||260);return{x:Number(((B=Ct.position)==null?void 0:B.x)||0)+X+140,y:Number(((G=Ct.position)==null?void 0:G.y)||0)}}return Is()},[Is,Ct]),Ts=m.useCallback((_,B={})=>{if(!_)return null;const G=gb(_)||_.id,X=OI(_),Z=B.id||z7(G,i),re=Ip(_.inputs),ae=Ip(_.outputs),me={definitionId:G,...X?{marketplaceRef:X}:{},..._.packageId?{marketplacePackageId:_.packageId}:{},..._.version?{marketplaceVersion:_.version}:{},label:B.label||nm(_),role:"normal",body:B.body||"",input:B.inputs||re,output:B.outputs||ae},xe={id:Z,type:yf,position:B.position||Is(),data:{label:me.label,definitionId:G,...X?{marketplaceRef:X}:{},..._.packageId?{marketplacePackageId:_.packageId}:{},..._.version?{marketplaceVersion:_.version}:{},schemaType:LI(G,_),role:"normal",body:me.body,inputs:me.input,outputs:me.output}},_e={...Yd(xe,{...w.current,[Z]:me},S),selected:!0};return a(pt=>[...pt.map(Bt=>({...Bt,selected:!1})),_e]),B.openProperties&&De(Z),Z},[Is,i,S,a]),ou=m.useCallback(_=>hj(_,u.current),[]),au=m.useCallback(_=>{if(!hj(_,u.current)){it("端口类型不匹配,已取消连线");return}b(null),a(B=>Zh(B,_)),c(B=>{const G=B.filter(X=>!(X.target===_.target&&X.targetHandle===_.targetHandle));return zd({..._,markerEnd:{type:os.ArrowClosed}},G)})},[c,a]),Ba=m.useCallback((_,B)=>{h.current=$7(B,u.current),b(null)},[]),ng=m.useCallback((_,B)=>{var tt,Dt,hn,Ht;const G=h.current;if(h.current=null,!G||B!=null&&B.toNode)return;const X=D7(S,G);if(X.length===0){it(`没有匹配 ${G.slotType} 端口的节点`);return}const Z=((Dt=(tt=_==null?void 0:_.changedTouches)==null?void 0:tt[0])==null?void 0:Dt.clientX)??(_==null?void 0:_.clientX),re=((Ht=(hn=_==null?void 0:_.changedTouches)==null?void 0:hn[0])==null?void 0:Ht.clientY)??(_==null?void 0:_.clientY);if(!Number.isFinite(Z)||!Number.isFinite(re))return;const ae=document.querySelector(".af-workspace-canvas .react-flow");if(!ae)return;const me=ae.getBoundingClientRect(),xe=320,_e=Math.min(440,104+X.length*58),pt=Math.max(12,Math.min(Z-me.left,me.width-xe-12)),Bt=Math.max(12,Math.min(re-me.top,me.height-_e-12));b({left:pt,top:Bt,flowPosition:n.screenToFlowPosition({x:Z,y:re}),draft:G,candidates:X,query:""})},[S,n]),rg=m.useCallback(_=>{const B=g.current;if(!B||!(_!=null&&_.def))return;const G=Ts(_.def,{position:B.flowPosition});if(!G)return;const X=B.draft.handleType==="source"?{source:B.draft.nodeId,sourceHandle:B.draft.handleId,target:G,targetHandle:`input-${_.slotIndex}`}:{source:G,sourceHandle:`output-${_.slotIndex}`,target:B.draft.nodeId,targetHandle:B.draft.handleId};a(Z=>Zh(Z,X)),c(Z=>{const re=Z.filter(ae=>!(ae.target===X.target&&ae.targetHandle===X.targetHandle));return zd({...X,markerEnd:{type:os.ArrowClosed}},re)}),b(null)},[Ts,c]),mt=m.useCallback(_=>{_&&(Ts(_,{position:Fo()}),se(!1),Ve(""))},[Ts,Fo]),Pl=m.useCallback(_=>{_&&(ni(_,Fo()),se(!1),Ve(""))},[ni,Fo]);m.useEffect(()=>{const _=B=>{if(B.defaultPrevented)return;const G=wI(B.target)||O7(B.target);if((B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="s"){B.preventDefault(),$n().catch(ae=>it(String(ae.message||ae)));return}if(vt){(B.key==="Escape"||tm(B))&&(B.preventDefault(),An(!1));return}if(G)return;const X=B.key.toLowerCase(),Z=(B.metaKey||B.ctrlKey)&&!B.shiftKey&&X==="z",re=(B.metaKey||B.ctrlKey)&&(B.shiftKey&&X==="z"||X==="y");if(Z||re){B.preventDefault(),B.stopPropagation();const ae=Z?Ta():Io();it(ae?Z?"Undo canvas change":"Redo canvas change":Z?"Nothing to undo":"Nothing to redo");return}if((B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="c"){const ae=uI(u.current,f.current,w.current);ae&&(B.preventDefault(),B.stopPropagation(),p.current=ae,it(`Copied ${ae.nodes.length} node${ae.nodes.length>1?"s":""}`));return}if((B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="v"){const ae=dI(p.current,u.current,f.current,w.current);ae&&(B.preventDefault(),B.stopPropagation(),w.current=ae.instances,v(ae.instances),a(ae.nodes),c(ae.edges),it(`Pasted ${ae.pastedNodeIds.length} node${ae.pastedNodeIds.length>1?"s":""}`));return}if(tm(B)&&!B.metaKey&&!B.ctrlKey&&!B.altKey){B.preventDefault(),An(!0);return}if(B.key==="a"||B.key==="A"){if(B.metaKey||B.ctrlKey){B.preventDefault(),a(ae=>ae.map(me=>({...me,selected:!0}))),c(ae=>ae.map(me=>({...me,selected:!1})));return}if(B.altKey)return;B.preventDefault(),se(!0);return}if((B.key==="v"||B.key==="V")&&!B.metaKey&&!B.ctrlKey&&!B.altKey){B.preventDefault(),bt("select");return}(B.key==="h"||B.key==="H")&&!B.metaKey&&!B.ctrlKey&&!B.altKey&&(B.preventDefault(),bt("pan"))};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[Io,$n,vt,c,a,Ta]);const sg=m.useCallback(_=>{et(B=>{const G=new Set(B);return G.has(_)?G.delete(_):G.add(_),G})},[]),Al=m.useCallback((_,B)=>{_.dataTransfer.effectAllowed="copy",_.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:B.path,name:B.name,type:B.type})),_.dataTransfer.setData("text/plain",B.path)},[]),ut=m.useCallback((_,B)=>{_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("application/agentflow-node",B.id),_.dataTransfer.setData("text/plain",B.id)},[]),Il=m.useCallback(async(_,B)=>{const G=String((_==null?void 0:_.name)||(_==null?void 0:_.path)||"").toLowerCase().split(".").pop(),X=G==="html"?"display_html":["png","jpg","jpeg","gif","webp","svg"].includes(G)?"display_image":"display_markdown",Z=S.find(tt=>tt.id===X);if(!Z){it("展示节点不可用");return}const re=Lu(s);re.set("path",_.path);const ae=await fetch(`/api/workspace/file?${re.toString()}`),me=await ae.json();if(!ae.ok)throw new Error(me.error||"读取文件失败");const xe=String(me.content||""),_e=X==="display_image"?"src":"content",pt=Ip(Z.inputs).map(tt=>tt.name===_e?{...tt,default:xe,value:xe}:tt),Bt=Ip(Z.outputs).map(tt=>tt.name===_e?{...tt,default:xe,value:xe}:tt);Ts(Z,{label:_.name||"Display",body:xe,inputs:pt,outputs:Bt,position:B}),it(`已创建展示:${_.path}`)},[Ts,s,S]),no=m.useCallback(_=>{Il(_,Is()).catch(B=>it(String(B.message||B)))},[Il,Is]),jf=m.useCallback(_=>{const B=_.dataTransfer.getData("application/x-agentflow-workspace-file");if(B){_.preventDefault();let ae;try{ae=JSON.parse(B)}catch{return}if(!(ae!=null&&ae.path))return;const me=n.screenToFlowPosition({x:_.clientX,y:_.clientY});Il(ae,me).catch(xe=>it(String(xe.message||xe)));return}const G=_.dataTransfer.getData("application/agentflow-snippet");if(G){const ae=O.find(xe=>`${xe.id}@${xe.version}`===G);if(!ae)return;_.preventDefault();const me=n.screenToFlowPosition({x:_.clientX,y:_.clientY});ni(ae,me);return}const X=_.dataTransfer.getData("application/agentflow-node");if(!X)return;const Z=S.find(ae=>ae.id===X);if(!Z)return;_.preventDefault();const re=n.screenToFlowPosition({x:_.clientX,y:_.clientY});Ts(Z,{position:re})},[Il,Ts,O,ni,S,n]),lu=m.useCallback(_=>{const B=Array.from(_.dataTransfer.types||[]);!B.includes("application/x-agentflow-workspace-file")&&!B.includes("application/agentflow-node")&&!B.includes("application/agentflow-snippet")||(_.preventDefault(),_.dataTransfer.dropEffect=B.includes("application/agentflow-node")||B.includes("application/agentflow-snippet")?"move":"copy")},[]),ig=m.useCallback(async(_="")=>{const B=window.prompt("新文件名",_?`${_}/notes.md`:"notes.md");if(!B)return;const G=_&&!B.includes("/")?`${_}/${B}`:B;try{const X=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:G,content:""})}),Z=await X.json();if(!X.ok)throw new Error(Z.error||"创建文件失败");await mr(),et(re=>{const ae=new Set(re);for(const me of Ty(Z.path||G))ae.delete(me);return ae}),it(`已创建 ${Z.path}`)}catch(X){it(String(X.message||X))}},[s,mr]),Rs=m.useCallback(async(_="")=>{const B=window.prompt("新文件夹名",_?`${_}/docs`:"docs");if(!B)return;const G=_&&!B.includes("/")?`${_}/${B}`:B;try{const X=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:G})}),Z=await X.json();if(!X.ok)throw new Error(Z.error||"创建文件夹失败");await mr(),et(re=>{const ae=new Set(re);for(const me of Ty(Z.path||G))ae.delete(me);return Z.path&&ae.delete(Z.path),ae}),it(`已创建 ${Z.path}`)}catch(X){it(String(X.message||X))}},[s,mr]),og=m.useCallback(async _=>{if(!(!(_!=null&&_.path)||!window.confirm(`删除 ${_.path}?`)))try{const B=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:_.path})}),G=await B.json();if(!B.ok)throw new Error(G.error||"删除失败");it(`已删除 ${G.path}`),await mr()}catch(B){it(String(B.message||B))}},[s,mr]),Ni=m.useCallback(async()=>{const _=Hn.trim();if(!_||Ft)return;const B=Tp(i,l,w.current);Re(""),As(!0),zt("workspace"),Ur(G=>[...G,{role:"user",text:_,at:Date.now()}]);try{await $n(i,l);const G=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,prompt:_,outputKind:"markdown",workspaceGraph:B,allowFlowYaml:!1,model:Mt,selectedSkills:Te,selectedNodeIds:ti})}),X=await G.json();if(!G.ok)throw new Error(X.error||"生成失败");const Z=String(X.content||"").trim();Ur(re=>[...re,{role:"assistant",text:Z,at:Date.now()}]),await Qs(),it("AI 生成完成")}catch(G){const X=String(G.message||G);Ur(Z=>[...Z,{role:"assistant",text:X,error:!0,at:Date.now()}]),it(X)}finally{As(!1)}},[Mt,Ft,Hn,l,s,Qs,i,zt,$n,ti,Te]),Vn=fr.find(_=>_.id===ds)||null,Cf=Vn?Array.isArray(Vn.messages)?Vn.messages:[]:ft,Ef=Vn?Vn.status==="running":Ft,Tl=Vn?Vn.status==="running"?`${Vn.label} running`:Vn.status==="paused"?`${Vn.label} paused`:Vn.status==="failed"?`${Vn.label} failed`:`${Vn.label} done`:Ft?"Workspace agent running":ft.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} · ${ur}`:ur||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",T7,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",onClick:()=>{t(Ev({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:Ao}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>An(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(fs?" af-composer-topbar-btn--active":"")+(Ft?" af-composer-topbar-btn--running":""),onClick:()=>pr(_=>!_),children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",onClick:()=>$n().catch(_=>it(String(_.message||_))),children:"Save"})]})]}),ue?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:ue}),o.jsx("button",{type:"button",onClick:()=>de(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(fs||Ce?" af-workspace-body--drawer":"")+(Me?" af-workspace-body--sidebar-collapsed":""),children:[Me?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:()=>se(!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:()=>qe(!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:()=>qe(!1),"aria-label":"展开侧边栏",title:(en==null?void 0:en.username)||(en==null?void 0:en.userId)||"展开侧边栏",children:El})]})}):null,o.jsxs("aside",{className:"af-workspace-sidebar","aria-hidden":Me,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:()=>qe(!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:()=>ig(""),"aria-label":"新增文件",title:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Rs(""),"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 mr(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),o.jsx("input",{className:"af-workspace-search",value:we,onChange:_=>Ge(_.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",children:o.jsx(zI,{items:Ma,onOpen:no,collapsedDirs:st,onToggleDir:sg,onCreateFile:ig,onCreateFolder:Rs,onDelete:og,onFileDragStart:Al})})]}),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:V==="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:R,onChange:_=>M(_.target.value),placeholder:V==="flows"?"搜索流程片段...":"搜索节点...","aria-label":V==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":V==="nodes",className:"af-palette-tab"+(V==="nodes"?" af-palette-tab--active":""),onClick:()=>D("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":V==="flows",className:"af-palette-tab"+(V==="flows"?" af-palette-tab--active":""),onClick:()=>D("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:V==="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:Fa,disabled:Wn.length<2,title:Wn.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:["已选 ",Wn.length," 节点 / ",gr.length," 连线"]})]})}),I?o.jsx("p",{className:"af-err af-palette-list-err",children:I}):null,$?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):Do.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:Do.map(_=>{const B=`${_.id}@${_.version}`,G=_.displayName||_.name||_.id,X=_.description||`${_.nodeCount||0} 个节点,${_.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",B),Z.dataTransfer.setData("text/plain",B)},onClick:()=>ni(_),title:X,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:[_.id,"@",_.version]})]})]}),X?o.jsx("span",{className:"af-palette-card-desc",children:X}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[_.nodeCount||0," nodes"]}),o.jsxs("span",{children:[_.edgeCount||0," edges"]})]})]},B)})})]}):o.jsx("p",{className:"af-palette-empty",children:R.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Yl.map(_=>{var B;return(B=ms[_])!=null&&B.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${_}`,children:[o.jsx("h3",{className:"af-palette-cat",children:_}),o.jsx("div",{className:"af-palette-cards",children:ms[_].map(G=>{const X=pj(G.inputs,"input"),Z=pj(G.outputs,"output"),re=Nw(G),ae=Yu(G);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:me=>ut(me,G),onClick:()=>Ts(G),title:re||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:dj(_)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:ae}),ae!==G.id?o.jsx("span",{className:"af-palette-card-id",children:G.id}):null]})]}),re?o.jsx("span",{className:"af-palette-card-desc",children:re}):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:[X.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[X.shown.map((me,xe)=>o.jsxs("span",{className:"af-palette-card-port",title:fj("input",me,xe),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Ln(me==null?void 0:me.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:Ay(me,xe)})]},`in-${xe}`)),X.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",X.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((me,xe)=>o.jsxs("span",{className:"af-palette-card-port",title:fj("output",me,xe),children:[o.jsx("span",{className:"af-palette-card-port-name",children:Ay(me,xe)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Ln(me==null?void 0:me.type)}})]},`out-${xe}`)),Z.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",Z.hidden]}):null]})]})]})]},G.id)})})]},_):null}),S.length>0&&R.trim()&&Yl.every(_=>{var B;return!((B=ms[_])!=null&&B.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),o.jsxs("main",{className:"af-workspace-canvas",children:[o.jsx(IP,{className:"af-flow-canvas af-workspace-flow"+($t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),nodes:eo,edges:eg,nodeTypes:oK,onNodesChange:_l,onEdgesChange:d,onConnect:au,onConnectStart:Ba,onConnectEnd:ng,isValidConnection:ou,onNodeClick:(_,B)=>{jt&&De(B.id)},onNodeDoubleClick:(_,B)=>{_.preventDefault(),pr(!1),a(G=>G.map(X=>({...X,selected:X.id===B.id}))),c(G=>G.map(X=>({...X,selected:!1}))),De(B.id)},onPaneClick:()=>De(""),onDrop:jf,onDragOver:lu,selectionOnDrag:$t==="select",panOnDrag:$t==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(MP,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),k?(()=>{var X;const _=String(k.query||"").trim().toLowerCase(),B=_?k.candidates.filter(Z=>{var re,ae,me;return[(re=Z.def)==null?void 0:re.id,Z.displayLabel,Z.description,(ae=Z.slot)==null?void 0:ae.name,(me=Z.slot)==null?void 0:me.type].filter(Boolean).some(xe=>String(xe).toLowerCase().includes(_))}):k.candidates,G=k.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:k.left,top:k.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:Ln((X=k.draft.slot)==null?void 0:X.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",k.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:k.query,onChange:Z=>b(re=>re&&{...re,query:Z.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[B.map(Z=>{var me,xe;const re=Z.displayLabel||((me=Z.def)==null?void 0:me.id),ae=Ay(Z.slot,Z.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>rg(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:re}),re!==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:Ln((xe=Z.slot)==null?void 0:xe.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:ae})]})]},`${Z.def.id}-${Z.slotIndex}`)}),B.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,qs?o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>Er(!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:()=>Er(!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:Wn.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Wn.map(_=>{var Z,re;const B=String(((Z=_.data)==null?void 0:Z.label)??_.id),G=(re=_.data)!=null&&re.definitionId?String(_.data.definitionId):"",X=G&&G!==B?`${B} · ${_.id} · ${G}`:`${B} · ${_.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:X,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:G||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:B}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>tg(_.id),"aria-label":`取消选择 ${_.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},_.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:Hn,rows:2,onChange:_=>Re(_.target.value),onKeyDown:_=>{(_.metaKey||_.ctrlKey)&&_.key==="Enter"&&(_.preventDefault(),Ni())},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:Xe,type:"button",className:"af-composer-skills-button"+(Te.length>0?" af-composer-skills-button--active":""),disabled:Ft,"aria-haspopup":"listbox","aria-expanded":Xn,onClick:()=>Ps(_=>!_),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:Te.length>0?`Skills ${Te.length}`:"Skills"})]}),Xn&&!Ft?Xr.createPortal(o.jsx("div",{ref:Vt,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:us,children:Qt.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[ei.groups.map(_=>{const B=wa(_,Qt),G=zE(_,Cl,Qt),X=Po.has(_.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(X?" 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:B.length===0,onChange:Z=>{const re=Z.target.checked;rn(ae=>re?DE(ae,B):FE(ae,B))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:_.name}),_.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":X?`展开 ${_.name}`:`收起 ${_.name}`,onClick:()=>{Cr(Z=>{const re=new Set(Z);return re.has(_.id)?re.delete(_.id):re.add(_.id),re})},children:[o.jsx("span",{children:_.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:X?"expand_more":"expand_less"})]})]}),X?null:o.jsx("div",{className:"af-composer-skill-group-items",children:_.skills.map(Z=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Cl.has(Z.key),onChange:re=>{const ae=re.target.checked;rn(me=>ae?me.includes(Z.key)?me:[...me,Z.key]:me.filter(xe=>xe!==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]})]},`${_.id}:${Z.key}`))})]},_.id)}),ei.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:ei.ungrouped.length})]}),ei.ungrouped.map(_=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Cl.has(_.key),onChange:B=>{const G=B.target.checked;rn(X=>G?X.includes(_.key)?X:[...X,_.key]:X.filter(Z=>Z!==_.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:_.name}),_.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:_.description}):null]})]},`ungrouped:${_.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:Mt,onChange:_=>Mn(_.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),iu.map(_=>o.jsx("option",{value:_.value,children:_.label},_.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(Hn.trim()&&!Ft?" af-composer-send--active":"")+(Ft?" af-composer-send--stop":""),disabled:Ft||!Hn.trim(),"aria-label":Ft?"Running":"Send",onClick:()=>void Ni(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Ft?"sync":"arrow_upward"})})]})]})]})})]}),fs?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:()=>pr(!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"+(ds==="workspace"?" af-composer-session-tab--active":""),onClick:()=>Un("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),fr.map(_=>o.jsx("button",{type:"button",className:"af-composer-session-tab"+(ds===_.id?" af-composer-session-tab--active":"")+(_.status==="running"?" af-composer-session-tab--running":""),onClick:()=>Un(_.id),title:_.runNodeId||_.label,children:o.jsx("span",{className:"af-composer-session-label",children:_.label})},_.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(Ef?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Tl}),o.jsx("div",{className:"af-composer-sidebar-thread",children:o.jsx(aK,{messages:Cf,running:Ef,showRunningIndicator:!Vn})})]})}):Ce&&Ct?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(jI,{draft:Ce,setDraft:Jt,definitionId:String(((_f=Ct.data)==null?void 0:_f.definitionId)||Ct.id),systemPromptReadonly:String(((cu=Ct.data)==null?void 0:cu.description)||""),modelLists:It,disabled:!1,onIdBlur:()=>Mo(!0),onClose:()=>De(""),onPublishToMarketplace:Sl,error:Bn,ioSlots:{inputs:Array.isArray(Ce==null?void 0:Ce.inputs)?Ce.inputs:[],outputs:Array.isArray(Ce==null?void 0:Ce.outputs)?Ce.outputs:[]}})}):null,o.jsx(vI,{open:vt,onClose:()=>An(!1)}),P?Xr.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:()=>T(!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:E.name,onChange:_=>{const B=_.target.value;J(G=>({...G,name:B,id:G.id?G.id:B.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:E.id,onChange:_=>J(B=>({...B,id:_.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:E.description,onChange:_=>J(B=>({...B,description:_.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Wn.length," 个节点和 ",gr.length," 条内部连线。"]}),te?o.jsx("div",{className:"af-flow-snippet-error",children:te}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>T(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Q||!E.name.trim(),onClick:()=>void za(),children:Q?"发布中...":"发布"})]})]})}),document.body):null,fe?Xr.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>se(!1),children:o.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:_=>_.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":pe==="nodes",className:"af-workspace-quick-add__tab"+(pe==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>ve("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":pe==="flows",className:"af-workspace-quick-add__tab"+(pe==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>ve("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:sn,value:je,onChange:_=>Ve(_.target.value),onKeyDown:_=>{if(_.key==="Escape")_.preventDefault(),se(!1);else if(_.key==="ArrowDown"){_.preventDefault();const B=pe==="flows"?$o.length:to.length;Je(G=>Math.min(Math.max(0,B-1),G+1))}else _.key==="ArrowUp"?(_.preventDefault(),Je(B=>Math.max(0,B-1))):_.key==="Tab"?(_.preventDefault(),ve(B=>B==="nodes"?"flows":"nodes")):_.key==="Enter"&&(_.preventDefault(),pe==="flows"?Pl($o[at]||$o[0]):mt(to[at]||to[0]))},placeholder:pe==="flows"?"搜索流程片段...":"搜索节点...","aria-label":pe==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:pe==="flows"?$o.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:$?"正在加载流程片段...":I||"没有匹配的流程片段"}):$o.map((_,B)=>{const G=_.displayName||_.name||_.id,X=_.snippet&&typeof _.snippet=="object"?_.snippet.instances:null,Z=_.snippet&&typeof _.snippet=="object"?_.snippet.edges:null,re=Number.isFinite(Number(_.nodeCount))?Number(_.nodeCount):Object.keys(X||{}).length,ae=Number.isFinite(Number(_.edgeCount))?Number(_.edgeCount):Array.isArray(Z)?Z.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(B===at?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Je(B),onClick:()=>Pl(_),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:[_.id,_.version?` · v${_.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:_.description||`${re} 节点 / ${ae} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${_.id}@${_.version}`)}):to.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):to.map((_,B)=>{const G=qu(_),X=Yu(_),Z=Nw(_);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(B===at?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Je(B),onClick:()=>mt(_),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:dj(G)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:X}),o.jsx("span",{className:"af-workspace-quick-add__meta",children:_.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})]},_.id)})})]})}),document.body):null]})]})}function yK(){return o.jsx(Kv,{children:o.jsx(gK,{})})}const dt=e=>typeof e=="string",Ou=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},yj=e=>e==null?"":""+e,xK=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},wK=/###/g,xj=e=>e&&e.indexOf("###")>-1?e.replace(wK,"."):e,wj=e=>!e||dt(e),pd=(e,t,n)=>{const r=dt(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(wj(e))return{};const i=xj(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return wj(e)?{}:{obj:e,k:xj(r[s])}},vj=(e,t,n)=>{const{obj:r,k:s}=pd(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=pd(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=pd(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},vK=(e,t,n,r)=>{const{obj:s,k:i}=pd(e,t,Object);s[i]=s[i]||[],s[i].push(n)},sm=(e,t)=>{const{obj:n,k:r}=pd(e,t);if(n)return n[r]},bK=(e,t,n)=>{const r=sm(e,n);return r!==void 0?r:sm(t,n)},BI=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?dt(e[r])||e[r]instanceof String||dt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):BI(e[r],t[r],n):e[r]=t[r]);return e},Vl=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var kK={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const SK=e=>dt(e)?e.replace(/[&<>"'\/]/g,t=>kK[t]):e;class NK{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 jK=[" ",",","?","!",";"],CK=new NK(20),EK=(e,t,n)=>{t=t||"",n=n||"";const r=jK.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=CK.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},jw=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},im=e=>e&&e.replace("_","-"),_K={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 om{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||_K,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:(dt(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new om(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new om(this.logger,t)}}var Bi=new om;class Ym{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 bj extends Ym{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):dt(r)&&i?l.push(...r.split(i)):l.push(r)));const c=sm(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!dt(r)?c:jw(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),vj(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)(dt(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=sm(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?BI(c,r,i):c={...c,...r},vj(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 HI={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 kj={};class am extends Ym{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),xK(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Bi.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&&!EK(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:dt(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:dt(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,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(u){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 f=this.resolve(t,n);let p=f&&f.res;const h=f&&f.usedKey||a,g=f&&f.exactUsedKey||a,k=Object.prototype.toString.apply(p),b=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!dt(p)&&typeof p!="boolean"&&typeof p!="number";if(v&&p&&w&&b.indexOf(k)<0&&!(dt(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?(f.res=N,f.usedParams=this.getUsedParamsDetails(n),f):N}if(i){const N=Array.isArray(p),C=N?[]:{},S=N?g:h;for(const A in p)if(Object.prototype.hasOwnProperty.call(p,A)){const R=`${S}${i}${A}`;C[A]=this.translate(R,{...n,joinArrays:!1,ns:l}),C[A]===R&&(C[A]=p[A])}p=C}}else if(v&&dt(y)&&Array.isArray(p))p=p.join(y),p&&(p=this.extendTranslation(p,t,n,r));else{let N=!1,C=!1;const S=n.count!==void 0&&!dt(n.count),A=am.hasDefaultValue(n),R=S?this.pluralResolver.getSuffix(d,n.count,n):"",M=n.ordinal&&S?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",V=S&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),D=V&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${R}`]||n[`defaultValue${M}`]||n.defaultValue;!this.isValidLookup(p)&&A&&(N=!0,p=D),this.isValidLookup(p)||(C=!0,p=a);const K=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:p,$=A&&D!==p&&this.options.updateMissing;if(C||N||$){if(this.logger.log($?"updateKey":"missingKey",d,c,a,$?D: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 L=[];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++)L.push(I[P]);else this.options.saveMissingTo==="all"?L=this.languageUtils.toResolveHierarchy(n.lng||this.language):L.push(n.lng||this.language);const z=(P,T,E)=>{const J=A&&E!==p?E:K;this.options.missingKeyHandler?this.options.missingKeyHandler(P,c,T,J,$,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(P,c,T,J,$,n),this.emit("missingKey",P,c,T,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?L.forEach(P=>{const T=this.pluralResolver.getSuffixes(P,n);V&&n[`defaultValue${this.options.pluralSeparator}zero`]&&T.indexOf(`${this.options.pluralSeparator}zero`)<0&&T.push(`${this.options.pluralSeparator}zero`),T.forEach(E=>{z([P],a+E,n[`defaultValue${E}`]||D)})}):z(L,a,D))}p=this.extendTranslation(p,t,n,f,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?(f.res=p,f.usedParams=this.getUsedParamsDetails(n),f):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=dt(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(d){const p=t.match(this.interpolator.nestingRegexp);u=p&&p.length}let f=r.replace&&!dt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||s.usedLng,r),d){const p=t.match(this.interpolator.nestingRegexp),h=p&&p.length;u<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=dt(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=HI.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 dt(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),u=d.key;s=u;let f=d.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const p=n.count!==void 0&&!dt(n.count),h=p&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(dt(n.context)||typeof n.context=="number")&&n.context!=="",k=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(b=>{this.isValidLookup(r)||(l=b,!kj[`${k[0]}-${b}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(kj[`${k[0]}-${b}`]=!0,this.logger.warn(`key "${s}" for languages "${k.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!!!")),k.forEach(y=>{if(this.isValidLookup(r))return;a=y;const v=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,u,y,b,n);else{let N;p&&(N=this.pluralResolver.getSuffix(y,n.count,n));const C=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(v.push(u+N),n.ordinal&&N.indexOf(S)===0&&v.push(u+N.replace(S,this.options.pluralSeparator)),h&&v.push(u+C)),g){const A=`${u}${this.options.contextSeparator}${n.context}`;v.push(A),p&&(v.push(A+N),n.ordinal&&N.indexOf(S)===0&&v.push(A+N.replace(S,this.options.pluralSeparator)),h&&v.push(A+C))}}let w;for(;w=v.pop();)this.isValidLookup(r)||(i=w,r=this.getResource(y,b,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&&!dt(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 Ry=e=>e.charAt(0).toUpperCase()+e.slice(1);class Sj{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Bi.create("languageUtils")}getScriptPartFromCode(t){if(t=im(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=im(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(dt(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]=Ry(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]=Ry(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Ry(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)),dt(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 dt(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))):dt(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let PK=[{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}],AK={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 IK=["v1","v2","v3"],TK=["v4"],Nj={zero:0,one:1,two:2,few:3,many:4,other:5},RK=()=>{const e={};return PK.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:AK[t.fc]}})}),e};class LK{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Bi.create("pluralResolver"),(!this.options.compatibilityJSON||TK.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=RK(),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=im(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)=>Nj[s]-Nj[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!IK.includes(this.options.compatibilityJSON)}}const jj=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=bK(e,t,n);return!i&&s&&dt(n)&&(i=jw(e,n,r),i===void 0&&(i=jw(t,n,r))),i},Ly=e=>e.replace(/\$/g,"$$$$");class OK{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bi.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:u,unescapePrefix:f,nestingPrefix:p,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:k,nestingOptionsSeparator:b,maxReplaces:y,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:SK,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Vl(i):a||"{{",this.suffix=l?Vl(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=u?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=p?Vl(p):h||Vl("$t("),this.nestingSuffix=g?Vl(g):k||Vl(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=y||1e3,this.alwaysFormat=v!==void 0?v:!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=jj(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),k=g.shift().trim(),b=g.join(this.formatSeparator).trim();return this.format(jj(n,c,k,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...s,...n,interpolationkey:k})};this.resetRegExp();const u=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,f=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Ly(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Ly(this.escape(h)):Ly(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 u=="function"){const b=u(t,i,s);a=dt(b)?b:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))a="";else if(f){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),a="";else!dt(a)&&!this.useRawValueToEscape&&(a=yj(a));const k=h.safeValue(a);if(t=t.replace(i[0],k),f?(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 u=this.nestingOptionsSeparator;if(c.indexOf(u)<0)return c;const f=c.split(new RegExp(`${u}[ ]*{`));let p=`{${f[1]}`;c=f[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(k){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,k),`${c}${u}${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&&!dt(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 u=s[1].split(this.formatSeparator).map(f=>f.trim());s[1]=u.shift(),c=u,d=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!dt(i))return i;dt(i)||(i=yj(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),d&&(i=c.reduce((u,f)=>this.format(u,f,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const MK=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,""),u=l.trim();n[u]||(n[u]=d),d==="false"&&(n[u]=!1),d==="true"&&(n[u]=!0),isNaN(d)||(n[u]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},Kl=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(im(r),s),t[a]=l),l(n)}};class $K{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bi.create("formatter"),this.options=t,this.formats={number:Kl((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:Kl((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:Kl((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:Kl((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:Kl((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()]=Kl(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:u}=MK(c);if(this.formats[d]){let f=l;try{const p=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=p.locale||p.lng||s.locale||s.lng||r;f=this.formats[d](l,h,{...u,...s,...p})}catch(p){this.logger.warn(p)}return f}else this.logger.warn(`there was no format function for ${d}`);return l},t)}}const DK=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class FK extends Ym{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=Bi.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 u=!0;n.forEach(f=>{const p=`${d}|${f}`;!r.reload&&this.store.hasResourceBundle(d,f)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?a[p]===void 0&&(a[p]=!0):(this.state[p]=1,u=!1,a[p]===void 0&&(a[p]=!0),i[p]===void 0&&(i[p]=!0),c[f]===void 0&&(c[f]=!0)))}),u||(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=>{vK(c.loaded,[i],a),DK(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const u=c.loaded[d];u.length&&u.forEach(f=>{l[d][f]===void 0&&(l[d][f]=!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,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(d&&u&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,a)},i);return}a(d,u)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(t,n);d&&typeof d.then=="function"?d.then(u=>l(null,u)).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();dt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),dt(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 u;d.length===5?u=d(t,n,r,s,c):u=d(t,n,r,s),u&&typeof u.then=="function"?u.then(f=>l(null,f)).catch(l):l(null,u)}catch(u){l(u)}else d(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const Cj=()=>({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]),dt(e[1])&&(t.defaultValue=e[1]),dt(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}}),Ej=e=>(dt(e.ns)&&(e.ns=[e.ns]),dt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),dt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Rp=()=>{},zK=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Gd extends Ym{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Ej(t),this.services={},this.logger=Bi,this.modules={external:[]},zK(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&&(dt(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=Cj();this.options={...s,...this.options,...Ej(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=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Bi.init(i(this.modules.logger),this.options):Bi.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=$K);const f=new Sj(this.options);this.store=new bj(this.options.resources,this.options);const p=this.services;p.logger=Bi,p.resourceStore=this.store,p.languageUtils=f,p.pluralResolver=new LK(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(p.formatter=i(u),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new OK(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new FK(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(h){for(var g=arguments.length,k=new Array(g>1?g-1:0),b=1;b<g;b++)k[b-1]=arguments[b];t.emit(h,...k)}),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 am(this.services,this.options),this.translator.on("*",function(h){for(var g=arguments.length,k=new Array(g>1?g-1:0),b=1;b<g;b++)k[b-1]=arguments[b];t.emit(h,...k)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Rp),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=function(){return t.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return t.store[u](...arguments),t}});const c=Ou(),d=()=>{const u=(f,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(f,p)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};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]:Rp;const s=dt(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=Ou();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=Rp),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"&&HI.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=Ou();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=dt(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,u=>{a(u,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,u=new Array(d>2?d-2:0),f=2;f<d;f++)u[f-2]=arguments[f];c=s.options.overloadTranslationOptionHandler([a,l].concat(u))}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 dt(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=Ou();return this.options.ns?(dt(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=Ou();dt(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 Sj(Cj());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 Gd(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rp;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new Gd(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 bj(this.store.data,s),i.services.resourceStore=i.store),i.translator=new am(i.services,s),i.translator.on("*",function(l){for(var c=arguments.length,d=new Array(c>1?c-1:0),u=1;u<c;u++)d[u-1]=arguments[u];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 Sr=Gd.createInstance();Sr.createInstance=Gd.createInstance;Sr.createInstance;Sr.dir;Sr.init;Sr.loadResources;Sr.reloadResources;Sr.use;Sr.changeLanguage;Sr.getFixedT;Sr.t;Sr.exists;Sr.setDefaultNamespace;Sr.hasLoadedNamespace;Sr.loadNamespaces;Sr.loadLanguages;function BK(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jd(e){"@babel/helpers - typeof";return Jd=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},Jd(e)}function HK(e,t){if(Jd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Jd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function UK(e){var t=HK(e,"string");return Jd(t)=="symbol"?t:t+""}function WK(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,UK(r.key),r)}}function VK(e,t,n){return t&&WK(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var UI=[],KK=UI.forEach,qK=UI.slice;function YK(e){return KK.call(qK.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var _j=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,GK=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(!_j.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!_j.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},Pj={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=GK(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)}},JK={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=Pj.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&Pj.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},XK={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}},Mu=null,Aj=function(){if(Mu!==null)return Mu;try{Mu=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Mu=!1}return Mu},QK={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&Aj()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&Aj()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},$u=null,Ij=function(){if($u!==null)return $u;try{$u=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{$u=!1}return $u},ZK={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&Ij()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Ij()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},eq={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}},tq={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}},nq={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}},rq={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]}},WI=!1;try{document.cookie,WI=!0}catch{}var VI=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];WI||VI.splice(1,1);function sq(){return{order:VI,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var KI=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};BK(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return VK(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=YK(r,this.options||{},sq()),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(JK),this.addDetector(XK),this.addDetector(QK),this.addDetector(ZK),this.addDetector(eq),this.addDetector(tq),this.addDetector(nq),this.addDetector(rq)}},{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)}))}}])}();KI.type="languageDetector";const iq={name:"AgentFlow",tagline:"AI Workflow Orchestration"},oq={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},aq={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"},lq={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},cq={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},uq={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},dq={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},fq={app:iq,nav:oq,common:aq,status:lq,nodeTypes:cq,engine:uq,links:dq},pq="Flow Editor",hq="Nodes",mq="Edges",gq="Properties",yq={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"},xq={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}}"},wq={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},vq={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},bq={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"},kq={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)"},Sq={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},Nq={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},jq={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},Cq={node:"Node",text:"Text",file:"File",bool:"Boolean"},Eq={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"},_q={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"},Pq={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},Aq={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."},Iq={mainNav:"Main Navigation"},Tq={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'},Rq={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):
|
|
152
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
153
|
-
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}}"},Lq={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"},Oq={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},Mq={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}}"},$q={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"},Dq={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"},Fq={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"},zq={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"},Bq={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"},Hq={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},Uq={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},Wq={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"},Vq={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."},Kq={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},qq={save:"Save",cancel:"Cancel"},Yq={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},Gq={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},Jq={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"},Xq={title:pq,nodes:hq,edges:mq,properties:gq,node:yq,nodeProps:xq,actions:wq,panel:vq,palette:bq,pipeline:kq,status:Sq,roles:Nq,phases:jq,types:Cq,runContext:Eq,shortcuts:_q,jumpPalette:Pq,emptyCanvas:Aq,sidebar:Iq,validation:Tq,composer:Rq,topbar:Lq,palette2:Oq,run:Mq,fileEdit:$q,settings:Dq,schedule:Fq,history:zq,nodePropsError:Bq,placeholder:Hq,time:Uq,userCheck:Wq,userAsk:Vq,toolPrint:Kq,provideEdit:qq,runParams:Yq,runPreset:Gq,runConfig:Jq},Qq="Settings",Zq={engine:"Engine Settings",preferences:"Global Preferences"},eY={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)."},tY={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..."}},nY={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."},rY={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."},sY={title:"Environment Variables",note:"Private to the current signed-in user; overrides service-level env at runtime",saving:"Saving...",key:"Key",value:"Value",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)"},iY={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},oY={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},aY={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},lY={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."},cY={title:Qq,crumb:Zq,workspace:eY,cursor:tY,opencode:nY,claudeCode:rY,env:sY,system:iY,shortcuts:oY,language:aY,onboarding:lY},uY={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},dY={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)"},fY={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},pY={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},hY={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},mY={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},gY={aiLabels:uY,placeholders:dY,actions:fY,labels:pY,tooltips:hY,rightPanel:mY},yY="Projects",xY="All",wY="Archived",vY="Nodes",bY="My Nodes",kY="My Flows",SY="Skills",NY="Active Projects",jY="Archived Pipelines",CY="Global Nodes",EY="Manage node versions published to the current workspace marketplace, {{count}} total.",_Y="Manage flow snippets published to the current workspace marketplace, {{count}} total.",PY="Global Skills",AY="Create New Project",IY="New Pipeline",TY="SEARCH PIPELINES...",RY="SEARCH NODES...",LY="SEARCH FLOW SNIPPETS...",OY="SEARCH SKILLS...",MY="Refresh Resources",$Y="Loading pipelines...",DY="Loading global resources...",FY="Filter result: {{count}} items (matching title, description, path and tags)",zY="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",BY="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",HY="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",UY="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",WY="Executable building blocks for pipeline runtime",VY="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.",KY="Published local node packages",qY="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",YY="Published flow snippets",GY="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",JY="Operating guides for Composer and agents",XY="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",QY="No archived projects.",ZY="No active pipelines; archived items are in the Archived tab.",eG="No global nodes available.",tG="No marketplace nodes have been published.",nG="No flow snippets have been published. Select multiple canvas nodes and publish them first.",rG="No skills available.",sG="No description.",iG='No node matches "{{query}}".',oG='No flow snippet matches "{{query}}".',aG='No skill matches "{{query}}".',lG="{{inputs}} in / {{outputs}} out",cG="Flow Snippet",uG="{{nodes}} nodes / {{edges}} edges",dG="Skill",fG="Node detail",pG="Flow snippet detail",hG="Skill detail",mG="Type",gG="Source",yG="Package",xG="Version",wG="Path",vG="Editable",bG="Read only",kG="Editable",SG="Schema",NG="Inputs",jG="Outputs",CG="Runtime",EG="Node Body",_G="Files",PG="Usage",AG="No runtime manifest.",IG="No node body or README.",TG="No previewable files.",RG="Select a file to preview.",LG="Binary file preview is not supported.",OG="Large file; showing the first 256KB only.",MG="No pipelines using this node were found.",$G="Node Management",DG="Delete Node Version",FG="Deleting...",zG="AgentFlow checks all flow references before deleting; installed or used versions are kept.",BG="Delete {{id}}@{{version}}? This cannot be undone.",HG="Deleted {{id}}@{{version}}.",UG="{{count}} flow(s) still use it.",WG="No slots",VG="Purpose",KG="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",qG="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.",YG="Scale",GG="Snippet JSON",JG="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",XG="SKILL.md Preview",QG="No preview content available.",ZG="Select a resource to inspect details.",eJ="Failed to load pipeline list.",tJ="No pipelines in current workspace.",nJ="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.",rJ='No pipelines found matching "{{query}}". Try different keywords or clear the search.',sJ="Recent Activity",iJ="No recent activity",oJ="No recent activity matching the keyword",aJ="Recent Run",lJ="Recent Open",cJ={builtin:"Built-in",workspace:"Workspace",user:"User"},uJ={flow:"Flow",global:"Global",marketplace:"Marketplace"},dJ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},fJ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},pJ="Open to edit this pipeline in the node canvas.",hJ={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>"},mJ={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"},gJ={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"},yJ={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"},xJ={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"},wJ={title:yY,all:xY,archived:wY,nodes:vY,myNodes:bY,myFlows:kY,skills:SY,activeProjects:NY,archivedPipelines:jY,globalNodes:CY,myNodesHint:EY,myFlowsHint:_Y,globalSkills:PY,createNew:AY,newPipeline:IY,searchPipelines:TY,searchNodes:RY,searchFlows:LY,searchSkills:OY,refreshResources:MY,loadingPipelines:$Y,loadingResources:DY,filterResult:FY,archivedHint:zY,activeHint:BY,nodesHint:HY,skillsHint:UY,nodesPurposeTitle:WY,nodesPurposeDesc:VY,myNodesPurposeTitle:KY,myNodesPurposeDesc:qY,myFlowsPurposeTitle:YY,myFlowsPurposeDesc:GY,skillsPurposeTitle:JY,skillsPurposeDesc:XY,noArchived:QY,noActive:ZY,noNodes:eG,noMyNodes:tG,noMyFlows:nG,noSkills:rG,noDescription:sG,noNodeMatch:iG,noFlowSnippetMatch:oG,noSkillMatch:aG,nodeSlots:lG,flowSnippet:cG,flowSnippetNodes:uG,skill:dG,nodeDetail:fG,flowDetail:pG,skillDetail:hG,detailType:mG,detailSource:gG,detailPackage:yG,detailVersion:xG,detailPath:wG,detailEditable:vG,readOnly:bG,editable:kG,nodeSchema:SG,nodeInputs:NG,nodeOutputs:jG,nodeRuntime:CG,nodeBody:EG,nodeFiles:_G,nodeUsage:PG,noRuntimeManifest:AG,noNodeBody:IG,noNodeFiles:TG,selectNodeFile:RG,binaryFile:LG,fileTruncated:OG,noNodeUsage:MG,myNodeManagement:$G,deleteMyNode:DG,deletingMyNode:FG,deleteMyNodeHint:zG,deleteMyNodeConfirm:BG,deleteMyNodeSuccess:HG,deleteMyNodeUsedBy:UG,noSlots:WG,resourceMeaning:VG,nodesMeaning:KG,myFlowsMeaning:qG,flowSnippetScale:YG,flowSnippetPreview:GG,skillsMeaning:JG,skillPreview:XG,skillPreviewEmpty:QG,selectResource:ZG,loadFailed:eJ,noPipelines:tJ,emptyHint:nJ,noMatch:rJ,recentActivity:sJ,noRecentActivity:iJ,noMatchRecent:oJ,recentRun:aJ,recentOpen:lJ,sourceBadge:cJ,resourceSource:uJ,resourceFilter:dJ,nodeDetailTabs:fJ,defaultCardDesc:pJ,hubCard:hJ,newPipelineModal:mJ,importModal:gJ,deleteModal:yJ,archiveModal:xJ},vJ="Back",bJ="Next",kJ="Skip",SJ="Done",NJ="Start Creating",jJ={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
154
|
-
|
|
155
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
156
|
-
|
|
157
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},CJ={intro:`Now you're in the flow editor.
|
|
158
|
-
|
|
159
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
160
|
-
|
|
161
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
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.`},EJ={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"},_J={back:vJ,next:bJ,skip:kJ,done:SJ,startCreate:NJ,projects:jJ,flow:CJ,newPipeline:EJ},PJ={name:"AgentFlow",tagline:"AI 工作流编排"},AJ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",flowEditor:"流程编辑器",settings:"设置",back:"返回"},IJ={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},TJ={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},RJ={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},LJ={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},OJ={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},MJ={app:PJ,nav:AJ,common:IJ,status:TJ,nodeTypes:RJ,engine:LJ,links:OJ},$J="流程编辑器",DJ="节点",FJ="连线",zJ="属性",BJ={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:"编辑内容"},HJ={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}}"},UJ={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},WJ={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},VJ={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},KJ={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},qJ={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},YJ={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},GJ={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},JJ={node:"节点",text:"文本",file:"文件",bool:"布尔"},XJ={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:"等待"},QJ={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},ZJ={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},eX={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},tX={mainNav:"主导航"},nX={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},rX={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}} 步):
|
|
166
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
167
|
-
当前:{{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}}"},sX={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},iX={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},oX={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}} 的分支"},aX={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},lX={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:"已复制"},cX={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:"定时配置已保存"},uX={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},dX={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},fX={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},pX={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},hX={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},mX={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},gX={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},yX={save:"保存",cancel:"取消"},xX={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},wX={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},vX={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},bX={title:$J,nodes:DJ,edges:FJ,properties:zJ,node:BJ,nodeProps:HJ,actions:UJ,panel:WJ,palette:VJ,pipeline:KJ,status:qJ,roles:YJ,phases:GJ,types:JJ,runContext:XJ,shortcuts:QJ,jumpPalette:ZJ,emptyCanvas:eX,sidebar:tX,validation:nX,composer:rX,topbar:sX,palette2:iX,run:oX,fileEdit:aX,settings:lX,schedule:cX,history:uX,nodePropsError:dX,placeholder:fX,time:pX,userCheck:hX,userAsk:mX,toolPrint:gX,provideEdit:yX,runParams:xX,runPreset:wX,runConfig:vX},kX="设置",SX={engine:"引擎设置",preferences:"全局首选项"},NX={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},jX={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},CX={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},EX={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},_X={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",saving:"正在保存...",key:"键",value:"值",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},PX={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},AX={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},IX={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},TX={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},RX={title:kX,crumb:SX,workspace:NX,cursor:jX,opencode:CX,claudeCode:EX,env:_X,system:PX,shortcuts:AX,language:IX,onboarding:TX},LX={thinking:"思考",result:"结果",reply:"回复",error:"错误"},OX={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},MX={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},$X={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},DX={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},FX={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},zX={aiLabels:LX,placeholders:OX,actions:MX,labels:$X,tooltips:DX,rightPanel:FX},BX="项目",HX="全部",UX="已归档",WX="Nodes",VX="我的 Nodes",KX="我的流程",qX="Skills",YX="活跃项目",GX="已归档流水线",JX="全局 Nodes",XX="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",QX="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",ZX="全局 Skills",eQ="创建新项目",tQ="新建流水线",nQ="搜索流水线…",rQ="搜索 nodes…",sQ="搜索流程片段…",iQ="搜索 skills…",oQ="刷新资源",aQ="加载流水线列表…",lQ="加载全局资源…",cQ="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",uQ="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",dQ="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",fQ="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",pQ="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",hQ="流程运行时的可执行积木",mQ="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",gQ="已发布的本地节点包",yQ="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",xQ="已发布的流程片段",wQ="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",vQ="Composer/Agent 的操作指南",bQ="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",kQ="暂无归档项目。",SQ="暂无未归档流水线;已归档项在 Archived 标签中查看。",NQ="暂无可用全局 nodes。",jQ="暂无已发布的 marketplace nodes。",CQ="暂无已发布的流程片段。可在画布中选中多个节点后发布。",EQ="暂无可用 skills。",_Q="暂无描述。",PQ="未找到与「{{query}}」匹配的 node。",AQ="未找到与「{{query}}」匹配的流程片段。",IQ="未找到与「{{query}}」匹配的 skill。",TQ="{{inputs}} in / {{outputs}} out",RQ="流程片段",LQ="{{nodes}} 节点 / {{edges}} 连线",OQ="Skill",MQ="Node 详情",$Q="流程片段详情",DQ="Skill 详情",FQ="类型",zQ="来源",BQ="包",HQ="版本",UQ="路径",WQ="可编辑",VQ="只读",KQ="可编辑",qQ="Schema",YQ="输入",GQ="输出",JQ="Runtime",XQ="节点内容",QQ="Files",ZQ="Usage",eZ="暂无 runtime manifest。",tZ="暂无节点正文或 README。",nZ="暂无可预览文件。",rZ="请选择文件查看内容。",sZ="二进制文件暂不支持预览。",iZ="文件较大,仅显示前 256KB。",oZ="暂未发现使用此 node 的流水线。",aZ="节点管理",lZ="删除节点版本",cZ="删除中…",uZ="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",dZ="确定删除 {{id}}@{{version}}?此操作不可撤销。",fZ="已删除 {{id}}@{{version}}。",pZ="仍有 {{count}} 个 Flow 使用它。",hZ="无槽位",mZ="作用",gZ="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",yZ="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",xZ="规模",wZ="片段 JSON",vZ="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",bZ="SKILL.md 预览",kZ="暂无可预览内容。",SZ="请选择一个资源查看详情。",NZ="未能加载流水线列表。",jZ="当前工作区暂无流水线。",CZ="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",EZ="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",_Z="最近打开或最近运行",PZ="暂无打开或运行记录",AZ="暂无与关键词匹配的最近记录",IZ="最近运行",TZ="最近打开",RZ={builtin:"内置",workspace:"工作区",user:"用户"},LZ={flow:"Flow",global:"Global",marketplace:"Marketplace"},OZ={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},MZ={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},$Z="打开以在节点画布中编辑此流水线。",DZ={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},FZ={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:"关闭"},zZ={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},BZ={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},HZ={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},UZ={title:BX,all:HX,archived:UX,nodes:WX,myNodes:VX,myFlows:KX,skills:qX,activeProjects:YX,archivedPipelines:GX,globalNodes:JX,myNodesHint:XX,myFlowsHint:QX,globalSkills:ZX,createNew:eQ,newPipeline:tQ,searchPipelines:nQ,searchNodes:rQ,searchFlows:sQ,searchSkills:iQ,refreshResources:oQ,loadingPipelines:aQ,loadingResources:lQ,filterResult:cQ,archivedHint:uQ,activeHint:dQ,nodesHint:fQ,skillsHint:pQ,nodesPurposeTitle:hQ,nodesPurposeDesc:mQ,myNodesPurposeTitle:gQ,myNodesPurposeDesc:yQ,myFlowsPurposeTitle:xQ,myFlowsPurposeDesc:wQ,skillsPurposeTitle:vQ,skillsPurposeDesc:bQ,noArchived:kQ,noActive:SQ,noNodes:NQ,noMyNodes:jQ,noMyFlows:CQ,noSkills:EQ,noDescription:_Q,noNodeMatch:PQ,noFlowSnippetMatch:AQ,noSkillMatch:IQ,nodeSlots:TQ,flowSnippet:RQ,flowSnippetNodes:LQ,skill:OQ,nodeDetail:MQ,flowDetail:$Q,skillDetail:DQ,detailType:FQ,detailSource:zQ,detailPackage:BQ,detailVersion:HQ,detailPath:UQ,detailEditable:WQ,readOnly:VQ,editable:KQ,nodeSchema:qQ,nodeInputs:YQ,nodeOutputs:GQ,nodeRuntime:JQ,nodeBody:XQ,nodeFiles:QQ,nodeUsage:ZQ,noRuntimeManifest:eZ,noNodeBody:tZ,noNodeFiles:nZ,selectNodeFile:rZ,binaryFile:sZ,fileTruncated:iZ,noNodeUsage:oZ,myNodeManagement:aZ,deleteMyNode:lZ,deletingMyNode:cZ,deleteMyNodeHint:uZ,deleteMyNodeConfirm:dZ,deleteMyNodeSuccess:fZ,deleteMyNodeUsedBy:pZ,noSlots:hZ,resourceMeaning:mZ,nodesMeaning:gZ,myFlowsMeaning:yZ,flowSnippetScale:xZ,flowSnippetPreview:wZ,skillsMeaning:vZ,skillPreview:bZ,skillPreviewEmpty:kZ,selectResource:SZ,loadFailed:NZ,noPipelines:jZ,emptyHint:CZ,noMatch:EZ,recentActivity:_Z,noRecentActivity:PZ,noMatchRecent:AZ,recentRun:IZ,recentOpen:TZ,sourceBadge:RZ,resourceSource:LZ,resourceFilter:OZ,nodeDetailTabs:MZ,defaultCardDesc:$Z,hubCard:DZ,newPipelineModal:FZ,importModal:zZ,deleteModal:BZ,archiveModal:HZ},WZ="返回",VZ="下一步",KZ="跳过",qZ="完成",YZ="开始创建",GZ={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
168
|
-
|
|
169
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
170
|
-
|
|
171
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},JZ={intro:`现在进入流程编辑器。
|
|
172
|
-
|
|
173
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
174
|
-
|
|
175
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
176
|
-
|
|
177
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
178
|
-
|
|
179
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},XZ={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},QZ={back:WZ,next:VZ,skip:KZ,done:qZ,startCreate:YZ,projects:GZ,flow:JZ,newPipeline:XZ},ZZ={en:{common:fq,flow:Xq,settings:cY,composer:gY,project:wJ,onboarding:_J},zh:{common:MJ,flow:bX,settings:RX,composer:zX,project:UZ,onboarding:QZ}};Sr.use(KI).use(sO).init({resources:ZZ,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 eee=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function tee(e){return Sr.changeLanguage(e)}const Cw="agentflow-settings-opencode-plan-v1";function Oy(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 qI(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function nee(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function Lp(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=String(n.key??"").trim(),s=String(n.value??""),i=String(n.id??"").trim()||qI();!r&&!s||t.push({id:i,key:r,value:s})}return t}function Tj(){try{return localStorage.getItem(Cw)??""}catch{return""}}function ree(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function see(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 iee(){const{t:e,i18n:t}=pn(["common","settings"]),n=t.language||"zh",[r,s]=m.useState(""),[i,a]=m.useState(""),[l,c]=m.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[d,u]=m.useState(""),[f,p]=m.useState(!1),[h,g]=m.useState(!1),[k,b]=m.useState(""),[y,v]=m.useState([]),[w,N]=m.useState(""),[C,S]=m.useState(!1),[A,R]=m.useState(""),[M,V]=m.useState(""),[D,O]=m.useState(""),K=m.useRef(null),$=m.useRef(!1),L=m.useRef(!1),I=m.useRef(""),z=m.useCallback(async()=>{a("");try{const se=await fetch("/api/ui-context");if(!se.ok)throw new Error("HTTP "+se.status);const pe=await se.json();s(typeof pe.workspaceRoot=="string"?pe.workspaceRoot:"")}catch(se){a(String(se.message||se)),s("")}},[]),P=m.useCallback(async()=>{u(""),p(!0);try{const se=await fetch("/api/model-lists");if(!se.ok)throw new Error("HTTP "+se.status);const pe=await se.json();c(Oy(pe))}catch(se){u(String(se.message||se))}finally{p(!1)}},[]),T=m.useCallback(async()=>{N("");try{const se=await fetch("/api/user-env"),pe=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof pe.error=="string"?pe.error:"HTTP "+se.status);const ve=Lp(Array.isArray(pe.env)?pe.env:[]);I.current=JSON.stringify(ve),v(ve)}catch(se){v([]),N(String(se.message||se))}finally{L.current=!0}},[]),E=m.useCallback(async se=>{const pe=Lp(se);S(!0),N("");try{const ve=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:pe})}),je=await ve.json().catch(()=>({}));if(!ve.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ve.status);const Ve=Lp(Array.isArray(je.env)?je.env:[]);I.current=JSON.stringify(Ve),v(Ve)}catch(ve){N(String(ve.message||ve))}finally{S(!1)}},[]),J=m.useCallback(async()=>{u(""),p(!0);try{const se=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:D.trim()})}),pe=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof pe.error=="string"?pe.error:"HTTP "+se.status);c(Oy(pe.modelLists))}catch(se){u(String(se.message||se))}finally{p(!1)}},[D]);m.useEffect(()=>{z(),P(),T(),(async()=>{try{const se=await fetch("/api/agentflow-config");if(se.ok){const pe=await se.json(),ve=typeof pe.opencodeProvider=="string"?pe.opencodeProvider:"";O(ve),K.current=ve;try{localStorage.setItem(Cw,ve)}catch{}}else{const pe=Tj();O(pe),K.current=pe}}catch{const se=Tj();O(se),K.current=se}finally{$.current=!0}})()},[z,P,T]),m.useEffect(()=>{if(!L.current||JSON.stringify(Lp(y))===I.current)return;const pe=setTimeout(()=>{E(y)},350);return()=>clearTimeout(pe)},[y,E]),m.useEffect(()=>{if(!$.current)return;const se=D.trim();if(se===K.current)return;const pe=setTimeout(()=>{(async()=>{g(!0),b("");try{const ve=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:se})}),je=await ve.json().catch(()=>({}));if(!ve.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ve.status);K.current=se;try{localStorage.setItem(Cw,se)}catch{}je.modelLists&&c(Oy(je.modelLists))}catch(ve){b(String(ve.message||ve))}finally{g(!1)}})()},450);return()=>clearTimeout(pe)},[D]);const Q=l.cursor.length>0,H=l.opencode.length>0,te=l.claudeCode.length>0,le=m.useCallback(()=>{var se;r&&((se=navigator.clipboard)==null||se.writeText(r))},[r]),ue=m.useCallback(()=>{const se=A.trim(),pe=M;if(se){if(!nee(se)){N(e("settings:env.invalidKey"));return}v(ve=>[...ve,{id:qI(),key:se,value:pe}]),R(""),V("")}},[A,M,e]),de=m.useCallback(se=>{v(pe=>pe.filter(ve=>ve.id!==se))},[]),ce=m.useCallback(se=>{const pe=se.target.value;tee(pe)},[]),fe=se=>{const pe=see(se,n);return pe?e("settings:cursor.modelList.fetchedAt",{time:pe}):e("settings:cursor.modelList.never")};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":e("settings:title"),children:[o.jsx("span",{className:"af-settings-crumb-muted",children:e("settings:crumb.engine")}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:e("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:[e("common:app.name")," ",e("settings:title")]}),o.jsx("p",{className:"af-settings-lead",children:e("settings:workspace.description")}),i?o.jsx("p",{className:"af-err af-settings-api-hint",children:i}):null,d?o.jsx("p",{className:"af-err af-settings-api-hint",children:d}):null,w?o.jsx("p",{className:"af-err af-settings-api-hint",children:w}):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:e("settings:workspace.title")})]}),o.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:e("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:r,placeholder:e("common:loading")}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:le,"aria-label":e("settings:workspace.copyPath"),disabled:!r,children:o.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),o.jsx("p",{className:"af-set-hint",children:e("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"+(Q?" af-set-badge--ok":" af-set-badge--muted"),children:e(Q?"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:Q?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:e(Q?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:Q?e("settings:cursor.modelList.count",{count:l.cursor.length})+" · "+fe(l.cursorFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),Q?o.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:cursor.modelPreviewLabel"),children:l.cursor.join(`
|
|
180
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>J(),disabled:f,children:e(f?"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"+(H?" af-set-badge--ok":" af-set-badge--err"),children:e(H?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),o.jsx("p",{className:"af-set-p",children:e("settings:opencode.description")}),o.jsxs("div",{children:[o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:e("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:D,onChange:se=>O(se.target.value),placeholder:e("settings:opencode.providerPlaceholder"),autoComplete:"off"}),h?o.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:e("settings:opencode.saving")}):null,k?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:k}):null]}),H?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:e("settings:cursor.modelList.count",{count:l.opencode.length})+" · "+fe(l.opencodeFetchedAt)}),o.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:opencode.modelPreviewLabel"),children:l.opencode.join(`
|
|
181
|
-
`)})]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>J(),disabled:f,children:e(f?"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:e("settings:claudeCode.title")}),o.jsx("span",{className:"af-set-badge"+(te?" af-set-badge--ok":" af-set-badge--err"),children:e(te?"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:te?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:e(te?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:te?e("settings:cursor.modelList.count",{count:l.claudeCode.length})+" · "+fe(l.claudeCodeFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:e("settings:claudeCode.description")}),te?o.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:claudeCode.modelPreviewLabel"),children:l.claudeCode.join(`
|
|
182
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>J(),disabled:f,children:e(f?"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:e("settings:env.title")})]}),o.jsx("span",{className:"af-set-env-note",children:e(C?"settings:env.saving":"settings:env.note")})]}),o.jsxs("div",{className:"af-set-env-rows",children:[y.map(se=>o.jsxs("div",{className:"af-set-env-row",children:[o.jsxs("div",{className:"af-set-env-cell",children:[o.jsx("span",{className:"af-set-env-k",children:e("settings:env.key")}),o.jsx("code",{className:"af-set-code-key",children:se.key||"—"})]}),o.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow",children:[o.jsx("span",{className:"af-set-env-k",children:e("settings:env.value")}),o.jsx("code",{className:"af-set-code-val",children:ree(se.value)})]}),o.jsx("div",{className:"af-set-env-actions",children:o.jsx("button",{type:"button",className:"af-set-env-del","aria-label":e("settings:env.delete",{key:se.key}),onClick:()=>de(se.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},se.id)),o.jsxs("div",{className:"af-set-env-row af-set-env-row--draft",children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",placeholder:"KEY_NAME",value:A,onChange:se=>R(se.target.value),"aria-label":e("settings:env.newKey")})}),o.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow",children:o.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",type:"password",placeholder:e("settings:env.newValue"),value:M,onChange:se=>V(se.target.value),"aria-label":e("settings:env.newValue")})}),o.jsx("div",{className:"af-set-env-actions",children:o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:ue,disabled:!A.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),e("settings:env.add")]})})]})]})]})]}),o.jsxs("aside",{className:"af-settings-rail","aria-label":e("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:e("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:e(!i&&!d?"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:e("settings:system.cursorModels")}),o.jsx("span",{children:l.cursor.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,l.cursor.length>0?12+l.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:e("settings:system.opencodeModels")}),o.jsx("span",{children:l.opencode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,l.opencode.length>0?12+l.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:e("settings:system.claudeCodeModels")}),o.jsx("span",{children:l.claudeCode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,l.claudeCode.length>0?12+l.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:e("settings:language.title")}),o.jsxs("div",{className:"af-set-language-selector",children:[o.jsx("select",{className:"af-set-input af-set-input--sm",value:n,onChange:ce,"aria-label":e("settings:language.description"),children:eee.map(se=>o.jsxs("option",{value:se.code,children:[se.flag," ",se.name]},se.code))}),o.jsx("p",{className:"af-set-hint",children:e("settings:language.description")})]})]})]})]})]})})]})}function YI(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Rj(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:YI(),key:r,value:String(s??""),private:n.has(r)}))}function Lj(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 oh(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(`
|
|
183
|
-
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:Rj(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:Rj(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 My(){return oh({name:"",raw:{command:""}})}function oee(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=Lj(e.envRows),s=Lj(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 Oj(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function Mj(e){return e?e.ok?"ok":"error":"unknown"}function $j({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:YI(),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 aee(){var O;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,i]=m.useState(My),[a,l]=m.useState(""),[c,d]=m.useState(!1),[u,f]=m.useState(!1),[p,h]=m.useState(!1),[g,k]=m.useState({}),[b,y]=m.useState(""),[v,w]=m.useState(""),N=m.useMemo(()=>n.find(K=>K.name===a)||null,[a,n]),C=N&&g[N.name]||null,S=m.useCallback(async()=>{d(!0),y("");try{const K=await fetch("/api/mcps"),$=await K.json().catch(()=>({}));if(!K.ok)throw new Error($.error||"MCP HTTP "+K.status);const L=Array.isArray($.servers)?$.servers:[];t(String($.path||"")),r(L),a&&L.some(I=>I.name===a)&&i(oh(L.find(I=>I.name===a)))}catch(K){y(String(K.message||K))}finally{d(!1)}},[a]);m.useEffect(()=>{S()},[S]);const A=()=>{l(""),i(My()),w(""),y("")},R=K=>{l(K.name),i(oh(K)),w(""),y("")},M=async(K="")=>{h(!0),y(""),w("");try{const $=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K?{name:K}:{})}),L=await $.json().catch(()=>({}));if(!$.ok)throw new Error(L.error||"检测 MCP 失败");const I=Array.isArray(L.results)?L.results:[];k(z=>{const P={...z};for(const T of I)T!=null&&T.name&&(P[T.name]=T);return P}),w(K?`已检测 ${K}。`:"已检测所有 MCP。")}catch($){y(String($.message||$))}finally{h(!1)}},V=async()=>{f(!0),y(""),w("");try{const K=oee(s);if(!K.nextName)throw new Error("请填写 MCP 名称");const $=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)}),L=await $.json().catch(()=>({}));if(!$.ok)throw new Error(L.error||"保存 MCP 失败");const I=Array.isArray(L.servers)?L.servers:[];r(I),t(String(L.path||e)),l(K.nextName),i(oh(I.find(z=>z.name===K.nextName)||null)),k(z=>{const P={...z};return s.originalName&&s.originalName!==K.nextName&&delete P[s.originalName],delete P[K.nextName],P}),w("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(K){y(String(K.message||K))}finally{f(!1)}},D=async K=>{if(K!=null&&K.name&&window.confirm(`删除 MCP "${K.name}"?`)){f(!0),y(""),w("");try{const $=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:K.name})}),L=await $.json().catch(()=>({}));if(!$.ok)throw new Error(L.error||"删除 MCP 失败");r(Array.isArray(L.servers)?L.servers:[]),l(""),i(My()),k(I=>{const z={...I};return delete z[K.name],z}),w("已删除。")}catch($){y(String($.message||$))}finally{f(!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:S,disabled:c||u,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>M(),disabled:p||c||u||n.length===0,children:p?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:A,disabled:u,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:A,disabled:u,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:A,disabled:u,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(K=>o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===K.name?" af-mcp-server-item--active":""),onClick:()=>R(K),children:[o.jsx("span",{className:"material-symbols-outlined",children:K.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:K.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${Mj(g[K.name])}`,children:Oj(g[K.name])})]}),o.jsx("em",{children:K.url||[K.command,...K.args||[]].filter(Boolean).join(" ")})]})]},K.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:()=>M(N.name),disabled:p||u,children:p?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>D(N),disabled:u,children:"删除"})]}):null]}),b?o.jsx("p",{className:"af-mcp-error",children:b}):null,v?o.jsx("p",{className:"af-mcp-status",children:v}):null,C?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${Mj(C)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:Oj(C)}),o.jsxs("span",{children:[C.elapsedMs||0,"ms"]})]}),C.error?o.jsx("p",{children:C.error}):null,(O=C.tools)!=null&&O.length?o.jsx("div",{className:"af-mcp-tools-list",children:C.tools.map(K=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:K.name}),K.description?o.jsx("span",{children:K.description}):null]},K.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:K=>i($=>({...$,name:K.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:K=>i($=>({...$,type:K.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:K=>i($=>({...$,url:K.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:K=>i($=>({...$,command:K.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:K=>i($=>({...$,argsText:K.target.value})),placeholder:`mcp-server-example
|
|
184
|
-
--flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:K=>i($=>({...$,description:K.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx($j,{title:"Headers",rows:s.headerRows,onChange:K=>i($=>({...$,headerRows:K})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx($j,{title:"Env",rows:s.envRows,onChange:K=>i($=>({...$,envRows:K})),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:K=>i($=>({...$,extraJson:K.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:A,disabled:u,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:V,disabled:u,children:u?"保存中...":"保存 MCP"})]})]})]})]})})]})}function GI(e){return t=>typeof t===e}var lee=GI("function"),cee=e=>e===null,Dj=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Fj=e=>!uee(e)&&!cee(e)&&(lee(e)||typeof e=="object"),uee=GI("undefined");function dee(e,t,n){return xee(n,e,t)?!0:(wee(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?fee(e,t,n):e instanceof Map&&t instanceof Map?mee(e,t,n):e instanceof Set&&t instanceof Set?yee(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?pee(e,t):Dj(e)&&Dj(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?hee(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():gee(e,t,n))}function xf(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!Fj(e)||!t||!Fj(t)?!1:dee(e,t,n)}function fee(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!xf(e[s],t[s],n))return!1;return!0}function pee(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 hee(e,t,n){return e.message===t.message&&e.name===t.name&&xf(e.cause,t.cause,n)}function mee(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(!xf(r[1],t.get(r[0]),n))return!1;return!0}function gee(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)&&!xf(e[i],t[i],n))return!1}return!0}function yee(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 xee(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function wee(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function yb(e,t){return xf(e,t,new WeakMap)}function $y(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function vee(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function bee(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function kee(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function See(e,t){const n=kee();m.useEffect(()=>{if(!n)return e()},t)}function JI(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function Nee(e,t){const n=m.useRef(t);return yb(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function jee(e){m.useEffect(()=>{e()},[])}function Cee(e=0){const[t,n]=m.useState({height:$y()?window.innerHeight:0,width:$y()?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(!$y())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),bee(window,"resize",i),()=>{vee(window,"resize",i)}},[]),t}var Eee=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],_ee=["bigint","boolean","null","number","string","symbol","undefined"];function wf(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Pee(t))return t}function ki(e){return t=>wf(t)===e}function Pee(e){return Eee.includes(e)}function Xc(e){return t=>typeof t===e}function Aee(e){return _ee.includes(e)}var Iee=["innerHTML","ownerDocument","style","attributes","nodeValue"],vf=e=>Array.isArray(e),Tee=e=>wf(e)==="AsyncGeneratorFunction",Ree=ki("AsyncFunction"),Lee=Xc("bigint"),Oee=e=>e===!0||e===!1,Mee=ki("Date"),$ee=ki("Error"),ka=Xc("function"),Dee=ki("GeneratorFunction"),Fee=e=>typeof e=="number"&&Number.isInteger(e),Ew=ki("Map"),XI=e=>Number.isNaN(e),xb=e=>e===null,QI=ki("Function"),zee=ki("Promise"),Bee=ki("RegExp"),_w=ki("Set"),bf=Xc("string"),Hee=Xc("symbol"),wb=Xc("undefined"),Uee=ki("WeakMap"),Wee=ki("WeakSet"),vb=e=>xb(e)||wb(e),ZI=e=>!wb(e),Vee=e=>Xc("number")(e)&&!XI(e),Kee=e=>bf(e)&&e.trim().length>0,qee=e=>{if(!bf(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},Gm=e=>!vb(e)&&(ka(e)||typeof e=="object"),eT=e=>{if(wf(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Yee=e=>xb(e)||Aee(typeof e),Gee=e=>wf(e)==="URL",tT=e=>!vb(e)&&ka(e[Symbol.iterator]),Jee=e=>tT(e)&&ka(e.next)&&ka(e.throw),Xee=e=>ka(e)&&/^class\s/.test(e.toString()),Qee=(e,t)=>!vf(e)||!ka(t)?!1:e.every(n=>t(n)),Zee=e=>Gm(e)&&!eT(e)&&e.nodeType===1&&bf(e.nodeName)&&Iee.every(t=>t in e),ete=e=>bf(e)&&e.length===0||vf(e)&&e.length===0||Gm(e)&&!Ew(e)&&!_w(e)&&Object.keys(e).length===0||_w(e)&&e.size===0||Ew(e)&&e.size===0,tte=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,nte=(e,t)=>vf(e)?e.indexOf(t)>-1:!1,rte=(e,t,n)=>{if(!Gm(e)||!t)return!1;const r=e[t];return ka(n)?n(r):ZI(r)};function wt(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(vf(e))return"Array";if(QI(e))return"Function";const t=wf(e);return t||"Object"}wt.array=vf;wt.arrayOf=Qee;wt.asyncGeneratorFunction=Tee;wt.asyncFunction=Ree;wt.bigint=Lee;wt.boolean=Oee;wt.class=Xee;wt.date=Mee;wt.defined=ZI;wt.domElement=Zee;wt.empty=ete;wt.error=$ee;wt.function=ka;wt.generator=Jee;wt.generatorFunction=Dee;wt.instanceOf=tte;wt.integer=Fee;wt.iterable=tT;wt.map=Ew;wt.nan=XI;wt.null=xb;wt.nullOrUndefined=vb;wt.nonEmptyString=Kee;wt.number=Vee;wt.numericString=qee;wt.object=Gm;wt.oneOf=nte;wt.plainFunction=QI;wt.plainObject=eT;wt.primitive=Yee;wt.promise=zee;wt.propertyOf=rte;wt.regexp=Bee;wt.set=_w;wt.string=bf;wt.symbol=Hee;wt.undefined=wb;wt.url=Gee;wt.weakMap=Uee;wt.weakSet=Wee;var Ir=wt;/* v8 ignore next -- @preserve */var ste=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},ite=function(e,t){return e+Xd(t)},Xd=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(ite,""):ste(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Xd(e.props.children):""};Xd.default=Xd;var ote=Xd;const Dy=Na(ote);var nT={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 S=0;const A=C.length,R=new Array(A);for(S;S<A;++S)R[S]=y(C[S]);return R}function l(C){const S={};if(p&&Object.getPrototypeOf(C)!==t)return p(C);const A=f(C);let R,M,V;for(R=0,M=A.length;R<M;++R)i(V=A[R])&&(S[V]=y(C[V]));return S}function c(C,S){const A=C.length,R=S.length;let M=0;const V=new Array(A+R);for(M;M<A;++M)V[M]=y(C[M]);for(M=0;M<R;++M)V[M+A]=y(S[M]);return V}const d=Object.prototype.propertyIsEnumerable;function u(C){const S=Object.keys(C),A=Object.getOwnPropertySymbols(C);for(let R=0,M=A.length;R<M;++R)d.call(C,A[R])&&S.push(A[R]);return S}const f=s!=null&&s.symbols?u: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 k(C){return typeof C!="object"||C===null}const b=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:y,deepmerge:w,getKeys:f,isMergeableObject:h}):c;function y(C){return h(C)?Array.isArray(C)?a(C):l(C):C}function v(C,S){const A={},R=f(C),M=f(S);let V,D,O;for(V=0,D=R.length;V<D;++V)i(O=R[V])&&M.indexOf(O)===-1&&(A[O]=y(C[O]));for(V=0,D=M.length;V<D;++V)if(i(O=M[V]))if(O in C)R.indexOf(O)!==-1&&(p&&h(S[O])&&Object.getPrototypeOf(S[O])!==t?A[O]=p(S[O]):A[O]=w(C[O],S[O]));else{if(g&&typeof S[O]>"u")continue;A[O]=y(S[O])}return A}function w(C,S){if(g&&typeof S>"u")return y(C);const A=Array.isArray(S),R=Array.isArray(C);return k(S)?S:h(C)?A&&R?b(C,S):A!==R?y(S):v(C,S):y(S)}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 S=0,A=arguments.length;S<A;++S)C=w(C,arguments[S]);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})})(nT);var ate=nT.exports;const lte=Na(ate);var cte=new Error("Element already at target scroll position"),ute=new Error("Scroll cancelled"),dte=Math.min,zj=Date.now,fte={left:Bj("scrollLeft"),top:Bj("scrollTop")};function Bj(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=hte);var a=zj(),l=n[e],c=s.ease||pte,d=isNaN(s.duration)?350:+s.duration,u=!1;return l===r?i(cte,n[e]):requestAnimationFrame(p),f;function f(){u=!0}function p(h){if(u)return i(ute,n[e]);var g=zj(),k=dte(1,(g-a)/d),b=c(k);n[e]=b*(r-l)+l,k<1?requestAnimationFrame(p):requestAnimationFrame(function(){i(null,n[e])})}}}function pte(e){return .5*(1-Math.cos(Math.PI*e))}function hte(){}const mte=Na(fte);var rT={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(hd,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})})(rT);var gte=rT.exports;const sT=Na(gte),yte=["top","right","bottom","left"],Hj=["start","end"],Uj=yte.reduce((e,t)=>e.concat(t,t+"-"+Hj[0],t+"-"+Hj[1]),[]),Wc=Math.min,ol=Math.max,lm=Math.round,Op=Math.floor,Ki=e=>({x:e,y:e}),xte={left:"right",right:"left",bottom:"top",top:"bottom"};function Pw(e,t,n){return ol(e,Wc(t,n))}function Qc(e,t){return typeof e=="function"?e(t):e}function jo(e){return e.split("-")[0]}function qi(e){return e.split("-")[1]}function iT(e){return e==="x"?"y":"x"}function bb(e){return e==="y"?"height":"width"}function sa(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function kb(e){return iT(sa(e))}function oT(e,t,n){n===void 0&&(n=!1);const r=qi(e),s=kb(e),i=bb(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=um(a)),[a,um(a)]}function wte(e){const t=um(e);return[cm(e),t,cm(t)]}function cm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Wj=["left","right"],Vj=["right","left"],vte=["top","bottom"],bte=["bottom","top"];function kte(e,t,n){switch(e){case"top":case"bottom":return n?t?Vj:Wj:t?Wj:Vj;case"left":case"right":return t?vte:bte;default:return[]}}function Ste(e,t,n,r){const s=qi(e);let i=kte(jo(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(cm)))),i}function um(e){const t=jo(e);return xte[t]+e.slice(t.length)}function Nte(e){return{top:0,right:0,bottom:0,left:0,...e}}function aT(e){return typeof e!="number"?Nte(e):{top:e,right:e,bottom:e,left:e}}function dm(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 Kj(e,t,n){let{reference:r,floating:s}=e;const i=sa(t),a=kb(t),l=bb(a),c=jo(t),d=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:u,y:r.y-s.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(qi(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 jte(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:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=Qc(t,e),g=aT(h),b=l[p?f==="floating"?"reference":"floating":f],y=dm(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),v=f==="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=dm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:c}):v);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 Cte=50,Ete=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:jte},c=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:f}=Kj(d,r,c),p=r,h=0;const g={};for(let k=0;k<i.length;k++){const b=i[k];if(!b)continue;const{name:y,fn:v}=b,{x:w,y:N,data:C,reset:S}=await v({x:u,y:f,initialPlacement:r,placement:p,strategy:s,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});u=w??u,f=N??f,g[y]={...g[y],...C},S&&h<Cte&&(h++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(d=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:u,y:f}=Kj(d,p,c)),k=-1)}return{x:u,y:f,placement:p,strategy:s,middlewareData:g}},_te=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:u=0}=Qc(e,t)||{};if(d==null)return{};const f=aT(u),p={x:n,y:r},h=kb(s),g=bb(h),k=await a.getDimensions(d),b=h==="y",y=b?"top":"left",v=b?"bottom":"right",w=b?"clientHeight":"clientWidth",N=i.reference[g]+i.reference[h]-p[h]-i.floating[g],C=p[h]-i.reference[h],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let A=S?S[w]:0;(!A||!await(a.isElement==null?void 0:a.isElement(S)))&&(A=l.floating[w]||i.floating[g]);const R=N/2-C/2,M=A/2-k[g]/2-1,V=Wc(f[y],M),D=Wc(f[v],M),O=V,K=A-k[g]-D,$=A/2-k[g]/2+R,L=Pw(O,$,K),I=!c.arrow&&qi(s)!=null&&$!==L&&i.reference[g]/2-($<O?V:D)-k[g]/2<0,z=I?$<O?$-O:$-K:0;return{[h]:p[h]+z,data:{[h]:L,centerOffset:$-L-z,...I&&{alignmentOffset:z}},reset:I}}});function Pte(e,t,n){return(e?[...n.filter(s=>qi(s)===e),...n.filter(s=>qi(s)!==e)]:n.filter(s=>jo(s)===s)).filter(s=>e?qi(s)===e||(t?cm(s)!==s:!1):!0)}const Ate=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:u=!1,alignment:f,allowedPlacements:p=Uj,autoAlignment:h=!0,...g}=Qc(e,t),k=f!==void 0||p===Uj?Pte(f||null,h,p):p,b=await c.detectOverflow(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,v=k[y];if(v==null)return{};const w=oT(v,i,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==v)return{reset:{placement:k[0]}};const N=[b[jo(v)],b[w[0]],b[w[1]]],C=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:N}],S=k[y+1];if(S)return{data:{index:y+1,overflows:C},reset:{placement:S}};const A=C.map(V=>{const D=qi(V.placement);return[V.placement,D&&u?V.overflows.slice(0,2).reduce((O,K)=>O+K,0):V.overflows[0],V.overflows]}).sort((V,D)=>V[1]-D[1]),M=((s=A.filter(V=>V[2].slice(0,qi(V[0])?2:3).every(D=>D<=0))[0])==null?void 0:s[0])||A[0][0];return M!==l?{data:{index:y+1,overflows:C},reset:{placement:M}}:{}}}},Ite=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:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:k=!0,...b}=Qc(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=jo(s),v=sa(l),w=jo(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=p||(w||!k?[um(l)]:wte(l)),S=g!=="none";!p&&S&&C.push(...Ste(l,k,g,N));const A=[l,...C],R=await c.detectOverflow(t,b),M=[];let V=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&M.push(R[y]),f){const $=oT(s,a,N);M.push(R[$[0]],R[$[1]])}if(V=[...V,{placement:s,overflows:M}],!M.every($=>$<=0)){var D,O;const $=(((D=i.flip)==null?void 0:D.index)||0)+1,L=A[$];if(L&&(!(f==="alignment"?v!==sa(L):!1)||V.every(P=>sa(P.placement)===v?P.overflows[0]>0:!0)))return{data:{index:$,overflows:V},reset:{placement:L}};let I=(O=V.filter(z=>z.overflows[0]<=0).sort((z,P)=>z.overflows[1]-P.overflows[1])[0])==null?void 0:O.placement;if(!I)switch(h){case"bestFit":{var K;const z=(K=V.filter(P=>{if(S){const T=sa(P.placement);return T===v||T==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(T=>T>0).reduce((T,E)=>T+E,0)]).sort((P,T)=>P[1]-T[1])[0])==null?void 0:K[0];z&&(I=z);break}case"initialPlacement":I=l;break}if(s!==I)return{reset:{placement:I}}}return{}}}},Tte=new Set(["left","top"]);async function Rte(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=jo(n),l=qi(n),c=sa(n)==="y",d=Tte.has(a)?-1:1,u=i&&c?-1:1,f=Qc(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*u,y:p*d}:{x:p*d,y:h*u}}const Lte=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 Rte(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}}}}},Ote=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:v,y:w}=y;return{x:v,y:w}}},...d}=Qc(e,t),u={x:n,y:r},f=await i.detectOverflow(t,d),p=sa(jo(s)),h=iT(p);let g=u[h],k=u[p];if(a){const y=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=g+f[y],N=g-f[v];g=Pw(w,g,N)}if(l){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",w=k+f[y],N=k-f[v];k=Pw(w,k,N)}const b=c.fn({...t,[h]:g,[p]:k});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[h]:a,[p]:l}}}}}};function Jm(){return typeof window<"u"}function Zc(e){return lT(e)?(e.nodeName||"").toLowerCase():"#document"}function Ns(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xi(e){var t;return(t=(lT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lT(e){return Jm()?e instanceof Node||e instanceof Ns(e).Node:!1}function wi(e){return Jm()?e instanceof Element||e instanceof Ns(e).Element:!1}function _o(e){return Jm()?e instanceof HTMLElement||e instanceof Ns(e).HTMLElement:!1}function qj(e){return!Jm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ns(e).ShadowRoot}function kf(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=vi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Mte(e){return/^(table|td|th)$/.test(Zc(e))}function Xm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $te=/transform|translate|scale|rotate|perspective|filter/,Dte=/paint|layout|strict|content/,Ka=e=>!!e&&e!=="none";let Fy;function Sb(e){const t=wi(e)?vi(e):e;return Ka(t.transform)||Ka(t.translate)||Ka(t.scale)||Ka(t.rotate)||Ka(t.perspective)||!Nb()&&(Ka(t.backdropFilter)||Ka(t.filter))||$te.test(t.willChange||"")||Dte.test(t.contain||"")}function Fte(e){let t=Sa(e);for(;_o(t)&&!Vc(t);){if(Sb(t))return t;if(Xm(t))return null;t=Sa(t)}return null}function Nb(){return Fy==null&&(Fy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Fy}function Vc(e){return/^(html|body|#document)$/.test(Zc(e))}function vi(e){return Ns(e).getComputedStyle(e)}function Qm(e){return wi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sa(e){if(Zc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qj(e)&&e.host||Xi(e);return qj(t)?t.host:t}function cT(e){const t=Sa(e);return Vc(t)?e.ownerDocument?e.ownerDocument.body:e.body:_o(t)&&kf(t)?t:cT(t)}function Qd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=cT(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=Ns(s);if(i){const l=Aw(a);return t.concat(a,a.visualViewport||[],kf(s)?s:[],l&&n?Qd(l):[])}else return t.concat(s,Qd(s,[],n))}function Aw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uT(e){const t=vi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=_o(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=lm(n)!==i||lm(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function jb(e){return wi(e)?e:e.contextElement}function Nc(e){const t=jb(e);if(!_o(t))return Ki(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=uT(t);let a=(i?lm(n.width):n.width)/r,l=(i?lm(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const zte=Ki(0);function dT(e){const t=Ns(e);return!Nb()||!t.visualViewport?zte:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bte(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ns(e)?!1:t}function yl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=jb(e);let a=Ki(1);t&&(r?wi(r)&&(a=Nc(r)):a=Nc(e));const l=Bte(i,n,r)?dT(i):Ki(0);let c=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,u=s.width/a.x,f=s.height/a.y;if(i){const p=Ns(i),h=r&&wi(r)?Ns(r):r;let g=p,k=Aw(g);for(;k&&r&&h!==g;){const b=Nc(k),y=k.getBoundingClientRect(),v=vi(k),w=y.left+(k.clientLeft+parseFloat(v.paddingLeft))*b.x,N=y.top+(k.clientTop+parseFloat(v.paddingTop))*b.y;c*=b.x,d*=b.y,u*=b.x,f*=b.y,c+=w,d+=N,g=Ns(k),k=Aw(g)}}return dm({width:u,height:f,x:c,y:d})}function Zm(e,t){const n=Qm(e).scrollLeft;return t?t.left+n:yl(Xi(e)).left+n}function fT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Zm(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Hte(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=Xi(r),l=t?Xm(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=Ki(1);const u=Ki(0),f=_o(r);if((f||!f&&!i)&&((Zc(r)!=="body"||kf(a))&&(c=Qm(r)),f)){const h=yl(r);d=Nc(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const p=a&&!f&&!i?fT(a,c):Ki(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:n.y*d.y-c.scrollTop*d.y+u.y+p.y}}function Ute(e){return Array.from(e.getClientRects())}function Wte(e){const t=Xi(e),n=Qm(e),r=e.ownerDocument.body,s=ol(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ol(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Zm(e);const l=-n.scrollTop;return vi(r).direction==="rtl"&&(a+=ol(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const Yj=25;function Vte(e,t){const n=Ns(e),r=Xi(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const u=Nb();(!u||u&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=Zm(r);if(d<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),h=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-h);g<=Yj&&(i-=g)}else d<=Yj&&(i+=d);return{width:i,height:a,x:l,y:c}}function Kte(e,t){const n=yl(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=_o(e)?Nc(e):Ki(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 Gj(e,t,n){let r;if(t==="viewport")r=Vte(e,n);else if(t==="document")r=Wte(Xi(e));else if(wi(t))r=Kte(t,n);else{const s=dT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return dm(r)}function pT(e,t){const n=Sa(e);return n===t||!wi(n)||Vc(n)?!1:vi(n).position==="fixed"||pT(n,t)}function qte(e,t){const n=t.get(e);if(n)return n;let r=Qd(e,[],!1).filter(l=>wi(l)&&Zc(l)!=="body"),s=null;const i=vi(e).position==="fixed";let a=i?Sa(e):e;for(;wi(a)&&!Vc(a);){const l=vi(a),c=Sb(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||kf(a)&&!c&&pT(e,a))?r=r.filter(u=>u!==a):s=l,a=Sa(a)}return t.set(e,r),r}function Yte(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?Xm(t)?[]:qte(t,this._c):[].concat(n),r],l=Gj(t,a[0],s);let c=l.top,d=l.right,u=l.bottom,f=l.left;for(let p=1;p<a.length;p++){const h=Gj(t,a[p],s);c=ol(h.top,c),d=Wc(h.right,d),u=Wc(h.bottom,u),f=ol(h.left,f)}return{width:d-f,height:u-c,x:f,y:c}}function Gte(e){const{width:t,height:n}=uT(e);return{width:t,height:n}}function Jte(e,t,n){const r=_o(t),s=Xi(t),i=n==="fixed",a=yl(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Ki(0);function d(){c.x=Zm(s)}if(r||!r&&!i)if((Zc(t)!=="body"||kf(s))&&(l=Qm(t)),r){const h=yl(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&d();i&&!r&&s&&d();const u=s&&!r&&!i?fT(s,l):Ki(0),f=a.left+l.scrollLeft-c.x-u.x,p=a.top+l.scrollTop-c.y-u.y;return{x:f,y:p,width:a.width,height:a.height}}function zy(e){return vi(e).position==="static"}function Jj(e,t){if(!_o(e)||vi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xi(e)===n&&(n=n.ownerDocument.body),n}function hT(e,t){const n=Ns(e);if(Xm(e))return n;if(!_o(e)){let s=Sa(e);for(;s&&!Vc(s);){if(wi(s)&&!zy(s))return s;s=Sa(s)}return n}let r=Jj(e,t);for(;r&&Mte(r)&&zy(r);)r=Jj(r,t);return r&&Vc(r)&&zy(r)&&!Sb(r)?n:r||Fte(e)||n}const Xte=async function(e){const t=this.getOffsetParent||hT,n=this.getDimensions,r=await n(e.floating);return{reference:Jte(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qte(e){return vi(e).direction==="rtl"}const Zte={convertOffsetParentRelativeRectToViewportRelativeRect:Hte,getDocumentElement:Xi,getClippingRect:Yte,getOffsetParent:hT,getElementRects:Xte,getClientRects:Ute,getDimensions:Gte,getScale:Nc,isElement:wi,isRTL:Qte};function mT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ene(e,t){let n=null,r;const s=Xi(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:u,top:f,width:p,height:h}=d;if(l||t(),!p||!h)return;const g=Op(f),k=Op(s.clientWidth-(u+p)),b=Op(s.clientHeight-(f+h)),y=Op(u),w={rootMargin:-g+"px "+-k+"px "+-b+"px "+-y+"px",threshold:ol(0,Wc(1,c))||1};let N=!0;function C(S){const A=S[0].intersectionRatio;if(A!==c){if(!N)return a();A?a(!1,A):r=setTimeout(()=>{a(!1,1e-7)},1e3)}A===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 Xj(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=jb(e),u=s||i?[...d?Qd(d):[],...t?Qd(t):[]]:[];u.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const f=d&&l?ene(d,n):null;let p=-1,h=null;a&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.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,k=c?yl(e):null;c&&b();function b(){const y=yl(e);k&&!mT(k,y)&&n(),k=y,g=requestAnimationFrame(b)}return n(),()=>{var y;u.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const tne=Lte,nne=Ate,rne=Ote,sne=Ite,Qj=_te,ine=(e,t,n)=>{const r=new Map,s={platform:Zte,...n},i={...s.platform,_c:r};return Ete(e,t,{...s,platform:i})};var one=typeof document<"u",ane=function(){},ah=one?m.useLayoutEffect:ane;function fm(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(!fm(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)&&!fm(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function gT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zj(e,t){const n=gT(e);return Math.round(t*n)/n}function By(e){const t=m.useRef(e);return ah(()=>{t.current=e}),t}function e1(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,[u,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(r);fm(p,r)||h(r);const[g,k]=m.useState(null),[b,y]=m.useState(null),v=m.useCallback(P=>{P!==S.current&&(S.current=P,k(P))},[]),w=m.useCallback(P=>{P!==A.current&&(A.current=P,y(P))},[]),N=i||g,C=a||b,S=m.useRef(null),A=m.useRef(null),R=m.useRef(u),M=c!=null,V=By(c),D=By(s),O=By(d),K=m.useCallback(()=>{if(!S.current||!A.current)return;const P={placement:t,strategy:n,middleware:p};D.current&&(P.platform=D.current),ine(S.current,A.current,P).then(T=>{const E={...T,isPositioned:O.current!==!1};$.current&&!fm(R.current,E)&&(R.current=E,Xr.flushSync(()=>{f(E)}))})},[p,t,n,D,O]);ah(()=>{d===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,f(P=>({...P,isPositioned:!1})))},[d]);const $=m.useRef(!1);ah(()=>($.current=!0,()=>{$.current=!1}),[]),ah(()=>{if(N&&(S.current=N),C&&(A.current=C),N&&C){if(V.current)return V.current(N,C,K);K()}},[N,C,K,V,M]);const L=m.useMemo(()=>({reference:S,floating:A,setReference:v,setFloating:w}),[v,w]),I=m.useMemo(()=>({reference:N,floating:C}),[N,C]),z=m.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const T=Zj(I.floating,u.x),E=Zj(I.floating,u.y);return l?{...P,transform:"translate("+T+"px, "+E+"px)",...gT(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:T,top:E}},[n,l,I.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:K,refs:L,elements:I,floatingStyles:z}),[u,K,L,I,z])}const lne=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?Qj({element:r.current,padding:s}).fn(n):{}:r?Qj({element:r,padding:s}).fn(n):{}}}},t1=(e,t)=>{const n=tne(e);return{name:n.name,fn:n.fn,options:[e,t]}},cne=(e,t)=>{const n=rne(e);return{name:n.name,fn:n.fn,options:[e,t]}},une=(e,t)=>{const n=sne(e);return{name:n.name,fn:n.fn,options:[e,t]}},dne=(e,t)=>{const n=nne(e);return{name:n.name,fn:n.fn,options:[e,t]}},fne=(e,t)=>{const n=lne(e);return{name:n.name,fn:n.fn,options:[e,t]}},pne={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},hne={beaconOptions:{offset:-18}},yT={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},mne={isFixed:!1,locale:yT,placement:"bottom"},gne={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},At={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},or={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"},ze={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},$i={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},Nt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},yne="react-joyride-portal";function xne(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function pc(...e){return lte({all:!0,isMergeableObject:t=>!(!Ir.plainObject(t)||m.isValidElement(t))})(...e)}function xT(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function po(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Dy(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&&xT(e.type)==="function")try{i=po(e.type({}),t)}catch{i=Dy(n)}else i=Dy(n);return i}function lr(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 wne(e,t){const n=xne(t);return{...e,...n}}function Zd(){}function vne(e){return Object.keys(e)}function pm(e,...t){if(!Ir.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 n1(e,...t){if(!Ir.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 Iw(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(xT(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(Ir.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):Iw(i,t,n))});if(Ir.function(e.type)&&!Object.values(e.props).length)try{return Iw(e.type({}),t,n)}catch{return e}return e}function r1(e){return vne(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Cb(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function s1(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 Eb(e){return e?e.getBoundingClientRect():null}function bne(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 zs(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 kne(e,t,n){const r=Eb(e),s=eu(e),i=s?!s.isSameNode(ns()):!1,a=n??tu(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(ns())||(c+=ns().scrollTop)),Math.floor(c-t)}function eu(e,t){if(!e)return ns();const n=sT(e);if(n){if(n.isSameNode(ns()))return t?document:ns();if(!(n.scrollHeight>n.offsetHeight))return ns()}return n}function Sne(e){const t=e.getBoundingClientRect(),n=ns(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function Nne(e,t){if(!e)return 0;const n=sT(e)??ns(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=Eb(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(wT(e)||jne(e))){const u=e.getBoundingClientRect(),f=u.top-((s==null?void 0:s.top)??0),p=f+u.height,h=n.clientHeight,g=h*.2;f>=g&&p<=h-g?c=i:c=f+i}const d=Math.floor(c-t-r);return d<0?0:d}function jne(e){return e.offsetParent!==document.body}function wT(e){if(!e)return!1;const t=eu(e);return t?!t.isSameNode(ns()):!1}function tu(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?tu(e.parentNode,t):!1}function Mp(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 i1(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==ze.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?eu(s):ns(),l=a?!a.isSameNode(ns()):!1;return(r.isFixed||tu(s))&&!l?!1:a.scrollHeight>a.clientHeight}function ns(){return document.scrollingElement??document.documentElement}function o1(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=mte.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function Cne(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 vT={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},$p={...vT,borderRadius:4,padding:8};function Ene(e,t){const{styles:n}=e,r=pc(n??{},t.styles??{});let{width:s}=t;Cb()&&(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 pc({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...vT,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(${Cne(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:{...$p,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...$p,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...$p,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...$p,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 _ne=["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 _b(e,t){if(!t)return null;const n=pc(mne,n1(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=pc(pne,e.options??{},n1(t,..._ne)),s=Ene(e,{...n,...r}),i=pc(hne,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:pc(yT,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:Pne(r.spotlightPadding),styles:s}}function Pne(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 Ane(e,t,n){const{action:r}=t,s=n&&[At.PREV,At.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function bT(e,t=!1){return Ir.plainObject(e)?e.target?!0:(lr(t,"tour","target is missing from the step"),!1):(lr(t,"tour","step must be an object"),!1)}function kT(e,t=!1){return Ir.array(e)?e.every(n=>bT(n,t)):(lr(t,"tour","steps must be an array"),!1)}var Ine=class{constructor(e){Tn(this,"beaconPosition",null);Tn(this,"debug");Tn(this,"eventListeners",new Map);Tn(this,"listeners",new Set);Tn(this,"props");Tn(this,"snapshot");Tn(this,"state");Tn(this,"steps");Tn(this,"tooltipPosition",null);Tn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});Tn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);Tn(this,"getServerSnapshot",()=>this.snapshot);Tn(this,"getSnapshot",()=>this.snapshot);Tn(this,"getEventState",()=>pm(this.snapshot,"positioned"));Tn(this,"getState",()=>pm(this.snapshot,"positioned"));Tn(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&lr(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===ze.BEACON_BEFORE||this.state.lifecycle===ze.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)});Tn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});Tn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});Tn(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)}});Tn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Tn(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,!yb(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=Ir.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,Ir.number(t)&&lr(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Ir.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&lr(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:At.INIT,controlled:s,index:i,lifecycle:ze.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?Nt.READY:Nt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===Nt.WAITING&&e.size>0?{...e,status:Nt.RUNNING}:e}getStep(e){return _b(this.props,this.steps[e??this.state.index])}};function Tne(e){return new Ine(e)}function a1(e,t){return Math.min(Math.max(e,0),t)}function Rne(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:(b=null)=>{const{index:y,status:v}=i();v===Nt.RUNNING&&e.current.updateState({action:At.CLOSE,index:y+1,origin:b,lifecycle:ze.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:b=>{const{controlled:y,size:v,status:w}=i();if(y){lr(r.current,"tour","go() is not supported in controlled mode");return}w===Nt.RUNNING&&e.current.updateState({action:At.GO,index:b,lifecycle:ze.COMPLETE,positioned:!1,scrolling:!1,status:b<v?w:Nt.FINISHED,waiting:!1})},info:()=>pm(e.current.getSnapshot(),"positioned"),next:b=>{const{index:y,size:v,status:w}=i();w===Nt.RUNNING&&e.current.updateState({action:At.NEXT,index:a1(y+1,v),lifecycle:ze.COMPLETE,origin:b,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:b}=i();b===Nt.RUNNING&&e.current.updateState({action:At.UPDATE,lifecycle:ze.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:b=>{const{index:y,size:v,status:w}=i();w===Nt.RUNNING&&e.current.updateState({action:At.PREV,index:a1(y-1,v),lifecycle:ze.COMPLETE,origin:b,positioned:!1,scrolling:!1,waiting:!1})},reset:(b=!1)=>{const{controlled:y}=i();if(y){lr(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:At.RESET,index:0,lifecycle:ze.INIT,positioned:!1,scrolling:!1,status:b?Nt.RUNNING:Nt.READY,waiting:!1})},skip:b=>{const{status:y}=i();y===Nt.RUNNING&&e.current.updateState({action:At.SKIP,lifecycle:ze.COMPLETE,origin:b,positioned:!1,scrolling:!1,status:Nt.SKIPPED,waiting:!1})},start:b=>{const{index:y,size:v}=i();s.current(),e.current.updateState({action:At.START,index:Ir.number(b)?b:y,lifecycle:ze.INIT,positioned:!1,scrolling:!1,status:v?Nt.RUNNING:Nt.WAITING,waiting:!1},!0)},stop:(b=!1)=>{const{index:y,status:v}=i();[Nt.FINISHED,Nt.SKIPPED].includes(v)||e.current.updateState({action:At.STOP,index:y+(b?1:0),lifecycle:ze.COMPLETE,positioned:!1,scrolling:!1,status:Nt.PAUSED,waiting:!1})}}},[e])}const Lne=new Set(["origin","positioned"]);function One(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return lr(!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]&&!Lne.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||lr(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function Mne(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 Xo(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 $ne(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:d,index:u,lifecycle:f,positioned:p,scrolling:h,size:g,status:k}=a,b=JI(l)??null,y=m.useRef(null),v=m.useRef(i),w=m.useRef(a),N=m.useRef(s),C=m.useRef(l),S=m.useRef(b),A=m.useRef(n),R=m.useRef(null),M=m.useRef(null),V=m.useRef(null);v.current=i,w.current=a,N.current=s,C.current=l,S.current=b,A.current=n;const D=()=>{R.current&&(clearInterval(R.current),R.current=null),M.current=null,V.current&&(V.current.cancel(),V.current=null)};m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:O}=Xo(w.current,N.current);(O("action",[At.NEXT,At.PREV,At.SKIP,At.CLOSE])||y.current===At.CLOSE&&d===At.START)&&(y.current=d)},[d]),m.useEffect(()=>{if(!N.current)return()=>{D()};const{hasChanged:O}=Xo(w.current,N.current),K=C.current;if(O("index")&&D(),k!==Nt.RUNNING||!K||f!==ze.INIT)return()=>{D()};const{hasChangedTo:$}=Xo(w.current,N.current);$("status",Nt.RUNNING)&&[Nt.IDLE,Nt.READY,Nt.PAUSED].includes(N.current.status)&&r(or.TOUR_START,K),c.current.cleanupPositionData();const{debug:L}=v.current;if(K.before&&!V.current){lr(L,`step:${u}`,"before()",K),V.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(or.STEP_BEFORE_HOOK,K,{action:y.current??w.current.action});const I=()=>{V.current=null,c.current.updateState({action:y.current??w.current.action,waiting:!1,lifecycle:ze.READY})},z=new AbortController,P=K.beforeTimeout;V.current={cancel:()=>z.abort()};const T=P?setTimeout(()=>{z.signal.aborted||(lr(L,`step:${u}`,"before()","timed out",`${P}ms`),z.abort(),t(K,"before_hook"),r(or.ERROR,K,{error:new Error("Step before hook timed out")}),I())},P):null;K.before({...c.current.getState(),action:y.current??c.current.getState().action,step:K}).then(()=>{z.signal.aborted||(T&&clearTimeout(T),I())}).catch(E=>{z.signal.aborted||(T&&clearTimeout(T),t(K,"before_hook"),r(or.ERROR,K,{error:E instanceof Error?E:new Error(String(E))}),I())})}else if(!V.current){R.current&&M.current!==K.target&&D();const I=zs(K.target);if(I&&Mp(I))D(),c.current.updateState({action:y.current??At.UPDATE,lifecycle:ze.READY,waiting:!1});else if(K.targetWaitTimeout===0)c.current.updateState({action:y.current??At.UPDATE,lifecycle:ze.READY,waiting:!1});else if(!R.current){const{targetWaitTimeout:z}=K,P=Date.now();M.current=K.target,lr(L,`step:${u}`,"polling","started",`${z}ms`),c.current.updateState({waiting:!0}),R.current=setInterval(()=>{const T=zs(K.target),E=Date.now()-P,J=E>=z;(T&&Mp(T)||J)&&(lr(L,`step:${u}`,"polling",T&&Mp(T)?"found":"timed out",`${E}ms`),D(),c.current.updateState({action:y.current??At.UPDATE,lifecycle:ze.READY,waiting:!1}))},100)}}return()=>{D()}},[t,r,u,f,k,c]),m.useEffect(()=>{if(!N.current)return;const{hasChanged:O,hasChangedTo:K,previous:$}=Xo(w.current,N.current),L=C.current;if(!L)return;const I=zs(L.target),z=!!I;if(z&&Mp(I)){if(K("lifecycle",ze.READY)&&$.lifecycle===ze.INIT&&r(or.STEP_BEFORE,L,{action:y.current??w.current.action}),K("lifecycle",ze.READY)){const P=w.current,T=Ane(L,P,v.current.continuous)?ze.TOOLTIP:ze.BEACON,E=zs(L.scrollTarget??L.spotlightTarget??L.target),J=i1({isFirstStep:P.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:L,target:E,targetLifecycle:T}),Q=T===ze.TOOLTIP?ze.TOOLTIP_BEFORE:ze.BEACON_BEFORE;lr(v.current.debug,`step:${u}`,"scroll",J?"needed":"skipped"),c.current.updateState({action:At.UPDATE,lifecycle:Q,scrolling:J})}}else if(w.current.status===Nt.RUNNING&&f!==ze.INIT&&f!==ze.COMPLETE&&O("lifecycle")){lr(v.current.debug,`step:${u}`,z?"Target not visible":"Target not mounted",L),t(L,"target_not_found"),r(or.TARGET_NOT_FOUND,L);const P=w.current;P.controlled||c.current.updateState({action:At.UPDATE,index:P.index+(P.action===At.PREV?-1:1),lifecycle:ze.INIT})}},[t,r,u,f,c]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:O,previous:K}=Xo(w.current,N.current),$=C.current,L=S.current;if($&&O("lifecycle",ze.TOOLTIP_BEFORE)&&K.lifecycle===ze.BEACON){const P=zs($.scrollTarget??$.spotlightTarget??$.target);if(i1({isFirstStep:w.current.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:$,target:P,targetLifecycle:ze.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const I=f===ze.BEACON_BEFORE||f===ze.TOOLTIP_BEFORE;if($&&I&&!h){const P=f===ze.TOOLTIP_BEFORE?ze.TOOLTIP:ze.BEACON;c.current.updateState({action:At.UPDATE,lifecycle:P})}$&&O("lifecycle",ze.BEACON)&&r(or.BEACON,$),$&&O("lifecycle",ze.TOOLTIP)&&r(or.TOOLTIP,$);const z=w.current;if((z.status===Nt.RUNNING||z.controlled&&z.status===Nt.PAUSED&&$)&&L&&O("lifecycle",ze.COMPLETE)&&K.lifecycle===ze.TOOLTIP&&(r(or.STEP_AFTER,L,{action:y.current??At.UPDATE,index:K.index??z.index,lifecycle:z.lifecycle}),L.after)){r(or.STEP_AFTER_HOOK,L,{action:y.current??At.UPDATE,index:K.index??z.index,lifecycle:z.lifecycle});try{L.after({...c.current.getState(),action:y.current??At.UPDATE,index:K.index??z.index,lifecycle:z.lifecycle,step:L})}catch{}}},[r,f,p,h,c]),m.useEffect(()=>{if(!N.current)return;const{hasChangedTo:O,previous:K}=Xo(w.current,N.current),$=C.current,L=S.current;g&&!$&&f===ze.INIT&&c.current.updateState({action:At.UPDATE,lifecycle:ze.COMPLETE,status:Nt.FINISHED}),!w.current.controlled&&k===Nt.RUNNING&&O("lifecycle",ze.COMPLETE)&&u<g&&c.current.updateState({action:At.UPDATE,lifecycle:ze.INIT}),O("lifecycle",ze.COMPLETE)&&u>=g&&c.current.updateState({action:At.UPDATE,lifecycle:ze.COMPLETE,status:Nt.FINISHED});const I=$??L??_b(v.current,v.current.steps[u-1]);if(I&&O("status",[Nt.FINISHED,Nt.SKIPPED])){let z;$?z=u:L?z=K.index??u:z=u-1,r(or.TOUR_END,I,{index:z}),w.current.controlled||A.current.reset(),y.current=null}$&&O("action",At.STOP)&&(y.current=null,r(or.TOUR_STATUS,$)),$&&O("action",At.RESET)&&(r(or.TOUR_STATUS,$),y.current=null)},[d,r,u,f,g,k,c])}function Dne({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:d}=n,u=m.useRef(void 0),f=m.useRef(r),p=m.useRef(e);f.current=r,p.current=e,m.useEffect(()=>{const h=u.current;if(u.current=n,!h||n===h)return;const{hasChanged:g}=Xo(n,h);if(yb(h.steps,d)||(kT(d,i)?s.current.setSteps(d):(lr(i,"tour","Steps are not valid",d),t(or.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(Ir.number(c)&&g("stepIndex")){const k=Ir.number(h.stepIndex)&&h.stepIndex<c?At.NEXT:At.PREV;[Nt.FINISHED,Nt.SKIPPED].includes(f.current.status)||s.current.updateState({action:k,index:c,lifecycle:ze.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,d,s])}function Fne(e,t){var l,c,d,u;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===ze.BEACON_BEFORE&&(n!=null&&n.placement)){const f=zne(n);["bottom"].includes(n.placement)||(a+=Math.floor(f-s))}else if(r===ze.TOOLTIP_BEFORE){const{placement:f}=i;if(f==="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(f==="left"||f==="right"){const p=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,h=((u=zs(i.target))==null?void 0:u.getBoundingClientRect().height)??0,g=s+i.spotlightPadding.top+h/2-p/2;g<s&&(a-=s-g)}}return Math.max(0,a)}function zne(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 Bne({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:d,status:u}=r,f=m.useRef(null),p=m.useRef(r),h=m.useRef(t),g=m.useRef(n),k=m.useRef(s);p.current=r,h.current=t,g.current=n,k.current=s,m.useEffect(()=>()=>{var b;(b=f.current)==null||b.call(f)},[]),m.useEffect(()=>{var C;if(!h.current||!k.current)return;const{hasChangedTo:b}=Xo(p.current,h.current),y=k.current,{debug:v}=g.current,{scrollDuration:w}=y,N=l===ze.BEACON_BEFORE||l===ze.TOOLTIP_BEFORE;if(u===Nt.RUNNING&&N&&d&&b("positioned",!0)){const S=zs(y.scrollTarget??y.spotlightTarget??y.target),A=i.current.getPositionData("beacon"),R=eu(S),M=R?!R.isSameNode(ns()):!1;(C=f.current)==null||C.call(f),(async()=>{if(M&&!tu(R)){const z=ns(),P=Sne(R),T={initial:z.scrollTop,target:P,element:z,duration:w};e(or.SCROLL_START,y,{scroll:T});const{cancel:E,promise:J}=o1(P,{element:z,duration:w});f.current=E,await J,e(or.SCROLL_END,y,{scroll:T})}const D=Math.floor(Nne(S,y.scrollOffset))||0,O=M?D:Fne(D,{beaconPosition:A,lifecycle:l,scrollOffset:y.scrollOffset,step:y});lr(v,`step:${a}`,"scroll",M?"custom":"document",`${D} → ${O}`);const K=R,$={initial:K.scrollTop,target:O,element:K,duration:w};e(or.SCROLL_START,y,{scroll:$});const{cancel:L,promise:I}=o1(O,{element:K,duration:w});f.current=L,await I,e(or.SCROLL_END,y,{scroll:$}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,d,u,i])}function Hne(e){const t=Nee(()=>wne(gne,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=m.useRef(Tne(t)),d=Z_.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[u,f]=m.useState([]),p=m.useCallback((C,S)=>{f(A=>[...A,{reason:S,step:C}])},[]),h=m.useCallback(()=>{f([])},[]);One(c,n);const g=Rne(c,n,h),k=Mne(s,g,c),{index:b,size:y,status:v}=d,w=JI(d),N=m.useMemo(()=>_b(t,l[b]),[b,t,l]);return jee(()=>{i&&y&&kT(l,n)&&g.start(a??r)}),See(()=>{i&&y&&v===Nt.IDLE&&c.current.updateState({status:Nt.READY})},[i,y,v]),Dne({controls:g,emitEvent:k,props:t,state:d,store:c}),$ne({addFailure:p,controls:g,emitEvent:k,previousState:w,props:t,state:d,step:N,store:c}),Bne({emitEvent:k,previousState:w,props:t,state:d,step:N,store:c}),{controls:g,failures:u,mergedProps:t,state:d,step:N,store:c}}function Une(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(Ir.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=yne,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Wne={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Vne({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Zd;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
185
|
-
@keyframes joyride-loader-spin {
|
|
186
|
-
to { transform: rotate(360deg); }
|
|
187
|
-
}
|
|
188
|
-
`)),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=Ze.createElement(c,{step:t})}else l=Ze.createElement("div",{style:{...Wne,height:s,width:i,borderTopColor:t.primaryColor}});return Ze.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const Kne={height:0,isFixed:!1,left:0,top:0,width:0};function Du(e,t){const n=zs(e);if(!n)return Kne;const r=Eb(n),s=tu(n),i=kne(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 qne(e,t,n){const[r,s]=m.useState(()=>Du(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(f=>{const p=Du(e,t);return f.top===p.top&&f.left===p.left&&f.width===p.width&&f.height===p.height&&f.isFixed===p.isFixed?f:p})},100)},[e,t]);m.useEffect(()=>{let f=null;const p=g=>{a.current=eu(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(Du(e,t))},h=zs(e);return h?p(h):(f=new MutationObserver(()=>{const g=zs(e);g&&(f==null||f.disconnect(),f=null,p(g))}),f.observe(document.body,{childList:!0,subtree:!0})),()=>{var g;f==null||f.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(Du(e,t)),l.current=n},[n,e,t]);let u=r;return l.current&&!n&&(u=Du(e,t)),u}function Yne(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function l1(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 Gne=[ze.BEACON_BEFORE,ze.BEACON];function Jne(e){var I,z;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:c,scrolling:d,spotlightPadding:u,spotlightRadius:f,spotlightTarget:p,styles:h,target:g,waiting:k}=e,b=Cee(),y=qne(p??g,u,d||k),v=m.useRef(null),w=(s===ze.TOOLTIP||s===ze.TOOLTIP_BEFORE)&&l!=="center",[N,C]=m.useState(!1),S=c?(I=v.current)==null?void 0:I.offsetParent:null,A=(S==null?void 0:S.clientWidth)??b.width,R=(S==null?void 0:S.clientHeight)??bne()??b.height,M=((z=h.overlay)==null?void 0:z.backgroundColor)??"rgba(0, 0, 0, 0.5)",V=m.useMemo(()=>{const{backgroundColor:P,mixBlendMode:T,...E}=h.overlay;return{height:R,pointerEvents:"none",...E}},[R,h.overlay]),D=w&&!d&&!k;m.useEffect(()=>{D?requestAnimationFrame(()=>C(!0)):C(!1)},[D]);const O=n&&Gne.includes(s),K=!n&&s!==ze.TOOLTIP;if(r||!k&&(O||K))return null;let $="";if(D)if(c&&S){const P=zs(p??g);if(P){const T=s1(P),E=s1(S);$=l1(T.left-E.left-u.left,T.top-E.top-u.top,P.offsetWidth+u.left+u.right,P.offsetHeight+u.top+u.bottom,f)}}else $=l1(y.left,y.top,y.width,y.height,f);const L=Yne(A,R,$);return Ze.createElement("div",{ref:v,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:V},Ze.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:R,left:0,position:y.isFixed?"fixed":"absolute",top:0,width:A}},Ze.createElement("path",{d:L,fill:M,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),$&&Ze.createElement("path",{d:$,fill:M,style:{opacity:N?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),$&&Object.keys(h.spotlight).length>0&&Ze.createElement("path",{d:$,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function ST(e){const{children:t,element:n}=e;return n?Xr.createPortal(t,n):null}const Xne='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function Qne(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return Zd;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(Xne)],{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 yo(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 Zne(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...yo(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...yo(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...yo(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...yo(e,t,n)};default:return null}}function ere(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...yo(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...yo(e,r,n)};case"left":return{right:-n,top:t.y??0,...yo(e,r,n)};case"right":return{left:-n,top:t.y??0,...yo(e,r,n)};default:return{}}}function tre({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let c=null;if(l){if(!yo(r,n,i))return null;c=Ze.createElement("span",{style:{flexShrink:0}},Ze.createElement(l,{base:n,placement:r,size:i}))}else{const d=Zne(r,n,i);if(!d)return null;c=Ze.createElement("svg",{height:d.height,width:d.width,xmlns:"http://www.w3.org/2000/svg"},Ze.createElement("polygon",{fill:"currentColor",points:d.points}))}return Ze.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...ere(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function nre(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:c,size:d,step:u,styles:f}=e,p=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return Zd;const b=document.createElement("style");b.id="joyride-beacon-animation",a&&b.setAttribute("nonce",a),b.appendChild(document.createTextNode(`
|
|
189
|
-
@keyframes joyride-beacon-inner {
|
|
190
|
-
20% {
|
|
191
|
-
opacity: 0.9;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
90% {
|
|
195
|
-
opacity: 0.7;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
@keyframes joyride-beacon-outer {
|
|
200
|
-
0% {
|
|
201
|
-
transform: scale(1);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
45% {
|
|
205
|
-
opacity: 0.7;
|
|
206
|
-
transform: scale(0.75);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
100% {
|
|
210
|
-
opacity: 0.9;
|
|
211
|
-
transform: scale(1);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
`)),document.head.appendChild(b);const y=setTimeout(()=>{Ir.domElement(p.current)&&c&&p.current.focus()},0);return()=>{clearTimeout(y);const v=document.getElementById("joyride-beacon-animation");v!=null&&v.parentNode&&v.parentNode.removeChild(v)}},[h,a,c]);const g=po(i.open);let k;if(t){const b=t;k=Ze.createElement(b,{continuous:n,index:r,isLastStep:s,size:d,step:u})}else k=Ze.createElement("span",{style:f.beacon},Ze.createElement("span",{style:f.beaconOuter}),Ze.createElement("span",{style:f.beaconInner}));return Ze.createElement("button",{ref:p,"aria-label":g,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:f.beaconWrapper,title:g,type:"button"},k)}function rre({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return Ze.createElement("button",{style:i,type:"button",...t},Ze.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"},Ze.createElement("g",null,Ze.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 sre(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=e,{buttons:d,content:u,styles:f,title:p}=l,h={};d.includes("primary")&&(h.primary=Ze.createElement("button",{"data-testid":"button-primary",style:f.buttonPrimary,type:"button",...i})),d.includes("skip")&&!s&&(h.skip=Ze.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:f.buttonSkip,type:"button",...a})),d.includes("back")&&r>0&&(h.back=Ze.createElement("button",{"data-testid":"button-back",style:f.buttonBack,type:"button",...t})),h.close=d.includes("close")&&Ze.createElement(rre,{"data-testid":"button-close",styles:f.buttonClose,...n});const g=p?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":po(u),"aria-describedby":"joyride-tooltip-content"};return Ze.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:f.tooltip,...c,...g},Ze.createElement("div",{style:f.tooltipContainer},p&&Ze.createElement("h4",{id:"joyride-tooltip-title",style:f.tooltipTitle},p),Ze.createElement("div",{id:"joyride-tooltip-content",style:f.tooltipContent},u)),d.some(k=>k==="back"||k==="primary"||k==="skip")&&Ze.createElement("div",{style:f.tooltipFooter},Ze.createElement("div",{style:f.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function ire(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=y=>{y.preventDefault(),n.prev($i.BUTTON_BACK)},c=y=>{y.preventDefault(),a.closeButtonAction==="skip"?n.skip($i.BUTTON_CLOSE):n.close($i.BUTTON_CLOSE)},d=y=>{if(y.preventDefault(),!t){n.close($i.BUTTON_PRIMARY);return}n.next($i.BUTTON_PRIMARY)},u=y=>{y.preventDefault(),n.skip($i.BUTTON_SKIP)},f=()=>{const{back:y,close:v,last:w,next:N,nextWithProgress:C,skip:S}=a.locale,A=po(y),R=po(v),M=po(w),V=po(N),D=po(S);let O=v,K=R;if(t){if(O=N,K=V,a.showProgress&&!s){const $=po(C,{step:r+1,steps:i});O=Iw(C,r+1,i),K=$}s&&(O=w,K=M)}return{backProps:{"aria-label":A,children:y,"data-action":"back",onClick:l,role:"button",title:A},closeProps:{"aria-label":R,children:v,"data-action":"close",onClick:c,role:"button",title:R},primaryProps:{"aria-label":K,children:O,"data-action":"primary",onClick:d,role:"button",title:K},skipProps:{"aria-label":D,children:S,"data-action":"skip",onClick:u,role:"button",title:D},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:p,beaconComponent:h,tooltipComponent:g,...k}=a;let b;if(g){const y=g;b=Ze.createElement(y,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:k})}else b=Ze.createElement(sre,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:k});return b}function ore(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function are(e,t,n){var r,s;return e?[dne()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[une({crossAxis:!1,fallbackPlacements:ore(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function lre(e){var T,E,J,Q,H;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:c,setTooltipRef:d,shouldScroll:u,size:f,step:p,target:h,updateState:g}=e,k=m.useRef(null),b=m.useRef({}),y=m.useRef({}),v=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(()=>wT(h)?eu(h):void 0,[h]),S=m.useMemo(()=>tu(h),[h]),A=m.useMemo(()=>C?{boundary:C,rootBoundary:"viewport"}:{},[C]),R=v||w?"bottom":p.placement,M=v?"fixed":((T=p.floatingOptions)==null?void 0:T.strategy)??(p.isFixed||S?"fixed":"absolute"),V=m.useMemo(()=>{var te,le,ue,de;return v?[{name:"center",fn:({rects:ce})=>({x:(window.innerWidth-ce.floating.width)/2,y:(window.innerHeight-ce.floating.height)/2})}]:[t1(({placement:ce})=>{var pe;let fe="right";ce.startsWith("top")?fe="top":ce.startsWith("bottom")?fe="bottom":ce.startsWith("left")&&(fe="left");const se=p.spotlightTarget?0:p.spotlightPadding[fe];return p.offset+se+((pe=p.floatingOptions)!=null&&pe.hideArrow?0:p.arrowSize)},[p.offset,p.spotlightPadding,p.spotlightTarget,p.arrowSize,(te=p.floatingOptions)==null?void 0:te.hideArrow]),...are(w,p,R),cne({padding:10,...A,...(le=p.floatingOptions)==null?void 0:le.shiftOptions}),...(ue=p.floatingOptions)!=null&&ue.hideArrow?[]:[fne({element:k,padding:p.arrowSpacing},[p.arrowSpacing,p.arrowBase])],...((de=p.floatingOptions)==null?void 0:de.middleware)??[]]},[v,p,w,R,A]),D=e1({...v?{elements:{reference:N}}:{},placement:R,strategy:M,middleware:V}),O=e1({strategy:M,placement:p.beaconPlacement??(w||v?"bottom":p.placement),middleware:m.useMemo(()=>{var te,le;return[t1(((le=(te=p.floatingOptions)==null?void 0:te.beaconOptions)==null?void 0:le.offset)??-18)]},[(J=(E=p.floatingOptions)==null?void 0:E.beaconOptions)==null?void 0:J.offset]),whileElementsMounted:Xj});y.current=D.middlewareData,b.current=O.middlewareData,m.useEffect(()=>{var ue;const{floating:te,reference:le}=D.elements;if(!(!le||!te||s!==ze.TOOLTIP))return Xj(le,te,D.update,(ue=p.floatingOptions)==null?void 0:ue.autoUpdate)},[s,D.update,(Q=p.floatingOptions)==null?void 0:Q.autoUpdate,p.target,D.elements]),m.useEffect(()=>{!v&&h&&D.refs.setReference(h),h&&O.refs.setReference(h)},[O.refs,v,h,D.refs]),m.useEffect(()=>{D.isPositioned&&c("tooltip",{placement:D.placement,x:D.x??0,y:D.y??0,middlewareData:y.current})},[c,D.isPositioned,D.placement,D.x,D.y]),m.useEffect(()=>{O.isPositioned&&c("beacon",{placement:O.placement,x:O.x??0,y:O.y??0,middlewareData:b.current})},[c,O.isPositioned,O.placement,O.x,O.y]);const K=p.zIndex+100,$=m.useCallback(te=>{te.type==="mouseenter"&&p.beaconTrigger!=="hover"||g({lifecycle:ze.TOOLTIP_BEFORE,positioned:!1})},[p.beaconTrigger,g]),L=m.useCallback(te=>{te&&(D.refs.setFloating(te),d(te))},[D.refs,d]),{arrow:I,floater:z}=p.styles;let P=null;if(s===ze.TOOLTIP||s===ze.TOOLTIP_BEFORE){const te=r1({...z,...D.floatingStyles,zIndex:K,opacity:a&&D.isPositioned?1:0,...!a&&{transition:"none"}});P=Ze.createElement("div",{ref:L,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:te},Ze.createElement(ire,{continuous:t,controls:n,index:r,isLastStep:r+1===f,size:f,step:p}),!v&&!((H=p.floatingOptions)!=null&&H.hideArrow)&&Ze.createElement(tre,{arrowComponent:p.arrowComponent,arrowRef:k,base:p.arrowBase,placement:D.placement,position:D.middlewareData.arrow,size:p.arrowSize,styles:I}))}else(s===ze.BEACON||s===ze.BEACON_BEFORE)&&(P=Ze.createElement("div",{ref:O.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:r1({...O.floatingStyles,zIndex:K})},Ze.createElement(nre,{beaconComponent:p.beaconComponent,continuous:t,index:r,isLastStep:r+1===f,locale:p.locale,nonce:i,onInteract:$,shouldFocus:u,size:f,step:p,styles:p.styles})));return Ze.createElement(ST,{element:l},P)}function cre(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:c,size:d,step:u,updateState:f}=e,[p,h]=m.useState(null);Qne(u.disableFocusTrap?null:p,"[data-action=primary]");const g=zs(u.target),k=s===ze.TOOLTIP;return!bT(u)||!Ir.domElement(g)?null:Ze.createElement(lre,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:k,portalElement:a,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:d,step:u,target:g,updateState:f})}function ure({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:c,scrollToFirstStep:d}=t,u=Une(c),{index:f,lifecycle:p,status:h}=n,g=h===Nt.RUNNING,[k,b]=m.useState(!1),y=m.useRef(null),v=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?v===0?b(!0):y.current=setTimeout(()=>{b(!0)},v):b(!1),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[v,n.waiting]),m.useEffect(()=>{if(!g)return;const C=S=>{!r||p!==ze.TOOLTIP||S.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next($i.KEYBOARD):e.close($i.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($i.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next($i.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!g)return null;const N=n.action===At.START&&!r.skipBeacon&&r.placement!=="center";return Ze.createElement(Ze.Fragment,null,p!==ze.INIT&&Ze.createElement(cre,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:u,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(f!==0||d),step:r,updateState:s.current.updateState}),Ze.createElement(ST,{element:u},Ze.createElement(Ze.Fragment,null,k&&Ze.createElement(Vne,{nonce:l,step:r}),!N&&Ze.createElement(Jne,{...r,continuous:i,lifecycle:p,onClickOverlay:w,portalElement:c?u:null,scrolling:n.scrolling,waiting:n.waiting}))))}function dre(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=Hne(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>a.current.on(l,c),[a]),state:m.useMemo(()=>pm(s,"positioned"),[s]),step:i,Tour:Cb()?Ze.createElement(ure,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function fre(e){const{Tour:t}=dre(e);return t}function pre(e){return Cb()?Ze.createElement(fre,e):null}function hre(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 mre(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function gre(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const Hy="af:onboarding";function yre({page:e,hasNodes:t=!1}){const{t:n}=pn(),[r,s]=m.useState(!1),[i,a]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?hre(n):t?mre(n):gre(n),[e,t,n]);return m.useEffect(()=>{const d=localStorage.getItem(Hy);console.log("[Onboarding] localStorage:",d);const u=d?JSON.parse(d):{};if(console.log("[Onboarding] progress:",u,"page:",e),u.completed||u[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=u=>{var g;const f=u.target.closest("button");if(!f||!f.closest(".react-joyride__tooltip"))return;const h=(g=f.textContent)==null?void 0:g.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const k=localStorage.getItem(Hy)||"{}",b=JSON.parse(k);h===n("onboarding:skip")?(b.projects=!0,b.flow=!0,b.completed=!0):b[e]=!0,localStorage.setItem(Hy,JSON.stringify(b)),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(pre,{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 xre(){const{navigate:e,path:t}=vl(),[n,r]=m.useState([]),[s,i]=m.useState(!1);if(m.useEffect(()=>{let u=!1;const f=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const g=await h.json();if(u)return;const k=Array.isArray(g.runs)?g.runs:[];r(k.filter(b=>b&&b.status==="running"))}catch{}};f();const p=window.setInterval(f,3e3);return()=>{u=!0,window.clearInterval(p)}},[]),n.length===0)return null;const a=u=>{const f=new URLSearchParams({flowId:u.flowId,flowSource:u.flowSource||"workspace"});e(`/flow?${f.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(u=>o.jsxs("button",{type:"button",className:"af-run-indicator__item"+(u.flowId===c?" af-run-indicator__item--current":""),onClick:()=>a(u),title:`${u.flowId} · ${u.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:u.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:u.runId.slice(0,12)})]},`${u.flowId}:${u.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>d?a(n[0]):i(u=>!u),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 wre 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 vre(){const{path:e}=vl();return e==="/projects"||e==="/"?o.jsx(zl,{}):e==="/nodes"?o.jsx(zl,{resourceKind:"nodes"}):e==="/my-nodes"?o.jsx(zl,{resourceKind:"my-nodes"}):e==="/my-flows"?o.jsx(zl,{resourceKind:"my-flows"}):e==="/skills"?o.jsx(zl,{resourceKind:"skills"}):e==="/mcps"?o.jsx(aee,{}):e==="/flow"?o.jsx(u7,{}):e==="/workspace"?o.jsx(yK,{}):e==="/settings"?o.jsx(iee,{}):o.jsx(zl,{})}function bre({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,u]=m.useState(""),f=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}),u(g.error?String(g.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),u(String(h.message||h))}};m.useEffect(()=>{f()},[]);const p=async h=>{h.preventDefault(),c(!0),u("");try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),k=await g.json().catch(()=>({}));if(!g.ok)throw new Error(k.error||"登录失败");n({loading:!1,authenticated:!0,user:k.user||null,setupRequired:!1})}catch(g){u(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 kre({authUser:e,onLogout:t}){const{path:n}=vl(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(yre,{page:r?"flow":"projects"}):null,r?null:o.jsx(dO,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(vre,{})}),o.jsx(xre,{})]})}function Sre(){return o.jsx(wre,{children:o.jsx(KL,{children:o.jsx(bre,{children:({user:e,onLogout:t})=>o.jsx(kre,{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 c1=document.querySelector('link[rel="icon"]');c1&&(c1.href=jE);Uy.createRoot(document.getElementById("root")).render(o.jsx(Ze.StrictMode,{children:o.jsx(Sre,{})}));
|