@fieldwangai/agentflow 0.1.35 → 0.1.36
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/auth.mjs +58 -0
- package/bin/lib/catalog-flows.mjs +3 -1
- package/bin/lib/composer-agent.mjs +2 -0
- package/bin/lib/git-worktree.mjs +57 -8
- package/bin/lib/locales/en.json +4 -0
- package/bin/lib/locales/zh.json +4 -0
- package/bin/lib/marketplace.mjs +21 -4
- package/bin/lib/runtime-context.mjs +22 -4
- package/bin/lib/skill-registry.mjs +3 -1
- package/bin/lib/ui-server.mjs +300 -23
- package/bin/pipeline/pre-process-node.mjs +4 -0
- package/builtin/nodes/agent_subAgent.md +4 -1
- package/builtin/nodes/display_chart.md +31 -0
- package/builtin/nodes/tool_git_worktree_load.md +10 -0
- package/builtin/nodes/tool_nodejs.md +3 -0
- package/builtin/web-ui/dist/assets/index-7-343AUn.js +214 -0
- package/builtin/web-ui/dist/assets/index-CPsrRISH.css +1 -0
- package/builtin/web-ui/dist/assets/index-DgQRkS4v.js +61 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-BzmhleR9.css +0 -1
- package/builtin/web-ui/dist/assets/index-DEeZI5V6.js +0 -214
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
var l2=Object.defineProperty;var c2=(e,t,n)=>t in e?l2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var In=(e,t,n)=>c2(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 wa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n1={exports:{}},dm={},r1={exports:{}},Et={};/**
|
|
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"),u2=Symbol.for("react.portal"),d2=Symbol.for("react.fragment"),f2=Symbol.for("react.strict_mode"),p2=Symbol.for("react.profiler"),h2=Symbol.for("react.provider"),m2=Symbol.for("react.context"),g2=Symbol.for("react.forward_ref"),y2=Symbol.for("react.suspense"),x2=Symbol.for("react.memo"),w2=Symbol.for("react.lazy"),Qb=Symbol.iterator;function v2(e){return e===null||typeof e!="object"?null:(e=Qb&&e[Qb]||e["@@iterator"],typeof e=="function"?e:null)}var s1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},i1=Object.assign,o1={};function Hc(e,t,n){this.props=e,this.context=t,this.refs=o1,this.updater=n||s1}Hc.prototype.isReactComponent={};Hc.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")};Hc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function a1(){}a1.prototype=Hc.prototype;function Cw(e,t,n){this.props=e,this.context=t,this.refs=o1,this.updater=n||s1}var Ew=Cw.prototype=new a1;Ew.constructor=Cw;i1(Ew,Hc.prototype);Ew.isPureReactComponent=!0;var Zb=Array.isArray,l1=Object.prototype.hasOwnProperty,_w={current:null},c1={key:!0,ref:!0,__self:!0,__source:!0};function u1(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)l1.call(t,r)&&!c1.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:_w.current}}function b2(e,t){return{$$typeof:ef,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Pw(e){return typeof e=="object"&&e!==null&&e.$$typeof===ef}function k2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var e0=/\/+/g;function wg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?k2(""+e.key):t.toString(36)}function Op(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 u2:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+wg(a,0):r,Zb(s)?(n="",e!=null&&(n=e.replace(e0,"$&/")+"/"),Op(s,t,n,"",function(d){return d})):s!=null&&(Pw(s)&&(s=b2(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(e0,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",Zb(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+wg(i,l);a+=Op(i,t,n,c,s)}else if(c=v2(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+wg(i,l++),a+=Op(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 Wf(e,t,n){if(e==null)return e;var r=[],s=0;return Op(e,r,"","",function(i){return t.call(n,i,s++)}),r}function S2(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 Hr={current:null},Mp={transition:null},N2={ReactCurrentDispatcher:Hr,ReactCurrentBatchConfig:Mp,ReactCurrentOwner:_w};function d1(){throw Error("act(...) is not supported in production builds of React.")}Et.Children={map:Wf,forEach:function(e,t,n){Wf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Wf(e,function(){t++}),t},toArray:function(e){return Wf(e,function(t){return t})||[]},only:function(e){if(!Pw(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Et.Component=Hc;Et.Fragment=d2;Et.Profiler=p2;Et.PureComponent=Cw;Et.StrictMode=f2;Et.Suspense=y2;Et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=N2;Et.act=d1;Et.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=i1({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=_w.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)l1.call(t,c)&&!c1.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}};Et.createContext=function(e){return e={$$typeof:m2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:h2,_context:e},e.Consumer=e};Et.createElement=u1;Et.createFactory=function(e){var t=u1.bind(null,e);return t.type=e,t};Et.createRef=function(){return{current:null}};Et.forwardRef=function(e){return{$$typeof:g2,render:e}};Et.isValidElement=Pw;Et.lazy=function(e){return{$$typeof:w2,_payload:{_status:-1,_result:e},_init:S2}};Et.memo=function(e,t){return{$$typeof:x2,type:e,compare:t===void 0?null:t}};Et.startTransition=function(e){var t=Mp.transition;Mp.transition={};try{e()}finally{Mp.transition=t}};Et.unstable_act=d1;Et.useCallback=function(e,t){return Hr.current.useCallback(e,t)};Et.useContext=function(e){return Hr.current.useContext(e)};Et.useDebugValue=function(){};Et.useDeferredValue=function(e){return Hr.current.useDeferredValue(e)};Et.useEffect=function(e,t){return Hr.current.useEffect(e,t)};Et.useId=function(){return Hr.current.useId()};Et.useImperativeHandle=function(e,t,n){return Hr.current.useImperativeHandle(e,t,n)};Et.useInsertionEffect=function(e,t){return Hr.current.useInsertionEffect(e,t)};Et.useLayoutEffect=function(e,t){return Hr.current.useLayoutEffect(e,t)};Et.useMemo=function(e,t){return Hr.current.useMemo(e,t)};Et.useReducer=function(e,t,n){return Hr.current.useReducer(e,t,n)};Et.useRef=function(e){return Hr.current.useRef(e)};Et.useState=function(e){return Hr.current.useState(e)};Et.useSyncExternalStore=function(e,t,n){return Hr.current.useSyncExternalStore(e,t,n)};Et.useTransition=function(){return Hr.current.useTransition()};Et.version="18.3.1";r1.exports=Et;var m=r1.exports;const Qe=wa(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 j2=m,C2=Symbol.for("react.element"),E2=Symbol.for("react.fragment"),_2=Object.prototype.hasOwnProperty,P2=j2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,A2={key:!0,ref:!0,__self:!0,__source:!0};function f1(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)_2.call(t,r)&&!A2.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:C2,type:e,key:i,ref:a,props:s,_owner:P2.current}}dm.Fragment=E2;dm.jsx=f1;dm.jsxs=f1;n1.exports=dm;var o=n1.exports,$y={},p1={exports:{}},Ps={},h1={exports:{}},m1={};/**
|
|
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(_,T){var C=_.length;_.push(T);e:for(;0<C;){var J=C-1>>>1,Z=_[J];if(0<s(Z,T))_[J]=T,_[C]=Z,C=J;else break e}}function n(_){return _.length===0?null:_[0]}function r(_){if(_.length===0)return null;var T=_[0],C=_.pop();if(C!==T){_[0]=C;e:for(var J=0,Z=_.length,H=Z>>>1;J<H;){var te=2*(J+1)-1,ae=_[te],ce=te+1,ue=_[ce];if(0>s(ae,C))ce<Z&&0>s(ue,ae)?(_[J]=ue,_[ce]=C,J=ce):(_[J]=ae,_[te]=C,J=te);else if(ce<Z&&0>s(ue,C))_[J]=ue,_[ce]=C,J=ce;else break e}}return T}function s(_,T){var C=_.sortIndex-T.sortIndex;return C!==0?C:_.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,y=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,g=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(_){for(var T=n(d);T!==null;){if(T.callback===null)r(d);else if(T.startTime<=_)r(d),T.sortIndex=T.expirationTime,t(c,T);else break;T=n(d)}}function j(_){if(k=!1,w(_),!y)if(n(c)!==null)y=!0,I(E);else{var T=n(d);T!==null&&z(j,T.startTime-_)}}function E(_,T){y=!1,k&&(k=!1,g(R),R=-1),h=!0;var C=p;try{for(w(T),f=n(c);f!==null&&(!(f.expirationTime>T)||_&&!D());){var J=f.callback;if(typeof J=="function"){f.callback=null,p=f.priorityLevel;var Z=J(f.expirationTime<=T);T=e.unstable_now(),typeof Z=="function"?f.callback=Z: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(j,te.startTime-T),H=!1}return H}finally{f=null,p=C,h=!1}}var S=!1,A=null,R=-1,M=5,W=-1;function D(){return!(e.unstable_now()-W<M)}function O(){if(A!==null){var _=e.unstable_now();W=_;var T=!0;try{T=A(!0,_)}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(_){A=_,S||(S=!0,K())}function z(_,T){R=b(function(){_(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(_){_.callback=null},e.unstable_continueExecution=function(){y||h||(y=!0,I(E))},e.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(_){switch(p){case 1:case 2:case 3:var T=3;break;default:T=p}var C=p;p=T;try{return _()}finally{p=C}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,T){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var C=p;p=_;try{return T()}finally{p=C}},e.unstable_scheduleCallback=function(_,T,C){var J=e.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0<C?J+C:J):C=J,_){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=C+Z,_={id:u++,callback:T,priorityLevel:_,startTime:C,expirationTime:Z,sortIndex:-1},C>J?(_.sortIndex=C,t(d,_),n(c)===null&&_===n(d)&&(k?(g(R),R=-1):k=!0,z(j,C-J))):(_.sortIndex=Z,t(c,_),y||h||(y=!0,I(E))),_},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(_){var T=p;return function(){var C=p;p=T;try{return _.apply(this,arguments)}finally{p=C}}}})(m1);h1.exports=m1;var I2=h1.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 T2=m,Es=I2;function ke(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var g1=new Set,md={};function gl(e,t){bc(e,t),bc(e+"Capture",t)}function bc(e,t){for(md[e]=t,e=0;e<t.length;e++)g1.add(t[e])}var xo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Dy=Object.prototype.hasOwnProperty,R2=/^[: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]*$/,t0={},n0={};function L2(e){return Dy.call(n0,e)?!0:Dy.call(t0,e)?!1:R2.test(e)?n0[e]=!0:(t0[e]=!0,!1)}function O2(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 M2(e,t,n,r){if(t===null||typeof t>"u"||O2(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 Ur(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 vr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){vr[e]=new Ur(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];vr[t]=new Ur(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){vr[e]=new Ur(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){vr[e]=new Ur(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){vr[e]=new Ur(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){vr[e]=new Ur(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){vr[e]=new Ur(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){vr[e]=new Ur(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){vr[e]=new Ur(e,5,!1,e.toLowerCase(),null,!1,!1)});var Aw=/[\-:]([a-z])/g;function Iw(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(Aw,Iw);vr[t]=new Ur(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(Aw,Iw);vr[t]=new Ur(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(Aw,Iw);vr[t]=new Ur(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){vr[e]=new Ur(e,1,!1,e.toLowerCase(),null,!1,!1)});vr.xlinkHref=new Ur("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){vr[e]=new Ur(e,1,!1,e.toLowerCase(),null,!0,!0)});function Tw(e,t,n,r){var s=vr.hasOwnProperty(t)?vr[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(M2(t,n,s,r)&&(n=null),r||s===null?L2(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 jo=T2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vf=Symbol.for("react.element"),Vl=Symbol.for("react.portal"),Kl=Symbol.for("react.fragment"),Rw=Symbol.for("react.strict_mode"),Fy=Symbol.for("react.profiler"),y1=Symbol.for("react.provider"),x1=Symbol.for("react.context"),Lw=Symbol.for("react.forward_ref"),zy=Symbol.for("react.suspense"),By=Symbol.for("react.suspense_list"),Ow=Symbol.for("react.memo"),Wo=Symbol.for("react.lazy"),w1=Symbol.for("react.offscreen"),r0=Symbol.iterator;function vu(e){return e===null||typeof e!="object"?null:(e=r0&&e[r0]||e["@@iterator"],typeof e=="function"?e:null)}var jn=Object.assign,vg;function Fu(e){if(vg===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);vg=t&&t[1]||""}return`
|
|
34
|
+
`+vg+e}var bg=!1;function kg(e,t){if(!e||bg)return"";bg=!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{bg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Fu(e):""}function $2(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=kg(e.type,!1),e;case 11:return e=kg(e.type.render,!1),e;case 1:return e=kg(e.type,!0),e;default:return""}}function Hy(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 Kl:return"Fragment";case Vl:return"Portal";case Fy:return"Profiler";case Rw:return"StrictMode";case zy:return"Suspense";case By:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case x1:return(e.displayName||"Context")+".Consumer";case y1:return(e._context.displayName||"Context")+".Provider";case Lw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ow:return t=e.displayName||null,t!==null?t:Hy(e.type)||"Memo";case Wo:t=e._payload,e=e._init;try{return Hy(e(t))}catch{}}return null}function D2(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 Hy(t);case 8:return t===Rw?"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 fa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function v1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function F2(e){var t=v1(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 Kf(e){e._valueTracker||(e._valueTracker=F2(e))}function b1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=v1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ih(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 Uy(e,t){var n=t.checked;return jn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function s0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=fa(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 k1(e,t){t=t.checked,t!=null&&Tw(e,"checked",t,!1)}function Wy(e,t){k1(e,t);var n=fa(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")?Vy(e,t.type,n):t.hasOwnProperty("defaultValue")&&Vy(e,t.type,fa(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function i0(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 Vy(e,t,n){(t!=="number"||ih(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zu=Array.isArray;function uc(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=""+fa(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 Ky(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ke(91));return jn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function o0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ke(92));if(zu(n)){if(1<n.length)throw Error(ke(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:fa(n)}}function S1(e,t){var n=fa(t.value),r=fa(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 a0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function N1(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 qy(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?N1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var qf,j1=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(qf=qf||document.createElement("div"),qf.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=qf.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},z2=["Webkit","ms","Moz","O"];Object.keys(Gu).forEach(function(e){z2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Gu[t]=Gu[e]})});function C1(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 E1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=C1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var B2=jn({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 Yy(e,t){if(t){if(B2[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ke(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ke(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ke(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ke(62))}}function Gy(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 Xy=null;function Mw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Jy=null,dc=null,fc=null;function l0(e){if(e=rf(e)){if(typeof Jy!="function")throw Error(ke(280));var t=e.stateNode;t&&(t=gm(t),Jy(e.stateNode,e.type,t))}}function _1(e){dc?fc?fc.push(e):fc=[e]:dc=e}function P1(){if(dc){var e=dc,t=fc;if(fc=dc=null,l0(e),t)for(e=0;e<t.length;e++)l0(t[e])}}function A1(e,t){return e(t)}function I1(){}var Sg=!1;function T1(e,t,n){if(Sg)return e(t,n);Sg=!0;try{return A1(e,t,n)}finally{Sg=!1,(dc!==null||fc!==null)&&(I1(),P1())}}function yd(e,t){var n=e.stateNode;if(n===null)return null;var r=gm(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ke(231,t,typeof n));return n}var Qy=!1;if(xo)try{var bu={};Object.defineProperty(bu,"passive",{get:function(){Qy=!0}}),window.addEventListener("test",bu,bu),window.removeEventListener("test",bu,bu)}catch{Qy=!1}function H2(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 Xu=!1,oh=null,ah=!1,Zy=null,U2={onError:function(e){Xu=!0,oh=e}};function W2(e,t,n,r,s,i,a,l,c){Xu=!1,oh=null,H2.apply(U2,arguments)}function V2(e,t,n,r,s,i,a,l,c){if(W2.apply(this,arguments),Xu){if(Xu){var d=oh;Xu=!1,oh=null}else throw Error(ke(198));ah||(ah=!0,Zy=d)}}function yl(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 R1(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 c0(e){if(yl(e)!==e)throw Error(ke(188))}function K2(e){var t=e.alternate;if(!t){if(t=yl(e),t===null)throw Error(ke(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return c0(s),e;if(i===r)return c0(s),t;i=i.sibling}throw Error(ke(188))}if(n.return!==r.return)n=s,r=i;else{for(var a=!1,l=s.child;l;){if(l===n){a=!0,n=s,r=i;break}if(l===r){a=!0,r=s,n=i;break}l=l.sibling}if(!a){for(l=i.child;l;){if(l===n){a=!0,n=i,r=s;break}if(l===r){a=!0,r=i,n=s;break}l=l.sibling}if(!a)throw Error(ke(189))}}if(n.alternate!==r)throw Error(ke(190))}if(n.tag!==3)throw Error(ke(188));return n.stateNode.current===n?e:t}function L1(e){return e=K2(e),e!==null?O1(e):null}function O1(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=O1(e);if(t!==null)return t;e=e.sibling}return null}var M1=Es.unstable_scheduleCallback,u0=Es.unstable_cancelCallback,q2=Es.unstable_shouldYield,Y2=Es.unstable_requestPaint,Bn=Es.unstable_now,G2=Es.unstable_getCurrentPriorityLevel,$w=Es.unstable_ImmediatePriority,$1=Es.unstable_UserBlockingPriority,lh=Es.unstable_NormalPriority,X2=Es.unstable_LowPriority,D1=Es.unstable_IdlePriority,fm=null,Ui=null;function J2(e){if(Ui&&typeof Ui.onCommitFiberRoot=="function")try{Ui.onCommitFiberRoot(fm,e,void 0,(e.current.flags&128)===128)}catch{}}var hi=Math.clz32?Math.clz32:eR,Q2=Math.log,Z2=Math.LN2;function eR(e){return e>>>=0,e===0?32:31-(Q2(e)/Z2|0)|0}var Yf=64,Gf=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 ch(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-hi(t),s=1<<n,r|=e[n],t&=~s;return r}function tR(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nR(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-hi(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=tR(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function ex(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function F1(){var e=Yf;return Yf<<=1,!(Yf&4194240)&&(Yf=64),e}function Ng(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-hi(t),e[t]=n}function rR(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-hi(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Dw(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-hi(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Kt=0;function z1(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var B1,Fw,H1,U1,W1,tx=!1,Xf=[],ea=null,ta=null,na=null,xd=new Map,wd=new Map,qo=[],sR="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 d0(e,t){switch(e){case"focusin":case"focusout":ea=null;break;case"dragenter":case"dragleave":ta=null;break;case"mouseover":case"mouseout":na=null;break;case"pointerover":case"pointerout":xd.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":wd.delete(t.pointerId)}}function ku(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&&Fw(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function iR(e,t,n,r,s){switch(t){case"focusin":return ea=ku(ea,e,t,n,r,s),!0;case"dragenter":return ta=ku(ta,e,t,n,r,s),!0;case"mouseover":return na=ku(na,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return xd.set(i,ku(xd.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,wd.set(i,ku(wd.get(i)||null,e,t,n,r,s)),!0}return!1}function V1(e){var t=Ga(e.target);if(t!==null){var n=yl(t);if(n!==null){if(t=n.tag,t===13){if(t=R1(n),t!==null){e.blockedOn=t,W1(e.priority,function(){H1(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 $p(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=nx(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xy=r,n.target.dispatchEvent(r),Xy=null}else return t=rf(n),t!==null&&Fw(t),e.blockedOn=n,!1;t.shift()}return!0}function f0(e,t,n){$p(e)&&n.delete(t)}function oR(){tx=!1,ea!==null&&$p(ea)&&(ea=null),ta!==null&&$p(ta)&&(ta=null),na!==null&&$p(na)&&(na=null),xd.forEach(f0),wd.forEach(f0)}function Su(e,t){e.blockedOn===t&&(e.blockedOn=null,tx||(tx=!0,Es.unstable_scheduleCallback(Es.unstable_NormalPriority,oR)))}function vd(e){function t(s){return Su(s,e)}if(0<Xf.length){Su(Xf[0],e);for(var n=1;n<Xf.length;n++){var r=Xf[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ea!==null&&Su(ea,e),ta!==null&&Su(ta,e),na!==null&&Su(na,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);)V1(n),n.blockedOn===null&&qo.shift()}var pc=jo.ReactCurrentBatchConfig,uh=!0;function aR(e,t,n,r){var s=Kt,i=pc.transition;pc.transition=null;try{Kt=1,zw(e,t,n,r)}finally{Kt=s,pc.transition=i}}function lR(e,t,n,r){var s=Kt,i=pc.transition;pc.transition=null;try{Kt=4,zw(e,t,n,r)}finally{Kt=s,pc.transition=i}}function zw(e,t,n,r){if(uh){var s=nx(e,t,n,r);if(s===null)Lg(e,t,r,dh,n),d0(e,r);else if(iR(s,e,t,n,r))r.stopPropagation();else if(d0(e,r),t&4&&-1<sR.indexOf(e)){for(;s!==null;){var i=rf(s);if(i!==null&&B1(i),i=nx(e,t,n,r),i===null&&Lg(e,t,r,dh,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Lg(e,t,r,null,n)}}var dh=null;function nx(e,t,n,r){if(dh=null,e=Mw(r),e=Ga(e),e!==null)if(t=yl(e),t===null)e=null;else if(n=t.tag,n===13){if(e=R1(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 dh=e,null}function K1(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(G2()){case $w:return 1;case $1:return 4;case lh:case X2:return 16;case D1:return 536870912;default:return 16}default:return 16}}var Xo=null,Bw=null,Dp=null;function q1(){if(Dp)return Dp;var e,t=Bw,n=t.length,r,s="value"in Xo?Xo.value:Xo.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 Dp=s.slice(e,1<r?1-r:void 0)}function Fp(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 Jf(){return!0}function p0(){return!1}function As(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)?Jf:p0,this.isPropagationStopped=p0,this}return jn(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=Jf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Jf)},persist:function(){},isPersistent:Jf}),t}var Uc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hw=As(Uc),nf=jn({},Uc,{view:0,detail:0}),cR=As(nf),jg,Cg,Nu,pm=jn({},nf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uw,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!==Nu&&(Nu&&e.type==="mousemove"?(jg=e.screenX-Nu.screenX,Cg=e.screenY-Nu.screenY):Cg=jg=0,Nu=e),jg)},movementY:function(e){return"movementY"in e?e.movementY:Cg}}),h0=As(pm),uR=jn({},pm,{dataTransfer:0}),dR=As(uR),fR=jn({},nf,{relatedTarget:0}),Eg=As(fR),pR=jn({},Uc,{animationName:0,elapsedTime:0,pseudoElement:0}),hR=As(pR),mR=jn({},Uc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),gR=As(mR),yR=jn({},Uc,{data:0}),m0=As(yR),xR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wR={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"},vR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=vR[e])?!!t[e]:!1}function Uw(){return bR}var kR=jn({},nf,{key:function(e){if(e.key){var t=xR[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Fp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uw,charCode:function(e){return e.type==="keypress"?Fp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Fp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),SR=As(kR),NR=jn({},pm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),g0=As(NR),jR=jn({},nf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uw}),CR=As(jR),ER=jn({},Uc,{propertyName:0,elapsedTime:0,pseudoElement:0}),_R=As(ER),PR=jn({},pm,{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}),AR=As(PR),IR=[9,13,27,32],Ww=xo&&"CompositionEvent"in window,Ju=null;xo&&"documentMode"in document&&(Ju=document.documentMode);var TR=xo&&"TextEvent"in window&&!Ju,Y1=xo&&(!Ww||Ju&&8<Ju&&11>=Ju),y0=" ",x0=!1;function G1(e,t){switch(e){case"keyup":return IR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function X1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ql=!1;function RR(e,t){switch(e){case"compositionend":return X1(t);case"keypress":return t.which!==32?null:(x0=!0,y0);case"textInput":return e=t.data,e===y0&&x0?null:e;default:return null}}function LR(e,t){if(ql)return e==="compositionend"||!Ww&&G1(e,t)?(e=q1(),Dp=Bw=Xo=null,ql=!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 Y1&&t.locale!=="ko"?null:t.data;default:return null}}var OR={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 w0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!OR[e.type]:t==="textarea"}function J1(e,t,n,r){_1(r),t=fh(t,"onChange"),0<t.length&&(n=new Hw("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Qu=null,bd=null;function MR(e){lC(e,0)}function hm(e){var t=Xl(e);if(b1(t))return e}function $R(e,t){if(e==="change")return t}var Q1=!1;if(xo){var _g;if(xo){var Pg="oninput"in document;if(!Pg){var v0=document.createElement("div");v0.setAttribute("oninput","return;"),Pg=typeof v0.oninput=="function"}_g=Pg}else _g=!1;Q1=_g&&(!document.documentMode||9<document.documentMode)}function b0(){Qu&&(Qu.detachEvent("onpropertychange",Z1),bd=Qu=null)}function Z1(e){if(e.propertyName==="value"&&hm(bd)){var t=[];J1(t,bd,e,Mw(e)),T1(MR,t)}}function DR(e,t,n){e==="focusin"?(b0(),Qu=t,bd=n,Qu.attachEvent("onpropertychange",Z1)):e==="focusout"&&b0()}function FR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return hm(bd)}function zR(e,t){if(e==="click")return hm(t)}function BR(e,t){if(e==="input"||e==="change")return hm(t)}function HR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gi=typeof Object.is=="function"?Object.is:HR;function kd(e,t){if(gi(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(!Dy.call(t,s)||!gi(e[s],t[s]))return!1}return!0}function k0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function S0(e,t){var n=k0(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=k0(n)}}function eC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?eC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function tC(){for(var e=window,t=ih();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ih(e.document)}return t}function Vw(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 UR(e){var t=tC(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&eC(n.ownerDocument.documentElement,n)){if(r!==null&&Vw(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=S0(n,i);var a=S0(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 WR=xo&&"documentMode"in document&&11>=document.documentMode,Yl=null,rx=null,Zu=null,sx=!1;function N0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;sx||Yl==null||Yl!==ih(r)||(r=Yl,"selectionStart"in r&&Vw(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=fh(rx,"onSelect"),0<r.length&&(t=new Hw("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Yl)))}function Qf(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Gl={animationend:Qf("Animation","AnimationEnd"),animationiteration:Qf("Animation","AnimationIteration"),animationstart:Qf("Animation","AnimationStart"),transitionend:Qf("Transition","TransitionEnd")},Ag={},nC={};xo&&(nC=document.createElement("div").style,"AnimationEvent"in window||(delete Gl.animationend.animation,delete Gl.animationiteration.animation,delete Gl.animationstart.animation),"TransitionEvent"in window||delete Gl.transitionend.transition);function mm(e){if(Ag[e])return Ag[e];if(!Gl[e])return e;var t=Gl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in nC)return Ag[e]=t[n];return e}var rC=mm("animationend"),sC=mm("animationiteration"),iC=mm("animationstart"),oC=mm("transitionend"),aC=new Map,j0="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 va(e,t){aC.set(e,t),gl(t,[e])}for(var Ig=0;Ig<j0.length;Ig++){var Tg=j0[Ig],VR=Tg.toLowerCase(),KR=Tg[0].toUpperCase()+Tg.slice(1);va(VR,"on"+KR)}va(rC,"onAnimationEnd");va(sC,"onAnimationIteration");va(iC,"onAnimationStart");va("dblclick","onDoubleClick");va("focusin","onFocus");va("focusout","onBlur");va(oC,"onTransitionEnd");bc("onMouseEnter",["mouseout","mouseover"]);bc("onMouseLeave",["mouseout","mouseover"]);bc("onPointerEnter",["pointerout","pointerover"]);bc("onPointerLeave",["pointerout","pointerover"]);gl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));gl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));gl("onBeforeInput",["compositionend","keypress","textInput","paste"]);gl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));gl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));gl("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(" "),qR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hu));function C0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,V2(r,t,void 0,e),e.currentTarget=null}function lC(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;C0(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;C0(s,l,d),i=c}}}if(ah)throw e=Zy,ah=!1,Zy=null,e}function fn(e,t){var n=t[cx];n===void 0&&(n=t[cx]=new Set);var r=e+"__bubble";n.has(r)||(cC(t,e,2,!1),n.add(r))}function Rg(e,t,n){var r=0;t&&(r|=4),cC(n,e,r,t)}var Zf="_reactListening"+Math.random().toString(36).slice(2);function Sd(e){if(!e[Zf]){e[Zf]=!0,g1.forEach(function(n){n!=="selectionchange"&&(qR.has(n)||Rg(n,!1,e),Rg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zf]||(t[Zf]=!0,Rg("selectionchange",!1,t))}}function cC(e,t,n,r){switch(K1(t)){case 1:var s=aR;break;case 4:s=lR;break;default:s=zw}n=s.bind(null,t,n,e),s=void 0,!Qy||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 Lg(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=Ga(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}T1(function(){var d=i,u=Mw(n),f=[];e:{var p=aC.get(e);if(p!==void 0){var h=Hw,y=e;switch(e){case"keypress":if(Fp(n)===0)break e;case"keydown":case"keyup":h=SR;break;case"focusin":y="focus",h=Eg;break;case"focusout":y="blur",h=Eg;break;case"beforeblur":case"afterblur":h=Eg;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=h0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=dR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=CR;break;case rC:case sC:case iC:h=hR;break;case oC:h=_R;break;case"scroll":h=cR;break;case"wheel":h=AR;break;case"copy":case"cut":case"paste":h=gR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=g0}var k=(t&4)!==0,b=!k&&e==="scroll",g=k?p!==null?p+"Capture":null:p;k=[];for(var v=d,w;v!==null;){w=v;var j=w.stateNode;if(w.tag===5&&j!==null&&(w=j,g!==null&&(j=yd(v,g),j!=null&&k.push(Nd(v,j,w)))),b)break;v=v.return}0<k.length&&(p=new h(p,y,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!==Xy&&(y=n.relatedTarget||n.fromElement)&&(Ga(y)||y[wo]))break e;if((h||p)&&(p=u.window===u?u:(p=u.ownerDocument)?p.defaultView||p.parentWindow:window,h?(y=n.relatedTarget||n.toElement,h=d,y=y?Ga(y):null,y!==null&&(b=yl(y),y!==b||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=d),h!==y)){if(k=h0,j="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(k=g0,j="onPointerLeave",g="onPointerEnter",v="pointer"),b=h==null?p:Xl(h),w=y==null?p:Xl(y),p=new k(j,v+"leave",h,n,u),p.target=b,p.relatedTarget=w,j=null,Ga(u)===d&&(k=new k(g,v+"enter",y,n,u),k.target=w,k.relatedTarget=b,j=k),b=j,h&&y)t:{for(k=h,g=y,v=0,w=k;w;w=Ol(w))v++;for(w=0,j=g;j;j=Ol(j))w++;for(;0<v-w;)k=Ol(k),v--;for(;0<w-v;)g=Ol(g),w--;for(;v--;){if(k===g||g!==null&&k===g.alternate)break t;k=Ol(k),g=Ol(g)}k=null}else k=null;h!==null&&E0(f,p,h,k,!1),y!==null&&b!==null&&E0(f,b,y,k,!0)}}e:{if(p=d?Xl(d):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var E=$R;else if(w0(p))if(Q1)E=BR;else{E=FR;var S=DR}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(E=zR);if(E&&(E=E(e,d))){J1(f,E,n,u);break e}S&&S(e,p,d),e==="focusout"&&(S=p._wrapperState)&&S.controlled&&p.type==="number"&&Vy(p,"number",p.value)}switch(S=d?Xl(d):window,e){case"focusin":(w0(S)||S.contentEditable==="true")&&(Yl=S,rx=d,Zu=null);break;case"focusout":Zu=rx=Yl=null;break;case"mousedown":sx=!0;break;case"contextmenu":case"mouseup":case"dragend":sx=!1,N0(f,n,u);break;case"selectionchange":if(WR)break;case"keydown":case"keyup":N0(f,n,u)}var A;if(Ww)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 ql?G1(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(Y1&&n.locale!=="ko"&&(ql||R!=="onCompositionStart"?R==="onCompositionEnd"&&ql&&(A=q1()):(Xo=u,Bw="value"in Xo?Xo.value:Xo.textContent,ql=!0)),S=fh(d,R),0<S.length&&(R=new m0(R,e,null,n,u),f.push({event:R,listeners:S}),A?R.data=A:(A=X1(n),A!==null&&(R.data=A)))),(A=TR?RR(e,n):LR(e,n))&&(d=fh(d,"onBeforeInput"),0<d.length&&(u=new m0("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:d}),u.data=A))}lC(f,t)})}function Nd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function fh(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 Ol(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function E0(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 YR=/\r\n?/g,GR=/\u0000|\uFFFD/g;function _0(e){return(typeof e=="string"?e:""+e).replace(YR,`
|
|
38
|
+
`).replace(GR,"")}function ep(e,t,n){if(t=_0(t),_0(e)!==t&&n)throw Error(ke(425))}function ph(){}var ix=null,ox=null;function ax(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 lx=typeof setTimeout=="function"?setTimeout:void 0,XR=typeof clearTimeout=="function"?clearTimeout:void 0,P0=typeof Promise=="function"?Promise:void 0,JR=typeof queueMicrotask=="function"?queueMicrotask:typeof P0<"u"?function(e){return P0.resolve(null).then(e).catch(QR)}:lx;function QR(e){setTimeout(function(){throw e})}function Og(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 ra(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 A0(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 Wc=Math.random().toString(36).slice(2),Fi="__reactFiber$"+Wc,jd="__reactProps$"+Wc,wo="__reactContainer$"+Wc,cx="__reactEvents$"+Wc,ZR="__reactListeners$"+Wc,eL="__reactHandles$"+Wc;function Ga(e){var t=e[Fi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[wo]||n[Fi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=A0(e);e!==null;){if(n=e[Fi])return n;e=A0(e)}return t}e=n,n=e.parentNode}return null}function rf(e){return e=e[Fi]||e[wo],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Xl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ke(33))}function gm(e){return e[jd]||null}var ux=[],Jl=-1;function ba(e){return{current:e}}function hn(e){0>Jl||(e.current=ux[Jl],ux[Jl]=null,Jl--)}function ln(e,t){Jl++,ux[Jl]=e.current,e.current=t}var pa={},Ir=ba(pa),os=ba(!1),il=pa;function kc(e,t){var n=e.type.contextTypes;if(!n)return pa;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 as(e){return e=e.childContextTypes,e!=null}function hh(){hn(os),hn(Ir)}function I0(e,t,n){if(Ir.current!==pa)throw Error(ke(168));ln(Ir,t),ln(os,n)}function uC(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(ke(108,D2(e)||"Unknown",s));return jn({},n,r)}function mh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pa,il=Ir.current,ln(Ir,e),ln(os,os.current),!0}function T0(e,t,n){var r=e.stateNode;if(!r)throw Error(ke(169));n?(e=uC(e,t,il),r.__reactInternalMemoizedMergedChildContext=e,hn(os),hn(Ir),ln(Ir,e)):hn(os),ln(os,n)}var co=null,ym=!1,Mg=!1;function dC(e){co===null?co=[e]:co.push(e)}function tL(e){ym=!0,dC(e)}function ka(){if(!Mg&&co!==null){Mg=!0;var e=0,t=Kt;try{var n=co;for(Kt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}co=null,ym=!1}catch(s){throw co!==null&&(co=co.slice(e+1)),M1($w,ka),s}finally{Kt=t,Mg=!1}}return null}var Ql=[],Zl=0,gh=null,yh=0,Fs=[],zs=0,ol=null,po=1,ho="";function Va(e,t){Ql[Zl++]=yh,Ql[Zl++]=gh,gh=e,yh=t}function fC(e,t,n){Fs[zs++]=po,Fs[zs++]=ho,Fs[zs++]=ol,ol=e;var r=po;e=ho;var s=32-hi(r)-1;r&=~(1<<s),n+=1;var i=32-hi(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,po=1<<32-hi(t)+s|n<<s|r,ho=i+e}else po=1<<i|n<<s|r,ho=e}function Kw(e){e.return!==null&&(Va(e,1),fC(e,1,0))}function qw(e){for(;e===gh;)gh=Ql[--Zl],Ql[Zl]=null,yh=Ql[--Zl],Ql[Zl]=null;for(;e===ol;)ol=Fs[--zs],Fs[zs]=null,ho=Fs[--zs],Fs[zs]=null,po=Fs[--zs],Fs[zs]=null}var js=null,Ss=null,vn=!1,ci=null;function pC(e,t){var n=Us(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 R0(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,js=e,Ss=ra(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,js=e,Ss=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ol!==null?{id:po,overflow:ho}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Us(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,js=e,Ss=null,!0):!1;default:return!1}}function dx(e){return(e.mode&1)!==0&&(e.flags&128)===0}function fx(e){if(vn){var t=Ss;if(t){var n=t;if(!R0(e,t)){if(dx(e))throw Error(ke(418));t=ra(n.nextSibling);var r=js;t&&R0(e,t)?pC(r,n):(e.flags=e.flags&-4097|2,vn=!1,js=e)}}else{if(dx(e))throw Error(ke(418));e.flags=e.flags&-4097|2,vn=!1,js=e}}}function L0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;js=e}function tp(e){if(e!==js)return!1;if(!vn)return L0(e),vn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ax(e.type,e.memoizedProps)),t&&(t=Ss)){if(dx(e))throw hC(),Error(ke(418));for(;t;)pC(e,t),t=ra(t.nextSibling)}if(L0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ke(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ss=ra(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ss=null}}else Ss=js?ra(e.stateNode.nextSibling):null;return!0}function hC(){for(var e=Ss;e;)e=ra(e.nextSibling)}function Sc(){Ss=js=null,vn=!1}function Yw(e){ci===null?ci=[e]:ci.push(e)}var nL=jo.ReactCurrentBatchConfig;function ju(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ke(309));var r=n.stateNode}if(!r)throw Error(ke(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var l=s.refs;a===null?delete l[i]:l[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(ke(284));if(!n._owner)throw Error(ke(290,e))}return e}function np(e,t){throw e=Object.prototype.toString.call(t),Error(ke(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function O0(e){var t=e._init;return t(e._payload)}function mC(e){function t(g,v){if(e){var w=g.deletions;w===null?(g.deletions=[v],g.flags|=16):w.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function r(g,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function s(g,v){return g=aa(g,v),g.index=0,g.sibling=null,g}function i(g,v,w){return g.index=w,e?(w=g.alternate,w!==null?(w=w.index,w<v?(g.flags|=2,v):w):(g.flags|=2,v)):(g.flags|=1048576,v)}function a(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,v,w,j){return v===null||v.tag!==6?(v=Ug(w,g.mode,j),v.return=g,v):(v=s(v,w),v.return=g,v)}function c(g,v,w,j){var E=w.type;return E===Kl?u(g,v,w.props.children,j,w.key):v!==null&&(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Wo&&O0(E)===v.type)?(j=s(v,w.props),j.ref=ju(g,v,w),j.return=g,j):(j=Kp(w.type,w.key,w.props,null,g.mode,j),j.ref=ju(g,v,w),j.return=g,j)}function d(g,v,w,j){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=Wg(w,g.mode,j),v.return=g,v):(v=s(v,w.children||[]),v.return=g,v)}function u(g,v,w,j,E){return v===null||v.tag!==7?(v=el(w,g.mode,j,E),v.return=g,v):(v=s(v,w),v.return=g,v)}function f(g,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Ug(""+v,g.mode,w),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Vf:return w=Kp(v.type,v.key,v.props,null,g.mode,w),w.ref=ju(g,null,v),w.return=g,w;case Vl:return v=Wg(v,g.mode,w),v.return=g,v;case Wo:var j=v._init;return f(g,j(v._payload),w)}if(zu(v)||vu(v))return v=el(v,g.mode,w,null),v.return=g,v;np(g,v)}return null}function p(g,v,w,j){var E=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return E!==null?null:l(g,v,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Vf:return w.key===E?c(g,v,w,j):null;case Vl:return w.key===E?d(g,v,w,j):null;case Wo:return E=w._init,p(g,v,E(w._payload),j)}if(zu(w)||vu(w))return E!==null?null:u(g,v,w,j,null);np(g,w)}return null}function h(g,v,w,j,E){if(typeof j=="string"&&j!==""||typeof j=="number")return g=g.get(w)||null,l(v,g,""+j,E);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Vf:return g=g.get(j.key===null?w:j.key)||null,c(v,g,j,E);case Vl:return g=g.get(j.key===null?w:j.key)||null,d(v,g,j,E);case Wo:var S=j._init;return h(g,v,w,S(j._payload),E)}if(zu(j)||vu(j))return g=g.get(w)||null,u(v,g,j,E,null);np(v,j)}return null}function y(g,v,w,j){for(var E=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 W=p(g,A,w[R],j);if(W===null){A===null&&(A=M);break}e&&A&&W.alternate===null&&t(g,A),v=i(W,v,R),S===null?E=W:S.sibling=W,S=W,A=M}if(R===w.length)return n(g,A),vn&&Va(g,R),E;if(A===null){for(;R<w.length;R++)A=f(g,w[R],j),A!==null&&(v=i(A,v,R),S===null?E=A:S.sibling=A,S=A);return vn&&Va(g,R),E}for(A=r(g,A);R<w.length;R++)M=h(A,g,R,w[R],j),M!==null&&(e&&M.alternate!==null&&A.delete(M.key===null?R:M.key),v=i(M,v,R),S===null?E=M:S.sibling=M,S=M);return e&&A.forEach(function(D){return t(g,D)}),vn&&Va(g,R),E}function k(g,v,w,j){var E=vu(w);if(typeof E!="function")throw Error(ke(150));if(w=E.call(w),w==null)throw Error(ke(151));for(var S=E=null,A=v,R=v=0,M=null,W=w.next();A!==null&&!W.done;R++,W=w.next()){A.index>R?(M=A,A=null):M=A.sibling;var D=p(g,A,W.value,j);if(D===null){A===null&&(A=M);break}e&&A&&D.alternate===null&&t(g,A),v=i(D,v,R),S===null?E=D:S.sibling=D,S=D,A=M}if(W.done)return n(g,A),vn&&Va(g,R),E;if(A===null){for(;!W.done;R++,W=w.next())W=f(g,W.value,j),W!==null&&(v=i(W,v,R),S===null?E=W:S.sibling=W,S=W);return vn&&Va(g,R),E}for(A=r(g,A);!W.done;R++,W=w.next())W=h(A,g,R,W.value,j),W!==null&&(e&&W.alternate!==null&&A.delete(W.key===null?R:W.key),v=i(W,v,R),S===null?E=W:S.sibling=W,S=W);return e&&A.forEach(function(O){return t(g,O)}),vn&&Va(g,R),E}function b(g,v,w,j){if(typeof w=="object"&&w!==null&&w.type===Kl&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Vf:e:{for(var E=w.key,S=v;S!==null;){if(S.key===E){if(E=w.type,E===Kl){if(S.tag===7){n(g,S.sibling),v=s(S,w.props.children),v.return=g,g=v;break e}}else if(S.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Wo&&O0(E)===S.type){n(g,S.sibling),v=s(S,w.props),v.ref=ju(g,S,w),v.return=g,g=v;break e}n(g,S);break}else t(g,S);S=S.sibling}w.type===Kl?(v=el(w.props.children,g.mode,j,w.key),v.return=g,g=v):(j=Kp(w.type,w.key,w.props,null,g.mode,j),j.ref=ju(g,v,w),j.return=g,g=j)}return a(g);case Vl: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(g,v.sibling),v=s(v,w.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else t(g,v);v=v.sibling}v=Wg(w,g.mode,j),v.return=g,g=v}return a(g);case Wo:return S=w._init,b(g,v,S(w._payload),j)}if(zu(w))return y(g,v,w,j);if(vu(w))return k(g,v,w,j);np(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),v=s(v,w),v.return=g,g=v):(n(g,v),v=Ug(w,g.mode,j),v.return=g,g=v),a(g)):n(g,v)}return b}var Nc=mC(!0),gC=mC(!1),xh=ba(null),wh=null,ec=null,Gw=null;function Xw(){Gw=ec=wh=null}function Jw(e){var t=xh.current;hn(xh),e._currentValue=t}function px(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 hc(e,t){wh=e,Gw=ec=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ts=!0),e.firstContext=null)}function Vs(e){var t=e._currentValue;if(Gw!==e)if(e={context:e,memoizedValue:t,next:null},ec===null){if(wh===null)throw Error(ke(308));ec=e,wh.dependencies={lanes:0,firstContext:e}}else ec=ec.next=e;return t}var Xa=null;function Qw(e){Xa===null?Xa=[e]:Xa.push(e)}function yC(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Qw(t)):(n.next=s.next,s.next=n),t.interleaved=n,vo(e,r)}function vo(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 Vo=!1;function Zw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xC(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 yo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function sa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Dt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,vo(e,n)}return s=r.interleaved,s===null?(t.next=t,Qw(r)):(t.next=s.next,s.next=t),r.interleaved=t,vo(e,n)}function zp(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,Dw(e,n)}}function M0(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 vh(e,t,n,r){var s=e.updateQueue;Vo=!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 y=e,k=l;switch(p=t,h=n,k.tag){case 1:if(y=k.payload,typeof y=="function"){f=y.call(h,f,p);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=k.payload,p=typeof y=="function"?y.call(h,f,p):y,p==null)break e;f=jn({},f,p);break e;case 2:Vo=!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);ll|=a,e.lanes=a,e.memoizedState=f}}function $0(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(ke(191,s));s.call(r)}}}var sf={},Wi=ba(sf),Cd=ba(sf),Ed=ba(sf);function Ja(e){if(e===sf)throw Error(ke(174));return e}function ev(e,t){switch(ln(Ed,t),ln(Cd,e),ln(Wi,sf),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:qy(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=qy(t,e)}hn(Wi),ln(Wi,t)}function jc(){hn(Wi),hn(Cd),hn(Ed)}function wC(e){Ja(Ed.current);var t=Ja(Wi.current),n=qy(t,e.type);t!==n&&(ln(Cd,e),ln(Wi,n))}function tv(e){Cd.current===e&&(hn(Wi),hn(Cd))}var Sn=ba(0);function bh(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 $g=[];function nv(){for(var e=0;e<$g.length;e++)$g[e]._workInProgressVersionPrimary=null;$g.length=0}var Bp=jo.ReactCurrentDispatcher,Dg=jo.ReactCurrentBatchConfig,al=0,Nn=null,er=null,or=null,kh=!1,ed=!1,_d=0,rL=0;function Er(){throw Error(ke(321))}function rv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gi(e[n],t[n]))return!1;return!0}function sv(e,t,n,r,s,i){if(al=i,Nn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Bp.current=e===null||e.memoizedState===null?aL:lL,e=n(r,s),ed){i=0;do{if(ed=!1,_d=0,25<=i)throw Error(ke(301));i+=1,or=er=null,t.updateQueue=null,Bp.current=cL,e=n(r,s)}while(ed)}if(Bp.current=Sh,t=er!==null&&er.next!==null,al=0,or=er=Nn=null,kh=!1,t)throw Error(ke(300));return e}function iv(){var e=_d!==0;return _d=0,e}function Oi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return or===null?Nn.memoizedState=or=e:or=or.next=e,or}function Ks(){if(er===null){var e=Nn.alternate;e=e!==null?e.memoizedState:null}else e=er.next;var t=or===null?Nn.memoizedState:or.next;if(t!==null)or=t,er=e;else{if(e===null)throw Error(ke(310));er=e,e={memoizedState:er.memoizedState,baseState:er.baseState,baseQueue:er.baseQueue,queue:er.queue,next:null},or===null?Nn.memoizedState=or=e:or=or.next=e}return or}function Pd(e,t){return typeof t=="function"?t(e):t}function Fg(e){var t=Ks(),n=t.queue;if(n===null)throw Error(ke(311));n.lastRenderedReducer=e;var r=er,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((al&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,Nn.lanes|=u,ll|=u}d=d.next}while(d!==null&&d!==i);c===null?a=r:c.next=l,gi(r,t.memoizedState)||(ts=!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,Nn.lanes|=i,ll|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function zg(e){var t=Ks(),n=t.queue;if(n===null)throw Error(ke(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var a=s=s.next;do i=e(i,a.action),a=a.next;while(a!==s);gi(i,t.memoizedState)||(ts=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function vC(){}function bC(e,t){var n=Nn,r=Ks(),s=t(),i=!gi(r.memoizedState,s);if(i&&(r.memoizedState=s,ts=!0),r=r.queue,ov(NC.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||or!==null&&or.memoizedState.tag&1){if(n.flags|=2048,Ad(9,SC.bind(null,n,r,s,t),void 0,null),lr===null)throw Error(ke(349));al&30||kC(n,t,s)}return s}function kC(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Nn.updateQueue,t===null?(t={lastEffect:null,stores:null},Nn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function SC(e,t,n,r){t.value=n,t.getSnapshot=r,jC(t)&&CC(e)}function NC(e,t,n){return n(function(){jC(t)&&CC(e)})}function jC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gi(e,n)}catch{return!0}}function CC(e){var t=vo(e,1);t!==null&&mi(t,e,1,-1)}function D0(e){var t=Oi();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=oL.bind(null,Nn,e),[t.memoizedState,e]}function Ad(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Nn.updateQueue,t===null?(t={lastEffect:null,stores:null},Nn.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 EC(){return Ks().memoizedState}function Hp(e,t,n,r){var s=Oi();Nn.flags|=e,s.memoizedState=Ad(1|t,n,void 0,r===void 0?null:r)}function xm(e,t,n,r){var s=Ks();r=r===void 0?null:r;var i=void 0;if(er!==null){var a=er.memoizedState;if(i=a.destroy,r!==null&&rv(r,a.deps)){s.memoizedState=Ad(t,n,i,r);return}}Nn.flags|=e,s.memoizedState=Ad(1|t,n,i,r)}function F0(e,t){return Hp(8390656,8,e,t)}function ov(e,t){return xm(2048,8,e,t)}function _C(e,t){return xm(4,2,e,t)}function PC(e,t){return xm(4,4,e,t)}function AC(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 IC(e,t,n){return n=n!=null?n.concat([e]):null,xm(4,4,AC.bind(null,t,e),n)}function av(){}function TC(e,t){var n=Ks();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&rv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function RC(e,t){var n=Ks();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&rv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function LC(e,t,n){return al&21?(gi(n,t)||(n=F1(),Nn.lanes|=n,ll|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ts=!0),e.memoizedState=n)}function sL(e,t){var n=Kt;Kt=n!==0&&4>n?n:4,e(!0);var r=Dg.transition;Dg.transition={};try{e(!1),t()}finally{Kt=n,Dg.transition=r}}function OC(){return Ks().memoizedState}function iL(e,t,n){var r=oa(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},MC(e))$C(t,n);else if(n=yC(e,t,n,r),n!==null){var s=Br();mi(n,e,r,s),DC(n,t,r)}}function oL(e,t,n){var r=oa(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(MC(e))$C(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,gi(l,a)){var c=t.interleaved;c===null?(s.next=s,Qw(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=yC(e,t,s,r),n!==null&&(s=Br(),mi(n,e,r,s),DC(n,t,r))}}function MC(e){var t=e.alternate;return e===Nn||t!==null&&t===Nn}function $C(e,t){ed=kh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function DC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Dw(e,n)}}var Sh={readContext:Vs,useCallback:Er,useContext:Er,useEffect:Er,useImperativeHandle:Er,useInsertionEffect:Er,useLayoutEffect:Er,useMemo:Er,useReducer:Er,useRef:Er,useState:Er,useDebugValue:Er,useDeferredValue:Er,useTransition:Er,useMutableSource:Er,useSyncExternalStore:Er,useId:Er,unstable_isNewReconciler:!1},aL={readContext:Vs,useCallback:function(e,t){return Oi().memoizedState=[e,t===void 0?null:t],e},useContext:Vs,useEffect:F0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hp(4194308,4,AC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hp(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hp(4,2,e,t)},useMemo:function(e,t){var n=Oi();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Oi();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=iL.bind(null,Nn,e),[r.memoizedState,e]},useRef:function(e){var t=Oi();return e={current:e},t.memoizedState=e},useState:D0,useDebugValue:av,useDeferredValue:function(e){return Oi().memoizedState=e},useTransition:function(){var e=D0(!1),t=e[0];return e=sL.bind(null,e[1]),Oi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Nn,s=Oi();if(vn){if(n===void 0)throw Error(ke(407));n=n()}else{if(n=t(),lr===null)throw Error(ke(349));al&30||kC(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,F0(NC.bind(null,r,i,e),[e]),r.flags|=2048,Ad(9,SC.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Oi(),t=lr.identifierPrefix;if(vn){var n=ho,r=po;n=(r&~(1<<32-hi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=_d++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=rL++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},lL={readContext:Vs,useCallback:TC,useContext:Vs,useEffect:ov,useImperativeHandle:IC,useInsertionEffect:_C,useLayoutEffect:PC,useMemo:RC,useReducer:Fg,useRef:EC,useState:function(){return Fg(Pd)},useDebugValue:av,useDeferredValue:function(e){var t=Ks();return LC(t,er.memoizedState,e)},useTransition:function(){var e=Fg(Pd)[0],t=Ks().memoizedState;return[e,t]},useMutableSource:vC,useSyncExternalStore:bC,useId:OC,unstable_isNewReconciler:!1},cL={readContext:Vs,useCallback:TC,useContext:Vs,useEffect:ov,useImperativeHandle:IC,useInsertionEffect:_C,useLayoutEffect:PC,useMemo:RC,useReducer:zg,useRef:EC,useState:function(){return zg(Pd)},useDebugValue:av,useDeferredValue:function(e){var t=Ks();return er===null?t.memoizedState=e:LC(t,er.memoizedState,e)},useTransition:function(){var e=zg(Pd)[0],t=Ks().memoizedState;return[e,t]},useMutableSource:vC,useSyncExternalStore:bC,useId:OC,unstable_isNewReconciler:!1};function oi(e,t){if(e&&e.defaultProps){t=jn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function hx(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:jn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var wm={isMounted:function(e){return(e=e._reactInternals)?yl(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Br(),s=oa(e),i=yo(r,s);i.payload=t,n!=null&&(i.callback=n),t=sa(e,i,s),t!==null&&(mi(t,e,s,r),zp(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Br(),s=oa(e),i=yo(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=sa(e,i,s),t!==null&&(mi(t,e,s,r),zp(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Br(),r=oa(e),s=yo(n,r);s.tag=2,t!=null&&(s.callback=t),t=sa(e,s,r),t!==null&&(mi(t,e,r,n),zp(t,e,r))}};function z0(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 FC(e,t,n){var r=!1,s=pa,i=t.contextType;return typeof i=="object"&&i!==null?i=Vs(i):(s=as(t)?il:Ir.current,r=t.contextTypes,i=(r=r!=null)?kc(e,s):pa),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=wm,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function B0(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&&wm.enqueueReplaceState(t,t.state,null)}function mx(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Zw(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Vs(i):(i=as(t)?il:Ir.current,s.context=kc(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(hx(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&&wm.enqueueReplaceState(s,s.state,null),vh(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Cc(e,t){try{var n="",r=t;do n+=$2(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 Bg(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function gx(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var uL=typeof WeakMap=="function"?WeakMap:Map;function zC(e,t,n){n=yo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){jh||(jh=!0,Cx=r),gx(e,t)},n}function BC(e,t,n){n=yo(-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(){gx(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){gx(e,t),typeof r!="function"&&(ia===null?ia=new Set([this]):ia.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function H0(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new uL;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=NL.bind(null,e,t,n),t.then(e,e))}function U0(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 W0(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=yo(-1,1),t.tag=2,sa(n,t,1))),n.lanes|=1),e)}var dL=jo.ReactCurrentOwner,ts=!1;function Fr(e,t,n,r){t.child=e===null?gC(t,null,n,r):Nc(t,e.child,n,r)}function V0(e,t,n,r,s){n=n.render;var i=t.ref;return hc(t,s),r=sv(e,t,n,r,i,s),n=iv(),e!==null&&!ts?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,bo(e,t,s)):(vn&&n&&Kw(t),t.flags|=1,Fr(e,t,r,s),t.child)}function K0(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!mv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,HC(e,t,i,r,s)):(e=Kp(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 bo(e,t,s)}return t.flags|=1,e=aa(i,r),e.ref=t.ref,e.return=t,t.child=e}function HC(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(kd(i,r)&&e.ref===t.ref)if(ts=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(ts=!0);else return t.lanes=e.lanes,bo(e,t,s)}return yx(e,t,n,r,s)}function UC(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},ln(nc,ws),ws|=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,ln(nc,ws),ws|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ln(nc,ws),ws|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ln(nc,ws),ws|=r;return Fr(e,t,s,n),t.child}function WC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function yx(e,t,n,r,s){var i=as(n)?il:Ir.current;return i=kc(t,i),hc(t,s),n=sv(e,t,n,r,i,s),r=iv(),e!==null&&!ts?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,bo(e,t,s)):(vn&&r&&Kw(t),t.flags|=1,Fr(e,t,n,s),t.child)}function q0(e,t,n,r,s){if(as(n)){var i=!0;mh(t)}else i=!1;if(hc(t,s),t.stateNode===null)Up(e,t),FC(t,n,r),mx(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=Vs(d):(d=as(n)?il:Ir.current,d=kc(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)&&B0(t,a,r,d),Vo=!1;var p=t.memoizedState;a.state=p,vh(t,r,a,s),c=t.memoizedState,l!==r||p!==c||os.current||Vo?(typeof u=="function"&&(hx(t,n,u,r),c=t.memoizedState),(l=Vo||z0(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,xC(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:oi(t.type,l),a.props=d,f=t.pendingProps,p=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Vs(c):(c=as(n)?il:Ir.current,c=kc(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)&&B0(t,a,r,c),Vo=!1,p=t.memoizedState,a.state=p,vh(t,r,a,s);var y=t.memoizedState;l!==f||p!==y||os.current||Vo?(typeof h=="function"&&(hx(t,n,h,r),y=t.memoizedState),(d=Vo||z0(t,n,d,r,p,y,c)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,y,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,y,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=y),a.props=r,a.state=y,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 xx(e,t,n,r,i,s)}function xx(e,t,n,r,s,i){WC(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&T0(t,n,!1),bo(e,t,i);r=t.stateNode,dL.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Nc(t,e.child,null,i),t.child=Nc(t,null,l,i)):Fr(e,t,l,i),t.memoizedState=r.state,s&&T0(t,n,!0),t.child}function VC(e){var t=e.stateNode;t.pendingContext?I0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&I0(e,t.context,!1),ev(e,t.containerInfo)}function Y0(e,t,n,r,s){return Sc(),Yw(s),t.flags|=256,Fr(e,t,n,r),t.child}var wx={dehydrated:null,treeContext:null,retryLane:0};function vx(e){return{baseLanes:e,cachePool:null,transitions:null}}function KC(e,t,n){var r=t.pendingProps,s=Sn.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),ln(Sn,s&1),e===null)return fx(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=km(a,r,0,null),e=el(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=vx(n),t.memoizedState=wx,e):lv(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return fL(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=aa(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=aa(l,i):(i=el(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?vx(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=wx,r}return i=e.child,e=i.sibling,r=aa(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 lv(e,t){return t=km({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function rp(e,t,n,r){return r!==null&&Yw(r),Nc(t,e.child,null,n),e=lv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function fL(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Bg(Error(ke(422))),rp(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=km({mode:"visible",children:r.children},s,0,null),i=el(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Nc(t,e.child,null,a),t.child.memoizedState=vx(a),t.memoizedState=wx,i);if(!(t.mode&1))return rp(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(ke(419)),r=Bg(i,r,void 0),rp(e,t,a,r)}if(l=(a&e.childLanes)!==0,ts||l){if(r=lr,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,vo(e,s),mi(r,e,s,-1))}return hv(),r=Bg(Error(ke(421))),rp(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=jL.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Ss=ra(s.nextSibling),js=t,vn=!0,ci=null,e!==null&&(Fs[zs++]=po,Fs[zs++]=ho,Fs[zs++]=ol,po=e.id,ho=e.overflow,ol=t),t=lv(t,r.children),t.flags|=4096,t)}function G0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),px(e.return,t,n)}function Hg(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 qC(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(Fr(e,t,r.children,n),r=Sn.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&&G0(e,n,t);else if(e.tag===19)G0(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(ln(Sn,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&&bh(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Hg(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&&bh(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Hg(t,!0,n,null,i);break;case"together":Hg(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Up(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function bo(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ll|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ke(153));if(t.child!==null){for(e=t.child,n=aa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=aa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function pL(e,t,n){switch(t.tag){case 3:VC(t),Sc();break;case 5:wC(t);break;case 1:as(t.type)&&mh(t);break;case 4:ev(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;ln(xh,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ln(Sn,Sn.current&1),t.flags|=128,null):n&t.child.childLanes?KC(e,t,n):(ln(Sn,Sn.current&1),e=bo(e,t,n),e!==null?e.sibling:null);ln(Sn,Sn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return qC(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ln(Sn,Sn.current),r)break;return null;case 22:case 23:return t.lanes=0,UC(e,t,n)}return bo(e,t,n)}var YC,bx,GC,XC;YC=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}};bx=function(){};GC=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Ja(Wi.current);var i=null;switch(n){case"input":s=Uy(e,s),r=Uy(e,r),i=[];break;case"select":s=jn({},s,{value:void 0}),r=jn({},r,{value:void 0}),i=[];break;case"textarea":s=Ky(e,s),r=Ky(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ph)}Yy(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"&&fn("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)}};XC=function(e,t,n,r){n!==r&&(t.flags|=4)};function Cu(e,t){if(!vn)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 _r(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 hL(e,t,n){var r=t.pendingProps;switch(qw(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _r(t),null;case 1:return as(t.type)&&hh(),_r(t),null;case 3:return r=t.stateNode,jc(),hn(os),hn(Ir),nv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(tp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ci!==null&&(Px(ci),ci=null))),bx(e,t),_r(t),null;case 5:tv(t);var s=Ja(Ed.current);if(n=t.type,e!==null&&t.stateNode!=null)GC(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ke(166));return _r(t),null}if(e=Ja(Wi.current),tp(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Fi]=t,r[jd]=i,e=(t.mode&1)!==0,n){case"dialog":fn("cancel",r),fn("close",r);break;case"iframe":case"object":case"embed":fn("load",r);break;case"video":case"audio":for(s=0;s<Hu.length;s++)fn(Hu[s],r);break;case"source":fn("error",r);break;case"img":case"image":case"link":fn("error",r),fn("load",r);break;case"details":fn("toggle",r);break;case"input":s0(r,i),fn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},fn("invalid",r);break;case"textarea":o0(r,i),fn("invalid",r)}Yy(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&&ep(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&ep(r.textContent,l,e),s=["children",""+l]):md.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&fn("scroll",r)}switch(n){case"input":Kf(r),i0(r,i,!0);break;case"textarea":Kf(r),a0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=ph)}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=N1(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[Fi]=t,e[jd]=r,YC(e,t,!1,!1),t.stateNode=e;e:{switch(a=Gy(n,r),n){case"dialog":fn("cancel",e),fn("close",e),s=r;break;case"iframe":case"object":case"embed":fn("load",e),s=r;break;case"video":case"audio":for(s=0;s<Hu.length;s++)fn(Hu[s],e);s=r;break;case"source":fn("error",e),s=r;break;case"img":case"image":case"link":fn("error",e),fn("load",e),s=r;break;case"details":fn("toggle",e),s=r;break;case"input":s0(e,r),s=Uy(e,r),fn("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=jn({},r,{value:void 0}),fn("invalid",e);break;case"textarea":o0(e,r),s=Ky(e,r),fn("invalid",e);break;default:s=r}Yy(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?E1(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&j1(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"&&fn("scroll",e):c!=null&&Tw(e,i,c,a))}switch(n){case"input":Kf(e),i0(e,r,!1);break;case"textarea":Kf(e),a0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+fa(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?uc(e,!!r.multiple,i,!1):r.defaultValue!=null&&uc(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=ph)}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 _r(t),null;case 6:if(e&&t.stateNode!=null)XC(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ke(166));if(n=Ja(Ed.current),Ja(Wi.current),tp(t)){if(r=t.stateNode,n=t.memoizedProps,r[Fi]=t,(i=r.nodeValue!==n)&&(e=js,e!==null))switch(e.tag){case 3:ep(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ep(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Fi]=t,t.stateNode=r}return _r(t),null;case 13:if(hn(Sn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(vn&&Ss!==null&&t.mode&1&&!(t.flags&128))hC(),Sc(),t.flags|=98560,i=!1;else if(i=tp(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ke(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ke(317));i[Fi]=t}else Sc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;_r(t),i=!1}else ci!==null&&(Px(ci),ci=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||Sn.current&1?nr===0&&(nr=3):hv())),t.updateQueue!==null&&(t.flags|=4),_r(t),null);case 4:return jc(),bx(e,t),e===null&&Sd(t.stateNode.containerInfo),_r(t),null;case 10:return Jw(t.type._context),_r(t),null;case 17:return as(t.type)&&hh(),_r(t),null;case 19:if(hn(Sn),i=t.memoizedState,i===null)return _r(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Cu(i,!1);else{if(nr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=bh(e),a!==null){for(t.flags|=128,Cu(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 ln(Sn,Sn.current&1|2),t.child}e=e.sibling}i.tail!==null&&Bn()>Ec&&(t.flags|=128,r=!0,Cu(i,!1),t.lanes=4194304)}else{if(!r)if(e=bh(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Cu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!vn)return _r(t),null}else 2*Bn()-i.renderingStartTime>Ec&&n!==1073741824&&(t.flags|=128,r=!0,Cu(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=Bn(),t.sibling=null,n=Sn.current,ln(Sn,r?n&1|2:n&1),t):(_r(t),null);case 22:case 23:return pv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ws&1073741824&&(_r(t),t.subtreeFlags&6&&(t.flags|=8192)):_r(t),null;case 24:return null;case 25:return null}throw Error(ke(156,t.tag))}function mL(e,t){switch(qw(t),t.tag){case 1:return as(t.type)&&hh(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jc(),hn(os),hn(Ir),nv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return tv(t),null;case 13:if(hn(Sn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ke(340));Sc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return hn(Sn),null;case 4:return jc(),null;case 10:return Jw(t.type._context),null;case 22:case 23:return pv(),null;case 24:return null;default:return null}}var sp=!1,Pr=!1,gL=typeof WeakSet=="function"?WeakSet:Set,Fe=null;function tc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Tn(e,t,r)}else n.current=null}function kx(e,t,n){try{n()}catch(r){Tn(e,t,r)}}var X0=!1;function yL(e,t){if(ix=uh,e=tC(),Vw(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(ox={focusedElem:e,selectionRange:n},uh=!1,Fe=t;Fe!==null;)if(t=Fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Fe=e;else for(;Fe!==null;){t=Fe;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var k=y.memoizedProps,b=y.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?k:oi(t.type,k),b);g.__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(ke(163))}}catch(j){Tn(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,Fe=e;break}Fe=t.return}return y=X0,X0=!1,y}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&&kx(t,n,i)}s=s.next}while(s!==r)}}function vm(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 Sx(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 JC(e){var t=e.alternate;t!==null&&(e.alternate=null,JC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Fi],delete t[jd],delete t[cx],delete t[ZR],delete t[eL])),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 QC(e){return e.tag===5||e.tag===3||e.tag===4}function J0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||QC(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 Nx(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=ph));else if(r!==4&&(e=e.child,e!==null))for(Nx(e,t,n),e=e.sibling;e!==null;)Nx(e,t,n),e=e.sibling}function jx(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(jx(e,t,n),e=e.sibling;e!==null;)jx(e,t,n),e=e.sibling}var yr=null,ai=!1;function Do(e,t,n){for(n=n.child;n!==null;)ZC(e,t,n),n=n.sibling}function ZC(e,t,n){if(Ui&&typeof Ui.onCommitFiberUnmount=="function")try{Ui.onCommitFiberUnmount(fm,n)}catch{}switch(n.tag){case 5:Pr||tc(n,t);case 6:var r=yr,s=ai;yr=null,Do(e,t,n),yr=r,ai=s,yr!==null&&(ai?(e=yr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):yr.removeChild(n.stateNode));break;case 18:yr!==null&&(ai?(e=yr,n=n.stateNode,e.nodeType===8?Og(e.parentNode,n):e.nodeType===1&&Og(e,n),vd(e)):Og(yr,n.stateNode));break;case 4:r=yr,s=ai,yr=n.stateNode.containerInfo,ai=!0,Do(e,t,n),yr=r,ai=s;break;case 0:case 11:case 14:case 15:if(!Pr&&(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)&&kx(n,t,a),s=s.next}while(s!==r)}Do(e,t,n);break;case 1:if(!Pr&&(tc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Tn(n,t,l)}Do(e,t,n);break;case 21:Do(e,t,n);break;case 22:n.mode&1?(Pr=(r=Pr)||n.memoizedState!==null,Do(e,t,n),Pr=r):Do(e,t,n);break;default:Do(e,t,n)}}function Q0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gL),t.forEach(function(r){var s=CL.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function si(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:yr=l.stateNode,ai=!1;break e;case 3:yr=l.stateNode.containerInfo,ai=!0;break e;case 4:yr=l.stateNode.containerInfo,ai=!0;break e}l=l.return}if(yr===null)throw Error(ke(160));ZC(i,a,s),yr=null,ai=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(d){Tn(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)eE(t,e),t=t.sibling}function eE(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(si(t,e),Li(e),r&4){try{td(3,e,e.return),vm(3,e)}catch(k){Tn(e,e.return,k)}try{td(5,e,e.return)}catch(k){Tn(e,e.return,k)}}break;case 1:si(t,e),Li(e),r&512&&n!==null&&tc(n,n.return);break;case 5:if(si(t,e),Li(e),r&512&&n!==null&&tc(n,n.return),e.flags&32){var s=e.stateNode;try{gd(s,"")}catch(k){Tn(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&&k1(s,i),Gy(l,a);var d=Gy(l,i);for(a=0;a<c.length;a+=2){var u=c[a],f=c[a+1];u==="style"?E1(s,f):u==="dangerouslySetInnerHTML"?j1(s,f):u==="children"?gd(s,f):Tw(s,u,f,d)}switch(l){case"input":Wy(s,i);break;case"textarea":S1(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?uc(s,!!i.multiple,h,!1):p!==!!i.multiple&&(i.defaultValue!=null?uc(s,!!i.multiple,i.defaultValue,!0):uc(s,!!i.multiple,i.multiple?[]:"",!1))}s[jd]=i}catch(k){Tn(e,e.return,k)}}break;case 6:if(si(t,e),Li(e),r&4){if(e.stateNode===null)throw Error(ke(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(k){Tn(e,e.return,k)}}break;case 3:if(si(t,e),Li(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{vd(t.containerInfo)}catch(k){Tn(e,e.return,k)}break;case 4:si(t,e),Li(e);break;case 13:si(t,e),Li(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(dv=Bn())),r&4&&Q0(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(Pr=(d=Pr)||u,si(t,e),Pr=d):si(t,e),Li(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(Fe=e,u=e.child;u!==null;){for(f=Fe=u;Fe!==null;){switch(p=Fe,h=p.child,p.tag){case 0:case 11:case 14:case 15:td(4,p,p.return);break;case 1:tc(p,p.return);var y=p.stateNode;if(typeof y.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(k){Tn(r,n,k)}}break;case 5:tc(p,p.return);break;case 22:if(p.memoizedState!==null){ek(f);continue}}h!==null?(h.return=p,Fe=h):ek(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=C1("display",a))}catch(k){Tn(e,e.return,k)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(k){Tn(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:si(t,e),Li(e),r&4&&Q0(e);break;case 21:break;default:si(t,e),Li(e)}}function Li(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(QC(n)){var r=n;break e}n=n.return}throw Error(ke(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(gd(s,""),r.flags&=-33);var i=J0(e);jx(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=J0(e);Nx(e,l,a);break;default:throw Error(ke(161))}}catch(c){Tn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xL(e,t,n){Fe=e,tE(e)}function tE(e,t,n){for(var r=(e.mode&1)!==0;Fe!==null;){var s=Fe,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||sp;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Pr;l=sp;var d=Pr;if(sp=a,(Pr=c)&&!d)for(Fe=s;Fe!==null;)a=Fe,c=a.child,a.tag===22&&a.memoizedState!==null?tk(s):c!==null?(c.return=a,Fe=c):tk(s);for(;i!==null;)Fe=i,tE(i),i=i.sibling;Fe=s,sp=l,Pr=d}Z0(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Fe=i):Z0(e)}}function Z0(e){for(;Fe!==null;){var t=Fe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Pr||vm(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Pr)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:oi(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&$0(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}$0(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(ke(163))}Pr||t.flags&512&&Sx(t)}catch(p){Tn(t,t.return,p)}}if(t===e){Fe=null;break}if(n=t.sibling,n!==null){n.return=t.return,Fe=n;break}Fe=t.return}}function ek(e){for(;Fe!==null;){var t=Fe;if(t===e){Fe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Fe=n;break}Fe=t.return}}function tk(e){for(;Fe!==null;){var t=Fe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{vm(4,t)}catch(c){Tn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){Tn(t,s,c)}}var i=t.return;try{Sx(t)}catch(c){Tn(t,i,c)}break;case 5:var a=t.return;try{Sx(t)}catch(c){Tn(t,a,c)}}}catch(c){Tn(t,t.return,c)}if(t===e){Fe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Fe=l;break}Fe=t.return}}var wL=Math.ceil,Nh=jo.ReactCurrentDispatcher,cv=jo.ReactCurrentOwner,Ws=jo.ReactCurrentBatchConfig,Dt=0,lr=null,Yn=null,xr=0,ws=0,nc=ba(0),nr=0,Id=null,ll=0,bm=0,uv=0,nd=null,Zr=null,dv=0,Ec=1/0,lo=null,jh=!1,Cx=null,ia=null,ip=!1,Jo=null,Ch=0,rd=0,Ex=null,Wp=-1,Vp=0;function Br(){return Dt&6?Bn():Wp!==-1?Wp:Wp=Bn()}function oa(e){return e.mode&1?Dt&2&&xr!==0?xr&-xr:nL.transition!==null?(Vp===0&&(Vp=F1()),Vp):(e=Kt,e!==0||(e=window.event,e=e===void 0?16:K1(e.type)),e):1}function mi(e,t,n,r){if(50<rd)throw rd=0,Ex=null,Error(ke(185));tf(e,n,r),(!(Dt&2)||e!==lr)&&(e===lr&&(!(Dt&2)&&(bm|=n),nr===4&&Yo(e,xr)),ls(e,r),n===1&&Dt===0&&!(t.mode&1)&&(Ec=Bn()+500,ym&&ka()))}function ls(e,t){var n=e.callbackNode;nR(e,t);var r=ch(e,e===lr?xr:0);if(r===0)n!==null&&u0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&u0(n),t===1)e.tag===0?tL(nk.bind(null,e)):dC(nk.bind(null,e)),JR(function(){!(Dt&6)&&ka()}),n=null;else{switch(z1(r)){case 1:n=$w;break;case 4:n=$1;break;case 16:n=lh;break;case 536870912:n=D1;break;default:n=lh}n=cE(n,nE.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function nE(e,t){if(Wp=-1,Vp=0,Dt&6)throw Error(ke(327));var n=e.callbackNode;if(mc()&&e.callbackNode!==n)return null;var r=ch(e,e===lr?xr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Eh(e,r);else{t=r;var s=Dt;Dt|=2;var i=sE();(lr!==e||xr!==t)&&(lo=null,Ec=Bn()+500,Za(e,t));do try{kL();break}catch(l){rE(e,l)}while(!0);Xw(),Nh.current=i,Dt=s,Yn!==null?t=0:(lr=null,xr=0,t=nr)}if(t!==0){if(t===2&&(s=ex(e),s!==0&&(r=s,t=_x(e,s))),t===1)throw n=Id,Za(e,0),Yo(e,r),ls(e,Bn()),n;if(t===6)Yo(e,r);else{if(s=e.current.alternate,!(r&30)&&!vL(s)&&(t=Eh(e,r),t===2&&(i=ex(e),i!==0&&(r=i,t=_x(e,i))),t===1))throw n=Id,Za(e,0),Yo(e,r),ls(e,Bn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(ke(345));case 2:Ka(e,Zr,lo);break;case 3:if(Yo(e,r),(r&130023424)===r&&(t=dv+500-Bn(),10<t)){if(ch(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Br(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=lx(Ka.bind(null,e,Zr,lo),t);break}Ka(e,Zr,lo);break;case 4:if(Yo(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-hi(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=Bn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wL(r/1960))-r,10<r){e.timeoutHandle=lx(Ka.bind(null,e,Zr,lo),r);break}Ka(e,Zr,lo);break;case 5:Ka(e,Zr,lo);break;default:throw Error(ke(329))}}}return ls(e,Bn()),e.callbackNode===n?nE.bind(null,e):null}function _x(e,t){var n=nd;return e.current.memoizedState.isDehydrated&&(Za(e,t).flags|=256),e=Eh(e,t),e!==2&&(t=Zr,Zr=n,t!==null&&Px(t)),e}function Px(e){Zr===null?Zr=e:Zr.push.apply(Zr,e)}function vL(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(!gi(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 Yo(e,t){for(t&=~uv,t&=~bm,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-hi(t),r=1<<n;e[n]=-1,t&=~r}}function nk(e){if(Dt&6)throw Error(ke(327));mc();var t=ch(e,0);if(!(t&1))return ls(e,Bn()),null;var n=Eh(e,t);if(e.tag!==0&&n===2){var r=ex(e);r!==0&&(t=r,n=_x(e,r))}if(n===1)throw n=Id,Za(e,0),Yo(e,t),ls(e,Bn()),n;if(n===6)throw Error(ke(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ka(e,Zr,lo),ls(e,Bn()),null}function fv(e,t){var n=Dt;Dt|=1;try{return e(t)}finally{Dt=n,Dt===0&&(Ec=Bn()+500,ym&&ka())}}function cl(e){Jo!==null&&Jo.tag===0&&!(Dt&6)&&mc();var t=Dt;Dt|=1;var n=Ws.transition,r=Kt;try{if(Ws.transition=null,Kt=1,e)return e()}finally{Kt=r,Ws.transition=n,Dt=t,!(Dt&6)&&ka()}}function pv(){ws=nc.current,hn(nc)}function Za(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,XR(n)),Yn!==null)for(n=Yn.return;n!==null;){var r=n;switch(qw(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&hh();break;case 3:jc(),hn(os),hn(Ir),nv();break;case 5:tv(r);break;case 4:jc();break;case 13:hn(Sn);break;case 19:hn(Sn);break;case 10:Jw(r.type._context);break;case 22:case 23:pv()}n=n.return}if(lr=e,Yn=e=aa(e.current,null),xr=ws=t,nr=0,Id=null,uv=bm=ll=0,Zr=nd=null,Xa!==null){for(t=0;t<Xa.length;t++)if(n=Xa[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}Xa=null}return e}function rE(e,t){do{var n=Yn;try{if(Xw(),Bp.current=Sh,kh){for(var r=Nn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}kh=!1}if(al=0,or=er=Nn=null,ed=!1,_d=0,cv.current=null,n===null||n.return===null){nr=1,Id=t,Yn=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=xr,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=U0(a);if(h!==null){h.flags&=-257,W0(h,a,l,i,t),h.mode&1&&H0(i,d,t),t=h,c=d;var y=t.updateQueue;if(y===null){var k=new Set;k.add(c),t.updateQueue=k}else y.add(c);break e}else{if(!(t&1)){H0(i,d,t),hv();break e}c=Error(ke(426))}}else if(vn&&l.mode&1){var b=U0(a);if(b!==null){!(b.flags&65536)&&(b.flags|=256),W0(b,a,l,i,t),Yw(Cc(c,l));break e}}i=c=Cc(c,l),nr!==4&&(nr=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 g=zC(i,c,t);M0(i,g);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"&&(ia===null||!ia.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var j=BC(i,l,t);M0(i,j);break e}}i=i.return}while(i!==null)}oE(n)}catch(E){t=E,Yn===n&&n!==null&&(Yn=n=n.return);continue}break}while(!0)}function sE(){var e=Nh.current;return Nh.current=Sh,e===null?Sh:e}function hv(){(nr===0||nr===3||nr===2)&&(nr=4),lr===null||!(ll&268435455)&&!(bm&268435455)||Yo(lr,xr)}function Eh(e,t){var n=Dt;Dt|=2;var r=sE();(lr!==e||xr!==t)&&(lo=null,Za(e,t));do try{bL();break}catch(s){rE(e,s)}while(!0);if(Xw(),Dt=n,Nh.current=r,Yn!==null)throw Error(ke(261));return lr=null,xr=0,nr}function bL(){for(;Yn!==null;)iE(Yn)}function kL(){for(;Yn!==null&&!q2();)iE(Yn)}function iE(e){var t=lE(e.alternate,e,ws);e.memoizedProps=e.pendingProps,t===null?oE(e):Yn=t,cv.current=null}function oE(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=mL(n,t),n!==null){n.flags&=32767,Yn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{nr=6,Yn=null;return}}else if(n=hL(n,t,ws),n!==null){Yn=n;return}if(t=t.sibling,t!==null){Yn=t;return}Yn=t=e}while(t!==null);nr===0&&(nr=5)}function Ka(e,t,n){var r=Kt,s=Ws.transition;try{Ws.transition=null,Kt=1,SL(e,t,n,r)}finally{Ws.transition=s,Kt=r}return null}function SL(e,t,n,r){do mc();while(Jo!==null);if(Dt&6)throw Error(ke(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ke(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(rR(e,i),e===lr&&(Yn=lr=null,xr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ip||(ip=!0,cE(lh,function(){return mc(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Ws.transition,Ws.transition=null;var a=Kt;Kt=1;var l=Dt;Dt|=4,cv.current=null,yL(e,n),eE(n,e),UR(ox),uh=!!ix,ox=ix=null,e.current=n,xL(n),Y2(),Dt=l,Kt=a,Ws.transition=i}else e.current=n;if(ip&&(ip=!1,Jo=e,Ch=s),i=e.pendingLanes,i===0&&(ia=null),J2(n.stateNode),ls(e,Bn()),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(jh)throw jh=!1,e=Cx,Cx=null,e;return Ch&1&&e.tag!==0&&mc(),i=e.pendingLanes,i&1?e===Ex?rd++:(rd=0,Ex=e):rd=0,ka(),null}function mc(){if(Jo!==null){var e=z1(Ch),t=Ws.transition,n=Kt;try{if(Ws.transition=null,Kt=16>e?16:e,Jo===null)var r=!1;else{if(e=Jo,Jo=null,Ch=0,Dt&6)throw Error(ke(331));var s=Dt;for(Dt|=4,Fe=e.current;Fe!==null;){var i=Fe,a=i.child;if(Fe.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(Fe=d;Fe!==null;){var u=Fe;switch(u.tag){case 0:case 11:case 15:td(8,u,i)}var f=u.child;if(f!==null)f.return=u,Fe=f;else for(;Fe!==null;){u=Fe;var p=u.sibling,h=u.return;if(JC(u),u===d){Fe=null;break}if(p!==null){p.return=h,Fe=p;break}Fe=h}}}var y=i.alternate;if(y!==null){var k=y.child;if(k!==null){y.child=null;do{var b=k.sibling;k.sibling=null,k=b}while(k!==null)}}Fe=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,Fe=a;else e:for(;Fe!==null;){if(i=Fe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:td(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Fe=g;break e}Fe=i.return}}var v=e.current;for(Fe=v;Fe!==null;){a=Fe;var w=a.child;if(a.subtreeFlags&2064&&w!==null)w.return=a,Fe=w;else e:for(a=v;Fe!==null;){if(l=Fe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:vm(9,l)}}catch(E){Tn(l,l.return,E)}if(l===a){Fe=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,Fe=j;break e}Fe=l.return}}if(Dt=s,ka(),Ui&&typeof Ui.onPostCommitFiberRoot=="function")try{Ui.onPostCommitFiberRoot(fm,e)}catch{}r=!0}return r}finally{Kt=n,Ws.transition=t}}return!1}function rk(e,t,n){t=Cc(n,t),t=zC(e,t,1),e=sa(e,t,1),t=Br(),e!==null&&(tf(e,1,t),ls(e,t))}function Tn(e,t,n){if(e.tag===3)rk(e,e,n);else for(;t!==null;){if(t.tag===3){rk(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ia===null||!ia.has(r))){e=Cc(n,e),e=BC(t,e,1),t=sa(t,e,1),e=Br(),t!==null&&(tf(t,1,e),ls(t,e));break}}t=t.return}}function NL(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Br(),e.pingedLanes|=e.suspendedLanes&n,lr===e&&(xr&n)===n&&(nr===4||nr===3&&(xr&130023424)===xr&&500>Bn()-dv?Za(e,0):uv|=n),ls(e,t)}function aE(e,t){t===0&&(e.mode&1?(t=Gf,Gf<<=1,!(Gf&130023424)&&(Gf=4194304)):t=1);var n=Br();e=vo(e,t),e!==null&&(tf(e,t,n),ls(e,n))}function jL(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),aE(e,n)}function CL(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ke(314))}r!==null&&r.delete(t),aE(e,n)}var lE;lE=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||os.current)ts=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ts=!1,pL(e,t,n);ts=!!(e.flags&131072)}else ts=!1,vn&&t.flags&1048576&&fC(t,yh,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Up(e,t),e=t.pendingProps;var s=kc(t,Ir.current);hc(t,n),s=sv(null,t,r,e,s,n);var i=iv();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,as(r)?(i=!0,mh(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Zw(t),s.updater=wm,t.stateNode=s,s._reactInternals=t,mx(t,r,e,n),t=xx(null,t,r,!0,i,n)):(t.tag=0,vn&&i&&Kw(t),Fr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Up(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=_L(r),e=oi(r,e),s){case 0:t=yx(null,t,r,e,n);break e;case 1:t=q0(null,t,r,e,n);break e;case 11:t=V0(null,t,r,e,n);break e;case 14:t=K0(null,t,r,oi(r.type,e),n);break e}throw Error(ke(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:oi(r,s),yx(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:oi(r,s),q0(e,t,r,s,n);case 3:e:{if(VC(t),e===null)throw Error(ke(387));r=t.pendingProps,i=t.memoizedState,s=i.element,xC(e,t),vh(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=Cc(Error(ke(423)),t),t=Y0(e,t,r,n,s);break e}else if(r!==s){s=Cc(Error(ke(424)),t),t=Y0(e,t,r,n,s);break e}else for(Ss=ra(t.stateNode.containerInfo.firstChild),js=t,vn=!0,ci=null,n=gC(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Sc(),r===s){t=bo(e,t,n);break e}Fr(e,t,r,n)}t=t.child}return t;case 5:return wC(t),e===null&&fx(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,ax(r,s)?a=null:i!==null&&ax(r,i)&&(t.flags|=32),WC(e,t),Fr(e,t,a,n),t.child;case 6:return e===null&&fx(t),null;case 13:return KC(e,t,n);case 4:return ev(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Nc(t,null,r,n):Fr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:oi(r,s),V0(e,t,r,s,n);case 7:return Fr(e,t,t.pendingProps,n),t.child;case 8:return Fr(e,t,t.pendingProps.children,n),t.child;case 12:return Fr(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,ln(xh,r._currentValue),r._currentValue=a,i!==null)if(gi(i.value,a)){if(i.children===s.children&&!os.current){t=bo(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=yo(-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),px(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(ke(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),px(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}Fr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,hc(t,n),s=Vs(s),r=r(s),t.flags|=1,Fr(e,t,r,n),t.child;case 14:return r=t.type,s=oi(r,t.pendingProps),s=oi(r.type,s),K0(e,t,r,s,n);case 15:return HC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:oi(r,s),Up(e,t),t.tag=1,as(r)?(e=!0,mh(t)):e=!1,hc(t,n),FC(t,r,s),mx(t,r,s,n),xx(null,t,r,!0,e,n);case 19:return qC(e,t,n);case 22:return UC(e,t,n)}throw Error(ke(156,t.tag))};function cE(e,t){return M1(e,t)}function EL(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 Us(e,t,n,r){return new EL(e,t,n,r)}function mv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _L(e){if(typeof e=="function")return mv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Lw)return 11;if(e===Ow)return 14}return 2}function aa(e,t){var n=e.alternate;return n===null?(n=Us(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 Kp(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")mv(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Kl:return el(n.children,s,i,t);case Rw:a=8,s|=8;break;case Fy:return e=Us(12,n,t,s|2),e.elementType=Fy,e.lanes=i,e;case zy:return e=Us(13,n,t,s),e.elementType=zy,e.lanes=i,e;case By:return e=Us(19,n,t,s),e.elementType=By,e.lanes=i,e;case w1:return km(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case y1:a=10;break e;case x1:a=9;break e;case Lw:a=11;break e;case Ow:a=14;break e;case Wo:a=16,r=null;break e}throw Error(ke(130,e==null?e:typeof e,""))}return t=Us(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function el(e,t,n,r){return e=Us(7,e,r,t),e.lanes=n,e}function km(e,t,n,r){return e=Us(22,e,r,t),e.elementType=w1,e.lanes=n,e.stateNode={isHidden:!1},e}function Ug(e,t,n){return e=Us(6,e,null,t),e.lanes=n,e}function Wg(e,t,n){return t=Us(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function PL(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=Ng(0),this.expirationTimes=Ng(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ng(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function gv(e,t,n,r,s,i,a,l,c){return e=new PL(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Us(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zw(i),e}function AL(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Vl,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function uE(e){if(!e)return pa;e=e._reactInternals;e:{if(yl(e)!==e||e.tag!==1)throw Error(ke(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(as(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ke(171))}if(e.tag===1){var n=e.type;if(as(n))return uC(e,n,t)}return t}function dE(e,t,n,r,s,i,a,l,c){return e=gv(n,r,!0,e,s,i,a,l,c),e.context=uE(null),n=e.current,r=Br(),s=oa(n),i=yo(r,s),i.callback=t??null,sa(n,i,s),e.current.lanes=s,tf(e,s,r),ls(e,r),e}function Sm(e,t,n,r){var s=t.current,i=Br(),a=oa(s);return n=uE(n),t.context===null?t.context=n:t.pendingContext=n,t=yo(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=sa(s,t,a),e!==null&&(mi(e,s,a,i),zp(e,s,a)),a}function _h(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 sk(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function yv(e,t){sk(e,t),(e=e.alternate)&&sk(e,t)}function IL(){return null}var fE=typeof reportError=="function"?reportError:function(e){console.error(e)};function xv(e){this._internalRoot=e}Nm.prototype.render=xv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ke(409));Sm(e,t,null,null)};Nm.prototype.unmount=xv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cl(function(){Sm(null,e,null,null)}),t[wo]=null}};function Nm(e){this._internalRoot=e}Nm.prototype.unstable_scheduleHydration=function(e){if(e){var t=U1();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&&V1(e)}};function wv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function jm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function ik(){}function TL(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var d=_h(a);i.call(d)}}var a=dE(t,r,e,0,null,!1,!1,"",ik);return e._reactRootContainer=a,e[wo]=a.current,Sd(e.nodeType===8?e.parentNode:e),cl(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=_h(c);l.call(d)}}var c=gv(e,0,!1,null,null,!1,!1,"",ik);return e._reactRootContainer=c,e[wo]=c.current,Sd(e.nodeType===8?e.parentNode:e),cl(function(){Sm(t,c,n,r)}),c}function Cm(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=_h(a);l.call(c)}}Sm(t,a,e,s)}else a=TL(n,t,e,s,r);return _h(a)}B1=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Bu(t.pendingLanes);n!==0&&(Dw(t,n|1),ls(t,Bn()),!(Dt&6)&&(Ec=Bn()+500,ka()))}break;case 13:cl(function(){var r=vo(e,1);if(r!==null){var s=Br();mi(r,e,1,s)}}),yv(e,1)}};Fw=function(e){if(e.tag===13){var t=vo(e,134217728);if(t!==null){var n=Br();mi(t,e,134217728,n)}yv(e,134217728)}};H1=function(e){if(e.tag===13){var t=oa(e),n=vo(e,t);if(n!==null){var r=Br();mi(n,e,t,r)}yv(e,t)}};U1=function(){return Kt};W1=function(e,t){var n=Kt;try{return Kt=e,t()}finally{Kt=n}};Jy=function(e,t,n){switch(t){case"input":if(Wy(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=gm(r);if(!s)throw Error(ke(90));b1(r),Wy(r,s)}}}break;case"textarea":S1(e,n);break;case"select":t=n.value,t!=null&&uc(e,!!n.multiple,t,!1)}};A1=fv;I1=cl;var RL={usingClientEntryPoint:!1,Events:[rf,Xl,gm,_1,P1,fv]},Eu={findFiberByHostInstance:Ga,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},LL={bundleType:Eu.bundleType,version:Eu.version,rendererPackageName:Eu.rendererPackageName,rendererConfig:Eu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:jo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=L1(e),e===null?null:e.stateNode},findFiberByHostInstance:Eu.findFiberByHostInstance||IL,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 op=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!op.isDisabled&&op.supportsFiber)try{fm=op.inject(LL),Ui=op}catch{}}Ps.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=RL;Ps.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wv(t))throw Error(ke(200));return AL(e,t,null,n)};Ps.createRoot=function(e,t){if(!wv(e))throw Error(ke(299));var n=!1,r="",s=fE;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=gv(e,1,!1,null,null,n,!1,r,s),e[wo]=t.current,Sd(e.nodeType===8?e.parentNode:e),new xv(t)};Ps.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ke(188)):(e=Object.keys(e).join(","),Error(ke(268,e)));return e=L1(t),e=e===null?null:e.stateNode,e};Ps.flushSync=function(e){return cl(e)};Ps.hydrate=function(e,t,n){if(!jm(t))throw Error(ke(200));return Cm(null,e,t,!0,n)};Ps.hydrateRoot=function(e,t,n){if(!wv(e))throw Error(ke(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=fE;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=dE(t,null,e,1,n??null,s,!1,i,a),e[wo]=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 Nm(t)};Ps.render=function(e,t,n){if(!jm(t))throw Error(ke(200));return Cm(null,e,t,!1,n)};Ps.unmountComponentAtNode=function(e){if(!jm(e))throw Error(ke(40));return e._reactRootContainer?(cl(function(){Cm(null,null,e,!1,function(){e._reactRootContainer=null,e[wo]=null})}),!0):!1};Ps.unstable_batchedUpdates=fv;Ps.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!jm(n))throw Error(ke(200));if(e==null||e._reactInternals===void 0)throw Error(ke(38));return Cm(e,t,n,!1,r)};Ps.version="18.3.1-next-f1338f8080-20240426";function pE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(pE)}catch(e){console.error(e)}}pE(),p1.exports=Ps;var es=p1.exports,ok=es;$y.createRoot=ok.createRoot,$y.hydrateRoot=ok.hydrateRoot;const hE=m.createContext(null);function Ax(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function OL(){const e=Ax(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function ML({children:e}){const[t,n]=m.useState(OL);m.useEffect(()=>{const i=()=>n(Ax(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=Ax(l.pathname),d=l.search||"";window.history.pushState({},"",c+d),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(hE.Provider,{value:s,children:e})}function xl(){const e=m.useContext(hE);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function $L(){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 ak={};function Ix(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&ak[t[0]]||(typeof t[0]=="string"&&(ak[t[0]]=new Date),$L(...t))}const mE=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function lk(e,t,n){e.loadNamespaces(t,mE(e,n))}function ck(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,mE(e,r))}function DL(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 FL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Ix("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}}):DL(e,t,n)}const zL=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,BL={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},HL=e=>BL[e],UL=e=>e.replace(zL,HL);let Tx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:UL};function WL(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Tx={...Tx,...e}}function VL(){return Tx}let gE;function KL(e){gE=e}function qL(){return gE}const YL={type:"3rdParty",init(e){WL(e.options.react),KL(e)}},GL=m.createContext();class XL{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const JL=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function un(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(GL)||{},i=n||r||qL();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new XL),!i){Ix("You will need to pass in an i18next instance by using initReactI18next");const w=(E,S)=>typeof S=="string"?S:S&&typeof S=="object"&&typeof S.defaultValue=="string"?S.defaultValue:Array.isArray(E)?E[E.length-1]:E,j=[w,{},!1];return j.t=w,j.i18n={},j.ready=!1,j}i.options.react&&i.options.react.wait!==void 0&&Ix("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...VL(),...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=>FL(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 y=d.join();t.lng&&(y=`${t.lng}${y}`);const k=JL(y),b=m.useRef(!0);m.useEffect(()=>{const{bindI18n:w,bindI18nStore:j}=a;b.current=!0,!u&&!l&&(t.lng?ck(i,t.lng,d,()=>{b.current&&h(f)}):lk(i,d,()=>{b.current&&h(f)})),u&&k&&k!==y&&b.current&&h(f);function E(){b.current&&h(f)}return w&&i&&i.on(w,E),j&&i&&i.store.on(j,E),()=>{b.current=!1,w&&i&&w.split(" ").forEach(S=>i.off(S,E)),j&&i&&j.split(" ").forEach(S=>i.store.off(S,E))}},[i,y]);const g=m.useRef(!0);m.useEffect(()=>{b.current&&!g.current&&h(f),g.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?ck(i,t.lng,d,()=>w()):lk(i,d,()=>w())})}const yE="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",QL=[{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"}],ZL=[{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 eO(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function tO({authUser:e,onLogout:t}){const{path:n,navigate:r}=xl(),{t:s}=un(),[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:yE,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:QL.map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(eO(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&&ZL.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 xE="agentflow.pipelineRecent",nO=50,rO=15;function sO(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function wE(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(xE);return e?sO(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 ap(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=wE(),i=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(a=>!(a.flowId===e&&a.flowSource===t))].slice(0,nO);try{localStorage.setItem(xE,JSON.stringify(i))}catch{}}function iO(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 Rx(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 oO(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 aO(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:iO(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,rO)}var vs=Uint8Array,rc=Uint16Array,lO=Int32Array,vE=new vs([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]),bE=new vs([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]),cO=new vs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kE=function(e,t){for(var n=new rc(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new lO(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}},SE=kE(vE,2),NE=SE.b,uO=SE.r;NE[28]=258,uO[258]=28;var dO=kE(bE,0),fO=dO.b,Lx=new rc(32768);for(var pn=0;pn<32768;++pn){var Fo=(pn&43690)>>1|(pn&21845)<<1;Fo=(Fo&52428)>>2|(Fo&13107)<<2,Fo=(Fo&61680)>>4|(Fo&3855)<<4,Lx[pn]=((Fo&65280)>>8|(Fo&255)<<8)>>1}var sd=function(e,t,n){for(var r=e.length,s=0,i=new rc(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new rc(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new rc(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[Lx[f]>>c]=d}else for(l=new rc(r),s=0;s<r;++s)e[s]&&(l[s]=Lx[a[e[s]-1]++]>>15-e[s]);return l},of=new vs(288);for(var pn=0;pn<144;++pn)of[pn]=8;for(var pn=144;pn<256;++pn)of[pn]=9;for(var pn=256;pn<280;++pn)of[pn]=7;for(var pn=280;pn<288;++pn)of[pn]=8;var jE=new vs(32);for(var pn=0;pn<32;++pn)jE[pn]=5;var pO=sd(of,9,1),hO=sd(jE,5,1),Vg=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ii=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Kg=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},mO=function(e){return(e+7)/8|0},vv=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new vs(e.subarray(t,n))},gO=["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"],Ds=function(e,t,n){var r=new Error(t||gO[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ds),!n)throw r;return r},yO=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new vs(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new vs(s*3));var d=function(fe){var ye=n.length;if(fe>ye){var je=new vs(Math.max(ye*2,fe));je.set(n),n=je}},u=t.f||0,f=t.p||0,p=t.b||0,h=t.l,y=t.d,k=t.m,b=t.n,g=s*8;do{if(!h){u=ii(e,f,1);var v=ii(e,f+1,3);if(f+=3,v)if(v==1)h=pO,y=hO,k=9,b=5;else if(v==2){var S=ii(e,f,31)+257,A=ii(e,f+10,15)+4,R=S+ii(e,f+5,31)+1;f+=14;for(var M=new vs(R),W=new vs(19),D=0;D<A;++D)W[cO[D]]=ii(e,f+D*3,7);f+=A*3;for(var O=Vg(W),K=(1<<O)-1,$=sd(W,O,1),D=0;D<R;){var L=$[ii(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+ii(e,f,3),f+=2,I=M[D-1]):w==17?(z=3+ii(e,f,7),f+=3):w==18&&(z=11+ii(e,f,127),f+=7);z--;)M[D++]=I}}var _=M.subarray(0,S),T=M.subarray(S);k=Vg(_),b=Vg(T),h=sd(_,k,1),y=sd(T,b,1)}else Ds(1);else{var w=mO(f)+4,j=e[w-4]|e[w-3]<<8,E=w+j;if(E>s){c&&Ds(0);break}l&&d(p+j),n.set(e.subarray(w,E),p),t.b=p+=j,t.p=f=E*8,t.f=u;continue}if(f>g){c&&Ds(0);break}}l&&d(p+131072);for(var C=(1<<k)-1,J=(1<<b)-1,Z=f;;Z=f){var I=h[Kg(e,f)&C],H=I>>4;if(f+=I&15,f>g){c&&Ds(0);break}if(I||Ds(2),H<256)n[p++]=H;else if(H==256){Z=f,h=null;break}else{var te=H-254;if(H>264){var D=H-257,ae=vE[D];te=ii(e,f,(1<<ae)-1)+NE[D],f+=ae}var ce=y[Kg(e,f)&J],ue=ce>>4;ce||Ds(3),f+=ce&15;var T=fO[ue];if(ue>3){var ae=bE[ue];T+=Kg(e,f)&(1<<ae)-1,f+=ae}if(f>g){c&&Ds(0);break}l&&d(p+131072);var le=p+te;if(p<T){var de=i-T,se=Math.min(T,le);for(de+p<0&&Ds(3);p<se;++p)n[p]=r[de+p]}for(;p<le;++p)n[p]=n[p-T]}}t.l=h,t.p=Z,t.b=p,t.f=u,h&&(u=1,t.m=k,t.d=y,t.n=b)}while(!u);return p!=n.length&&a?vv(n,0,p):n.subarray(0,p)},xO=new vs(0),zi=function(e,t){return e[t]|e[t+1]<<8},ui=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},qg=function(e,t){return ui(e,t)+ui(e,t+4)*4294967296};function wO(e,t){return yO(e,{i:2},t&&t.out,t&&t.dictionary)}var Ox=typeof TextDecoder<"u"&&new TextDecoder,vO=0;try{Ox.decode(xO,{stream:!0}),vO=1}catch{}var bO=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:vv(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 kO(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(Ox)return Ox.decode(e);var s=bO(e),i=s.s,n=s.r;return n.length&&Ds(8),i}}var SO=function(e,t){return t+30+zi(e,t+26)+zi(e,t+28)},NO=function(e,t,n){var r=zi(e,t+28),s=kO(e.subarray(t+46,t+46+r),!(zi(e,t+8)&2048)),i=t+46+r,a=ui(e,t+20),l=n&&a==4294967295?jO(e,i):[a,ui(e,t+24),ui(e,t+42)],c=l[0],d=l[1],u=l[2];return[zi(e,t+10),c,d,s,i+zi(e,t+30)+zi(e,t+32),u]},jO=function(e,t){for(;zi(e,t)!=1;t+=4+zi(e,t+2));return[qg(e,t+12),qg(e,t+4),qg(e,t+20)]};function CO(e,t){for(var n={},r=e.length-22;ui(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Ds(13);var s=zi(e,r+8);if(!s)return{};var i=ui(e,r+16),a=i==4294967295||s==65535;if(a){var l=ui(e,r-12);a=ui(e,l)==101075792,a&&(s=ui(e,l+32),i=ui(e,l+48))}for(var c=0;c<s;++c){var d=NO(e,i,a),u=d[0],f=d[1],p=d[2],h=d[3],y=d[4],k=d[5],b=SO(e,k);i=y,u?u==8?n[h]=wO(e.subarray(b,b+f),{out:new vs(p)}):Ds(14,"unknown compression type "+u):n[h]=vv(e,b,b+f)}return n}const EO=8*1024*1024,_O=500;function PO(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 AO(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function IO(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 TO=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function RO(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=CO(t),r=new Map;let s=0,i=0;for(const[c,d]of Object.entries(n)){if(c.endsWith("/"))continue;const u=PO(c);if(!u||AO(u))continue;const f=(d==null?void 0:d.length)??0;if(s+=f,s>EO||(i+=1,i>_O))return null;r.set(u,f)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const d=IO(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 TO.test(l)?l:null}catch{return null}}const Yg=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function LO({file:e,onClose:t,onImported:n}){const{t:r}=un(),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,y]=m.useState(""),[k,b]=m.useState(null),g=k??e;m.useEffect(()=>{const E=requestAnimationFrame(()=>{var S;return(S=i.current)==null?void 0:S.focus()});return()=>cancelAnimationFrame(E)},[]),m.useEffect(()=>{let E=!1;return(async()=>{const S=g.name||"",A=S.toLowerCase();let R="";if(A.endsWith(".zip")){if(R=await RO(g)||"",!R){const M=S.replace(/\.zip$/i,"");Yg.test(M)&&(R=M)}}else if(A.endsWith(".yaml")||A.endsWith(".yml")){const M=S.replace(/\.ya?ml$/i,"");Yg.test(M)&&(R=M)}E||c(R)})(),()=>{E=!0}},[g]);const v=l.trim(),w=v.length>0&&Yg.test(v);async function j(E){if(E.preventDefault(),!(!w||f)){p(!0),y("");try{const S=new FormData;S.set("flowId",v),S.set("targetSpace",d),S.set("file",g,g.name);const A=await fetch("/api/flows/import",{method:"POST",body:S}),R=await A.json().catch(()=>({}));if(!A.ok){y(typeof R.error=="string"?R.error:r("project:importModal.importFailed"));return}n({id:R.flowId,source:R.flowSource??"user"})}catch(S){y(String((S==null?void 0:S.message)||S))}finally{p(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:E=>{E.target===E.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:E=>E.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:j,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:g.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:E=>{var A;const S=(A=E.target.files)==null?void 0:A[0];S&&b(S),E.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:E=>c(E.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 E;return(E=a.current)==null?void 0:E.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 OO=/^[a-zA-Z][a-zA-Z0-9_-]*$/,uk="af:newPipelineGuide";function MO({open:e,onClose:t,onCreated:n}){const{t:r}=un(),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),[y,k]=m.useState(""),[b,g]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),d(""),f("user"),k(""),h(!1),localStorage.getItem(uk)==="true"&&g(!0);const A=requestAnimationFrame(()=>{var R;return(R=i.current)==null?void 0:R.focus()});return()=>cancelAnimationFrame(A)},[e]);const v=()=>{localStorage.removeItem(uk),g(!1)};if(!e)return null;const w=a.trim(),j=w.length>0&&OO.test(w);async function E(S){if(S.preventDefault(),!(!j||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:E,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&&!j}),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]}),y?o.jsx("p",{className:"af-err af-new-pipeline-err",children:y}):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:!j||p,children:r(p?"project:newPipelineModal.creating":b?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const CE="agentflow.pipelineViewPreference";function EE(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function _E(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(CE)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function $O(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(CE,JSON.stringify(e))}catch{}}function Ph(e){return e==="pipeline"?"pipeline":"workspace"}function DO(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function PE(e,t,n,r=!1){if(!e)return;const s=_E();s[EE(e,t,r)]={view:Ph(n),at:Date.now()},$O(s)}function FO(e,t="workspace"){if(!(e!=null&&e.id))return Ph(t);const r=_E()[EE(e.id,e.source??"user",!!e.archived)],s=Ph((r==null?void 0:r.view)||t);return s==="pipeline"&&!DO(e)?"workspace":s}function bv(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"),`/${Ph(t)==="pipeline"?"flow":"workspace"}?${n.toString()}`}function lp(e,t="workspace"){return bv(e,FO(e,t))}function zO({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,y]=m.useState(""),[k,b]=m.useState(""),g=m.useCallback(async()=>{y("");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){y(String(S.message||S))}},[]);m.useEffect(()=>{g()},[g]);const v=m.useCallback(async()=>{const S=i.trim();if(S){p("search"),y(""),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){y(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}`),y(""),b("");try{const W=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(W)}),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 g(),typeof e=="function"&&await e()}catch(W){y(String(W.message||W))}finally{p("")}}},[g,e]),j=m.useCallback(async S=>{const A=String(S||"").trim();if(A){p(`uninstall:${A}`),y(""),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 g(),typeof e=="function"&&await e()}catch(R){y(String(R.message||R))}finally{p("")}}},[g,e]),E=m.useCallback(async()=>{p("update-cli"),y(""),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 g()}catch(S){y(String(S.message||S))}finally{p("")}},[g]);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:g,disabled:!!f,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:E,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:()=>j(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(W=>W.name===A||W.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 la(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 BO(e){return{version:1,collections:la({collections:e})}}function ha(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 AE(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 IE(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function TE(e,t,n){const r=ha(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 HO(e,t,n){const r=String(e||"").trim().toLowerCase(),s=la({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return ha(s,t)}function RE(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(d=>d.key).filter(Boolean),i=String(t||"").trim().toLowerCase(),a=la({collections:r}),l=HO(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(g=>f.has(g));if(s.length>0&&p.length===s.length)return c;const h=new Set(p),y=new Set(l),k=l.length>0&&l.every(g=>h.has(g)),b=a.some(g=>{if(!g.builtin||g.id===i||g.name.toLowerCase()===i)return!1;const v=ha(g,n);return v.length>0&&v.every(w=>h.has(w))});return l.length>0&&b&&!k?c:p}}}catch{}return c}function _u(e){return e==="secondary"?"af-proj-badge af-proj-badge--secondary":e==="primary"?"af-proj-badge af-proj-badge--primary":e==="muted"?"af-proj-badge af-proj-badge--muted":"af-proj-badge"}function UO(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 Mx(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 LE(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 WO="project:defaultCardDesc";function OE(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(WO)}function VO(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zn({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(`(${VO(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 KO(e,t,n){const r=[String(e.id),OE(e,n),LE(e),Mx(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
+
`).toLowerCase()}function qO(e,t,n){return t?KO(e,t,n).includes(t):!0}function YO(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 Gg(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
+
`).toLowerCase().includes(n):!0}function dk(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 fk(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const GO=["all","agent","control","provide","marketplace"],XO=["all","agent","control","provide"];function cp(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function wn(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 Pu(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function Ml({resourceKind:e=""}){var hs,Wn,ms,fr,Gs,jr,gs,ys;const{t}=un(),{navigate:n,path:r}=xl(),[s,i]=m.useState(e||"all"),[a,l]=m.useState([]),[c,d]=m.useState([]),[u,f]=m.useState([]),[p,h]=m.useState([]),[y,k]=m.useState([]),[b,g]=m.useState(""),[v,w]=m.useState(!1),[j,E]=m.useState([]),[S,A]=m.useState(""),[R,M]=m.useState(""),[W,D]=m.useState(!1),[O,K]=m.useState(!1),[$,L]=m.useState(!1),[I,z]=m.useState(null),[_,T]=m.useState(!1),[C,J]=m.useState(""),[Z,H]=m.useState(!0),[te,ae]=m.useState("all"),[ce,ue]=m.useState(""),[le,de]=m.useState("overview"),[se,fe]=m.useState({}),[ye,je]=m.useState(""),[He,lt]=m.useState({}),[Ge,Ct]=m.useState(""),[Me,Ce]=m.useState(""),[Gt,Hn]=m.useState({}),[Xt,Cn]=m.useState(""),[kr,cr]=m.useState(""),[oe,ge]=m.useState(""),[qe,it]=m.useState(!1),tt=m.useRef(0),It=m.useRef(0),Ln=m.useCallback(async()=>{const q=++It.current;A("");try{const ve=await fetch("/api/flows");if(q!==It.current)return;if(!ve.ok)throw new Error("HTTP "+ve.status);const Le=await ve.json();if(q!==It.current)return;l(Array.isArray(Le)?Le:[])}catch(ve){if(q!==It.current)return;l([]),A(String(ve.message||ve))}try{const ve=await fetch("/api/pipeline-recent-runs");if(q!==It.current)return;if(ve.ok){const Le=await ve.json();if(q!==It.current)return;E(Array.isArray(Le.runs)?Le.runs:[])}else E([])}catch{if(q!==It.current)return;E([])}D(!0)},[]),Ft=m.useCallback(async()=>{M(""),K(!1);try{const[q,ve,Le,Ve]=await Promise.all([fetch("/api/nodes"),fetch("/api/skills"),fetch("/api/skill-collections"),fetch("/api/marketplace/flow-snippets")]),vt=await q.json().catch(()=>({})),_n=await ve.json().catch(()=>({})),zt=await Le.json().catch(()=>({})),bt=await Ve.json().catch(()=>({}));if(!q.ok)throw new Error(vt.error||"Nodes HTTP "+q.status);if(!ve.ok)throw new Error(_n.error||"Skills HTTP "+ve.status);if(!Le.ok)throw new Error(zt.error||"Collections HTTP "+Le.status);if(!Ve.ok)throw new Error(bt.error||"Flow snippets HTTP "+Ve.status);d(Array.isArray(vt.nodes)?vt.nodes:Array.isArray(vt)?vt:[]),f(Array.isArray(_n.skills)?_n.skills:[]),k(la(zt)),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),Ln(),Ft()},[Ln,Ft]),m.useEffect(()=>{let q=!1;return fetch("/api/ui-context").then(ve=>ve.json()).then(ve=>{q||it(!!ve.hideCommunityLinks)}).catch(()=>{}),()=>{q=!0}},[]);const On=m.useCallback(async q=>{const ve=la({collections:q});w(!0),M("");try{const Le=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(BO(ve))}),Ve=await Le.json().catch(()=>({}));if(!Le.ok)throw new Error(Ve.error||"Collections HTTP "+Le.status);k(la(Ve))}catch(Le){M(String(Le.message||Le))}finally{w(!1)}},[]),Jt=m.useCallback(()=>{const q=b.trim();if(!q)return;const ve=q.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Le=new Set(y.map(zt=>zt.id));let Ve=ve,vt=2;for(;Le.has(Ve);)Ve=`${ve}-${vt++}`;const _n=Date.now();On([...y,{id:Ve,name:q,skillKeys:[],createdAt:_n,updatedAt:_n}]),g(""),ae(`collection:${Ve}`)},[b,On,y]),Qt=m.useCallback(q=>{const ve=y.find(Ve=>Ve.id===q);if(ve!=null&&ve.builtin)return;const Le=y.filter(Ve=>Ve.id!==q);te===`collection:${q}`&&ae("all"),On(Le)},[te,On,y]),rr=m.useCallback((q,ve,Le)=>{const Ve=String(ve||"").trim();if(!Ve)return;const vt=Date.now(),_n=y.map(zt=>{if(zt.id!==q)return zt;const bt=new Set(zt.skillKeys||[]);return Le?bt.add(Ve):bt.delete(Ve),{...zt,skillKeys:Array.from(bt),updatedAt:vt}});On(_n)},[On,y]),pe=m.useCallback(async q=>{const ve=q==null?void 0:q.packageId,Le=q==null?void 0:q.version;if(!ve||!Le||!window.confirm(t("project:deleteMyNodeConfirm",{id:ve,version:Le})))return;const Ve=wn(q);cr(Ve),ge(""),M("");try{const vt=new URLSearchParams({id:ve,version:Le}),_n=await fetch(`/api/marketplace/node?${vt.toString()}`,{method:"DELETE"}),zt=await _n.json().catch(()=>({}));if(!_n.ok||(zt==null?void 0:zt.ok)===!1){const bt=Array.isArray(zt==null?void 0:zt.usage)&&zt.usage.length>0?` ${t("project:deleteMyNodeUsedBy",{count:zt.usage.length})}`:"";throw new Error(((zt==null?void 0:zt.error)||"Delete failed")+bt)}ge(t("project:deleteMyNodeSuccess",{id:ve,version:Le})),lt(bt=>{const Zt={...bt};return delete Zt[Ve],Zt}),Hn(bt=>{const Zt={};for(const[Xs,Lr]of Object.entries(bt))Xs.startsWith(`${Ve}:`)||(Zt[Xs]=Lr);return Zt}),ue(""),await Ft()}catch(vt){ge(String(vt.message||vt))}finally{cr("")}},[Ft,t]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){i(e),ae("all"),ue(""),de("overview");return}i(q=>q==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(r!=="/projects"&&r!=="/")return;const q=new URLSearchParams(window.location.search);let ve=!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"),ve=!0),q.get("new")==="1"&&(L(!0),q.delete("new"),ve=!0),ve){const Le=q.toString();window.history.replaceState({},"",Le?`/projects?${Le}`:"/projects")}},[r,n]);const Ie=m.useMemo(()=>aO(j,wE(),a),[j,a,r]),tn=m.useMemo(()=>Ie.filter(q=>YO(C,q)),[Ie,C]),ct=C.trim().toLowerCase(),gn=m.useMemo(()=>s==="archived"?a.filter(q=>q.archived):a.filter(q=>!q.archived),[a,s]),qs=m.useMemo(()=>gn.filter(q=>qO(q,ct,t)),[gn,ct,t]),En=s==="nodes"||s==="my-nodes",Sr=s==="my-nodes",ur=s==="my-flows",Wr=m.useMemo(()=>c.filter(q=>Sr&&q.source!=="marketplace"?!1:(te==="all"||(te==="marketplace"?q.source==="marketplace":q.type===te))&&Gg(C,[q.id,q.label,q.displayName,q.description,q.type,q.source,q.packageId,q.version])),[c,Sr,C,te]),Ys=m.useMemo(()=>{const q=new Map;for(const ve of y)q.set(ve.id,new Set(ve.skillKeys||[]));return q},[y]),_o=m.useMemo(()=>[{id:"all",label:"全部"},...y.map(q=>({id:`collection:${q.id}`,label:q.name,count:q.skillKeys.length,collection:q})),{id:"ungrouped",label:"未分组"}],[y]),Nr=m.useMemo(()=>u.filter(q=>{var Ve;const ve=wn(q);let Le=te==="all";if(te.startsWith("collection:")){const vt=te.slice(11);Le=!!((Ve=Ys.get(vt))!=null&&Ve.has(ve))}else te==="ungrouped"&&(Le=!Array.from(Ys.values()).some(vt=>vt.has(ve)));return Le&&Gg(C,[q.name,q.id,q.description,q.sourceLabel,q.source,q.path])}),[u,C,te,Ys]),Jn=m.useMemo(()=>p.filter(q=>Gg(C,[q.id,q.name,q.displayName,q.description,q.version,q.packageDir,Array.isArray(q.tags)?q.tags.join(" "):""])),[p,C]),Is=En||ur||s==="skills",Je=m.useMemo(()=>Wr.find(q=>wn(q)===ce)||Wr[0]||null,[Wr,ce]),Vt=m.useMemo(()=>Nr.find(q=>wn(q)===ce)||Nr[0]||null,[Nr,ce]),nn=m.useMemo(()=>Jn.find(q=>Pu(q)===ce)||Jn[0]||null,[Jn,ce]),ps=Vt?se[wn(Vt)]:null,We=Je?He[wn(Je)]:null,Un=Je&&Me?Gt[`${wn(Je)}:${Me}`]:null,Te=t(En?"project:searchNodes":ur?"project:searchFlows":s==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(s!=="skills"||!Vt)return;const q=wn(Vt);if(se[q])return;let ve=!1;return je(q),fetch(`/api/skills/detail?key=${encodeURIComponent(q)}`).then(Le=>Le.json().then(Ve=>({ok:Le.ok,json:Ve}))).then(({ok:Le,json:Ve})=>{ve||Le&&Ve.skill&&fe(vt=>({...vt,[q]:Ve.skill}))}).catch(()=>{}).finally(()=>{ve||je("")}),()=>{ve=!0}},[s,Vt,se]),m.useEffect(()=>{if(!En||!Je)return;const q=wn(Je);if(He[q])return;let ve=!1;return Ct(q),fetch(`/api/nodes/detail?id=${encodeURIComponent(Je.id)}`).then(Le=>Le.json().then(Ve=>({ok:Le.ok,json:Ve}))).then(({ok:Le,json:Ve})=>{ve||Le&<(vt=>({...vt,[q]:Ve}))}).catch(()=>{}).finally(()=>{ve||Ct("")}),()=>{ve=!0}},[En,Je,He]),m.useEffect(()=>{if(!En)return;const q=Array.isArray(We==null?void 0:We.files)?We.files:[];Ce(ve=>{var Le;return ve&&q.some(Ve=>Ve.path===ve)?ve:((Le=q[0])==null?void 0:Le.path)||""})},[En,We]),m.useEffect(()=>{if(!En||!Je||!Me)return;const q=`${wn(Je)}:${Me}`;if(Gt[q])return;let ve=!1;return Cn(q),fetch(`/api/nodes/file?id=${encodeURIComponent(Je.id)}&path=${encodeURIComponent(Me)}`).then(Le=>Le.json().then(Ve=>({ok:Le.ok,json:Ve}))).then(({ok:Le,json:Ve})=>{ve||Le&&Hn(vt=>({...vt,[q]:Ve}))}).catch(()=>{}).finally(()=>{ve||Cn("")}),()=>{ve=!0}},[En,Je,Me,Gt]),m.useEffect(()=>{ge("")},[ce,s]);const Bt=q=>{n(lp(q,"workspace"))},Ts=q=>{n(lp({id:q.flowId,source:q.flowSource,archived:!!q.archived},"workspace"))},mt=m.useCallback(q=>{var ve,Le;q.preventDefault(),q.stopPropagation(),(Le=(ve=q.dataTransfer)==null?void 0:ve.types)!=null&&Le.includes("Files")&&(tt.current+=1,T(!0))},[]),Vr=m.useCallback(q=>{q.preventDefault(),q.stopPropagation(),tt.current-=1,tt.current<=0&&(tt.current=0,T(!1))},[]),dr=m.useCallback(q=>{q.preventDefault(),q.stopPropagation()},[]),rn=m.useCallback(q=>{var Ve,vt;q.preventDefault(),q.stopPropagation(),tt.current=0,T(!1);const ve=(vt=(Ve=q.dataTransfer)==null?void 0:Ve.files)==null?void 0:vt[0];if(!ve)return;const Le=ve.name.toLowerCase();!Le.endsWith(".yaml")&&!Le.endsWith(".yml")&&!Le.endsWith(".zip")||z(ve)},[]);return o.jsxs("div",{className:"af-projects"+(_?" af-projects--drop-target":""),onDragEnter:mt,onDragLeave:Vr,onDragOver:dr,onDrop:rn,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"+(C.trim()?" af-search--has-clear":""),type:"search",placeholder:Te,"aria-label":Te,autoComplete:"off",value:C,onChange:q=>J(q.target.value),onKeyDown:q=>{q.key==="Escape"&&(J(""),q.currentTarget.blur())}}),C.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]}),Is?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Ft(),children:t("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(Z?" af-icon-btn--active":""),"aria-label":t("flow:palette.toggleRecentActivity"),"aria-expanded":Z,"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:ct?t("project:filterResult",{count:s==="nodes"||s==="my-nodes"?Wr.length:s==="my-flows"?Jn.length:s==="skills"?Nr.length:qs.length}):s==="my-nodes"?t("project:myNodesHint",{count:Wr.length}):s==="my-flows"?t("project:myFlowsHint",{count:Jn.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&&Is?o.jsx("p",{className:"af-err af-projects-api-hint",children:R}):null]}),Is?o.jsxs("div",{className:"af-resource-toolbar",children:[s==="skills"?o.jsx(zO,{onChanged:Ft}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:ur?"schema":En?Sr?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:t(ur?"project:myFlowsPurposeTitle":Sr?"project:myNodesPurposeTitle":En?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:t(ur?"project:myFlowsPurposeDesc":Sr?"project:myNodesPurposeDesc":En?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),ur?null:o.jsx("div",{className:"af-resource-filter-row",children:(En?(Sr?XO:GO).map(q=>({id:q,label:t(`project:resourceFilter.${q}`)})):_o).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:()=>{ae(q.id),ue("")},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:()=>Qt(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:()=>{ae(q.id),ue("")},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=>g(q.target.value),onKeyDown:q=>{q.key==="Enter"&&Jt()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!b.trim()||v,onClick:()=>Jt(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,En?o.jsx("div",{className:"af-resource-grid",children:Wr.length>0?Wr.map(q=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Je&&wn(q)===wn(Je)?" af-resource-card--active":""),onClick:()=>ue(wn(q)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:_u(q.type==="control"?"secondary":q.type==="provide"?"primary":"muted"),children:o.jsx(zn,{query:C,children:q.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(zn,{query:C,children:dk(q.source,t)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(zn,{query:C,children:q.label||q.displayName||q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(zn,{query:C,children:q.description||t("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(zn,{query:C,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(zn,{query:C,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:ct?t("project:noNodeMatch",{query:C.trim()}):t(Sr?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):ur?o.jsx("div",{className:"af-resource-grid",children:Jn.length>0?Jn.map(q=>{const ve=q.snippet&&Array.isArray(q.snippet.instances)?q.snippet.instances:[],Le=q.snippet&&Array.isArray(q.snippet.edges)?q.snippet.edges:[],Ve=Number.isFinite(Number(q.nodeCount))?Number(q.nodeCount):ve.length,vt=Number.isFinite(Number(q.edgeCount))?Number(q.edgeCount):Le.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(nn&&Pu(q)===Pu(nn)?" af-resource-card--active":""),onClick:()=>ue(Pu(q)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:_u("primary"),children:o.jsx(zn,{query:C,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(zn,{query:C,children:q.displayName||q.name||q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(zn,{query:C,children:q.description||t("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:t("project:flowSnippetNodes",{nodes:Ve,edges:vt})}),o.jsx("span",{children:o.jsx(zn,{query:C,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(zn,{query:C,children:fk(q)})})]})]},Pu(q))}):O?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:ct?t("project:noFlowSnippetMatch",{query:C.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:Nr.length>0?Nr.map(q=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Vt&&wn(q)===wn(Vt)?" af-resource-card--active":""),onClick:()=>ue(wn(q)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:_u(q.source==="builtin"?"muted":"primary"),children:o.jsx(zn,{query:C,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(zn,{query:C,children:q.name||q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(zn,{query:C,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(zn,{query:C,children:q.path||q.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[y.filter(ve=>ve.skillKeys.includes(wn(q))).slice(0,3).map(ve=>o.jsx("span",{children:ve.name},ve.id)),y.filter(ve=>ve.skillKeys.includes(wn(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:ct?t("project:noSkillMatch",{query:C.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:[qs.length>0?qs.map(q=>o.jsx("button",{type:"button",className:"af-project-card",onClick:()=>Bt(q),children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:_u(Mx(q.source,t).tone),children:o.jsx(zn,{query:C,children:Mx(q.source,t).label})}),q.archived?o.jsx("span",{className:_u("muted"),children:o.jsx(zn,{query:C,children:t("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(zn,{query:C,children:q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(zn,{query:C,children:OE(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(zn,{query:C,children:LE(q)})})]})]})},`${q.id}:${q.source??"user"}:${q.archived?"a":""}`)):W?gn.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:C.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")})]}),qe?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")})]})]})]}),Is?o.jsx("aside",{className:"af-resource-detail","aria-label":t(En?"project:nodeDetail":ur?"project:flowDetail":"project:skillDetail"),children:En&&Je?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:Je.label||Je.displayName||Je.id}),o.jsx("p",{children:Je.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"+(le===q?" af-resource-detail-tab--active":""),onClick:()=>de(q),children:t(`project:nodeDetailTabs.${q}`)},q))}),Ge===wn(Je)?o.jsx("p",{className:"af-resource-detail-desc",children:t("project:loadingResources")}):le==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:Je.description||((hs=We==null?void 0:We.node)==null?void 0:hs.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:Je.type||((Wn=We==null?void 0:We.node)==null?void 0:Wn.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailSource")}),o.jsx("dd",{children:dk(Je.source,t)})]}),Je.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailPackage")}),o.jsx("dd",{children:Je.packageId})]}):null,Je.version?o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailVersion")}),o.jsx("dd",{children:Je.version})]}):null,Je.packageDir||We!=null&&We.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailPath")}),o.jsx("dd",{children:Je.packageDir||(We==null?void 0:We.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailEditable")}),o.jsx("dd",{children:(We==null?void 0:We.readOnly)===!1?t("project:editable"):t("project:readOnly")})]})]}),Sr&&Je.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:kr===wn(Je),onClick:()=>pe(Je),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),kr===wn(Je)?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")})]})]}):le==="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")}),cp(((ms=We==null?void 0:We.node)==null?void 0:ms.inputs)||Je.inputs).length>0?cp(((fr=We==null?void 0:We.node)==null?void 0:fr.inputs)||Je.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")}),cp(((Gs=We==null?void 0:We.node)==null?void 0:Gs.outputs)||Je.outputs).length>0?cp(((jr=We==null?void 0:We.node)==null?void 0:jr.outputs)||Je.outputs).map(q=>o.jsxs("code",{children:[q.name||q.key,q.type?`: ${q.type}`:""]},q.key)):o.jsx("em",{children:t("project:noSlots")})]})]}):le==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:t("project:nodeRuntime")}),We!=null&&We.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(We.runtime,null,2)}):o.jsx("p",{children:t("project:noRuntimeManifest")}),We!=null&&We.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:We.body})]}):o.jsx("p",{children:t("project:noNodeBody")})]}):le==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:t("project:nodeFiles")}),Array.isArray(We==null?void 0:We.files)&&We.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:We.files.map(q=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(Me===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===`${wn(Je)}:${Me}`?t("project:loadingResources"):Un!=null&&Un.binary?t("project:binaryFile"):(Un==null?void 0:Un.content)||t("project:selectNodeFile"),Un!=null&&Un.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(We==null?void 0:We.usage)&&We.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:We.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(ve=>ve.label||ve.instanceId).join(", ")})]},`${q.flowSource}:${q.flowId}:${q.archived?"a":""}`))}):o.jsx("p",{children:t("project:noNodeUsage")})]})]}):ur&&nn?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:nn.displayName||nn.name||nn.id}),o.jsx("p",{children:nn.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:nn.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:nn.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:t("project:detailPath")}),o.jsx("dd",{children:fk(nn)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:t("project:flowSnippetScale")}),o.jsx("dd",{children:t("project:flowSnippetNodes",{nodes:Number.isFinite(Number(nn.nodeCount))?Number(nn.nodeCount):Array.isArray((gs=nn.snippet)==null?void 0:gs.instances)?nn.snippet.instances.length:0,edges:Number.isFinite(Number(nn.edgeCount))?Number(nn.edgeCount):Array.isArray((ys=nn.snippet)==null?void 0:ys.edges)?nn.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(nn.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"}),y.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:y.map(q=>{const ve=wn(Vt),Le=q.skillKeys.includes(ve);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:Le,disabled:v,onChange:Ve=>rr(q.id,ve,Ve.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:ye===wn(Vt)?t("project:loadingResources"):(ps==null?void 0:ps.body)||(ps==null?void 0:ps.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"+(Z?"":" af-activity--hidden"),"aria-hidden":!Z,"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:tn.length===0?o.jsx("p",{className:"af-activity-empty",children:Ie.length===0?t("project:noRecentActivity"):t("project:noMatchRecent")}):tn.map(q=>o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action",onClick:()=>Ts(q),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(zn,{query:C,children:q.flowId})}),o.jsx("span",{className:"af-activity-time",children:Rx(q.at,t)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:UO(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")," · ",Rx(q.at,t)]})]})]},`${q.kind}-${q.flowId}-${q.flowSource}-${q.at}`))})]})]}),o.jsx(MO,{open:$,onClose:()=>L(!1),onCreated:async q=>{L(!1),await Ln();const ve=q.source??"user";n(lp({id:q.id,source:ve},"workspace"))}}),I?o.jsx(LO,{file:I,onClose:()=>z(null),onImported:async q=>{z(null),await Ln();const ve=q.source??"user";n(lp({id:q.id,source:ve},"workspace"))}},`${I.name}-${I.size}-${I.lastModified}`):null]})}function Xn(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=Xn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var JO={value:()=>{}};function Em(){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 qp(n)}function qp(e){this._=e}function QO(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}})}qp.prototype=Em.prototype={constructor:qp,on:function(e,t){var n=this._,r=QO(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=ZO(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]=pk(n[s],e.name,t);else if(t==null)for(s in n)n[s]=pk(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 qp(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 ZO(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function pk(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=JO,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var $x="http://www.w3.org/1999/xhtml";const hk={svg:"http://www.w3.org/2000/svg",xhtml:$x,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function _m(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),hk.hasOwnProperty(t)?{space:hk[t],local:e}:e}function eM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===$x&&t.documentElement.namespaceURI===$x?t.createElement(e):t.createElementNS(n,e)}}function tM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ME(e){var t=_m(e);return(t.local?tM:eM)(t)}function nM(){}function kv(e){return e==null?nM:function(){return this.querySelector(e)}}function rM(e){typeof e!="function"&&(e=kv(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 _s(r,this._parents)}function sM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function iM(){return[]}function $E(e){return e==null?iM:function(){return this.querySelectorAll(e)}}function oM(e){return function(){return sM(e.apply(this,arguments))}}function aM(e){typeof e=="function"?e=oM(e):e=$E(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 _s(r,s)}function DE(e){return function(){return this.matches(e)}}function FE(e){return function(t){return t.matches(e)}}var lM=Array.prototype.find;function cM(e){return function(){return lM.call(this.children,e)}}function uM(){return this.firstElementChild}function dM(e){return this.select(e==null?uM:cM(typeof e=="function"?e:FE(e)))}var fM=Array.prototype.filter;function pM(){return Array.from(this.children)}function hM(e){return function(){return fM.call(this.children,e)}}function mM(e){return this.selectAll(e==null?pM:hM(typeof e=="function"?e:FE(e)))}function gM(e){typeof e!="function"&&(e=DE(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 _s(r,this._parents)}function zE(e){return new Array(e.length)}function yM(){return new _s(this._enter||this._groups.map(zE),this._parents)}function Ah(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ah.prototype={constructor:Ah,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 xM(e){return function(){return e}}function wM(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 Ah(e,i[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function vM(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 Ah(e,i[l]);for(l=0;l<u;++l)(c=t[l])&&d.get(p[l])===c&&(s[l]=c)}function bM(e){return e.__data__}function kM(e,t){if(!arguments.length)return Array.from(this,bM);var n=t?vM:wM,r=this._parents,s=this._groups;typeof e!="function"&&(e=xM(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=SM(e.call(u,u&&u.__data__,d,r)),y=h.length,k=l[d]=new Array(y),b=a[d]=new Array(y),g=c[d]=new Array(p);n(u,f,k,b,g,h,t);for(var v=0,w=0,j,E;v<y;++v)if(j=k[v]){for(v>=w&&(w=v+1);!(E=b[w])&&++w<y;);j._next=E||null}}return a=new _s(a,r),a._enter=l,a._exit=c,a}function SM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function NM(){return new _s(this._exit||this._groups.map(zE),this._parents)}function jM(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 CM(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,y=0;y<f;++y)(h=d[y]||u[y])&&(p[y]=h);for(;c<s;++c)l[c]=n[c];return new _s(l,this._parents)}function EM(){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 _M(e){e||(e=PM);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 _s(s,this._parents).order()}function PM(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function AM(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function IM(){return Array.from(this)}function TM(){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 RM(){let e=0;for(const t of this)++e;return e}function LM(){return!this.node()}function OM(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 MM(e){return function(){this.removeAttribute(e)}}function $M(e){return function(){this.removeAttributeNS(e.space,e.local)}}function DM(e,t){return function(){this.setAttribute(e,t)}}function FM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function zM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function BM(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 HM(e,t){var n=_m(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?$M:MM:typeof t=="function"?n.local?BM:zM:n.local?FM:DM)(n,t))}function BE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function UM(e){return function(){this.style.removeProperty(e)}}function WM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function VM(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function KM(e,t,n){return arguments.length>1?this.each((t==null?UM:typeof t=="function"?VM:WM)(e,t,n??"")):_c(this.node(),e)}function _c(e,t){return e.style.getPropertyValue(t)||BE(e).getComputedStyle(e,null).getPropertyValue(t)}function qM(e){return function(){delete this[e]}}function YM(e,t){return function(){this[e]=t}}function GM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function XM(e,t){return arguments.length>1?this.each((t==null?qM:typeof t=="function"?GM:YM)(e,t)):this.node()[e]}function HE(e){return e.trim().split(/^|\s+/)}function Sv(e){return e.classList||new UE(e)}function UE(e){this._node=e,this._names=HE(e.getAttribute("class")||"")}UE.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 WE(e,t){for(var n=Sv(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function VE(e,t){for(var n=Sv(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function JM(e){return function(){WE(this,e)}}function QM(e){return function(){VE(this,e)}}function ZM(e,t){return function(){(t.apply(this,arguments)?WE:VE)(this,e)}}function e$(e,t){var n=HE(e+"");if(arguments.length<2){for(var r=Sv(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?ZM:t?JM:QM)(n,t))}function t$(){this.textContent=""}function n$(e){return function(){this.textContent=e}}function r$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function s$(e){return arguments.length?this.each(e==null?t$:(typeof e=="function"?r$:n$)(e)):this.node().textContent}function i$(){this.innerHTML=""}function o$(e){return function(){this.innerHTML=e}}function a$(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function l$(e){return arguments.length?this.each(e==null?i$:(typeof e=="function"?a$:o$)(e)):this.node().innerHTML}function c$(){this.nextSibling&&this.parentNode.appendChild(this)}function u$(){return this.each(c$)}function d$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function f$(){return this.each(d$)}function p$(e){var t=typeof e=="function"?e:ME(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function h$(){return null}function m$(e,t){var n=typeof e=="function"?e:ME(e),r=t==null?h$:typeof t=="function"?t:kv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function g$(){var e=this.parentNode;e&&e.removeChild(this)}function y$(){return this.each(g$)}function x$(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function w$(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function v$(e){return this.select(e?w$:x$)}function b$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function k$(e){return function(t){e.call(this,t,this.__data__)}}function S$(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 N$(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 j$(e,t,n){return function(){var r=this.__on,s,i=k$(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 C$(e,t,n){var r=S$(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?j$:N$,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function KE(e,t,n){var r=BE(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$(e,t){return function(){return KE(this,e,t)}}function _$(e,t){return function(){return KE(this,e,t.apply(this,arguments))}}function P$(e,t){return this.each((typeof t=="function"?_$:E$)(e,t))}function*A$(){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 qE=[null];function _s(e,t){this._groups=e,this._parents=t}function af(){return new _s([[document.documentElement]],qE)}function I$(){return this}_s.prototype=af.prototype={constructor:_s,select:rM,selectAll:aM,selectChild:dM,selectChildren:mM,filter:gM,data:kM,enter:yM,exit:NM,join:jM,merge:CM,selection:I$,order:EM,sort:_M,call:AM,nodes:IM,node:TM,size:RM,empty:LM,each:OM,attr:HM,style:KM,property:XM,classed:e$,text:s$,html:l$,raise:u$,lower:f$,append:p$,insert:m$,remove:y$,clone:v$,datum:b$,on:C$,dispatch:P$,[Symbol.iterator]:A$};function bs(e){return typeof e=="string"?new _s([[document.querySelector(e)]],[document.documentElement]):new _s([[e]],qE)}function T$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function li(e,t){if(e=T$(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 R$={passive:!1},Td={capture:!0,passive:!1};function Xg(e){e.stopImmediatePropagation()}function gc(e){e.preventDefault(),e.stopImmediatePropagation()}function YE(e){var t=e.document.documentElement,n=bs(e).on("dragstart.drag",gc,Td);"onselectstart"in t?n.on("selectstart.drag",gc,Td):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function GE(e,t){var n=e.document.documentElement,r=bs(e).on("dragstart.drag",null);t&&(r.on("click.drag",gc,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 up=e=>()=>e;function Dx(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}})}Dx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function L$(e){return!e.ctrlKey&&!e.button}function O$(){return this.parentNode}function M$(e,t){return t??{x:e.x,y:e.y}}function $$(){return navigator.maxTouchPoints||"ontouchstart"in this}function XE(){var e=L$,t=O$,n=M$,r=$$,s={},i=Em("start","drag","end"),a=0,l,c,d,u,f=0;function p(j){j.on("mousedown.drag",h).filter(r).on("touchstart.drag",b).on("touchmove.drag",g,R$).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(j,E){if(!(u||!e.call(this,j,E))){var S=w(this,t.call(this,j,E),j,E,"mouse");S&&(bs(j.view).on("mousemove.drag",y,Td).on("mouseup.drag",k,Td),YE(j.view),Xg(j),d=!1,l=j.clientX,c=j.clientY,S("start",j))}}function y(j){if(gc(j),!d){var E=j.clientX-l,S=j.clientY-c;d=E*E+S*S>f}s.mouse("drag",j)}function k(j){bs(j.view).on("mousemove.drag mouseup.drag",null),GE(j.view,d),gc(j),s.mouse("end",j)}function b(j,E){if(e.call(this,j,E)){var S=j.changedTouches,A=t.call(this,j,E),R=S.length,M,W;for(M=0;M<R;++M)(W=w(this,A,j,E,S[M].identifier,S[M]))&&(Xg(j),W("start",j,S[M]))}}function g(j){var E=j.changedTouches,S=E.length,A,R;for(A=0;A<S;++A)(R=s[E[A].identifier])&&(gc(j),R("drag",j,E[A]))}function v(j){var E=j.changedTouches,S=E.length,A,R;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),A=0;A<S;++A)(R=s[E[A].identifier])&&(Xg(j),R("end",j,E[A]))}function w(j,E,S,A,R,M){var W=i.copy(),D=li(M||S,E),O,K,$;if(($=n.call(j,new Dx("beforestart",{sourceEvent:S,target:p,identifier:R,active:a,x:D[0],y:D[1],dx:0,dy:0,dispatch:W}),A))!=null)return O=$.x-D[0]||0,K=$.y-D[1]||0,function L(I,z,_){var T=D,C;switch(I){case"start":s[R]=L,C=a++;break;case"end":delete s[R],--a;case"drag":D=li(_||z,E),C=a;break}W.call(I,j,new Dx(I,{sourceEvent:z,subject:$,target:p,identifier:R,active:C,x:D[0]+O,y:D[1]+K,dx:D[0]-T[0],dy:D[1]-T[1],dispatch:W}),A)}}return p.filter=function(j){return arguments.length?(e=typeof j=="function"?j:up(!!j),p):e},p.container=function(j){return arguments.length?(t=typeof j=="function"?j:up(j),p):t},p.subject=function(j){return arguments.length?(n=typeof j=="function"?j:up(j),p):n},p.touchable=function(j){return arguments.length?(r=typeof j=="function"?j:up(!!j),p):r},p.on=function(){var j=i.on.apply(i,arguments);return j===i?p:j},p.clickDistance=function(j){return arguments.length?(f=(j=+j)*j,p):Math.sqrt(f)},p}function Nv(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function JE(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function lf(){}var Rd=.7,Ih=1/Rd,yc="\\s*([+-]?\\d+)\\s*",Ld="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Vi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",D$=/^#([0-9a-f]{3,8})$/,F$=new RegExp(`^rgb\\(${yc},${yc},${yc}\\)$`),z$=new RegExp(`^rgb\\(${Vi},${Vi},${Vi}\\)$`),B$=new RegExp(`^rgba\\(${yc},${yc},${yc},${Ld}\\)$`),H$=new RegExp(`^rgba\\(${Vi},${Vi},${Vi},${Ld}\\)$`),U$=new RegExp(`^hsl\\(${Ld},${Vi},${Vi}\\)$`),W$=new RegExp(`^hsla\\(${Ld},${Vi},${Vi},${Ld}\\)$`),mk={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};Nv(lf,ul,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gk,formatHex:gk,formatHex8:V$,formatHsl:K$,formatRgb:yk,toString:yk});function gk(){return this.rgb().formatHex()}function V$(){return this.rgb().formatHex8()}function K$(){return QE(this).formatHsl()}function yk(){return this.rgb().formatRgb()}function ul(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=D$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?xk(t):n===3?new ns(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?dp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?dp(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=F$.exec(e))?new ns(t[1],t[2],t[3],1):(t=z$.exec(e))?new ns(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=B$.exec(e))?dp(t[1],t[2],t[3],t[4]):(t=H$.exec(e))?dp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=U$.exec(e))?bk(t[1],t[2]/100,t[3]/100,1):(t=W$.exec(e))?bk(t[1],t[2]/100,t[3]/100,t[4]):mk.hasOwnProperty(e)?xk(mk[e]):e==="transparent"?new ns(NaN,NaN,NaN,0):null}function xk(e){return new ns(e>>16&255,e>>8&255,e&255,1)}function dp(e,t,n,r){return r<=0&&(e=t=n=NaN),new ns(e,t,n,r)}function q$(e){return e instanceof lf||(e=ul(e)),e?(e=e.rgb(),new ns(e.r,e.g,e.b,e.opacity)):new ns}function Fx(e,t,n,r){return arguments.length===1?q$(e):new ns(e,t,n,r??1)}function ns(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Nv(ns,Fx,JE(lf,{brighter(e){return e=e==null?Ih:Math.pow(Ih,e),new ns(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Rd:Math.pow(Rd,e),new ns(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ns(tl(this.r),tl(this.g),tl(this.b),Th(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:wk,formatHex:wk,formatHex8:Y$,formatRgb:vk,toString:vk}));function wk(){return`#${Qa(this.r)}${Qa(this.g)}${Qa(this.b)}`}function Y$(){return`#${Qa(this.r)}${Qa(this.g)}${Qa(this.b)}${Qa((isNaN(this.opacity)?1:this.opacity)*255)}`}function vk(){const e=Th(this.opacity);return`${e===1?"rgb(":"rgba("}${tl(this.r)}, ${tl(this.g)}, ${tl(this.b)}${e===1?")":`, ${e})`}`}function Th(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function tl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qa(e){return e=tl(e),(e<16?"0":"")+e.toString(16)}function bk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new di(e,t,n,r)}function QE(e){if(e instanceof di)return new di(e.h,e.s,e.l,e.opacity);if(e instanceof lf||(e=ul(e)),!e)return new di;if(e instanceof di)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 di(a,l,c,e.opacity)}function G$(e,t,n,r){return arguments.length===1?QE(e):new di(e,t,n,r??1)}function di(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Nv(di,G$,JE(lf,{brighter(e){return e=e==null?Ih:Math.pow(Ih,e),new di(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Rd:Math.pow(Rd,e),new di(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 ns(Jg(e>=240?e-240:e+120,s,r),Jg(e,s,r),Jg(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new di(kk(this.h),fp(this.s),fp(this.l),Th(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=Th(this.opacity);return`${e===1?"hsl(":"hsla("}${kk(this.h)}, ${fp(this.s)*100}%, ${fp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function kk(e){return e=(e||0)%360,e<0?e+360:e}function fp(e){return Math.max(0,Math.min(1,e||0))}function Jg(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 jv=e=>()=>e;function X$(e,t){return function(n){return e+n*t}}function J$(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 Q$(e){return(e=+e)==1?ZE:function(t,n){return n-t?J$(t,n,e):jv(isNaN(t)?n:t)}}function ZE(e,t){var n=t-e;return n?X$(e,n):jv(isNaN(e)?t:e)}const Rh=function e(t){var n=Q$(t);function r(s,i){var a=n((s=Fx(s)).r,(i=Fx(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),d=ZE(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 Z$(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 eD(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function tD(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 nD(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function $i(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function rD(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 zx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qg=new RegExp(zx.source,"g");function sD(e){return function(){return e}}function iD(e){return function(t){return e(t)+""}}function e_(e,t){var n=zx.lastIndex=Qg.lastIndex=0,r,s,i,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=zx.exec(e))&&(s=Qg.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:$i(r,s)})),n=Qg.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?c[0]?iD(c[0].x):sD(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"?jv(t):(n==="number"?$i:n==="string"?(r=ul(t))?(t=r,Rh):e_:t instanceof ul?Rh:t instanceof Date?nD:eD(t)?Z$:Array.isArray(t)?tD:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?rD:$i)(e,t)}var Sk=180/Math.PI,Bx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function t_(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)*Sk,skewX:Math.atan(c)*Sk,scaleX:a,scaleY:l}}var pp;function oD(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Bx:t_(t.a,t.b,t.c,t.d,t.e,t.f)}function aD(e){return e==null||(pp||(pp=document.createElementNS("http://www.w3.org/2000/svg","g")),pp.setAttribute("transform",e),!(e=pp.transform.baseVal.consolidate()))?Bx:(e=e.matrix,t_(e.a,e.b,e.c,e.d,e.e,e.f))}function n_(e,t,n,r){function s(d){return d.length?d.pop()+" ":""}function i(d,u,f,p,h,y){if(d!==f||u!==p){var k=h.push("translate(",null,t,null,n);y.push({i:k-4,x:$i(d,f)},{i:k-2,x:$i(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:$i(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:$i(d,u)}):u&&f.push(s(f)+"skewX("+u+r)}function c(d,u,f,p,h,y){if(d!==f||u!==p){var k=h.push(s(h)+"scale(",null,",",null,")");y.push({i:k-4,x:$i(d,f)},{i:k-2,x:$i(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 y=-1,k=p.length,b;++y<k;)f[(b=p[y]).i]=b.x(h);return f.join("")}}}var lD=n_(oD,"px, ","px)","deg)"),cD=n_(aD,", ",")",")"),uD=1e-12;function Nk(e){return((e=Math.exp(e))+1/e)/2}function dD(e){return((e=Math.exp(e))-1/e)/2}function fD(e){return((e=Math.exp(2*e))-1)/(e+1)}const Yp=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,y=f-c,k=h*h+y*y,b,g;if(k<uD)g=Math.log(p/d)/t,b=function(A){return[l+A*h,c+A*y,d*Math.exp(t*A*g)]};else{var v=Math.sqrt(k),w=(p*p-d*d+r*k)/(2*d*n*v),j=(p*p-d*d-r*k)/(2*p*n*v),E=Math.log(Math.sqrt(w*w+1)-w),S=Math.log(Math.sqrt(j*j+1)-j);g=(S-E)/t,b=function(A){var R=A*g,M=Nk(E),W=d/(n*v)*(M*fD(t*R+E)-dD(E));return[l+W*h,c+W*y,d*M/Nk(t*R+E)]}}return b.duration=g*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 Pc=0,Uu=0,Au=0,r_=1e3,Lh,Wu,Oh=0,dl=0,Pm=0,Od=typeof performance=="object"&&performance.now?performance:Date,s_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Cv(){return dl||(s_(pD),dl=Od.now()+Pm)}function pD(){dl=0}function Mh(){this._call=this._time=this._next=null}Mh.prototype=i_.prototype={constructor:Mh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Cv():+n)+(t==null?0:+t),!this._next&&Wu!==this&&(Wu?Wu._next=this:Lh=this,Wu=this),this._call=e,this._time=n,Hx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Hx())}};function i_(e,t,n){var r=new Mh;return r.restart(e,t,n),r}function hD(){Cv(),++Pc;for(var e=Lh,t;e;)(t=dl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Pc}function jk(){dl=(Oh=Od.now())+Pm,Pc=Uu=0;try{hD()}finally{Pc=0,gD(),dl=0}}function mD(){var e=Od.now(),t=e-Oh;t>r_&&(Pm-=t,Oh=e)}function gD(){for(var e,t=Lh,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:Lh=n);Wu=e,Hx(r)}function Hx(e){if(!Pc){Uu&&(Uu=clearTimeout(Uu));var t=e-dl;t>24?(e<1/0&&(Uu=setTimeout(jk,e-Od.now()-Pm)),Au&&(Au=clearInterval(Au))):(Au||(Oh=Od.now(),Au=setInterval(mD,r_)),Pc=1,s_(jk))}}function Ck(e,t,n){var r=new Mh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var yD=Em("start","end","cancel","interrupt"),xD=[],o_=0,Ek=1,Ux=2,Gp=3,_k=4,Wx=5,Xp=6;function Am(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;wD(e,n,{name:t,index:r,group:s,on:yD,tween:xD,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:o_})}function Ev(e,t){var n=wi(e,t);if(n.state>o_)throw new Error("too late; already scheduled");return n}function Ji(e,t){var n=wi(e,t);if(n.state>Gp)throw new Error("too late; already running");return n}function wi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function wD(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=i_(i,0,n.time);function i(d){n.state=Ek,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!==Ek)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Gp)return Ck(a);h.state===_k?(h.state=Xp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Xp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Ck(function(){n.state===Gp&&(n.state=_k,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=Ux,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ux){for(n.state=Gp,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=Wx,1),f=-1,p=s.length;++f<p;)s[f].call(e,u);n.state===Wx&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Xp,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function Jp(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>Ux&&r.state<Wx,r.state=Xp,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function vD(e){return this.each(function(){Jp(this,e)})}function bD(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 kD(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 SD(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=wi(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?bD:kD)(n,e,t))}function _v(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 wi(s,r).value[t]}}function a_(e,t){var n;return(typeof t=="number"?$i:t instanceof ul?Rh:(n=ul(t))?(t=n,Rh):e_)(e,t)}function ND(e){return function(){this.removeAttribute(e)}}function jD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function CD(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 ED(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 _D(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 PD(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 AD(e,t){var n=_m(e),r=n==="transform"?cD:a_;return this.attrTween(e,typeof t=="function"?(n.local?PD:_D)(n,r,_v(this,"attr."+e,t)):t==null?(n.local?jD:ND)(n):(n.local?ED:CD)(n,r,t))}function ID(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function TD(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function RD(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&TD(e,i)),n}return s._value=t,s}function LD(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&ID(e,i)),n}return s._value=t,s}function OD(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=_m(e);return this.tween(n,(r.local?RD:LD)(r,t))}function MD(e,t){return function(){Ev(this,e).delay=+t.apply(this,arguments)}}function $D(e,t){return t=+t,function(){Ev(this,e).delay=t}}function DD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?MD:$D)(t,e)):wi(this.node(),t).delay}function FD(e,t){return function(){Ji(this,e).duration=+t.apply(this,arguments)}}function zD(e,t){return t=+t,function(){Ji(this,e).duration=t}}function BD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?FD:zD)(t,e)):wi(this.node(),t).duration}function HD(e,t){if(typeof t!="function")throw new Error;return function(){Ji(this,e).ease=t}}function UD(e){var t=this._id;return arguments.length?this.each(HD(t,e)):wi(this.node(),t).ease}function WD(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ji(this,e).ease=n}}function VD(e){if(typeof e!="function")throw new Error;return this.each(WD(this._id,e))}function KD(e){typeof e!="function"&&(e=DE(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 ko(r,this._parents,this._name,this._id)}function qD(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 ko(a,this._parents,this._name,this._id)}function YD(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 GD(e,t,n){var r,s,i=YD(t)?Ev:Ji;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function XD(e,t){var n=this._id;return arguments.length<2?wi(this.node(),n).on.on(e):this.each(GD(n,e,t))}function JD(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function QD(){return this.on("end.remove",JD(this._id))}function ZD(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kv(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,Am(d[p],t,n,p,d,wi(u,n)));return new ko(i,this._parents,t,n)}function eF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=$E(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,y=wi(u,n),k=0,b=p.length;k<b;++k)(h=p[k])&&Am(h,t,n,k,p,y);i.push(p),a.push(u)}return new ko(i,a,t,n)}var tF=af.prototype.constructor;function nF(){return new tF(this._groups,this._parents)}function rF(e,t){var n,r,s;return function(){var i=_c(this,e),a=(this.style.removeProperty(e),_c(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function l_(e){return function(){this.style.removeProperty(e)}}function sF(e,t,n){var r,s=n+"",i;return function(){var a=_c(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function iF(e,t,n){var r,s,i;return function(){var a=_c(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),_c(this,e))),a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l))}}function oF(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=l_(t)):void 0;(d!==n||s!==u)&&(r=(n=d).copy()).on(a,s=u),c.on=r}}function aF(e,t,n){var r=(e+="")=="transform"?lD:a_;return t==null?this.styleTween(e,rF(e,r)).on("end.style."+e,l_(e)):typeof t=="function"?this.styleTween(e,iF(e,r,_v(this,"style."+e,t))).each(oF(this._id,e)):this.styleTween(e,sF(e,r,t),n).on("end.style."+e,null)}function lF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function cF(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&lF(e,a,n)),r}return i._value=t,i}function uF(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,cF(e,t,n??""))}function dF(e){return function(){this.textContent=e}}function fF(e){return function(){var t=e(this);this.textContent=t??""}}function pF(e){return this.tween("text",typeof e=="function"?fF(_v(this,"text",e)):dF(e==null?"":e+""))}function hF(e){return function(t){this.textContent=e.call(this,t)}}function mF(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&hF(s)),t}return r._value=e,r}function gF(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,mF(e))}function yF(){for(var e=this._name,t=this._id,n=c_(),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=wi(c,t);Am(c,e,n,d,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ko(r,this._parents,e,n)}function xF(){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 wF=0;function ko(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function c_(){return++wF}var oo=af.prototype;ko.prototype={constructor:ko,select:ZD,selectAll:eF,selectChild:oo.selectChild,selectChildren:oo.selectChildren,filter:KD,merge:qD,selection:nF,transition:yF,call:oo.call,nodes:oo.nodes,node:oo.node,size:oo.size,empty:oo.empty,each:oo.each,on:XD,attr:AD,attrTween:OD,style:aF,styleTween:uF,text:pF,textTween:gF,remove:QD,tween:SD,delay:DD,duration:BD,ease:UD,easeVarying:VD,end:xF,[Symbol.iterator]:oo[Symbol.iterator]};function vF(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var bF={time:null,delay:0,duration:250,ease:vF};function kF(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 SF(e){var t,n;e instanceof ko?(t=e._id,e=e._name):(t=c_(),(n=bF).time=Cv(),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])&&Am(c,e,t,d,a,n||kF(c,t));return new ko(r,this._parents,e,t)}af.prototype.interrupt=vD;af.prototype.transition=SF;const hp=e=>()=>e;function NF(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 mo(e,t,n){this.k=e,this.x=t,this.y=n}mo.prototype={constructor:mo,scale:function(e){return e===1?this:new mo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new mo(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 Im=new mo(1,0,0);u_.prototype=mo.prototype;function u_(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Im;return e.__zoom}function Zg(e){e.stopImmediatePropagation()}function Iu(e){e.preventDefault(),e.stopImmediatePropagation()}function jF(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function CF(){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 Pk(){return this.__zoom||Im}function EF(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _F(){return navigator.maxTouchPoints||"ontouchstart"in this}function PF(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 d_(){var e=jF,t=CF,n=PF,r=EF,s=_F,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Yp,d=Em("start","zoom","end"),u,f,p,h=500,y=150,k=0,b=10;function g($){$.property("__zoom",Pk).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",W).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)")}g.transform=function($,L,I,z){var _=$.selection?$.selection():$;_.property("__zoom",Pk),$!==_?E($,L,I,z):_.interrupt().each(function(){S(this,arguments).event(z).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},g.scaleBy=function($,L,I,z){g.scaleTo($,function(){var _=this.__zoom.k,T=typeof L=="function"?L.apply(this,arguments):L;return _*T},I,z)},g.scaleTo=function($,L,I,z){g.transform($,function(){var _=t.apply(this,arguments),T=this.__zoom,C=I==null?j(_):typeof I=="function"?I.apply(this,arguments):I,J=T.invert(C),Z=typeof L=="function"?L.apply(this,arguments):L;return n(w(v(T,Z),C,J),_,a)},I,z)},g.translateBy=function($,L,I,z){g.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)},g.translateTo=function($,L,I,z,_){g.transform($,function(){var T=t.apply(this,arguments),C=this.__zoom,J=z==null?j(T):typeof z=="function"?z.apply(this,arguments):z;return n(Im.translate(J[0],J[1]).scale(C.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof I=="function"?-I.apply(this,arguments):-I),T,a)},z,_)};function v($,L){return L=Math.max(i[0],Math.min(i[1],L)),L===$.k?$:new mo(L,$.x,$.y)}function w($,L,I){var z=L[0]-I[0]*$.k,_=L[1]-I[1]*$.k;return z===$.x&&_===$.y?$:new mo($.k,z,_)}function j($){return[(+$[0][0]+ +$[1][0])/2,(+$[0][1]+ +$[1][1])/2]}function E($,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 _=this,T=arguments,C=S(_,T).event(z),J=t.apply(_,T),Z=I==null?j(J):typeof I=="function"?I.apply(_,T):I,H=Math.max(J[1][0]-J[0][0],J[1][1]-J[0][1]),te=_.__zoom,ae=typeof L=="function"?L.apply(_,T):L,ce=c(te.invert(Z).concat(H/te.k),ae.invert(Z).concat(H/ae.k));return function(ue){if(ue===1)ue=ae;else{var le=ce(ue),de=H/le[2];ue=new mo(de,Z[0]-le[0]*de,Z[1]-le[1]*de)}C.zoom(null,ue)}})}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=bs(this.that).datum();d.call($,this.that,new NF($,{sourceEvent:this.sourceEvent,target:g,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,_=Math.max(i[0],Math.min(i[1],z.k*Math.pow(2,r.apply(this,arguments)))),T=li($);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===_)return;I.mouse=[T,z.invert(T)],Jp(this),I.start()}Iu($),I.wheel=setTimeout(C,y),I.zoom("mouse",n(w(v(z,_),I.mouse[0],I.mouse[1]),I.extent,a));function C(){I.wheel=null,I.end()}}function M($,...L){if(p||!e.apply(this,arguments))return;var I=$.currentTarget,z=S(this,L,!0).event($),_=bs($.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",H,!0),T=li($,I),C=$.clientX,J=$.clientY;YE($.view),Zg($),z.mouse=[T,this.__zoom.invert(T)],Jp(this),z.start();function Z(te){if(Iu(te),!z.moved){var ae=te.clientX-C,ce=te.clientY-J;z.moved=ae*ae+ce*ce>k}z.event(te).zoom("mouse",n(w(z.that.__zoom,z.mouse[0]=li(te,I),z.mouse[1]),z.extent,a))}function H(te){_.on("mousemove.zoom mouseup.zoom",null),GE(te.view,z.moved),Iu(te),z.event(te).end()}}function W($,...L){if(e.apply(this,arguments)){var I=this.__zoom,z=li($.changedTouches?$.changedTouches[0]:$,this),_=I.invert(z),T=I.k*($.shiftKey?.5:2),C=n(w(v(I,T),z,_),t.apply(this,L),a);Iu($),l>0?bs(this).transition().duration(l).call(E,C,z,$):bs(this).call(g.transform,C,z,$)}}function D($,...L){if(e.apply(this,arguments)){var I=$.touches,z=I.length,_=S(this,L,$.changedTouches.length===z).event($),T,C,J,Z;for(Zg($),C=0;C<z;++C)J=I[C],Z=li(J,this),Z=[Z,this.__zoom.invert(Z),J.identifier],_.touch0?!_.touch1&&_.touch0[2]!==Z[2]&&(_.touch1=Z,_.taps=0):(_.touch0=Z,T=!0,_.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(_.taps<2&&(f=Z[0],u=setTimeout(function(){u=null},h)),Jp(this),_.start())}}function O($,...L){if(this.__zooming){var I=S(this,L).event($),z=$.changedTouches,_=z.length,T,C,J,Z;for(Iu($),T=0;T<_;++T)C=z[T],J=li(C,this),I.touch0&&I.touch0[2]===C.identifier?I.touch0[0]=J:I.touch1&&I.touch1[2]===C.identifier&&(I.touch1[0]=J);if(C=I.that.__zoom,I.touch1){var H=I.touch0[0],te=I.touch0[1],ae=I.touch1[0],ce=I.touch1[1],ue=(ue=ae[0]-H[0])*ue+(ue=ae[1]-H[1])*ue,le=(le=ce[0]-te[0])*le+(le=ce[1]-te[1])*le;C=v(C,Math.sqrt(ue/le)),J=[(H[0]+ae[0])/2,(H[1]+ae[1])/2],Z=[(te[0]+ce[0])/2,(te[1]+ce[1])/2]}else if(I.touch0)J=I.touch0[0],Z=I.touch0[1];else return;I.zoom("touch",n(w(C,J,Z),I.extent,a))}}function K($,...L){if(this.__zooming){var I=S(this,L).event($),z=$.changedTouches,_=z.length,T,C;for(Zg($),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),T=0;T<_;++T)C=z[T],I.touch0&&I.touch0[2]===C.identifier?delete I.touch0:I.touch1&&I.touch1[2]===C.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&&(C=li(C,this),Math.hypot(f[0]-C[0],f[1]-C[1])<b)){var J=bs(this).on("dblclick.zoom");J&&J.apply(this,arguments)}}}return g.wheelDelta=function($){return arguments.length?(r=typeof $=="function"?$:hp(+$),g):r},g.filter=function($){return arguments.length?(e=typeof $=="function"?$:hp(!!$),g):e},g.touchable=function($){return arguments.length?(s=typeof $=="function"?$:hp(!!$),g):s},g.extent=function($){return arguments.length?(t=typeof $=="function"?$:hp([[+$[0][0],+$[0][1]],[+$[1][0],+$[1][1]]]),g):t},g.scaleExtent=function($){return arguments.length?(i[0]=+$[0],i[1]=+$[1],g):[i[0],i[1]]},g.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],g):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},g.constrain=function($){return arguments.length?(n=$,g):n},g.duration=function($){return arguments.length?(l=+$,g):l},g.interpolate=function($){return arguments.length?(c=$,g):c},g.on=function(){var $=d.on.apply(d,arguments);return $===d?g:$},g.clickDistance=function($){return arguments.length?(k=($=+$)*$,g):Math.sqrt(k)},g.tapDistance=function($){return arguments.length?(b=+$,g):b},g}const Gi={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]],f_=["Enter"," ","Escape"],p_={"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 Ac;(function(e){e.Strict="strict",e.Loose="loose"})(Ac||(Ac={}));var nl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(nl||(nl={}));var $d;(function(e){e.Partial="partial",e.Full="full"})($d||($d={}));const h_={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Go;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Go||(Go={}));var cs;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(cs||(cs={}));var Be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Be||(Be={}));const Ak={[Be.Left]:Be.Right,[Be.Right]:Be.Left,[Be.Top]:Be.Bottom,[Be.Bottom]:Be.Top};function m_(e){return e===null?null:e?"valid":"invalid"}const g_=e=>"id"in e&&"source"in e&&"target"in e,AF=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Pv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),cf=(e,t=[0,0])=>{const{width:n,height:r}=Co(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},IF=(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):Pv(s)?s:t.nodeLookup.get(s.id));const l=a?$h(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Tm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Rm(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=Tm(n,$h(s)),r=!0)}),r?Rm(n):{x:0,y:0,width:0,height:0}},Av=(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,y=u.height??d.height??d.initialHeight??null,k=Dd(l,Tc(d)),b=(h??0)*(y??0),g=i&&k>0;(!d.internals.handleBounds||g||k>=b||d.dragging)&&c.push(d)}return c},TF=(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 RF(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 LF({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=RF(e,a),c=uf(l),d=Iv(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 y_({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",Gi.error005());else{const h=l.measured.width,y=l.measured.height;h&&y&&(f=[[c,d],[c+h,d+y]])}else l&&Rc(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=Rc(f)?fl(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",Gi.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 OF({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),y=!h&&p.parentId&&a.find(k=>k.id===p.parentId);(h||y)&&a.push(p)}const l=new Set(t.map(p=>p.id)),c=r.filter(p=>p.deletable!==!1),u=TF(a,c);for(const p of c)l.has(p.id)&&!u.find(y=>y.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 Ic=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),fl=(e={x:0,y:0},t,n)=>({x:Ic(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ic(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function x_(e,t,n){const{width:r,height:s}=Co(n),{x:i,y:a}=n.internals.positionAbsolute;return fl(e,[[i,a],[i+r,a+s]],t)}const Ik=(e,t,n)=>e<t?Ic(Math.abs(e-t),1,t)/t:e>n?-Ic(Math.abs(e-n),1,t)/t:0,w_=(e,t,n=15,r=40)=>{const s=Ik(e.x,r,t.width-r)*n,i=Ik(e.y,r,t.height-r)*n;return[s,i]},Tm=(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)}),Vx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Rm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Tc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Pv(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}},$h=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Pv(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)}},v_=(e,t)=>Rm(Tm(Vx(e),Vx(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)},Tk=e=>fi(e.width)&&fi(e.height)&&fi(e.x)&&fi(e.y),fi=e=>!isNaN(e)&&isFinite(e),MF=(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},Dh=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function $l(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 $F(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=$l(e,n),s=$l(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=$l(e.top??e.y??0,n),s=$l(e.bottom??e.y??0,n),i=$l(e.left??e.x??0,t),a=$l(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 DF(e,t,n,r,s,i){const{x:a,y:l}=Dh(e,[t,n,r]),{x:c,y:d}=Dh({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 Iv=(e,t,n,r,s,i)=>{const a=$F(i,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,d=Math.min(l,c),u=Ic(d,r,s),f=e.x+e.width/2,p=e.y+e.height/2,h=t/2-f*u,y=n/2-p*u,k=DF(e,h,y,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:y-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 Rc(e){return e!=null&&e!=="parent"}function Co(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 b_(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 k_(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 Rk(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function FF(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function zF(e){return{...p_,...e||{}}}function od(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=pi(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 Tv=e=>({width:e.offsetWidth,height:e.offsetHeight}),S_=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},BF=["INPUT","SELECT","TEXTAREA"];function N_(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:BF.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const j_=e=>"clientX"in e,pi=(e,t)=>{var i,a;const n=j_(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)}},Lk=(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,...Tv(a)}})};function C_({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 mp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ok({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Be.Left:return[t-mp(t-r,i),n];case Be.Right:return[t+mp(r-t,i),n];case Be.Top:return[t,n-mp(n-s,i)];case Be.Bottom:return[t,n+mp(s-n,i)]}}function E_({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:r,targetY:s,targetPosition:i=Be.Top,curvature:a=.25}){const[l,c]=Ok({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[d,u]=Ok({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[f,p,h,y]=C_({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,y]}function __({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 HF({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 UF({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Tm($h(e),$h(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,Rm(i))>0}const WF=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,VF=(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||WF;let s;return g_(e)?s={...e}:s={...e,id:r(e)},VF(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function P_({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=__({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const Mk={[Be.Left]:{x:-1,y:0},[Be.Right]:{x:1,y:0},[Be.Top]:{x:0,y:-1},[Be.Bottom]:{x:0,y:1}},KF=({source:e,sourcePosition:t=Be.Bottom,target:n})=>t===Be.Left||t===Be.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},$k=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function qF({source:e,sourcePosition:t=Be.Bottom,target:n,targetPosition:r=Be.Top,center:s,offset:i,stepPosition:a}){const l=Mk[t],c=Mk[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=KF({source:d,sourcePosition:t,target:u}),p=f.x!==0?"x":"y",h=f[p];let y=[],k,b;const g={x:0,y:0},v={x:0,y:0},[,,w,j]=__({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?y=p==="x"?R:M:y=p==="x"?M:R}else{const R=[{x:d.x,y:u.y}],M=[{x:u.x,y:d.y}];if(p==="x"?y=l.x===h?M:R:y=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?g[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))&&(y=p==="x"?R:M)}const W={x:d.x+g.x,y:d.y+g.y},D={x:u.x+v.x,y:u.y+v.y},O=Math.max(Math.abs(W.x-y[0].x),Math.abs(D.x-y[0].x)),K=Math.max(Math.abs(W.y-y[0].y),Math.abs(D.y-y[0].y));O>=K?(k=(W.x+D.x)/2,b=y[0].y):(k=y[0].x,b=(W.y+D.y)/2)}const E={x:d.x+g.x,y:d.y+g.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...E.x!==y[0].x||E.y!==y[0].y?[E]:[],...y,...S.x!==y[y.length-1].x||S.y!==y[y.length-1].y?[S]:[],n],k,b,w,j]}function YF(e,t,n,r){const s=Math.min($k(e,t)/2,$k(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 Kx({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:r,targetY:s,targetPosition:i=Be.Top,borderRadius:a=5,centerX:l,centerY:c,offset:d=20,stepPosition:u=.5}){const[f,p,h,y,k]=qF({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 g=1;g<f.length-1;g++)b+=YF(f[g-1],f[g],f[g+1],a);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,p,h,y,k]}function Dk(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function GF(e){var f;const{sourceNode:t,targetNode:n}=e;if(!Dk(t)||!Dk(n))return null;const r=t.internals.handleBounds||Fk(t.handles),s=n.internals.handleBounds||Fk(n.handles),i=zk((r==null?void 0:r.source)??[],e.sourceHandle),a=zk(e.connectionMode===Ac.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",Gi.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Be.Bottom,c=(a==null?void 0:a.position)||Be.Top,d=pl(t,i,l),u=pl(n,a,c);return{sourceX:d.x,sourceY:d.y,targetX:u.x,targetY:u.y,sourcePosition:l,targetPosition:c}}function Fk(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 pl(e,t,n=Be.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??Co(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Be.Top:return{x:s+a/2,y:i};case Be.Right:return{x:s+a,y:i+l/2};case Be.Bottom:return{x:s+a/2,y:i+l};case Be.Left:return{x:s,y:i+l/2}}}function zk(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function qx(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function XF(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=qx(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 A_=1e3,JF=10,Rv={nodeOrigin:[0,0],nodeExtent:Md,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},QF={...Rv,checkEquality:!0};function Lv(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function ZF(e,t,n){const r=Lv(Rv,n);for(const s of e.values())if(s.parentId)Mv(s,e,t,r);else{const i=cf(s,r.nodeOrigin),a=Rc(s.extent)?s.extent:r.nodeExtent,l=fl(i,a,Co(s));s.internals.positionAbsolute=l}}function e3(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 Ov(e){return e==="manual"}function Yx(e,t,n,r={}){var u,f;const s=Lv(QF,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Ov(s.zIndexMode)?A_: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 y=cf(p,s.nodeOrigin),k=Rc(p.extent)?p.extent:s.nodeExtent,b=fl(y,k,Co(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:e3(p,h),z:I_(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&&Mv(h,t,n,r,i),d||(d=p.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:d}}function t3(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 Mv(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Lv(Rv,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}t3(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*JF),s&&u.internals.rootParentIndex!==void 0&&(s.i=u.internals.rootParentIndex);const f=i&&!Ov(c)?A_:0,{x:p,y:h,z:y}=n3(e,u,a,l,f,c),{positionAbsolute:k}=e.internals,b=p!==k.x||h!==k.y;(b||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:p,y:h}:k,z:y}})}function I_(e,t,n){const r=fi(e.zIndex)?e.zIndex:0;return Ov(n)?r:r+(e.selected?t:0)}function n3(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,c=Co(e),d=cf(e,n),u=Rc(e.extent)?fl(d,e.extent,c):d;let f=fl({x:a+u.x,y:l+u.y},r,c);e.extent==="parent"&&(f=x_(f,c,t));const p=I_(e,s,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=p?h+1:p}}function $v(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)??Tc(c),u=v_(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=Co(c),p=c.origin??r,h=l.x<u.x?Math.round(Math.abs(u.x-l.x)):0,y=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)),g=(k-f.width)*p[0],v=(b-f.height)*p[1];(h>0||y>0||g||v)&&(s.push({id:d,type:"position",position:{x:c.position.x-h+g,y:c.position.y-y+v}}),(w=n.get(d))==null||w.forEach(j=>{e.some(E=>E.id===j.id)||s.push({id:j.id,type:"position",position:{x:j.position.x+h,y:j.position.y+y}})})),(f.width<l.width||f.height<l.height||h||y)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:k+(h?p[0]*h-g:0),height:b+(y?p[1]*y-v:0)}})}),s}function r3(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 y=t.get(h.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),c=!0;continue}const k=Tv(h.nodeElement),b=y.measured.width!==k.width||y.measured.height!==k.height;if(!!(k.width&&k.height&&(b||!y.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),w=Rc(y.extent)?y.extent:i;let{positionAbsolute:j}=y.internals;y.parentId&&y.extent==="parent"?j=x_(j,k,t.get(y.parentId)):w&&(j=fl(j,w,k));const E={...y,measured:k,internals:{...y.internals,positionAbsolute:j,handleBounds:{source:Lk("source",h.nodeElement,v,f,y.id),target:Lk("target",h.nodeElement,v,f,y.id)}}};t.set(y.id,E),y.parentId&&Mv(E,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,b&&(d.push({id:y.id,type:"dimensions",dimensions:k}),y.expandParent&&y.parentId&&p.push({id:y.id,parentId:y.parentId,rect:Tc(E,s)}))}}if(p.length>0){const h=$v(p,t,n,s);d.push(...h)}return{changes:d,updatedInternals:c}}async function s3({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 Bk(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 T_(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}`;Bk("source",c,u,e,s,a),Bk("target",c,d,e,i,l),t.set(r.id,r)}}function R_(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:R_(n,t):!1}function Hk(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 i3(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!R_(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 ey({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 o3({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 a3({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,y=!1,k=null;function b({noDragClassName:v,handleSelector:w,domNode:j,isSelectable:E,nodeId:S,nodeClickDistance:A=0}){p=bs(j);function R({x:O,y:K}){const{nodeLookup:$,nodeExtent:L,snapGrid:I,snapToGrid:z,nodeOrigin:_,onNodeDrag:T,onSelectionDrag:C,onError:J,updateNodePositions:Z}=t();i={x:O,y:K};let H=!1;const te=l.size>1,ae=te&&L?Vx(uf(l)):null,ce=te&&z?o3({dragItems:l,snapGrid:I,x:O,y:K}):null;for(const[ue,le]of l){if(!$.has(ue))continue;let de={x:O-le.distance.x,y:K-le.distance.y};z&&(de=ce?{x:Math.round(de.x+ce.x),y:Math.round(de.y+ce.y)}:df(de,I));let se=null;if(te&&L&&!le.extent&&ae){const{positionAbsolute:je}=le.internals,He=je.x-ae.x+L[0][0],lt=je.x+le.measured.width-ae.x2+L[1][0],Ge=je.y-ae.y+L[0][1],Ct=je.y+le.measured.height-ae.y2+L[1][1];se=[[He,Ge],[lt,Ct]]}const{position:fe,positionAbsolute:ye}=y_({nodeId:ue,nextPosition:de,nodeLookup:$,nodeExtent:se||L,nodeOrigin:_,onError:J});H=H||le.position.x!==fe.x||le.position.y!==fe.y,le.position=fe,le.internals.positionAbsolute=ye}if(y=y||H,!!H&&(Z(l,!0),k&&(r||T||!S&&C))){const[ue,le]=ey({nodeId:S,dragItems:l,nodeLookup:$});r==null||r(k,l,ue,le),T==null||T(k,ue,le),S||C==null||C(k,le)}}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]=w_(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 W(O){var te;const{nodeLookup:K,multiSelectionActive:$,nodesDraggable:L,transform:I,snapGrid:z,snapToGrid:_,selectNodesOnDrag:T,onNodeDragStart:C,onSelectionDragStart:J,unselectNodesAndEdges:Z}=t();f=!0,(!T||!E)&&!$&&S&&((te=K.get(S))!=null&&te.selected||Z()),E&&T&&S&&(e==null||e(S));const H=od(O.sourceEvent,{transform:I,snapGrid:z,snapToGrid:_,containerBounds:u});if(i=H,l=i3(K,L,H,S),l.size>0&&(n||C||!S&&J)){const[ae,ce]=ey({nodeId:S,dragItems:l,nodeLookup:K});n==null||n(O.sourceEvent,l,ae,ce),C==null||C(O.sourceEvent,ae,ce),S||J==null||J(O.sourceEvent,ce)}}const D=XE().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,y=!1,k=O.sourceEvent,$===0&&W(O),i=od(O.sourceEvent,{transform:L,snapGrid:I,snapToGrid:z,containerBounds:u}),d=pi(O.sourceEvent,u)}).on("drag",O=>{const{autoPanOnNodeDrag:K,transform:$,snapGrid:L,snapToGrid:I,nodeDragThreshold:z,nodeLookup:_}=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&&!_.has(S))&&(h=!0),!h){if(!c&&K&&f&&(c=!0,M()),!f){const C=pi(O.sourceEvent,u),J=C.x-d.x,Z=C.y-d.y;Math.sqrt(J*J+Z*Z)>z&&W(O)}(i.x!==T.xSnapped||i.y!==T.ySnapped)&&l&&f&&(d=pi(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(y&&($(l,!1),y=!1),s||L||!S&&I){const[z,_]=ey({nodeId:S,dragItems:l,nodeLookup:K,dragging:!1});s==null||s(O.sourceEvent,l,z,_),L==null||L(O.sourceEvent,z,_),S||I==null||I(O.sourceEvent,_)}}}).filter(O=>{const K=O.target;return!O.button&&(!v||!Hk(K,`.${v}`,j))&&(!w||Hk(K,w,j))});p.call(D)}function g(){p==null||p.on(".drag",null)}return{update:b,destroy:g}}function l3(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,Tc(i))>0&&r.push(i);return r}const c3=250;function u3(e,t,n,r){var l,c;let s=[],i=1/0;const a=l3(e,n,t+c3);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}=pl(d,f,f.position,!0),y=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(h-e.y,2));y>t||(y<i?(s=[{...f,x:p,y:h}],i=y):y===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 L_(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,...pl(a,c,c.position,!0)}:c}function O_(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function d3(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const M_=()=>!0;function f3(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:y,onConnect:k,onConnectEnd:b,isValidConnection:g=M_,onReconnectEnd:v,updateConnection:w,getTransform:j,getFromHandle:E,autoPanSpeed:S,dragThreshold:A=1,handleDomNode:R}){const M=S_(e.target);let W=0,D;const{x:O,y:K}=pi(e),$=O_(i,R),L=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!L||!$)return;const z=L_(s,$,r,c,t);if(!z)return;let _=pi(e,L),T=!1,C=null,J=!1,Z=null;function H(){if(!u||!L)return;const[fe,ye]=w_(_,L,S);p({x:fe,y:ye}),W=requestAnimationFrame(H)}const te={...z,nodeId:s,type:$,position:z.position},ae=c.get(s);let ue={inProgress:!0,isValid:null,from:pl(ae,te,Be.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:ae,to:_,toHandle:null,toPosition:Ak[te.position],toNode:null,pointer:_};function le(){I=!0,w(ue),y==null||y(e,{nodeId:s,handleId:r,handleType:$})}A===0&&le();function de(fe){if(!I){const{x:Ct,y:Me}=pi(fe),Ce=Ct-O,Gt=Me-K;if(!(Ce*Ce+Gt*Gt>A*A))return;le()}if(!E()||!te){se(fe);return}const ye=j();_=pi(fe,L),D=u3(ff(_,ye,!1,[1,1]),n,c,te),T||(H(),T=!0);const je=$_(fe,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:M,lib:d,flowId:f,nodeLookup:c});Z=je.handleDomNode,C=je.connection,J=d3(!!D,je.isValid);const He=c.get(s),lt=He?pl(He,te,Be.Left,!0):ue.from,Ge={...ue,from:lt,isValid:J,to:je.toHandle&&J?Dh({x:je.toHandle.x,y:je.toHandle.y},ye):_,toHandle:je.toHandle,toPosition:J&&je.toHandle?je.toHandle.position:Ak[te.position],toNode:je.toHandle?c.get(je.toHandle.nodeId):null,pointer:_};w(Ge),ue=Ge}function se(fe){if(!("touches"in fe&&fe.touches.length>0)){if(I){(D||Z)&&C&&J&&(k==null||k(C));const{inProgress:ye,...je}=ue,He={...je,toPosition:ue.toHandle?ue.toPosition:null};b==null||b(fe,He),i&&(v==null||v(fe,He))}h(),cancelAnimationFrame(W),T=!1,J=!1,C=null,Z=null,M.removeEventListener("mousemove",de),M.removeEventListener("mouseup",se),M.removeEventListener("touchmove",de),M.removeEventListener("touchend",se)}}M.addEventListener("mousemove",de),M.addEventListener("mouseup",se),M.addEventListener("touchmove",de),M.addEventListener("touchend",se)}function $_(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:c,isValidConnection:d=M_,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}=pi(e),k=a.elementFromPoint(h,y),b=k!=null&&k.classList.contains(`${l}-flow__handle`)?k:p,g={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const v=O_(void 0,b),w=b.getAttribute("data-nodeid"),j=b.getAttribute("data-handleid"),E=b.classList.contains("connectable"),S=b.classList.contains("connectableend");if(!w||!v)return g;const A={source:f?w:r,sourceHandle:f?j:s,target:f?r:w,targetHandle:f?s:j};g.connection=A;const M=E&&S&&(n===Ac.Strict?f&&v==="source"||!f&&v==="target":w!==r||j!==s);g.isValid=M&&d(A),g.toHandle=L_(w,v,j,u,n,!0)}return g}const Gx={onPointerDown:f3,isValid:$_};function p3({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=bs(e);function i({translateExtent:l,width:c,height:d,zoomStep:u=1,pannable:f=!0,zoomable:p=!0,inversePan:h=!1}){const y=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const j=n(),E=w.sourceEvent.ctrlKey&&Fd()?10:1,S=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*u,A=j[2]*Math.pow(2,S*E);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])},g=w=>{const j=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const E=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],S=[E[0]-k[0],E[1]-k[1]];k=E;const A=r()*Math.max(j[2],Math.log(j[2]))*(h?-1:1),R={x:j[0]-S[0]*A,y:j[1]-S[1]*A},M=[[0,0],[c,d]];t.setViewportConstrained({x:R.x,y:R.y,zoom:j[2]},M,l)},v=d_().on("start",b).on("zoom",f?g:null).on("zoom.wheel",p?y:null);s.call(v,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:li}}const Lm=e=>({x:e.x,y:e.y,zoom:e.k}),ty=({x:e,y:t,zoom:n})=>Im.translate(e,t).scale(n),sc=(e,t)=>e.target.closest(`.${t}`),D_=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),h3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ny=(e,t=0,n=h3,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},F_=e=>{const t=e.ctrlKey&&Fd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function m3({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return u=>{if(sc(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=li(u),g=F_(u),v=f*Math.pow(2,g);r.scaleTo(n,v,b,u);return}const p=u.deltaMode===1?20:1;let h=s===nl.Vertical?0:u.deltaX*p,y=s===nl.Horizontal?0:u.deltaY*p;!Fd()&&u.shiftKey&&s!==nl.Vertical&&(h=u.deltaY*p,y=0),r.translateBy(n,-(h/f)*i,-(y/f)*i,{internal:!0});const k=Lm(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 g3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=sc(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function y3({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Lm(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 x3({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&D_(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,Lm(i.transform)))}}function w3({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&&D_(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Lm(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function v3({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,y=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(sc(f,`${d}-flow__node`)||sc(f,`${d}-flow__edge`)))return!0;if(!r&&!p&&!s&&!i&&!n||a||u&&!y||sc(f,l)&&y||sc(f,c)&&(!y||s&&y&&!e)||!n&&f.ctrlKey&&y)return!1;if(!n&&f.type==="touchstart"&&((b=f.touches)==null?void 0:b.length)>1)return f.preventDefault(),!1;if(!p&&!s&&!h&&y||!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||y)&&k}}function b3({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=d_().scaleExtent([t,n]).translateExtent(r),p=bs(e).call(f);v({x:s.x,y:s.y,zoom:Ic(s.zoom,t,n)},[[0,0],[u.width,u.height]],r);const h=p.on("wheel.zoom"),y=p.on("dblclick.zoom");f.wheelDelta(F_);function k(D,O){return p?new Promise(K=>{f==null||f.interpolate((O==null?void 0:O.interpolate)==="linear"?id:Yp).transform(ny(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:_,preventScrolling:T,zoomOnPinch:C,zoomOnScroll:J,zoomOnDoubleClick:Z,zoomActivationKeyPressed:H,lib:te,onTransformChange:ae,connectionInProgress:ce,paneClickDistance:ue,selectionOnDrag:le}){$&&!d.isZoomingOrPanning&&g();const de=L&&!H&&!$;f.clickDistance(le?1/0:!fi(ue)||ue<0?0:ue);const se=de?m3({zoomPanValues:d,noWheelClassName:D,d3Selection:p,d3Zoom:f,panOnScrollMode:z,panOnScrollSpeed:_,zoomOnPinch:C,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):g3({noWheelClassName:D,preventScrolling:T,d3ZoomHandler:h});if(p.on("wheel.zoom",se,{passive:!1}),!$){const ye=y3({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:a});f.on("start",ye);const je=x3({zoomPanValues:d,panOnDrag:I,onPaneContextMenu:!!K,onPanZoom:i,onTransformChange:ae});f.on("zoom",je);const He=w3({zoomPanValues:d,panOnDrag:I,panOnScroll:L,onPaneContextMenu:K,onPanZoomEnd:l,onDraggingChange:c});f.on("end",He)}const fe=v3({zoomActivationKeyPressed:H,panOnDrag:I,zoomOnScroll:J,panOnScroll:L,zoomOnDoubleClick:Z,zoomOnPinch:C,userSelectionActive:$,noPanClassName:O,noWheelClassName:D,lib:te,connectionInProgress:ce});f.filter(fe),Z?p.on("dblclick.zoom",y):p.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function v(D,O,K){const $=ty(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=ty(D);return await k(K,O),new Promise($=>$(K))}function j(D){if(p){const O=ty(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 E(){const D=p?u_(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:Yp).scaleTo(ny(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:Yp).scaleBy(ny(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 W(D){const O=!fi(D)||D<0?0:D;f==null||f.clickDistance(O)}return{update:b,destroy:g,setViewport:w,setViewportConstrained:v,getViewport:E,scaleTo:S,scaleBy:A,setScaleExtent:R,setTranslateExtent:M,syncViewport:j,setClickDistance:W}}var Lc;(function(e){e.Line="line",e.Handle="handle"})(Lc||(Lc={}));function k3({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 Uk(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 zo(e,t){return Math.max(0,t-e)}function Bo(e,t){return Math.max(0,e-t)}function gp(e,t,n){return Math.max(0,t-e,e-n)}function Wk(e,t){return e?!t:t}function S3(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:y}=n,{minWidth:k,maxWidth:b,minHeight:g,maxHeight:v}=r,{x:w,y:j,width:E,height:S,aspectRatio:A}=e;let R=Math.floor(u?h-e.pointerX:0),M=Math.floor(f?y-e.pointerY:0);const W=E+(c?-R:R),D=S+(d?-M:M),O=-i[0]*E,K=-i[1]*S;let $=gp(W,k,b),L=gp(D,g,v);if(a){let _=0,T=0;c&&R<0?_=zo(w+R+O,a[0][0]):!c&&R>0&&(_=Bo(w+W+O,a[1][0])),d&&M<0?T=zo(j+M+K,a[0][1]):!d&&M>0&&(T=Bo(j+D+K,a[1][1])),$=Math.max($,_),L=Math.max(L,T)}if(l){let _=0,T=0;c&&R>0?_=Bo(w+R,l[0][0]):!c&&R<0&&(_=zo(w+W,l[1][0])),d&&M>0?T=Bo(j+M,l[0][1]):!d&&M<0&&(T=zo(j+D,l[1][1])),$=Math.max($,_),L=Math.max(L,T)}if(s){if(u){const _=gp(W/A,g,v)*A;if($=Math.max($,_),a){let T=0;!c&&!d||c&&!d&&p?T=Bo(j+K+W/A,a[1][1])*A:T=zo(j+K+(c?R:-R)/A,a[0][1])*A,$=Math.max($,T)}if(l){let T=0;!c&&!d||c&&!d&&p?T=zo(j+W/A,l[1][1])*A:T=Bo(j+(c?R:-R)/A,l[0][1])*A,$=Math.max($,T)}}if(f){const _=gp(D*A,k,b)/A;if(L=Math.max(L,_),a){let T=0;!c&&!d||d&&!c&&p?T=Bo(w+D*A+O,a[1][0])/A:T=zo(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=zo(w+D*A,l[1][0])/A:T=Bo(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?W>D*A?M=(Wk(c,d)?-R:R)/A:R=(Wk(c,d)?-M:M)*A:u?(M=R/A,d=c):(R=M*A,c=d));const I=c?w+R:w,z=d?j+M:j;return{width:E+(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 z_={width:0,height:0,x:0,y:0},N3={...z_,pointerX:0,pointerY:0,aspectRatio:1};function j3(e){return[[0,0],[e.measured.width,e.measured.height]]}function C3(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 E3({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=bs(e);let a={controlDirection:Uk("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:y,onResizeEnd:k,shouldResize:b}){let g={...z_},v={...N3};a={boundaries:u,resizeDirection:p,keepAspectRatio:f,controlDirection:Uk(d)};let w,j=null,E=[],S,A,R,M=!1;const W=XE().on("start",D=>{const{nodeLookup:O,transform:K,snapGrid:$,snapToGrid:L,nodeOrigin:I,paneDomNode:z}=n();if(w=O.get(t),!w)return;j=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:_,ySnapped:T}=od(D.sourceEvent,{transform:K,snapGrid:$,snapToGrid:L,containerBounds:j});g={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},v={...g,pointerX:_,pointerY:T,aspectRatio:g.width/g.height},S=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(S=O.get(w.parentId),A=S&&w.extent==="parent"?j3(S):void 0),E=[],R=void 0;for(const[C,J]of O)if(J.parentId===t&&(E.push({id:C,position:{...J.position},extent:J.extent}),J.extent==="parent"||J.expandParent)){const Z=C3(J,w,J.origin??I);R?R=[[Math.min(Z[0][0],R[0][0]),Math.min(Z[0][1],R[0][1])],[Math.max(Z[1][0],R[1][0]),Math.max(Z[1][1],R[1][1])]]:R=Z}h==null||h(D,{...g})}).on("drag",D=>{const{transform:O,snapGrid:K,snapToGrid:$,nodeOrigin:L}=n(),I=od(D.sourceEvent,{transform:O,snapGrid:K,snapToGrid:$,containerBounds:j}),z=[];if(!w)return;const{x:_,y:T,width:C,height:J}=g,Z={},H=w.origin??L,{width:te,height:ae,x:ce,y:ue}=S3(v,a.controlDirection,I,a.boundaries,a.keepAspectRatio,H,A,R),le=te!==C,de=ae!==J,se=ce!==_&&le,fe=ue!==T&&de;if(!se&&!fe&&!le&&!de)return;if((se||fe||H[0]===1||H[1]===1)&&(Z.x=se?ce:g.x,Z.y=fe?ue:g.y,g.x=Z.x,g.y=Z.y,E.length>0)){const lt=ce-_,Ge=ue-T;for(const Ct of E)Ct.position={x:Ct.position.x-lt+H[0]*(te-C),y:Ct.position.y-Ge+H[1]*(ae-J)},z.push(Ct)}if((le||de)&&(Z.width=le&&(!a.resizeDirection||a.resizeDirection==="horizontal")?te:g.width,Z.height=de&&(!a.resizeDirection||a.resizeDirection==="vertical")?ae:g.height,g.width=Z.width,g.height=Z.height),S&&w.expandParent){const lt=H[0]*(Z.width??0);Z.x&&Z.x<lt&&(g.x=lt,v.x=v.x-(Z.x-lt));const Ge=H[1]*(Z.height??0);Z.y&&Z.y<Ge&&(g.y=Ge,v.y=v.y-(Z.y-Ge))}const ye=k3({width:g.width,prevWidth:C,height:g.height,prevHeight:J,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),je={...g,direction:ye};(b==null?void 0:b(D,je))!==!1&&(M=!0,y==null||y(D,je),r(Z,z))}).on("end",D=>{M&&(k==null||k(D,{...g}),s==null||s({...g}),M=!1)});i.call(W)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var B_={exports:{}},H_={},U_={exports:{}},W_={};/**
|
|
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 Oc=m;function _3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var P3=typeof Object.is=="function"?Object.is:_3,A3=Oc.useState,I3=Oc.useEffect,T3=Oc.useLayoutEffect,R3=Oc.useDebugValue;function L3(e,t){var n=t(),r=A3({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return T3(function(){s.value=n,s.getSnapshot=t,ry(s)&&i({inst:s})},[e,n,t]),I3(function(){return ry(s)&&i({inst:s}),e(function(){ry(s)&&i({inst:s})})},[e]),R3(n),n}function ry(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!P3(e,n)}catch{return!0}}function O3(e,t){return t()}var M3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?O3:L3;W_.useSyncExternalStore=Oc.useSyncExternalStore!==void 0?Oc.useSyncExternalStore:M3;U_.exports=W_;var V_=U_.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 Om=m,$3=V_;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=$3.useSyncExternalStore,B3=Om.useRef,H3=Om.useEffect,U3=Om.useMemo,W3=Om.useDebugValue;H_.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=B3(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=U3(function(){function c(h){if(!d){if(d=!0,u=h,h=r(h),s!==void 0&&a.hasValue){var y=a.value;if(s(y,h))return f=y}return f=h}if(y=f,F3(u,h))return y;var k=r(h);return s!==void 0&&s(y,k)?(u=h,y):(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=z3(e,i[0],i[1]);return H3(function(){a.hasValue=!0,a.value=l},[l]),W3(l),l};B_.exports=H_;var V3=B_.exports;const K3=wa(V3),q3={},Vk=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(y=>y(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(q3?"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},Y3=e=>e?Vk(e):Vk,{useDebugValue:G3}=Qe,{useSyncExternalStoreWithSelector:X3}=K3,J3=e=>e;function K_(e,t=J3,n){const r=X3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return G3(r),r}const Kk=(e,t)=>{const n=Y3(e),r=(s,i=t)=>K_(n,s,i);return Object.assign(r,n),r},Q3=(e,t)=>e?Kk(e,t):Kk;function bn(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 Mm=m.createContext(null),Z3=Mm.Provider,q_=Gi.error001();function Lt(e,t){const n=m.useContext(Mm);if(n===null)throw new Error(q_);return K_(n,e,t)}function mn(){const e=m.useContext(Mm);if(e===null)throw new Error(q_);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const qk={display:"none"},ez={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Y_="react-flow__node-desc",G_="react-flow__edge-desc",tz="react-flow__aria-live",nz=e=>e.ariaLiveMessage,rz=e=>e.ariaLabelConfig;function sz({rfId:e}){const t=Lt(nz);return o.jsx("div",{id:`${tz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ez,children:t})}function iz({rfId:e,disableKeyboardA11y:t}){const n=Lt(rz);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${Y_}-${e}`,style:qk,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${G_}-${e}`,style:qk,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(sz,{rfId:e})]})}const Mc=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Xn(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});Mc.displayName="Panel";function oz({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Mc,{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 az=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}},yp=e=>e.id;function lz(e,t){return bn(e.selectedNodes.map(yp),t.selectedNodes.map(yp))&&bn(e.selectedEdges.map(yp),t.selectedEdges.map(yp))}function cz({onSelectionChange:e}){const t=mn(),{selectedNodes:n,selectedEdges:r}=Lt(az,lz);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 uz=e=>!!e.onSelectionChangeHandlers;function dz({onSelectionChange:e}){const t=Lt(uz);return e||t?o.jsx(cz,{onSelectionChange:e}):null}const Xx=typeof window<"u"?m.useLayoutEffect:m.useEffect,X_=[0,0],fz={x:0,y:0,zoom:1},pz=["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"],Yk=[...pz,"rfId"],hz=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}),Gk={translateExtent:Md,nodeOrigin:X_,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function mz(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Lt(hz,bn),d=mn();Xx(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Gk,l()}),[]);const u=m.useRef(Gk);return Xx(()=>{for(const f of Yk){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:zF(p)}):f==="fitView"?d.setState({fitViewQueued:p}):f==="fitViewOptions"?d.setState({fitViewOptions:p}):d.setState({[f]:p})))}u.current=e},Yk.map(f=>e[f])),null}function Xk(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function gz(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=Xk(),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=Xk())!=null&&r.matches?"dark":"light"}const Jk=typeof document<"u"?document:null;function Bd(e=null,t={target:Jk,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)??Jk,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const u=h=>{var b,g;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!d)&&N_(h))return!1;const k=Zk(h.code,l);if(i.current.add(h[k]),Qk(a,i.current,!1)){const v=((g=(b=h.composedPath)==null?void 0:b.call(h))==null?void 0:g[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 y=Zk(h.code,l);Qk(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[y]),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 Qk(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function Zk(e,t){return t.includes(e)?"code":"key"}const yz=()=>{const e=mn();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=Iv(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=Dh(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function J_(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)xz(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 xz(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 Dv(e,t){return J_(e,t)}function Q_(e,t){return J_(e,t)}function qa(e,t){return{id:e,type:"select",selected:t}}function ic(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(qa(i.id,a)))}return r}function eS({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 tS(e){return{id:e.id,type:"remove"}}const nS=e=>AF(e),wz=e=>g_(e);function Z_(e){return m.forwardRef(e)}function rS(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>vz(()=>n(s=>s+BigInt(1))));return Xx(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function vz(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const eP=m.createContext(null);function bz({children:e}){const t=mn(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:d,hasDefaultNodes:u,onNodesChange:f,nodeLookup:p,fitViewQueued:h,onNodesChangeMiddlewareMap:y}=t.getState();let k=c;for(const g of l)k=typeof g=="function"?g(k):g;let b=eS({items:k,lookup:p});for(const g of y.values())b=g(b);u&&d(k),b.length>0?f==null||f(b):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:v,setNodes:w}=t.getState();g&&w(v)})},[]),r=rS(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:d,hasDefaultEdges:u,onEdgesChange:f,edgeLookup:p}=t.getState();let h=c;for(const y of l)h=typeof y=="function"?y(h):y;u?d(h):f&&f(eS({items:h,lookup:p}))},[]),i=rS(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(eP.Provider,{value:a,children:e})}function kz(){const e=m.useContext(eP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Sz=e=>!!e.panZoom;function wl(){const e=yz(),t=mn(),n=kz(),r=Lt(Sz),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 g,v;const{nodeLookup:p,nodeOrigin:h}=t.getState(),y=nS(f)?f:p.get(f.id),k=y.parentId?k_(y.position,y.measured,y.parentId,p,h):y.position,b={...y,position:k,width:((g=y.measured)==null?void 0:g.width)??y.width,height:((v=y.measured)==null?void 0:v.height)??y.height};return Tc(b)},d=(f,p,h={replace:!1})=>{a(y=>y.map(k=>{if(k.id===f){const b=typeof p=="function"?p(k):p;return h.replace&&nS(b)?b:{...k,...b}}return k}))},u=(f,p,h={replace:!1})=>{l(y=>y.map(k=>{if(k.id===f){const b=typeof p=="function"?p(k):p;return h.replace&&wz(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(),[y,k,b]=h;return{nodes:f.map(g=>({...g})),edges:p.map(g=>({...g})),viewport:{x:y,y:k,zoom:b}}},deleteElements:async({nodes:f=[],edges:p=[]})=>{const{nodes:h,edges:y,onNodesDelete:k,onEdgesDelete:b,triggerNodeChanges:g,triggerEdgeChanges:v,onDelete:w,onBeforeDelete:j}=t.getState(),{nodes:E,edges:S}=await OF({nodesToRemove:f,edgesToRemove:p,nodes:h,edges:y,onBeforeDelete:j}),A=S.length>0,R=E.length>0;if(A){const M=S.map(tS);b==null||b(S),v(M)}if(R){const M=E.map(tS);k==null||k(E),g(M)}return(R||A)&&(w==null||w({nodes:E,edges:S})),{deletedNodes:E,deletedEdges:S}},getIntersectingNodes:(f,p=!0,h)=>{const y=Tk(f),k=y?f:c(f),b=h!==void 0;return k?(h||t.getState().nodes).filter(g=>{const v=t.getState().nodeLookup.get(g.id);if(v&&!y&&(g.id===f.id||!v.internals.positionAbsolute))return!1;const w=Tc(b?g:v),j=Dd(w,k);return p&&j>0||j>=w.width*w.height||j>=k.width*k.height}):[]},isNodeIntersecting:(f,p,h=!0)=>{const k=Tk(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,y=>{const k=typeof p=="function"?p(y):p;return h.replace?{...y,data:k}:{...y,data:{...y.data,...k}}},h)},updateEdge:u,updateEdgeData:(f,p,h={replace:!1})=>{u(f,y=>{const k=typeof p=="function"?p(y):p;return h.replace?{...y,data:k}:{...y,data:{...y.data,...k}}},h)},getNodesBounds:f=>{const{nodeLookup:p,nodeOrigin:h}=t.getState();return IF(f,{nodeLookup:p,nodeOrigin:h})},getHandleConnections:({type:f,id:p,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}-${f}${p?`-${p}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:f,handleId:p,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}${f?p?`-${f}-${p}`:`-${f}`:""}`))==null?void 0:y.values())??[])},fitView:async f=>{const p=t.getState().fitViewResolver??FF();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 sS=e=>e.selected,Nz=typeof window<"u"?window:void 0;function jz({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=mn(),{deleteElements:r}=wl(),s=Bd(e,{actInsideInputWithModifier:!1}),i=Bd(t,{target:Nz});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(sS),edges:a.filter(sS)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Cz(e){const t=mn();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=Tv(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Gi.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 $m={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ez=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function _z({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=nl.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:u,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:h=!0,children:y,noWheelClassName:k,noPanClassName:b,onViewportChange:g,isControlledViewport:v,paneClickDistance:w,selectionOnDrag:j}){const E=mn(),S=m.useRef(null),{userSelectionActive:A,lib:R,connectionInProgress:M}=Lt(Ez,bn),W=Bd(p),D=m.useRef();Cz(S);const O=m.useCallback(K=>{g==null||g({x:K[0],y:K[1],zoom:K[2]}),v||E.setState({transform:K})},[g,v]);return m.useEffect(()=>{if(S.current){D.current=b3({domNode:S.current,minZoom:u,maxZoom:f,translateExtent:d,viewport:c,onDraggingChange:I=>E.setState(z=>z.paneDragging===I?z:{paneDragging:I}),onPanZoomStart:(I,z)=>{const{onViewportChangeStart:_,onMoveStart:T}=E.getState();T==null||T(I,z),_==null||_(z)},onPanZoom:(I,z)=>{const{onViewportChange:_,onMove:T}=E.getState();T==null||T(I,z),_==null||_(z)},onPanZoomEnd:(I,z)=>{const{onViewportChangeEnd:_,onMoveEnd:T}=E.getState();T==null||T(I,z),_==null||_(z)}});const{x:K,y:$,zoom:L}=D.current.getViewport();return E.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:W,preventScrolling:h,noPanClassName:b,userSelectionActive:A,noWheelClassName:k,lib:R,onTransformChange:O,connectionInProgress:M,selectionOnDrag:j,paneClickDistance:w})},[e,t,n,r,s,i,a,l,W,h,b,A,k,R,O,M,j,w]),o.jsx("div",{className:"react-flow__renderer",ref:S,style:$m,children:y})}const Pz=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Az(){const{userSelectionActive:e,userSelectionRect:t}=Lt(Pz,bn);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 sy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Iz=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Tz({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:y}){const k=mn(),{userSelectionActive:b,elementsSelectable:g,dragging:v,connectionInProgress:w}=Lt(Iz,bn),j=g&&(e||b),E=m.useRef(null),S=m.useRef(),A=m.useRef(new Set),R=m.useRef(new Set),M=m.useRef(!1),W=_=>{if(M.current||w){M.current=!1;return}c==null||c(_),k.getState().resetSelectedElements(),k.setState({nodesSelectionActive:!1})},D=_=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){_.preventDefault();return}d==null||d(_)},O=u?_=>u(_):void 0,K=_=>{M.current&&(_.stopPropagation(),M.current=!1)},$=_=>{var ae,ce;const{domNode:T}=k.getState();if(S.current=T==null?void 0:T.getBoundingClientRect(),!S.current)return;const C=_.target===E.current;if(!C&&!!_.target.closest(".nokey")||!e||!(i&&C||t)||_.button!==0||!_.isPrimary)return;(ce=(ae=_.target)==null?void 0:ae.setPointerCapture)==null||ce.call(ae,_.pointerId),M.current=!1;const{x:H,y:te}=pi(_.nativeEvent,S.current);k.setState({userSelectionRect:{width:0,height:0,startX:H,startY:te,x:H,y:te}}),C||(_.stopPropagation(),_.preventDefault())},L=_=>{const{userSelectionRect:T,transform:C,nodeLookup:J,edgeLookup:Z,connectionLookup:H,triggerNodeChanges:te,triggerEdgeChanges:ae,defaultEdgeOptions:ce,resetSelectedElements:ue}=k.getState();if(!S.current||!T)return;const{x:le,y:de}=pi(_.nativeEvent,S.current),{startX:se,startY:fe}=T;if(!M.current){const Ge=t?0:s;if(Math.hypot(le-se,de-fe)<=Ge)return;ue(),a==null||a(_)}M.current=!0;const ye={startX:se,startY:fe,x:le<se?le:se,y:de<fe?de:fe,width:Math.abs(le-se),height:Math.abs(de-fe)},je=A.current,He=R.current;A.current=new Set(Av(J,ye,C,n===$d.Partial,!0).map(Ge=>Ge.id)),R.current=new Set;const lt=(ce==null?void 0:ce.selectable)??!0;for(const Ge of A.current){const Ct=H.get(Ge);if(Ct)for(const{edgeId:Me}of Ct.values()){const Ce=Z.get(Me);Ce&&(Ce.selectable??lt)&&R.current.add(Me)}}if(!Rk(je,A.current)){const Ge=ic(J,A.current,!0);te(Ge)}if(!Rk(He,R.current)){const Ge=ic(Z,R.current);ae(Ge)}k.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},I=_=>{var T,C;_.button===0&&((C=(T=_.target)==null?void 0:T.releasePointerCapture)==null||C.call(T,_.pointerId),!b&&_.target===E.current&&k.getState().userSelectionRect&&(W==null||W(_)),k.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(l==null||l(_),k.setState({nodesSelectionActive:A.current.size>0})))},z=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:Xn(["react-flow__pane",{draggable:z,dragging:v,selection:e}]),onClick:j?void 0:sy(W,E),onContextMenu:sy(D,E),onWheel:sy(O,E),onPointerEnter:j?void 0:f,onPointerMove:j?L:p,onPointerUp:j?I:void 0,onPointerDownCapture:j?$:void 0,onClickCapture:j?K:void 0,onPointerLeave:h,ref:E,style:$m,children:[y,o.jsx(Az,{})]})}function Jx({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",Gi.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 tP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=mn(),[c,d]=m.useState(!1),u=m.useRef();return m.useEffect(()=>{u.current=a3({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{Jx({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 Rz=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function nP(){const e=mn();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=Rz(a),h=s?i[0]:5,y=s?i[1]:5,k=n.direction.x*h*n.factor,b=n.direction.y*y*n.factor;for(const[,g]of d){if(!p(g))continue;let v={x:g.internals.positionAbsolute.x+k,y:g.internals.positionAbsolute.y+b};s&&(v=df(v,i));const{position:w,positionAbsolute:j}=y_({nodeId:g.id,nextPosition:v,nodeLookup:d,nodeExtent:r,nodeOrigin:u,onError:l});g.position=w,g.internals.positionAbsolute=j,f.set(g.id,g)}c(f)},[])}const Fv=m.createContext(null),Lz=Fv.Provider;Fv.Consumer;const rP=()=>m.useContext(Fv),Oz=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Mz=(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===Ac.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 $z({type:e="source",position:t=Be.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 y=a||null,k=e==="target",b=mn(),g=rP(),{connectOnClick:v,noPanClassName:w,rfId:j}=Lt(Oz,bn),{connectingFrom:E,connectingTo:S,clickConnecting:A,isPossibleEndHandle:R,connectionInProcess:M,clickConnectionInProcess:W,valid:D}=Lt(Mz(g,y,e),bn);g||(I=(L=b.getState()).onError)==null||I.call(L,"010",Gi.error010());const O=z=>{const{defaultEdgeOptions:_,onConnect:T,hasDefaultEdges:C}=b.getState(),J={..._,...z};if(C){const{edges:Z,setEdges:H}=b.getState();H(zd(J,Z))}T==null||T(J),l==null||l(J)},K=z=>{if(!g)return;const _=j_(z.nativeEvent);if(s&&(_&&z.button===0||!_)){const T=b.getState();Gx.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:y,nodeId:g,flowId:T.rfId,panBy:T.panBy,cancelConnection:T.cancelConnection,onConnectStart:T.onConnectStart,onConnectEnd:(...C)=>{var J,Z;return(Z=(J=b.getState()).onConnectEnd)==null?void 0:Z.call(J,...C)},updateConnection:T.updateConnection,onConnect:O,isValidConnection:n||((...C)=>{var J,Z;return((Z=(J=b.getState()).isValidConnection)==null?void 0:Z.call(J,...C))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:T.autoPanSpeed,dragThreshold:T.connectionDragThreshold})}_?u==null||u(z):f==null||f(z)},$=z=>{const{onClickConnectStart:_,onClickConnectEnd:T,connectionClickStartHandle:C,connectionMode:J,isValidConnection:Z,lib:H,rfId:te,nodeLookup:ae,connection:ce}=b.getState();if(!g||!C&&!s)return;if(!C){_==null||_(z.nativeEvent,{nodeId:g,handleId:y,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:g,type:e,id:y}});return}const ue=S_(z.target),le=n||Z,{connection:de,isValid:se}=Gx.isValid(z.nativeEvent,{handle:{nodeId:g,id:y,type:e},connectionMode:J,fromNodeId:C.nodeId,fromHandleId:C.id||null,fromType:C.type,isValidConnection:le,flowId:te,doc:ue,lib:H,nodeLookup:ae});se&&de&&O(de);const fe=structuredClone(ce);delete fe.inProgress,fe.toPosition=fe.toHandle?fe.toHandle.position:null,T==null||T(z,fe),b.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":y,"data-nodeid":g,"data-handlepos":t,"data-id":`${j}-${g}-${y}-${e}`,className:Xn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,d,{source:!k,target:k,connectable:r,connectablestart:s,connectableend:i,clickconnecting:A,connectingfrom:E,connectingto:S,valid:D,connectionindicator:r&&(!M||R)&&(M||W?i:s)}]),onMouseDown:K,onTouchStart:K,onClick:v?$:void 0,ref:h,...p,children:c})}const ds=m.memo(Z_($z));function Dz({data:e,isConnectable:t,sourcePosition:n=Be.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(ds,{type:"source",position:n,isConnectable:t})]})}function Fz({data:e,isConnectable:t,targetPosition:n=Be.Top,sourcePosition:r=Be.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(ds,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(ds,{type:"source",position:r,isConnectable:t})]})}function zz(){return null}function Bz({data:e,isConnectable:t,targetPosition:n=Be.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(ds,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Fh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},iS={input:Dz,default:Fz,output:Bz,group:zz};function Hz(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 Uz=e=>{const{width:t,height:n,x:r,y:s}=uf(e.nodeLookup,{filter:i=>!!i.selected});return{width:fi(t)?t:null,height:fi(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 Wz({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=mn(),{width:s,height:i,transformString:a,userSelectionActive:l}=Lt(Uz,bn),c=nP(),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(tP({nodeRef:d,disabled:!u}),!u)return null;const f=e?h=>{const y=r.getState().nodes.filter(k=>k.selected);e(h,y)}:void 0,p=h=>{Object.prototype.hasOwnProperty.call(Fh,h.key)&&(h.preventDefault(),c({direction:Fh[h.key],factor:h.shiftKey?4:1}))};return o.jsx("div",{className:Xn(["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 oS=typeof window<"u"?window:void 0,Vz=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function sP({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:y,panActivationKeyCode:k,zoomActivationKeyCode:b,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:j,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:A,panOnDrag:R,defaultViewport:M,translateExtent:W,minZoom:D,maxZoom:O,preventScrolling:K,onSelectionContextMenu:$,noWheelClassName:L,noPanClassName:I,disableKeyboardA11y:z,onViewportChange:_,isControlledViewport:T}){const{nodesSelectionActive:C,userSelectionActive:J}=Lt(Vz,bn),Z=Bd(d,{target:oS}),H=Bd(k,{target:oS}),te=H||R,ae=H||j,ce=u&&te!==!0,ue=Z||J||ce;return jz({deleteKeyCode:c,multiSelectionKeyCode:y}),o.jsx(_z,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:ae,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:A,panOnDrag:!Z&&te,defaultViewport:M,translateExtent:W,minZoom:D,maxZoom:O,zoomActivationKeyCode:b,preventScrolling:K,noWheelClassName:L,noPanClassName:I,onViewportChange:_,isControlledViewport:T,paneClickDistance:l,selectionOnDrag:ce,children:o.jsxs(Tz,{onSelectionStart:p,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:te,isSelecting:!!ue,selectionMode:f,selectionKeyPressed:Z,paneClickDistance:l,selectionOnDrag:ce,children:[e,C&&o.jsx(Wz,{onSelectionContextMenu:$,noPanClassName:I,disableKeyboardA11y:z})]})})}sP.displayName="FlowRenderer";const Kz=m.memo(sP),qz=e=>t=>e?Av(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 Yz(e){return Lt(m.useCallback(qz(e),[e]),bn)}const Gz=e=>e.updateNodeInternals;function Xz(){const e=Lt(Gz),[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 Jz({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=mn(),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 Qz({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:y,rfId:k,nodeTypes:b,nodeClickDistance:g,onError:v}){const{node:w,internals:j,isParent:E}=Lt(le=>{const de=le.nodeLookup.get(e),se=le.parentLookup.has(e);return{node:de,internals:de.internals,isParent:se}},bn);let S=w.type||"default",A=(b==null?void 0:b[S])||iS[S];A===void 0&&(v==null||v("003",Gi.error003(S)),S="default",A=(b==null?void 0:b.default)||iS.default);const R=!!(w.draggable||l&&typeof w.draggable>"u"),M=!!(w.selectable||c&&typeof w.selectable>"u"),W=!!(w.connectable||d&&typeof w.connectable>"u"),D=!!(w.focusable||u&&typeof w.focusable>"u"),O=mn(),K=b_(w),$=Jz({node:w,nodeType:S,hasDimensions:K,resizeObserver:f}),L=tP({nodeRef:$,disabled:w.hidden||!R,noDragClassName:p,handleSelector:w.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:g}),I=nP();if(w.hidden)return null;const z=Co(w),_=Hz(w),T=M||R||t||n||r||s,C=n?le=>n(le,{...j.userNode}):void 0,J=r?le=>r(le,{...j.userNode}):void 0,Z=s?le=>s(le,{...j.userNode}):void 0,H=i?le=>i(le,{...j.userNode}):void 0,te=a?le=>a(le,{...j.userNode}):void 0,ae=le=>{const{selectNodesOnDrag:de,nodeDragThreshold:se}=O.getState();M&&(!de||!R||se>0)&&Jx({id:e,store:O,nodeRef:$}),t&&t(le,{...j.userNode})},ce=le=>{if(!(N_(le.nativeEvent)||y)){if(f_.includes(le.key)&&M){const de=le.key==="Escape";Jx({id:e,store:O,unselect:de,nodeRef:$})}else if(R&&w.selected&&Object.prototype.hasOwnProperty.call(Fh,le.key)){le.preventDefault();const{ariaLabelConfig:de}=O.getState();O.setState({ariaLiveMessage:de["node.a11yDescription.ariaLiveMessage"]({direction:le.key.replace("Arrow","").toLowerCase(),x:~~j.positionAbsolute.x,y:~~j.positionAbsolute.y})}),I({direction:Fh[le.key],factor:le.shiftKey?4:1})}}},ue=()=>{var He;if(y||!((He=$.current)!=null&&He.matches(":focus-visible")))return;const{transform:le,width:de,height:se,autoPanOnNodeFocus:fe,setCenter:ye}=O.getState();if(!fe)return;Av(new Map([[e,w]]),{x:0,y:0,width:de,height:se},le,!0).length>0||ye(w.position.x+z.width/2,w.position.y+z.height/2,{zoom:le[2]})};return o.jsx("div",{className:Xn(["react-flow__node",`react-flow__node-${S}`,{[h]:R},w.className,{selected:w.selected,selectable:M,parent:E,draggable:R,dragging:L}]),ref:$,style:{zIndex:j.z,transform:`translate(${j.positionAbsolute.x}px,${j.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:K?"visible":"hidden",...w.style,..._},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:C,onMouseMove:J,onMouseLeave:Z,onContextMenu:H,onClick:ae,onDoubleClick:te,onKeyDown:D?ce:void 0,tabIndex:D?0:void 0,onFocus:D?ue:void 0,role:w.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${Y_}-${k}`,"aria-label":w.ariaLabel,...w.domAttributes,children:o.jsx(Lz,{value:e,children:o.jsx(A,{id:e,data:w.data,type:S,positionAbsoluteX:j.positionAbsolute.x,positionAbsoluteY:j.positionAbsolute.y,selected:w.selected??!1,selectable:M,draggable:R,deletable:w.deletable??!0,isConnectable:W,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:L,dragHandle:w.dragHandle,zIndex:j.z,parentId:w.parentId,...z})})})}var Zz=m.memo(Qz);const e5=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function iP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Lt(e5,bn),a=Yz(e.onlyRenderVisibleElements),l=Xz();return o.jsx("div",{className:"react-flow__nodes",style:$m,children:a.map(c=>o.jsx(Zz,{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))})}iP.displayName="NodeRenderer";const t5=m.memo(iP);function n5(e){return Lt(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&&UF({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),bn)}const r5=({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"})},s5=({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"})},aS={[cs.Arrow]:r5,[cs.ArrowClosed]:s5};function i5(e){const t=mn();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(aS,e)?aS[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Gi.error009(e)),null)},[e])}const o5=({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=i5(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},oP=({defaultColor:e,rfId:t})=>{const n=Lt(i=>i.edges),r=Lt(i=>i.defaultEdgeOptions),s=m.useMemo(()=>XF(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(o5,{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};oP.displayName="MarkerDefinitions";var a5=m.memo(oP);function aP({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=Xn(["react-flow__edge-textwrapper",d]),y=m.useRef(null);return m.useEffect(()=>{if(y.current){const k=y.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:y,style:r,children:n}),c]}):null}aP.displayName="EdgeText";const l5=m.memo(aP);function Dm({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:Xn(["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&&fi(t)&&fi(n)?o.jsx(l5,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function lS({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Be.Left||e===Be.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function lP({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:r,targetY:s,targetPosition:i=Be.Top}){const[a,l]=lS({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,d]=lS({pos:i,x1:r,y1:s,x2:e,y2:t}),[u,f,p,h]=C_({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 cP(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:y,markerEnd:k,markerStart:b,interactionWidth:g})=>{const[v,w,j]=lP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),E=e.isInternal?void 0:t;return o.jsx(Dm,{id:E,path:v,labelX:w,labelY:j,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:y,markerEnd:k,markerStart:b,interactionWidth:g})})}const c5=cP({isInternal:!1}),uP=cP({isInternal:!0});c5.displayName="SimpleBezierEdge";uP.displayName="SimpleBezierEdgeInternal";function dP(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=Be.Bottom,targetPosition:y=Be.Top,markerEnd:k,markerStart:b,pathOptions:g,interactionWidth:v})=>{const[w,j,E]=Kx({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:i,targetPosition:y,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),S=e.isInternal?void 0:t;return o.jsx(Dm,{id:S,path:w,labelX:j,labelY:E,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:k,markerStart:b,interactionWidth:v})})}const fP=dP({isInternal:!1}),pP=dP({isInternal:!0});fP.displayName="SmoothStepEdge";pP.displayName="SmoothStepEdgeInternal";function hP(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(fP,{...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 u5=hP({isInternal:!1}),mP=hP({isInternal:!0});u5.displayName="StepEdge";mP.displayName="StepEdgeInternal";function gP(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:y,interactionWidth:k})=>{const[b,g,v]=P_({sourceX:n,sourceY:r,targetX:s,targetY:i}),w=e.isInternal?void 0:t;return o.jsx(Dm,{id:w,path:b,labelX:g,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:y,interactionWidth:k})})}const d5=gP({isInternal:!1}),yP=gP({isInternal:!0});d5.displayName="StraightEdge";yP.displayName="StraightEdgeInternal";function xP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Be.Bottom,targetPosition:l=Be.Top,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:y,markerEnd:k,markerStart:b,pathOptions:g,interactionWidth:v})=>{const[w,j,E]=E_({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:g==null?void 0:g.curvature}),S=e.isInternal?void 0:t;return o.jsx(Dm,{id:S,path:w,labelX:j,labelY:E,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:y,markerEnd:k,markerStart:b,interactionWidth:v})})}const f5=xP({isInternal:!1}),wP=xP({isInternal:!0});f5.displayName="BezierEdge";wP.displayName="BezierEdgeInternal";const cS={default:wP,straight:yP,step:mP,smoothstep:pP,simplebezier:uP},uS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},p5=(e,t,n)=>n===Be.Left?e-t:n===Be.Right?e+t:e,h5=(e,t,n)=>n===Be.Top?e-t:n===Be.Bottom?e+t:e,dS="react-flow__edgeupdater";function fS({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:Xn([dS,`${dS}-${l}`]),cx:p5(t,r,e),cy:h5(n,r,e),r,stroke:"transparent",fill:"transparent"})}function m5({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 y=mn(),k=(j,E)=>{if(j.button!==0)return;const{autoPanOnConnect:S,domNode:A,connectionMode:R,connectionRadius:M,lib:W,onConnectStart:D,cancelConnection:O,nodeLookup:K,rfId:$,panBy:L,updateConnection:I}=y.getState(),z=E.type==="target",_=(J,Z)=>{p(!1),f==null||f(J,n,E.type,Z)},T=J=>d==null?void 0:d(n,J),C=(J,Z)=>{p(!0),u==null||u(j,n,E.type),D==null||D(J,Z)};Gx.onPointerDown(j.nativeEvent,{autoPanOnConnect:S,connectionMode:R,connectionRadius:M,domNode:A,handleId:E.id,nodeId:E.nodeId,nodeLookup:K,isTarget:z,edgeUpdaterType:E.type,lib:W,flowId:$,cancelConnection:O,panBy:L,isValidConnection:(...J)=>{var Z,H;return((H=(Z=y.getState()).isValidConnection)==null?void 0:H.call(Z,...J))??!0},onConnect:T,onConnectStart:C,onConnectEnd:(...J)=>{var Z,H;return(H=(Z=y.getState()).onConnectEnd)==null?void 0:H.call(Z,...J)},onReconnectEnd:_,updateConnection:I,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:j.currentTarget})},b=j=>k(j,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=j=>k(j,{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(fS,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:b,onMouseEnter:v,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&o.jsx(fS,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:w,type:"target"})]})}function g5({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:y,edgeTypes:k,noPanClassName:b,onError:g,disableKeyboardA11y:v}){let w=Lt(ye=>ye.edgeLookup.get(e));const j=Lt(ye=>ye.defaultEdgeOptions);w=j?{...j,...w}:w;let E=w.type||"default",S=(k==null?void 0:k[E])||cS[E];S===void 0&&(g==null||g("011",Gi.error011(E)),E="default",S=(k==null?void 0:k.default)||cS.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"),W=m.useRef(null),[D,O]=m.useState(!1),[K,$]=m.useState(!1),L=mn(),{zIndex:I,sourceX:z,sourceY:_,targetX:T,targetY:C,sourcePosition:J,targetPosition:Z}=Lt(m.useCallback(ye=>{const je=ye.nodeLookup.get(w.source),He=ye.nodeLookup.get(w.target);if(!je||!He)return{zIndex:w.zIndex,...uS};const lt=GF({id:e,sourceNode:je,targetNode:He,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:ye.connectionMode,onError:g});return{zIndex:HF({selected:w.selected,zIndex:w.zIndex,sourceNode:je,targetNode:He,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...lt||uS}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),bn),H=m.useMemo(()=>w.markerStart?`url('#${qx(w.markerStart,y)}')`:void 0,[w.markerStart,y]),te=m.useMemo(()=>w.markerEnd?`url('#${qx(w.markerEnd,y)}')`:void 0,[w.markerEnd,y]);if(w.hidden||z===null||_===null||T===null||C===null)return null;const ae=ye=>{var Ge;const{addSelectedEdges:je,unselectNodesAndEdges:He,multiSelectionActive:lt}=L.getState();M&&(L.setState({nodesSelectionActive:!1}),w.selected&<?(He({nodes:[],edges:[w]}),(Ge=W.current)==null||Ge.blur()):je([e])),s&&s(ye,w)},ce=i?ye=>{i(ye,{...w})}:void 0,ue=a?ye=>{a(ye,{...w})}:void 0,le=l?ye=>{l(ye,{...w})}:void 0,de=c?ye=>{c(ye,{...w})}:void 0,se=d?ye=>{d(ye,{...w})}:void 0,fe=ye=>{var je;if(!v&&f_.includes(ye.key)&&M){const{unselectNodesAndEdges:He,addSelectedEdges:lt}=L.getState();ye.key==="Escape"?((je=W.current)==null||je.blur(),He({edges:[w]})):lt([e])}};return o.jsx("svg",{style:{zIndex:I},children:o.jsxs("g",{className:Xn(["react-flow__edge",`react-flow__edge-${E}`,w.className,b,{selected:w.selected,animated:w.animated,inactive:!M&&!s,updating:D,selectable:M}]),onClick:ae,onDoubleClick:ce,onContextMenu:ue,onMouseEnter:le,onMouseMove:de,onMouseLeave:se,onKeyDown:A?fe: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?`${G_}-${y}`:void 0,ref:W,...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:_,targetX:T,targetY:C,sourcePosition:J,targetPosition:Z,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(m5,{edge:w,isReconnectable:R,reconnectRadius:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,sourceX:z,sourceY:_,targetX:T,targetY:C,sourcePosition:J,targetPosition:Z,setUpdateHover:O,setReconnecting:$})]})})}var y5=m.memo(g5);const x5=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function vP({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:y,disableKeyboardA11y:k}){const{edgesFocusable:b,edgesReconnectable:g,elementsSelectable:v,onError:w}=Lt(x5,bn),j=n5(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(a5,{defaultColor:e,rfId:n}),j.map(E=>o.jsx(y5,{id:E,edgesFocusable:b,edgesReconnectable:g,elementsSelectable:v,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:u,reconnectRadius:f,onDoubleClick:p,onReconnectStart:h,onReconnectEnd:y,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:k},E))]})}vP.displayName="EdgeRenderer";const w5=m.memo(vP),v5=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function b5({children:e}){const t=Lt(v5);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function k5(e){const t=wl(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const S5=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function N5(e){const t=Lt(S5),n=mn();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function j5(e){return e.connection.inProgress?{...e.connection,to:ff(e.connection.to,e.transform)}:{...e.connection}}function C5(e){return j5}function E5(e){const t=C5();return Lt(t,bn)}const _5=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function P5({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:c}=Lt(_5,bn);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:Xn(["react-flow__connection",m_(l)]),children:o.jsx(bP,{style:t,type:n,CustomComponent:r,isValid:l})})})}const bP=({style:e,type:t=Go.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}=E5();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:m_(r),toNode:u,toHandle:f,pointer:h});let y="";const k={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:d.x,targetY:d.y,targetPosition:p};switch(t){case Go.Bezier:[y]=E_(k);break;case Go.SimpleBezier:[y]=lP(k);break;case Go.Step:[y]=Kx({...k,borderRadius:0});break;case Go.SmoothStep:[y]=Kx(k);break;default:[y]=P_(k)}return o.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};bP.displayName="ConnectionLine";const A5={};function pS(e=A5){m.useRef(e),mn(),m.useEffect(()=>{},[e])}function I5(){mn(),m.useRef(!1),m.useEffect(()=>{},[])}function kP({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:y,connectionLineStyle:k,connectionLineComponent:b,connectionLineContainerStyle:g,selectionKeyCode:v,selectionOnDrag:w,selectionMode:j,multiSelectionKeyCode:E,panActivationKeyCode:S,zoomActivationKeyCode:A,deleteKeyCode:R,onlyRenderVisibleElements:M,elementsSelectable:W,defaultViewport:D,translateExtent:O,minZoom:K,maxZoom:$,preventScrolling:L,defaultMarkerColor:I,zoomOnScroll:z,zoomOnPinch:_,panOnScroll:T,panOnScrollSpeed:C,panOnScrollMode:J,zoomOnDoubleClick:Z,panOnDrag:H,onPaneClick:te,onPaneMouseEnter:ae,onPaneMouseMove:ce,onPaneMouseLeave:ue,onPaneScroll:le,onPaneContextMenu:de,paneClickDistance:se,nodeClickDistance:fe,onEdgeContextMenu:ye,onEdgeMouseEnter:je,onEdgeMouseMove:He,onEdgeMouseLeave:lt,reconnectRadius:Ge,onReconnect:Ct,onReconnectStart:Me,onReconnectEnd:Ce,noDragClassName:Gt,noWheelClassName:Hn,noPanClassName:Xt,disableKeyboardA11y:Cn,nodeExtent:kr,rfId:cr,viewport:oe,onViewportChange:ge}){return pS(e),pS(t),I5(),k5(n),N5(oe),o.jsx(Kz,{onPaneClick:te,onPaneMouseEnter:ae,onPaneMouseMove:ce,onPaneMouseLeave:ue,onPaneContextMenu:de,onPaneScroll:le,paneClickDistance:se,deleteKeyCode:R,selectionKeyCode:v,selectionOnDrag:w,selectionMode:j,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:E,panActivationKeyCode:S,zoomActivationKeyCode:A,elementsSelectable:W,zoomOnScroll:z,zoomOnPinch:_,zoomOnDoubleClick:Z,panOnScroll:T,panOnScrollSpeed:C,panOnScrollMode:J,panOnDrag:H,defaultViewport:D,translateExtent:O,minZoom:K,maxZoom:$,onSelectionContextMenu:f,preventScrolling:L,noDragClassName:Gt,noWheelClassName:Hn,noPanClassName:Xt,disableKeyboardA11y:Cn,onViewportChange:ge,isControlledViewport:!!oe,children:o.jsxs(b5,{children:[o.jsx(w5,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Ct,onReconnectStart:Me,onReconnectEnd:Ce,onlyRenderVisibleElements:M,onEdgeContextMenu:ye,onEdgeMouseEnter:je,onEdgeMouseMove:He,onEdgeMouseLeave:lt,reconnectRadius:Ge,defaultMarkerColor:I,noPanClassName:Xt,disableKeyboardA11y:Cn,rfId:cr}),o.jsx(P5,{style:k,type:y,component:b,containerStyle:g}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(t5,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,nodeClickDistance:fe,onlyRenderVisibleElements:M,noPanClassName:Xt,noDragClassName:Gt,disableKeyboardA11y:Cn,nodeExtent:kr,rfId:cr}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}kP.displayName="GraphView";const T5=m.memo(kP),hS=({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,y=new Map,k=new Map,b=new Map,g=r??t??[],v=n??e??[],w=u??[0,0],j=f??Md;T_(k,b,g);const{nodesInitialized:E}=Yx(v,h,y,{nodeOrigin:w,nodeExtent:j,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:W}=Iv(A,s,i,c,d,(l==null?void 0:l.padding)??.1);S=[R,M,W]}return{rfId:"1",width:s??0,height:i??0,transform:S,nodes:v,nodesInitialized:E,nodeLookup:h,parentLookup:y,edges:g,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:j,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ac.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:{...h_},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:MF,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:p_,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},R5=({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})=>Q3((h,y)=>{async function k(){const{nodeLookup:b,panZoom:g,fitViewOptions:v,fitViewResolver:w,width:j,height:E,minZoom:S,maxZoom:A}=y();g&&(await LF({nodes:b,width:j,height:E,panZoom:g,minZoom:S,maxZoom:A},v),w==null||w.resolve(!0),h({fitViewResolver:null}))}return{...hS({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:g,parentLookup:v,nodeOrigin:w,elevateNodesOnSelect:j,fitViewQueued:E,zIndexMode:S,nodesSelectionActive:A}=y(),{nodesInitialized:R,hasSelectedNodes:M}=Yx(b,g,v,{nodeOrigin:w,nodeExtent:f,elevateNodesOnSelect:j,checkEquality:!0,zIndexMode:S}),W=A&&M;E&&R?(k(),h({nodes:b,nodesInitialized:R,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:W})):h({nodes:b,nodesInitialized:R,nodesSelectionActive:W})},setEdges:b=>{const{connectionLookup:g,edgeLookup:v}=y();T_(g,v,b),h({edges:b})},setDefaultNodesAndEdges:(b,g)=>{if(b){const{setNodes:v}=y();v(b),h({hasDefaultNodes:!0})}if(g){const{setEdges:v}=y();v(g),h({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:g,nodeLookup:v,parentLookup:w,domNode:j,nodeOrigin:E,nodeExtent:S,debug:A,fitViewQueued:R,zIndexMode:M}=y(),{changes:W,updatedInternals:D}=r3(b,v,w,j,E,S,M);D&&(ZF(v,w,{nodeOrigin:E,nodeExtent:S,zIndexMode:M}),R?(k(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(W==null?void 0:W.length)>0&&(A&&console.log("React Flow: trigger node changes",W),g==null||g(W)))},updateNodePositions:(b,g=!1)=>{const v=[];let w=[];const{nodeLookup:j,triggerNodeChanges:E,connection:S,updateConnection:A,onNodesChangeMiddlewareMap:R}=y();for(const[M,W]of b){const D=j.get(M),O=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(W!=null&&W.position)),K={id:M,type:"position",position:O?{x:Math.max(0,W.position.x),y:Math.max(0,W.position.y)}:W.position,dragging:g};if(D&&S.inProgress&&S.fromNode.id===D.id){const $=pl(D,S.fromHandle,Be.Left,!0);A({...S,from:$})}O&&D.parentId&&v.push({id:M,parentId:D.parentId,rect:{...W.internals.positionAbsolute,width:W.measured.width??0,height:W.measured.height??0}}),w.push(K)}if(v.length>0){const{parentLookup:M,nodeOrigin:W}=y(),D=$v(v,j,M,W);w.push(...D)}for(const M of R.values())w=M(w);E(w)},triggerNodeChanges:b=>{const{onNodesChange:g,setNodes:v,nodes:w,hasDefaultNodes:j,debug:E}=y();if(b!=null&&b.length){if(j){const S=Dv(b,w);v(S)}E&&console.log("React Flow: trigger node changes",b),g==null||g(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:g,setEdges:v,edges:w,hasDefaultEdges:j,debug:E}=y();if(b!=null&&b.length){if(j){const S=Q_(b,w);v(S)}E&&console.log("React Flow: trigger edge changes",b),g==null||g(b)}},addSelectedNodes:b=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:w,triggerNodeChanges:j,triggerEdgeChanges:E}=y();if(g){const S=b.map(A=>qa(A,!0));j(S);return}j(ic(w,new Set([...b]),!0)),E(ic(v))},addSelectedEdges:b=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:w,triggerNodeChanges:j,triggerEdgeChanges:E}=y();if(g){const S=b.map(A=>qa(A,!0));E(S);return}E(ic(v,new Set([...b]))),j(ic(w,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:g}={})=>{const{edges:v,nodes:w,nodeLookup:j,triggerNodeChanges:E,triggerEdgeChanges:S}=y(),A=b||w,R=g||v,M=[];for(const D of A){if(!D.selected)continue;const O=j.get(D.id);O&&(O.selected=!1),M.push(qa(D.id,!1))}const W=[];for(const D of R)D.selected&&W.push(qa(D.id,!1));E(M),S(W)},setMinZoom:b=>{const{panZoom:g,maxZoom:v}=y();g==null||g.setScaleExtent([b,v]),h({minZoom:b})},setMaxZoom:b=>{const{panZoom:g,minZoom:v}=y();g==null||g.setScaleExtent([v,b]),h({maxZoom:b})},setTranslateExtent:b=>{var g;(g=y().panZoom)==null||g.setTranslateExtent(b),h({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:g,triggerNodeChanges:v,triggerEdgeChanges:w,elementsSelectable:j}=y();if(!j)return;const E=g.reduce((A,R)=>R.selected?[...A,qa(R.id,!1)]:A,[]),S=b.reduce((A,R)=>R.selected?[...A,qa(R.id,!1)]:A,[]);v(E),w(S)},setNodeExtent:b=>{const{nodes:g,nodeLookup:v,parentLookup:w,nodeOrigin:j,elevateNodesOnSelect:E,nodeExtent:S,zIndexMode:A}=y();b[0][0]===S[0][0]&&b[0][1]===S[0][1]&&b[1][0]===S[1][0]&&b[1][1]===S[1][1]||(Yx(g,v,w,{nodeOrigin:j,nodeExtent:b,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:A}),h({nodeExtent:b}))},panBy:b=>{const{transform:g,width:v,height:w,panZoom:j,translateExtent:E}=y();return s3({delta:b,panZoom:j,transform:g,translateExtent:E,width:v,height:w})},setCenter:async(b,g,v)=>{const{width:w,height:j,maxZoom:E,panZoom:S}=y();if(!S)return Promise.resolve(!1);const A=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:E;return await S.setViewport({x:w/2-b*A,y:j/2-g*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:{...h_}})},updateConnection:b=>{h({connection:b})},reset:()=>h({...hS()})}},Object.is);function zv({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[y]=m.useState(()=>R5({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(Z3,{value:y,children:o.jsx(bz,{children:h})})}function L5({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(Mm)?o.jsx(o.Fragment,{children:e}):o.jsx(zv,{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 O5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function M5({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:y,onConnectEnd:k,onClickConnectStart:b,onClickConnectEnd:g,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:j,onNodeContextMenu:E,onNodeDoubleClick:S,onNodeDragStart:A,onNodeDrag:R,onNodeDragStop:M,onNodesDelete:W,onEdgesDelete:D,onDelete:O,onSelectionChange:K,onSelectionDragStart:$,onSelectionDrag:L,onSelectionDragStop:I,onSelectionContextMenu:z,onSelectionStart:_,onSelectionEnd:T,onBeforeDelete:C,connectionMode:J,connectionLineType:Z=Go.Bezier,connectionLineStyle:H,connectionLineComponent:te,connectionLineContainerStyle:ae,deleteKeyCode:ce="Backspace",selectionKeyCode:ue="Shift",selectionOnDrag:le=!1,selectionMode:de=$d.Full,panActivationKeyCode:se="Space",multiSelectionKeyCode:fe=Fd()?"Meta":"Control",zoomActivationKeyCode:ye=Fd()?"Meta":"Control",snapToGrid:je,snapGrid:He,onlyRenderVisibleElements:lt=!1,selectNodesOnDrag:Ge,nodesDraggable:Ct,autoPanOnNodeFocus:Me,nodesConnectable:Ce,nodesFocusable:Gt,nodeOrigin:Hn=X_,edgesFocusable:Xt,edgesReconnectable:Cn,elementsSelectable:kr=!0,defaultViewport:cr=fz,minZoom:oe=.5,maxZoom:ge=2,translateExtent:qe=Md,preventScrolling:it=!0,nodeExtent:tt,defaultMarkerColor:It="#b1b1b7",zoomOnScroll:Ln=!0,zoomOnPinch:Ft=!0,panOnScroll:On=!1,panOnScrollSpeed:Jt=.5,panOnScrollMode:Qt=nl.Free,zoomOnDoubleClick:rr=!0,panOnDrag:pe=!0,onPaneClick:Ie,onPaneMouseEnter:tn,onPaneMouseMove:ct,onPaneMouseLeave:gn,onPaneScroll:qs,onPaneContextMenu:En,paneClickDistance:Sr=1,nodeClickDistance:ur=0,children:Wr,onReconnect:Ys,onReconnectStart:_o,onReconnectEnd:Nr,onEdgeContextMenu:Jn,onEdgeDoubleClick:Is,onEdgeMouseEnter:Je,onEdgeMouseMove:Vt,onEdgeMouseLeave:nn,reconnectRadius:ps=10,onNodesChange:We,onEdgesChange:Un,noDragClassName:Te="nodrag",noWheelClassName:Bt="nowheel",noPanClassName:Ts="nopan",fitView:mt,fitViewOptions:Vr,connectOnClick:dr,attributionPosition:rn,proOptions:hs,defaultEdgeOptions:Wn,elevateNodesOnSelect:ms=!0,elevateEdgesOnSelect:fr=!1,disableKeyboardA11y:Gs=!1,autoPanOnConnect:jr,autoPanOnNodeDrag:gs,autoPanSpeed:ys,connectionRadius:q,isValidConnection:ve,onError:Le,style:Ve,id:vt,nodeDragThreshold:_n,connectionDragThreshold:zt,viewport:bt,onViewportChange:Zt,width:Xs,height:Lr,colorMode:Js="light",debug:Qs,onScroll:pr,ariaLabelConfig:Na,zIndexMode:sr="basic",...ja},Kr){const Po=vt||"1",ut=gz(Js),Qn=m.useCallback(Zi=>{Zi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),pr==null||pr(Zi)},[pr]);return o.jsx("div",{"data-testid":"rf__wrapper",...ja,onScroll:Qn,style:{...Ve,...O5},ref:Kr,className:Xn(["react-flow",s,ut]),id:vt,role:"application",children:o.jsxs(L5,{nodes:e,edges:t,width:Xs,height:Lr,fitView:mt,fitViewOptions:Vr,minZoom:oe,maxZoom:ge,nodeOrigin:Hn,nodeExtent:tt,zIndexMode:sr,children:[o.jsx(mz,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:y,onConnectEnd:k,onClickConnectStart:b,onClickConnectEnd:g,nodesDraggable:Ct,autoPanOnNodeFocus:Me,nodesConnectable:Ce,nodesFocusable:Gt,edgesFocusable:Xt,edgesReconnectable:Cn,elementsSelectable:kr,elevateNodesOnSelect:ms,elevateEdgesOnSelect:fr,minZoom:oe,maxZoom:ge,nodeExtent:tt,onNodesChange:We,onEdgesChange:Un,snapToGrid:je,snapGrid:He,connectionMode:J,translateExtent:qe,connectOnClick:dr,defaultEdgeOptions:Wn,fitView:mt,fitViewOptions:Vr,onNodesDelete:W,onEdgesDelete:D,onDelete:O,onNodeDragStart:A,onNodeDrag:R,onNodeDragStop:M,onSelectionDrag:L,onSelectionDragStart:$,onSelectionDragStop:I,onMove:u,onMoveStart:f,onMoveEnd:p,noPanClassName:Ts,nodeOrigin:Hn,rfId:Po,autoPanOnConnect:jr,autoPanOnNodeDrag:gs,autoPanSpeed:ys,onError:Le,connectionRadius:q,isValidConnection:ve,selectNodesOnDrag:Ge,nodeDragThreshold:_n,connectionDragThreshold:zt,onBeforeDelete:C,debug:Qs,ariaLabelConfig:Na,zIndexMode:sr}),o.jsx(T5,{onInit:d,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:j,onNodeContextMenu:E,onNodeDoubleClick:S,nodeTypes:i,edgeTypes:a,connectionLineType:Z,connectionLineStyle:H,connectionLineComponent:te,connectionLineContainerStyle:ae,selectionKeyCode:ue,selectionOnDrag:le,selectionMode:de,deleteKeyCode:ce,multiSelectionKeyCode:fe,panActivationKeyCode:se,zoomActivationKeyCode:ye,onlyRenderVisibleElements:lt,defaultViewport:cr,translateExtent:qe,minZoom:oe,maxZoom:ge,preventScrolling:it,zoomOnScroll:Ln,zoomOnPinch:Ft,zoomOnDoubleClick:rr,panOnScroll:On,panOnScrollSpeed:Jt,panOnScrollMode:Qt,panOnDrag:pe,onPaneClick:Ie,onPaneMouseEnter:tn,onPaneMouseMove:ct,onPaneMouseLeave:gn,onPaneScroll:qs,onPaneContextMenu:En,paneClickDistance:Sr,nodeClickDistance:ur,onSelectionContextMenu:z,onSelectionStart:_,onSelectionEnd:T,onReconnect:Ys,onReconnectStart:_o,onReconnectEnd:Nr,onEdgeContextMenu:Jn,onEdgeDoubleClick:Is,onEdgeMouseEnter:Je,onEdgeMouseMove:Vt,onEdgeMouseLeave:nn,reconnectRadius:ps,defaultMarkerColor:It,noDragClassName:Te,noWheelClassName:Bt,noPanClassName:Ts,rfId:Po,disableKeyboardA11y:Gs,nodeExtent:tt,viewport:bt,onViewportChange:Zt}),o.jsx(dz,{onSelectionChange:K}),Wr,o.jsx(oz,{proOptions:hs,position:rn}),o.jsx(iz,{rfId:Po,disableKeyboardA11y:Gs})]})})}var SP=Z_(M5);function NP(){const e=mn();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 jP(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>Dv(s,i)),[]);return[t,n,r]}function CP(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>Q_(s,i)),[]);return[t,n,r]}function $5({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:Xn(["react-flow__background-pattern",n,r])})}function D5({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Xn(["react-flow__background-pattern","dots",t])})}var ca;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ca||(ca={}));const F5={[ca.Dots]:1,[ca.Lines]:1,[ca.Cross]:6},z5=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function EP({id:e,variant:t=ca.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}=Lt(z5,bn),y=r||F5[t],k=t===ca.Dots,b=t===ca.Cross,g=Array.isArray(n)?n:[n,n],v=[g[0]*p[2]||1,g[1]*p[2]||1],w=y*p[2],j=Array.isArray(i)?i:[i,i],E=b?[w,w]:v,S=[j[0]*p[2]||1+E[0]/2,j[1]*p[2]||1+E[1]/2],A=`${h}${e||""}`;return o.jsxs("svg",{className:Xn(["react-flow__background",d]),style:{...c,...$m,"--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(D5,{radius:w/2,className:u}):o.jsx($5,{dimensions:E,lineWidth:s,variant:t,className:u})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}EP.displayName="Background";const _P=m.memo(EP);function B5(){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 H5(){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 U5(){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 W5(){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 V5(){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 xp({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Xn(["react-flow__controls-button",t]),...n,children:e})}const K5=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function PP({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 y=mn(),{isInteractive:k,minZoomReached:b,maxZoomReached:g,ariaLabelConfig:v}=Lt(K5,bn),{zoomIn:w,zoomOut:j,fitView:E}=wl(),S=()=>{w(),i==null||i()},A=()=>{j(),a==null||a()},R=()=>{E(s),l==null||l()},M=()=>{y.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),c==null||c(!k)},W=p==="horizontal"?"horizontal":"vertical";return o.jsxs(Mc,{className:Xn(["react-flow__controls",W,d]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(xp,{onClick:S,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:g,children:o.jsx(B5,{})}),o.jsx(xp,{onClick:A,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:b,children:o.jsx(H5,{})})]}),n&&o.jsx(xp,{className:"react-flow__controls-fitview",onClick:R,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:o.jsx(U5,{})}),r&&o.jsx(xp,{className:"react-flow__controls-interactive",onClick:M,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:k?o.jsx(V5,{}):o.jsx(W5,{})}),u]})}PP.displayName="Controls";const q5=m.memo(PP);function Y5({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:y,backgroundColor:k}=i||{},b=a||y||k;return o.jsx("rect",{className:Xn(["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?g=>h(g,e):void 0})}const G5=m.memo(Y5),X5=e=>e.nodes.map(t=>t.id),iy=e=>e instanceof Function?e:()=>e;function J5({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=G5,onClick:a}){const l=Lt(X5,bn),c=iy(t),d=iy(e),u=iy(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(p=>o.jsx(Z5,{id:p,nodeColorFunc:c,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:f},p))})}function Q5({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}=Lt(y=>{const k=y.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};const b=k.internals.userNode,{x:g,y:v}=k.internals.positionAbsolute,{width:w,height:j}=Co(b);return{node:b,x:g,y:v,width:w,height:j}},bn);return!d||d.hidden||!b_(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 Z5=m.memo(Q5);var e4=m.memo(J5);const t4=200,n4=150,r4=e=>!e.hidden,s4=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?v_(uf(e.nodeLookup,{filter:r4}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},i4="react-flow__minimap-desc";function AP({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:y,pannable:k=!1,zoomable:b=!1,ariaLabel:g,inversePan:v,zoomStep:w=1,offsetScale:j=5}){const E=mn(),S=m.useRef(null),{boundingRect:A,viewBB:R,rfId:M,panZoom:W,translateExtent:D,flowWidth:O,flowHeight:K,ariaLabelConfig:$}=Lt(s4,bn),L=(e==null?void 0:e.width)??t4,I=(e==null?void 0:e.height)??n4,z=A.width/L,_=A.height/I,T=Math.max(z,_),C=T*L,J=T*I,Z=j*T,H=A.x-(C-A.width)/2-Z,te=A.y-(J-A.height)/2-Z,ae=C+Z*2,ce=J+Z*2,ue=`${i4}-${M}`,le=m.useRef(0),de=m.useRef();le.current=T,m.useEffect(()=>{if(S.current&&W)return de.current=p3({domNode:S.current,panZoom:W,getTransform:()=>E.getState().transform,getViewScale:()=>le.current}),()=>{var je;(je=de.current)==null||je.destroy()}},[W]),m.useEffect(()=>{var je;(je=de.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 Ge;const[He,lt]=((Ge=de.current)==null?void 0:Ge.pointer(je))||[0,0];h(je,{x:He,y:lt})}:void 0,fe=y?m.useCallback((je,He)=>{const lt=E.getState().nodeLookup.get(He).internals.userNode;y(je,lt)},[]):void 0,ye=g??$["minimap.ariaLabel"];return o.jsx(Mc,{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:Xn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:L,height:I,viewBox:`${H} ${te} ${ae} ${ce}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ue,ref:S,onClick:se,children:[ye&&o.jsx("title",{id:ue,children:ye}),o.jsx(e4,{onClick:fe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-Z},${te-Z}h${ae+Z*2}v${ce+Z*2}h${-ae-Z*2}z
|
|
66
|
+
M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}AP.displayName="MiniMap";const o4=m.memo(AP),a4=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,l4={[Lc.Line]:"right",[Lc.Handle]:"bottom-right"};function c4({nodeId:e,position:t,variant:n=Lc.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:y,onResizeStart:k,onResize:b,onResizeEnd:g}){const v=rP(),w=typeof e=="string"?e:v,j=mn(),E=m.useRef(null),S=n===Lc.Handle,A=Lt(m.useCallback(a4(S&&h),[S,h]),bn),R=m.useRef(null),M=t??l4[n];m.useEffect(()=>{if(!(!E.current||!w))return R.current||(R.current=E3({domNode:E.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:D,transform:O,snapGrid:K,snapToGrid:$,nodeOrigin:L,domNode:I}=j.getState();return{nodeLookup:D,transform:O,snapGrid:K,snapToGrid:$,nodeOrigin:L,paneDomNode:I}},onChange:(D,O)=>{const{triggerNodeChanges:K,nodeLookup:$,parentLookup:L,nodeOrigin:I}=j.getState(),z=[],_={x:D.x,y:D.y},T=$.get(w);if(T&&T.expandParent&&T.parentId){const C=T.origin??I,J=D.width??T.measured.width??0,Z=D.height??T.measured.height??0,H={id:T.id,parentId:T.parentId,rect:{width:J,height:Z,...k_({x:D.x??T.position.x,y:D.y??T.position.y},{width:J,height:Z},T.parentId,$,C)}},te=$v([H],$,L,I);z.push(...te),_.x=D.x?Math.max(C[0]*J,D.x):void 0,_.y=D.y?Math.max(C[1]*Z,D.y):void 0}if(_.x!==void 0&&_.y!==void 0){const C={id:w,type:"position",position:{..._}};z.push(C)}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 C of O){const J={...C,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}};j.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:g,shouldResize:y}),()=>{var D;(D=R.current)==null||D.destroy()}},[M,l,c,d,u,f,k,b,g,y]);const W=M.split("-");return o.jsx("div",{className:Xn(["react-flow__resize-control","nodrag",...W,n,r]),ref:E,style:{...s,scale:A,...a&&{[S?"backgroundColor":"borderColor"]:a}},children:i})}const u4=m.memo(c4);function d4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const f4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,h4={};function mS(e,t){return(h4.jsx?p4:f4).test(e)}const m4=/[ \t\n\f\r]/g;function g4(e){return typeof e=="object"?e.type==="text"?gS(e.value):!1:gS(e)}function gS(e){return e.replace(m4,"")===""}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 IP(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 Qx(e){return e.toLowerCase()}class fs{constructor(t,n){this.attribute=n,this.property=t}}fs.prototype.attribute="";fs.prototype.booleanish=!1;fs.prototype.boolean=!1;fs.prototype.commaOrSpaceSeparated=!1;fs.prototype.commaSeparated=!1;fs.prototype.defined=!1;fs.prototype.mustUseProperty=!1;fs.prototype.number=!1;fs.prototype.overloadedBoolean=!1;fs.prototype.property="";fs.prototype.spaceSeparated=!1;fs.prototype.space=void 0;let y4=0;const xt=vl(),qn=vl(),Zx=vl(),Se=vl(),an=vl(),xc=vl(),xs=vl();function vl(){return 2**++y4}const ew=Object.freeze(Object.defineProperty({__proto__:null,boolean:xt,booleanish:qn,commaOrSpaceSeparated:xs,commaSeparated:xc,number:Se,overloadedBoolean:Zx,spaceSeparated:an},Symbol.toStringTag,{value:"Module"})),oy=Object.keys(ew);class Bv extends fs{constructor(t,n,r,s){let i=-1;if(super(t,n),yS(this,"space",s),typeof r=="number")for(;++i<oy.length;){const a=oy[i];yS(this,oy[i],(r&ew[a])===ew[a])}}}Bv.prototype.defined=!0;function yS(e,t,n){n&&(e[t]=n)}function Vc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Bv(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Qx(r)]=r,n[Qx(i.attribute)]=r}return new pf(t,n,e.space)}const TP=Vc({properties:{ariaActiveDescendant:null,ariaAtomic:qn,ariaAutoComplete:null,ariaBusy:qn,ariaChecked:qn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:an,ariaCurrent:null,ariaDescribedBy:an,ariaDetails:null,ariaDisabled:qn,ariaDropEffect:an,ariaErrorMessage:null,ariaExpanded:qn,ariaFlowTo:an,ariaGrabbed:qn,ariaHasPopup:null,ariaHidden:qn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:an,ariaLevel:Se,ariaLive:null,ariaModal:qn,ariaMultiLine:qn,ariaMultiSelectable:qn,ariaOrientation:null,ariaOwns:an,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:qn,ariaReadOnly:qn,ariaRelevant:null,ariaRequired:qn,ariaRoleDescription:an,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:qn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function RP(e,t){return t in e?e[t]:t}function LP(e,t){return RP(e,t.toLowerCase())}const x4=Vc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xc,acceptCharset:an,accessKey:an,action:null,allow:null,allowFullScreen:xt,allowPaymentRequest:xt,allowUserMedia:xt,alt:null,as:null,async:xt,autoCapitalize:null,autoComplete:an,autoFocus:xt,autoPlay:xt,blocking:an,capture:null,charSet:null,checked:xt,cite:null,className:an,cols:Se,colSpan:null,content:null,contentEditable:qn,controls:xt,controlsList:an,coords:Se|xc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xt,defer:xt,dir:null,dirName:null,disabled:xt,download:Zx,draggable:qn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xt,formTarget:null,headers:an,height:Se,hidden:Zx,high:Se,href:null,hrefLang:null,htmlFor:an,httpEquiv:an,id:null,imageSizes:null,imageSrcSet:null,inert:xt,inputMode:null,integrity:null,is:null,isMap:xt,itemId:null,itemProp:an,itemRef:an,itemScope:xt,itemType:an,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xt,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,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:Se,pattern:null,ping:an,placeholder:null,playsInline:xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xt,referrerPolicy:null,rel:an,required:xt,reversed:xt,rows:Se,rowSpan:Se,sandbox:an,scope:null,scoped:xt,seamless:xt,selected:xt,shadowRootClonable:xt,shadowRootDelegatesFocus:xt,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:qn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:xt,useMap:null,value:qn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:an,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xt,declare:xt,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:xt,noHref:xt,noShade:xt,noWrap:xt,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:qn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xt,disableRemotePlayback:xt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:LP}),w4=Vc({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:xs,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:an,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xc,g2:xc,glyphName:xc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:xs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:an,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:xs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xs,rev:xs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xs,requiredFeatures:xs,requiredFonts:xs,requiredFormats:xs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:xs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:xs,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:xs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:RP}),OP=Vc({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()}}),MP=Vc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:LP}),$P=Vc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),v4={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"},b4=/[A-Z]/g,xS=/-[a-z]/g,k4=/^data[-\w.:]+$/i;function S4(e,t){const n=Qx(t);let r=t,s=fs;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&k4.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(xS,j4);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!xS.test(i)){let a=i.replace(b4,N4);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Bv}return new s(r,t)}function N4(e){return"-"+e.toLowerCase()}function j4(e){return e.charAt(1).toUpperCase()}const C4=IP([TP,x4,OP,MP,$P],"html"),Hv=IP([TP,w4,OP,MP,$P],"svg");function E4(e){return e.join(" ").trim()}var Uv={},wS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,_4=/\n/g,P4=/^\s*/,A4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,I4=/^:\s*/,T4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,R4=/^[;\s]*/,L4=/^\s+|\s+$/g,O4=`
|
|
67
|
+
`,vS="/",bS="*",Ya="",M4="comment",$4="declaration";function D4(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(y){var k=y.match(_4);k&&(n+=k.length);var b=y.lastIndexOf(O4);r=~b?y.length-b:r+y.length}function i(){var y={line:n,column:r};return function(k){return k.position=new a(y),d(),k}}function a(y){this.start=y,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(y){var k=new Error(t.source+":"+n+":"+r+": "+y);if(k.reason=y,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function c(y){var k=y.exec(e);if(k){var b=k[0];return s(b),e=e.slice(b.length),k}}function d(){c(P4)}function u(y){var k;for(y=y||[];k=f();)k!==!1&&y.push(k);return y}function f(){var y=i();if(!(vS!=e.charAt(0)||bS!=e.charAt(1))){for(var k=2;Ya!=e.charAt(k)&&(bS!=e.charAt(k)||vS!=e.charAt(k+1));)++k;if(k+=2,Ya===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,y({type:M4,comment:b})}}function p(){var y=i(),k=c(A4);if(k){if(f(),!c(I4))return l("property missing ':'");var b=c(T4),g=y({type:$4,property:kS(k[0].replace(wS,Ya)),value:b?kS(b[0].replace(wS,Ya)):Ya});return c(R4),g}}function h(){var y=[];u(y);for(var k;k=p();)k!==!1&&(y.push(k),u(y));return y}return d(),h()}function kS(e){return e?e.replace(L4,Ya):Ya}var F4=D4,z4=hd&&hd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.default=H4;const B4=z4(F4);function H4(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,B4.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 Fm={};Object.defineProperty(Fm,"__esModule",{value:!0});Fm.camelCase=void 0;var U4=/^--[a-zA-Z0-9_-]+$/,W4=/-([a-z])/g,V4=/^[^-]+$/,K4=/^-(webkit|moz|ms|o|khtml)-/,q4=/^-(ms)-/,Y4=function(e){return!e||V4.test(e)||U4.test(e)},G4=function(e,t){return t.toUpperCase()},SS=function(e,t){return"".concat(t,"-")},X4=function(e,t){return t===void 0&&(t={}),Y4(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(q4,SS):e=e.replace(K4,SS),e.replace(W4,G4))};Fm.camelCase=X4;var J4=hd&&hd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Q4=J4(Uv),Z4=Fm;function tw(e,t){var n={};return!e||typeof e!="string"||(0,Q4.default)(e,function(r,s){r&&s&&(n[(0,Z4.camelCase)(r,t)]=s)}),n}tw.default=tw;var eB=tw;const tB=wa(eB),DP=FP("end"),Wv=FP("start");function FP(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 nB(e){const t=Wv(e),n=DP(e);if(t&&n)return{start:t,end:n}}function ad(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?NS(e.position):"start"in e||"end"in e?NS(e):"line"in e||"column"in e?nw(e):""}function nw(e){return jS(e&&e.line)+":"+jS(e&&e.column)}function NS(e){return nw(e&&e.start)+"-"+nw(e&&e.end)}function jS(e){return e&&typeof e=="number"?e:1}class Tr 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}}Tr.prototype.file="";Tr.prototype.name="";Tr.prototype.reason="";Tr.prototype.message="";Tr.prototype.stack="";Tr.prototype.column=void 0;Tr.prototype.line=void 0;Tr.prototype.ancestors=void 0;Tr.prototype.cause=void 0;Tr.prototype.fatal=void 0;Tr.prototype.place=void 0;Tr.prototype.ruleId=void 0;Tr.prototype.source=void 0;const Vv={}.hasOwnProperty,rB=new Map,sB=/[A-Z]/g,iB=new Set(["table","tbody","thead","tfoot","tr"]),oB=new Set(["td","th"]),zP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function aB(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=mB(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=hB(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"?Hv:C4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=BP(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function BP(e,t,n){if(t.type==="element")return lB(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return cB(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return dB(e,t,n);if(t.type==="mdxjsEsm")return uB(e,t);if(t.type==="root")return fB(e,t,n);if(t.type==="text")return pB(e,t)}function lB(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Hv,e.schema=s),e.ancestors.push(t);const i=UP(e,t.tagName,!1),a=gB(e,t);let l=qv(e,t);return iB.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!g4(c):!0})),HP(e,a,i,t),Kv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function cB(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 uB(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Hd(e,t.position)}function dB(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Hv,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:UP(e,t.name,!0),a=yB(e,t),l=qv(e,t);return HP(e,a,i,t),Kv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function fB(e,t,n){const r={};return Kv(r,qv(e,t)),e.create(t,e.Fragment,r,n)}function pB(e,t){return t.value}function HP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Kv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function hB(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 mB(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=Wv(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 gB(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Vv.call(t.properties,s)){const i=xB(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&oB.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 yB(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 qv(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:rB;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=BP(e,i,a);l!==void 0&&n.push(l)}return n}function xB(e,t,n){const r=S4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?d4(n):E4(n)),r.property==="style"){let s=typeof n=="object"?n:wB(e,String(n));return e.stylePropertyNameCase==="css"&&(s=vB(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?v4[r.property]||r.property:r.attribute,n]}}function wB(e,t){try{return tB(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Tr("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=zP+"#cannot-parse-style-attribute",s}}function UP(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=mS(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=mS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Vv.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 Tr("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=zP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function vB(e){const t={};let n;for(n in e)Vv.call(e,n)&&(t[bB(n)]=e[n]);return t}function bB(e){let t=e.replace(sB,kB);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function kB(e){return"-"+e.toLowerCase()}const ay={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"]},SB={};function NB(e,t){const n=SB,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return WP(e,r,s)}function WP(e,t,n){if(jB(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 CS(e.children,t,n)}return Array.isArray(e)?CS(e,t,n):""}function CS(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=WP(e[s],t,n);return r.join("")}function jB(e){return!!(e&&typeof e=="object")}const ES=document.createElement("i");function Yv(e){const t="&"+e+";";ES.innerHTML=t;const n=ES.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Xi(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 Bs(e,t){return e.length>0?(Xi(e,e.length,0,t),e):t}const _S={}.hasOwnProperty;function CB(e){const t={};let n=-1;for(;++n<e.length;)EB(t,e[n]);return t}function EB(e,t){let n;for(n in t){const s=(_S.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){_S.call(s,a)||(s[a]=[]);const l=i[a];_B(s[a],Array.isArray(l)?l:l?[l]:[])}}}function _B(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Xi(e,0,0,r)}function VP(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 wc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Bi=Sa(/[A-Za-z]/),Ns=Sa(/[\dA-Za-z]/),PB=Sa(/[#-'*+\--9=?A-Z^-~]/);function rw(e){return e!==null&&(e<32||e===127)}const sw=Sa(/\d/),AB=Sa(/[\dA-Fa-f]/),IB=Sa(/[!-/:-@[-`{-~]/);function at(e){return e!==null&&e<-2}function us(e){return e!==null&&(e<0||e===32)}function Ut(e){return e===-2||e===-1||e===32}const TB=Sa(new RegExp("\\p{P}|\\p{S}","u")),RB=Sa(/\s/);function Sa(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Kc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Ns(e.charCodeAt(n+1))&&Ns(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 cn(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Ut(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ut(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const LB={tokenize:OB};function OB(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"),cn(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 at(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const MB={tokenize:$B},PS={tokenize:DB};function $B(e){const t=this,n=[];let r=0,s,i,a;return l;function l(w){if(r<n.length){const j=n[r];return t.containerState=j[1],e.attempt(j[0].continuation,c,d)(w)}return d(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const j=t.events.length;let E=j,S;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){S=t.events[E][1].end;break}g(r);let A=j;for(;A<t.events.length;)t.events[A][1].end={...S},A++;return Xi(t.events,E+1,0,t.events.slice(j)),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 y(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(PS,u,f)(w)}function u(w){return s&&v(),g(r),p(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,y(w)}function p(w){return t.containerState={},e.attempt(PS,h,y)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function y(w){if(w===null){s&&v(),g(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),g(0),e.consume(w);return}return at(w)?(e.consume(w),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),k)}function b(w,j){const E=t.sliceStream(w);if(j&&E.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(E),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,W;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(M){W=t.events[R][1].end;break}M=!0}for(g(r),S=A;S<t.events.length;)t.events[S][1].end={...W},S++;Xi(t.events,R+1,0,t.events.slice(A)),t.events.length=S}}function g(w){let j=n.length;for(;j-- >w;){const E=n[j];t.containerState=E[1],E[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 DB(e,t,n){return cn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function AS(e){if(e===null||us(e)||RB(e))return 1;if(TB(e))return 2}function Gv(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 iw={name:"attention",resolveAll:FB,tokenize:zB};function FB(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};IS(f,-c),IS(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=Bs(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Bs(d,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),d=Bs(d,Gv(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Bs(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=Bs(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Xi(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 zB(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=AS(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=AS(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 IS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const BB={name:"autolink",tokenize:HB};function HB(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 Bi(h)?(e.consume(h),a):h===64?n(h):d(h)}function a(h){return h===43||h===45||h===46||Ns(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||Ns(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||rw(h)?n(h):(e.consume(h),c)}function d(h){return h===64?(e.consume(h),u):PB(h)?(e.consume(h),d):n(h)}function u(h){return Ns(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||Ns(h))&&r++<63){const y=h===45?p:f;return e.consume(h),y}return n(h)}}const zm={partial:!0,tokenize:UB};function UB(e,t,n){return r;function r(i){return Ut(i)?cn(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||at(i)?t(i):n(i)}}const KP={continuation:{tokenize:VB},exit:KB,name:"blockQuote",tokenize:WB};function WB(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 Ut(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function VB(e,t,n){const r=this;return s;function s(a){return Ut(a)?cn(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(KP,t,n)(a)}}function KB(e){e.exit("blockQuote")}const qP={name:"characterEscape",tokenize:qB};function qB(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 IB(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const YP={name:"characterReference",tokenize:YB};function YB(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=Ns,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=AB,u):(e.enter("characterReferenceValue"),i=7,a=sw,u(f))}function u(f){if(f===59&&s){const p=e.exit("characterReferenceValue");return a===Ns&&!Yv(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 TS={partial:!0,tokenize:XB},RS={concrete:!0,name:"codeFenced",tokenize:GB};function GB(e,t,n){const r=this,s={partial:!0,tokenize:E};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"),Ut(S)?cn(e,f,"whitespace")(S):f(S))}function f(S){return S===null||at(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(TS,k,j)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||at(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(S)):Ut(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),cn(e,h,"whitespace")(S)):S===96&&S===l?n(S):(e.consume(S),p)}function h(S){return S===null||at(S)?f(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===null||at(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(S)):S===96&&S===l?n(S):(e.consume(S),y)}function k(S){return e.attempt(s,j,b)(S)}function b(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),g}function g(S){return i>0&&Ut(S)?cn(e,v,"linePrefix",i+1)(S):v(S)}function v(S){return S===null||at(S)?e.check(TS,k,j)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||at(S)?(e.exit("codeFlowValue"),v(S)):(e.consume(S),w)}function j(S){return e.exit("codeFenced"),t(S)}function E(S,A,R){let M=0;return W;function W(L){return S.enter("lineEnding"),S.consume(L),S.exit("lineEnding"),D}function D(L){return S.enter("codeFencedFence"),Ut(L)?cn(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"),Ut(L)?cn(S,$,"whitespace")(L):$(L)):R(L)}function $(L){return L===null||at(L)?(S.exit("codeFencedFence"),A(L)):R(L)}}}function XB(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 ly={name:"codeIndented",tokenize:QB},JB={partial:!0,tokenize:ZB};function QB(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),cn(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):at(d)?e.attempt(JB,a,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||at(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function ZB(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):at(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):cn(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):at(a)?s(a):n(a)}}const eH={name:"codeText",previous:nH,resolve:tH,tokenize:rH};function tH(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 nH(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function rH(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)):at(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||at(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 sH{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&&Tu(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),Tu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Tu(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);Tu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Tu(this.left,n.reverse())}}}function Tu(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 GP(e){const t={};let n=-1,r,s,i,a,l,c,d;const u=new sH(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,iH(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 Xi(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function iH(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,y=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 g=l.slice(b[p],b[p+1]),v=i.pop();c.push([v,v+g.length-1]),e.splice(v,2,g)}for(c.reverse(),p=-1;++p<c.length;)d[y+c[p][0]]=y+c[p][1],y+=c[p][1]-c[p][0]-1;return d}const oH={resolve:lH,tokenize:cH},aH={partial:!0,tokenize:uH};function lH(e){return GP(e),e}function cH(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):at(l)?e.check(aH,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 uH(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),cn(e,i,"linePrefix")}function i(a){if(a===null||at(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 XP(e,t,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return f;function f(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),p):g===null||g===32||g===41||rw(g)?n(g):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),k(g))}function p(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(l),p(g)):g===null||g===60||at(g)?n(g):(e.consume(g),g===92?y:h)}function y(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function k(g){return!u&&(g===null||g===41||us(g))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(g)):u<d&&g===40?(e.consume(g),u++,k):g===41?(e.consume(g),u--,k):g===null||g===32||g===40||rw(g)?n(g):(e.consume(g),g===92?b:k)}function b(g){return g===40||g===41||g===92?(e.consume(g),k):k(g)}}function JP(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):at(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||at(h)||l++>999?(e.exit("chunkString"),u(h)):(e.consume(h),c||(c=!Ut(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function QP(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):at(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),cn(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===a||p===null||at(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 at(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ut(s)?cn(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const dH={name:"definition",tokenize:pH},fH={partial:!0,tokenize:hH};function pH(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),a(h)}function a(h){return JP.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=wc(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 us(h)?ld(e,d)(h):d(h)}function d(h){return XP(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return e.attempt(fH,f,f)(h)}function f(h){return Ut(h)?cn(e,p,"whitespace")(h):p(h)}function p(h){return h===null||at(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function hH(e,t,n){return r;function r(l){return us(l)?ld(e,s)(l):n(l)}function s(l){return QP(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ut(l)?cn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||at(l)?t(l):n(l)}}const mH={name:"hardBreakEscape",tokenize:gH};function gH(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return at(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const yH={name:"headingAtx",resolve:xH,tokenize:wH};function xH(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"},Xi(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function wH(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||us(u)?(e.exit("atxHeadingSequence"),l(u)):n(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||at(u)?(e.exit("atxHeading"),t(u)):Ut(u)?cn(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||us(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),d)}}const vH=["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"],LS=["pre","script","style","textarea"],bH={concrete:!0,name:"htmlFlow",resolveTo:NH,tokenize:jH},kH={partial:!0,tokenize:EH},SH={partial:!0,tokenize:CH};function NH(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 jH(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:C):Bi(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,y):Bi(H)?(e.consume(H),s=4,r.interrupt?t:C):n(H)}function h(H){return H===45?(e.consume(H),r.interrupt?t:C):n(H)}function y(H){const te="CDATA[";return H===te.charCodeAt(l++)?(e.consume(H),l===te.length?r.interrupt?t:O:y):n(H)}function k(H){return Bi(H)?(e.consume(H),a=String.fromCharCode(H),b):n(H)}function b(H){if(H===null||H===47||H===62||us(H)){const te=H===47,ae=a.toLowerCase();return!te&&!i&&LS.includes(ae)?(s=1,r.interrupt?t(H):O(H)):vH.includes(a.toLowerCase())?(s=6,te?(e.consume(H),g):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||Ns(H)?(e.consume(H),a+=String.fromCharCode(H),b):n(H)}function g(H){return H===62?(e.consume(H),r.interrupt?t:O):n(H)}function v(H){return Ut(H)?(e.consume(H),v):W(H)}function w(H){return H===47?(e.consume(H),W):H===58||H===95||Bi(H)?(e.consume(H),j):Ut(H)?(e.consume(H),w):W(H)}function j(H){return H===45||H===46||H===58||H===95||Ns(H)?(e.consume(H),j):E(H)}function E(H){return H===61?(e.consume(H),S):Ut(H)?(e.consume(H),E):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):Ut(H)?(e.consume(H),S):R(H)}function A(H){return H===c?(e.consume(H),c=null,M):H===null||at(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||us(H)?E(H):(e.consume(H),R)}function M(H){return H===47||H===62||Ut(H)?w(H):n(H)}function W(H){return H===62?(e.consume(H),D):n(H)}function D(H){return H===null||at(H)?O(H):Ut(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),C):H===93&&s===5?(e.consume(H),T):at(H)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(kH,Z,K)(H)):H===null||at(H)?(e.exit("htmlFlowData"),K(H)):(e.consume(H),O)}function K(H){return e.check(SH,$,Z)(H)}function $(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),L}function L(H){return H===null||at(H)?K(H):(e.enter("htmlFlowData"),O(H))}function I(H){return H===45?(e.consume(H),C):O(H)}function z(H){return H===47?(e.consume(H),a="",_):O(H)}function _(H){if(H===62){const te=a.toLowerCase();return LS.includes(te)?(e.consume(H),J):O(H)}return Bi(H)&&a.length<8?(e.consume(H),a+=String.fromCharCode(H),_):O(H)}function T(H){return H===93?(e.consume(H),C):O(H)}function C(H){return H===62?(e.consume(H),J):H===45&&s===2?(e.consume(H),C):O(H)}function J(H){return H===null||at(H)?(e.exit("htmlFlowData"),Z(H)):(e.consume(H),J)}function Z(H){return e.exit("htmlFlow"),t(H)}}function CH(e,t,n){const r=this;return s;function s(a){return at(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 EH(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(zm,t,n)}}const _H={name:"htmlText",tokenize:PH};function PH(e,t,n){const r=this;let s,i,a;return l;function l(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),c}function c(C){return C===33?(e.consume(C),d):C===47?(e.consume(C),E):C===63?(e.consume(C),w):Bi(C)?(e.consume(C),R):n(C)}function d(C){return C===45?(e.consume(C),u):C===91?(e.consume(C),i=0,y):Bi(C)?(e.consume(C),v):n(C)}function u(C){return C===45?(e.consume(C),h):n(C)}function f(C){return C===null?n(C):C===45?(e.consume(C),p):at(C)?(a=f,z(C)):(e.consume(C),f)}function p(C){return C===45?(e.consume(C),h):f(C)}function h(C){return C===62?I(C):C===45?p(C):f(C)}function y(C){const J="CDATA[";return C===J.charCodeAt(i++)?(e.consume(C),i===J.length?k:y):n(C)}function k(C){return C===null?n(C):C===93?(e.consume(C),b):at(C)?(a=k,z(C)):(e.consume(C),k)}function b(C){return C===93?(e.consume(C),g):k(C)}function g(C){return C===62?I(C):C===93?(e.consume(C),g):k(C)}function v(C){return C===null||C===62?I(C):at(C)?(a=v,z(C)):(e.consume(C),v)}function w(C){return C===null?n(C):C===63?(e.consume(C),j):at(C)?(a=w,z(C)):(e.consume(C),w)}function j(C){return C===62?I(C):w(C)}function E(C){return Bi(C)?(e.consume(C),S):n(C)}function S(C){return C===45||Ns(C)?(e.consume(C),S):A(C)}function A(C){return at(C)?(a=A,z(C)):Ut(C)?(e.consume(C),A):I(C)}function R(C){return C===45||Ns(C)?(e.consume(C),R):C===47||C===62||us(C)?M(C):n(C)}function M(C){return C===47?(e.consume(C),I):C===58||C===95||Bi(C)?(e.consume(C),W):at(C)?(a=M,z(C)):Ut(C)?(e.consume(C),M):I(C)}function W(C){return C===45||C===46||C===58||C===95||Ns(C)?(e.consume(C),W):D(C)}function D(C){return C===61?(e.consume(C),O):at(C)?(a=D,z(C)):Ut(C)?(e.consume(C),D):M(C)}function O(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),s=C,K):at(C)?(a=O,z(C)):Ut(C)?(e.consume(C),O):(e.consume(C),$)}function K(C){return C===s?(e.consume(C),s=void 0,L):C===null?n(C):at(C)?(a=K,z(C)):(e.consume(C),K)}function $(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||us(C)?M(C):(e.consume(C),$)}function L(C){return C===47||C===62||us(C)?M(C):n(C)}function I(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function z(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),_}function _(C){return Ut(C)?cn(e,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):T(C)}function T(C){return e.enter("htmlTextData"),a(C)}}const Xv={name:"labelEnd",resolveAll:RH,resolveTo:LH,tokenize:OH},AH={tokenize:MH},IH={tokenize:$H},TH={tokenize:DH};function RH(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&&Xi(e,0,e.length,n),e}function LH(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=Bs(l,e.slice(i+1,i+r+3)),l=Bs(l,[["enter",u,t]]),l=Bs(l,Gv(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Bs(l,[["exit",u,t],e[a-2],e[a-1],["exit",d,t]]),l=Bs(l,e.slice(a+1)),l=Bs(l,[["exit",c,t]]),Xi(e,i,e.length,l),e}function OH(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(wc(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(AH,u,a?u:f)(p):p===91?e.attempt(IH,u,a?d:f)(p):a?u(p):f(p)}function d(p){return e.attempt(TH,u,f)(p)}function u(p){return t(p)}function f(p){return i._balanced=!0,n(p)}}function MH(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 us(f)?ld(e,i)(f):i(f)}function i(f){return f===41?u(f):XP(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return us(f)?ld(e,c)(f):u(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?QP(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function d(f){return us(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 $H(e,t,n){const r=this;return s;function s(l){return JP.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(wc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function DH(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 FH={name:"labelStartImage",resolveAll:Xv.resolveAll,tokenize:zH};function zH(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 BH={name:"labelStartLink",resolveAll:Xv.resolveAll,tokenize:HH};function HH(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 cy={name:"lineEnding",tokenize:UH};function UH(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),cn(e,t,"linePrefix")}}const Qp={name:"thematicBreak",tokenize:WH};function WH(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||at(d))?(e.exit("thematicBreak"),t(d)):n(d)}function c(d){return d===s?(e.consume(d),r++,c):(e.exit("thematicBreakSequence"),Ut(d)?cn(e,l,"whitespace")(d):l(d))}}const Qr={continuation:{tokenize:YH},exit:XH,name:"list",tokenize:qH},VH={partial:!0,tokenize:JH},KH={partial:!0,tokenize:GH};function qH(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 y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:sw(h)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Qp,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 sw(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(zm,r.interrupt?n:u,e.attempt(VH,p,f))}function u(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function f(h){return Ut(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 YH(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(zm,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,cn(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ut(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(KH,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,cn(e,e.attempt(Qr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function GH(e,t,n){const r=this;return cn(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 XH(e){e.exit(this.containerState.type)}function JH(e,t,n){const r=this;return cn(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!Ut(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const OS={name:"setextUnderline",resolveTo:QH,tokenize:ZH};function QH(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 ZH(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"),Ut(d)?cn(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||at(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const e6={tokenize:t6};function t6(e){const t=this,n=e.attempt(zm,r,e.attempt(this.parser.constructs.flowInitial,s,cn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(oH,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 n6={resolveAll:eA()},r6=ZP("string"),s6=ZP("text");function ZP(e){return{resolveAll:eA(e==="text"?i6: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 eA(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 i6(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 o6={42:Qr,43:Qr,45:Qr,48:Qr,49:Qr,50:Qr,51:Qr,52:Qr,53:Qr,54:Qr,55:Qr,56:Qr,57:Qr,62:KP},a6={91:dH},l6={[-2]:ly,[-1]:ly,32:ly},c6={35:yH,42:Qp,45:[OS,Qp],60:bH,61:OS,95:Qp,96:RS,126:RS},u6={38:YP,92:qP},d6={[-5]:cy,[-4]:cy,[-3]:cy,33:FH,38:YP,42:iw,60:[BB,_H],91:BH,92:[mH,qP],93:Xv,95:iw,96:eH},f6={null:[iw,n6]},p6={null:[42,95]},h6={null:[]},m6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:p6,contentInitial:a6,disable:h6,document:o6,flow:c6,flowInitial:l6,insideSpan:f6,string:u6,text:d6},Symbol.toStringTag,{value:"Module"}));function g6(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(E),check:A(S),consume:v,enter:w,exit:j,interrupt:A(S,{interrupt:!0})},d={code:null,containerState:{},defineSkip:k,events:[],now:y,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=Bs(a,D),b(),a[a.length-1]!==null?[]:(R(t,0),d.events=Gv(i,d.events,d),d.events)}function p(D,O){return x6(h(D),O)}function h(D){return y6(a,D)}function y(){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,W()}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;)g(O.charCodeAt(r._bufferIndex));else g(O)}}function g(D){u=u(D)}function v(D){at(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,W()):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=y(),d.events.push(["enter",K,d]),l.push(K),K}function j(D){const O=l.pop();return O.end=y(),d.events.push(["exit",O,d]),O}function E(D,O){R(D,O.from)}function S(D,O){O.restore()}function A(D,O){return K;function K($,L,I){let z,_,T,C;return Array.isArray($)?Z($):"tokenize"in $?Z([$]):J($);function J(ce){return ue;function ue(le){const de=le!==null&&ce[le],se=le!==null&&ce.null,fe=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(se)?se:se?[se]:[]];return Z(fe)(le)}}function Z(ce){return z=ce,_=0,ce.length===0?I:H(ce[_])}function H(ce){return ue;function ue(le){return C=M(),T=ce,ce.partial||(d.currentConstruct=ce),ce.name&&d.parser.constructs.disable.null.includes(ce.name)?ae():ce.tokenize.call(O?Object.assign(Object.create(d),O):d,c,te,ae)(le)}}function te(ce){return D(T,C),L}function ae(ce){return C.restore(),++_<z.length?H(z[_]):I}}}function R(D,O){D.resolveAll&&!i.includes(D)&&i.push(D),D.resolve&&Xi(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=y(),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,W()}}function W(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function y6(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 x6(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 w6(e){const r={constructs:CB([m6,...(e||{}).extensions||[]]),content:s(LB),defined:[],document:s(MB),flow:s(e6),lazy:{},string:s(r6),text:s(s6)};return r;function s(i){return a;function a(l){return g6(r,i,l)}}}function v6(e){for(;!GP(e););return e}const MS=/[\0\t\n\r]/g;function b6(){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(MS.lastIndex=f,d=MS.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 k6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function S6(e){return e.replace(k6,N6)}function N6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return VP(n.slice(i?2:1),i?16:10)}return Yv(n)||e}const tA={}.hasOwnProperty;function j6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),C6(n)(v6(w6(n).document().write(b6()(e,t,!0))))}function C6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ce),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(lt),blockQuote:i(se),characterEscape:M,characterReference:M,codeFenced:i(fe),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(fe,a),codeText:i(ye,a),codeTextData:M,data:M,codeFlowValue:M,definition:i(je),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(He),hardBreakEscape:i(Ge),hardBreakTrailing:i(Ge),htmlFlow:i(Ct,a),htmlFlowData:M,htmlText:i(Ct,a),htmlTextData:M,image:i(Me),label:a,link:i(Ce),listItem:i(Hn),listItemValue:p,listOrdered:i(Gt,f),listUnordered:i(Gt),paragraph:i(Xt),reference:H,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(lt),strong:i(Cn),thematicBreak:i(cr)},exit:{atxHeading:c(),atxHeadingSequence:E,autolink:c(),autolinkEmail:de,autolinkProtocol:le,blockQuote:c(),characterEscapeValue:W,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:ce,characterReference:ue,codeFenced:c(b),codeFencedFence:k,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:W,codeIndented:c(g),codeText:c(L),codeTextData:W,data:W,definition:c(),definitionDestinationString:j,definitionLabelString:v,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(K),htmlFlowData:W,htmlText:c($),htmlTextData:W,image:c(z),label:T,labelText:_,lineEnding:D,link:c(I),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:C,resourceTitleString:J,resource:Z,setextHeading:c(R),setextHeadingLineSequence:A,setextHeadingText:S,strong:c(),thematicBreak:c()}};nA(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let ge={type:"root",children:[]};const qe={stack:[ge],tokenStack:[],config:t,enter:l,exit:d,buffer:a,resume:u,data:n},it=[];let tt=-1;for(;++tt<oe.length;)if(oe[tt][1].type==="listOrdered"||oe[tt][1].type==="listUnordered")if(oe[tt][0]==="enter")it.push(tt);else{const It=it.pop();tt=s(oe,It,tt)}for(tt=-1;++tt<oe.length;){const It=t[oe[tt][0]];tA.call(It,oe[tt][1].type)&&It[oe[tt][1].type].call(Object.assign({sliceSerialize:oe[tt][2].sliceSerialize},qe),oe[tt][1])}if(qe.tokenStack.length>0){const It=qe.tokenStack[qe.tokenStack.length-1];(It[1]||$S).call(qe,void 0,It[0])}for(ge.position={start:Ho(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Ho(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<t.transforms.length;)ge=t.transforms[tt](ge)||ge;return ge}function s(oe,ge,qe){let it=ge-1,tt=-1,It=!1,Ln,Ft,On,Jt;for(;++it<=qe;){const Qt=oe[it];switch(Qt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qt[0]==="enter"?tt++:tt--,Jt=void 0;break}case"lineEndingBlank":{Qt[0]==="enter"&&(Ln&&!Jt&&!tt&&!On&&(On=it),Jt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Jt=void 0}if(!tt&&Qt[0]==="enter"&&Qt[1].type==="listItemPrefix"||tt===-1&&Qt[0]==="exit"&&(Qt[1].type==="listUnordered"||Qt[1].type==="listOrdered")){if(Ln){let rr=it;for(Ft=void 0;rr--;){const pe=oe[rr];if(pe[1].type==="lineEnding"||pe[1].type==="lineEndingBlank"){if(pe[0]==="exit")continue;Ft&&(oe[Ft][1].type="lineEndingBlank",It=!0),pe[1].type="lineEnding",Ft=rr}else if(!(pe[1].type==="linePrefix"||pe[1].type==="blockQuotePrefix"||pe[1].type==="blockQuotePrefixWhitespace"||pe[1].type==="blockQuoteMarker"||pe[1].type==="listItemIndent"))break}On&&(!Ft||On<Ft)&&(Ln._spread=!0),Ln.end=Object.assign({},Ft?oe[Ft][1].start:Qt[1].end),oe.splice(Ft||it,0,["exit",Ln,Qt[2]]),it++,qe++}if(Qt[1].type==="listItemPrefix"){const rr={type:"listItem",_spread:!1,start:Object.assign({},Qt[1].start),end:void 0};Ln=rr,oe.splice(it,0,["enter",rr,Qt[2]]),it++,qe++,On=void 0,Jt=!0}}}return oe[ge][1]._spread=It,qe}function i(oe,ge){return qe;function qe(it){l.call(this,oe(it),it),ge&&ge.call(this,it)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(oe,ge,qe){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ge,qe||void 0]),oe.position={start:Ho(ge.start),end:void 0}}function c(oe){return ge;function ge(qe){oe&&oe.call(this,qe),d.call(this,qe)}}function d(oe,ge){const qe=this.stack.pop(),it=this.tokenStack.pop();if(it)it[0].type!==oe.type&&(ge?ge.call(this,oe,it[0]):(it[1]||$S).call(this,oe,it[0]));else throw new Error("Cannot close `"+oe.type+"` ("+ad({start:oe.start,end:oe.end})+"): it’s not open");qe.position.end=Ho(oe.end)}function u(){return NB(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(oe){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function h(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=oe}function y(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=oe}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe.replace(/(\r?\n|\r)$/g,"")}function v(oe){const ge=this.resume(),qe=this.stack[this.stack.length-1];qe.label=ge,qe.identifier=wc(this.sliceSerialize(oe)).toLowerCase()}function w(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=oe}function j(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=oe}function E(oe){const ge=this.stack[this.stack.length-1];if(!ge.depth){const qe=this.sliceSerialize(oe).length;ge.depth=qe}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function A(oe){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function M(oe){const qe=this.stack[this.stack.length-1].children;let it=qe[qe.length-1];(!it||it.type!=="text")&&(it=kr(),it.position={start:Ho(oe.start),end:void 0},qe.push(it)),this.stack.push(it)}function W(oe){const ge=this.stack.pop();ge.value+=this.sliceSerialize(oe),ge.position.end=Ho(oe.end)}function D(oe){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const qe=ge.children[ge.children.length-1];qe.position.end=Ho(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ge.type)&&(M.call(this,oe),W.call(this,oe))}function O(){this.data.atHardBreak=!0}function K(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe}function $(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe}function L(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe}function I(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ge,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 ge=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ge,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function _(oe){const ge=this.sliceSerialize(oe),qe=this.stack[this.stack.length-2];qe.label=S6(ge),qe.identifier=wc(ge).toLowerCase()}function T(){const oe=this.stack[this.stack.length-1],ge=this.resume(),qe=this.stack[this.stack.length-1];if(this.data.inReference=!0,qe.type==="link"){const it=oe.children;qe.children=it}else qe.alt=ge}function C(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=oe}function J(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=oe}function Z(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function te(oe){const ge=this.resume(),qe=this.stack[this.stack.length-1];qe.label=ge,qe.identifier=wc(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function ae(oe){this.data.characterReferenceType=oe.type}function ce(oe){const ge=this.sliceSerialize(oe),qe=this.data.characterReferenceType;let it;qe?(it=VP(ge,qe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):it=Yv(ge);const tt=this.stack[this.stack.length-1];tt.value+=it}function ue(oe){const ge=this.stack.pop();ge.position.end=Ho(oe.end)}function le(oe){W.call(this,oe);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(oe)}function de(oe){W.call(this,oe);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(oe)}function se(){return{type:"blockquote",children:[]}}function fe(){return{type:"code",lang:null,meta:null,value:""}}function ye(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function He(){return{type:"emphasis",children:[]}}function lt(){return{type:"heading",depth:0,children:[]}}function Ge(){return{type:"break"}}function Ct(){return{type:"html",value:""}}function Me(){return{type:"image",title:null,url:"",alt:null}}function Ce(){return{type:"link",title:null,url:"",children:[]}}function Gt(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Hn(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function Xt(){return{type:"paragraph",children:[]}}function Cn(){return{type:"strong",children:[]}}function kr(){return{type:"text",value:""}}function cr(){return{type:"thematicBreak"}}}function Ho(e){return{line:e.line,column:e.column,offset:e.offset}}function nA(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?nA(e,r):E6(e,r)}}function E6(e,t){let n;for(n in t)if(tA.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 $S(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 _6(e){const t=this;t.parser=n;function n(r){return j6(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function P6(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 A6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
+
`}]}function I6(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 T6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function R6(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function L6(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Kc(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 O6(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 M6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function rA(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 $6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rA(e,t);const s={src:Kc(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 D6(e,t){const n={src:Kc(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 F6(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 z6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rA(e,t);const s={href:Kc(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 B6(e,t){const n={href:Kc(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 H6(e,t,n){const r=e.all(t),s=n?U6(n):sA(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 U6(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=sA(n[r])}return t}function sA(e){const t=e.spread;return t??e.children.length>1}function W6(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 V6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function K6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function q6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Y6(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=Wv(t.children[1]),c=DP(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 G6(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 y={type:"element",tagName:i,properties:p,children:[]};f&&(y.children=e.all(f),e.patch(f,y),y=e.applyData(f,y)),d.push(y)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,u),e.applyData(t,u)}function X6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const DS=9,FS=32;function J6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(zS(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(zS(t.slice(s),s>0,!1)),i.join("")}function zS(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===DS||i===FS;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===DS||i===FS;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function Q6(e,t){const n={type:"text",value:J6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Z6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const e8={blockquote:P6,break:A6,code:I6,delete:T6,emphasis:R6,footnoteReference:L6,heading:O6,html:M6,imageReference:$6,image:D6,inlineCode:F6,linkReference:z6,link:B6,listItem:H6,list:W6,paragraph:V6,root:K6,strong:q6,table:Y6,tableCell:X6,tableRow:G6,text:Q6,thematicBreak:Z6,toml:wp,yaml:wp,definition:wp,footnoteDefinition:wp};function wp(){}const iA=-1,Bm=0,cd=1,zh=2,Jv=3,Qv=4,Zv=5,eb=6,oA=7,aA=8,BS=typeof self=="object"?self:globalThis,t8=(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 Bm:case iA:return n(a,s);case cd:{const l=n([],s);for(const c of a)l.push(r(c));return l}case zh:{const l=n({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case Jv:return n(new Date(a),s);case Qv:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case Zv:{const l=n(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case eb:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case oA:{const{name:l,message:c}=a;return n(new BS[l](c),s)}case aA: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 BS[i](a),s)};return r},HS=e=>t8(new Map,e)(0),Dl="",{toString:n8}={},{keys:r8}=Object,Ru=e=>{const t=typeof e;if(t!=="object"||!e)return[Bm,t];const n=n8.call(e).slice(8,-1);switch(n){case"Array":return[cd,Dl];case"Object":return[zh,Dl];case"Date":return[Jv,Dl];case"RegExp":return[Qv,Dl];case"Map":return[Zv,Dl];case"Set":return[eb,Dl];case"DataView":return[cd,n]}return n.includes("Array")?[cd,n]:n.includes("Error")?[oA,n]:[zh,n]},vp=([e,t])=>e===Bm&&(t==="function"||t==="symbol"),s8=(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]=Ru(a);switch(l){case Bm:{let u=a;switch(c){case"bigint":l=aA,u=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return s([iA],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 zh:{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 r8(a))(e||!vp(Ru(a[p])))&&u.push([i(p),i(a[p])]);return f}case Jv:return s([l,a.toISOString()],a);case Qv:{const{source:u,flags:f}=a;return s([l,{source:u,flags:f}],a)}case Zv:{const u=[],f=s([l,u],a);for(const[p,h]of a)(e||!(vp(Ru(p))||vp(Ru(h))))&&u.push([i(p),i(h)]);return f}case eb:{const u=[],f=s([l,u],a);for(const p of a)(e||!vp(Ru(p)))&&u.push(i(p));return f}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},US=(e,{json:t,lossy:n}={})=>{const r=[];return s8(!(t||n),!!t,new Map,r)(e),r},Bh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?HS(US(e,t)):structuredClone(e):(e,t)=>HS(US(e,t));function i8(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 o8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function a8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||i8,r=e.options.footnoteBackLabel||o8,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=Kc(f.toLowerCase());let h=0;const y=[],k=e.footnoteCounts.get(f);for(;k!==void 0&&++h<=k;){y.length>0&&y.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,h);typeof v=="string"&&(v={type:"text",value:v}),y.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(...y)}else u.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(u,!0)};e.patch(d,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Bh(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 lA=function(e){if(e==null)return d8;if(typeof e=="function")return Hm(e);if(typeof e=="object")return Array.isArray(e)?l8(e):c8(e);if(typeof e=="string")return u8(e);throw new Error("Expected function, string, or object as test")};function l8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=lA(e[n]);return Hm(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function c8(e){const t=e;return Hm(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function u8(e){return Hm(t);function t(n){return n&&n.type===e}}function Hm(e){return t;function t(n,r,s){return!!(f8(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function d8(){return!0}function f8(e){return e!==null&&typeof e=="object"&&"type"in e}const cA=[],p8=!0,WS=!1,h8="skip";function m8(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=lA(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=cA,y,k,b;if((!t||i(c,d,u[u.length-1]||void 0))&&(h=g8(n(c,u)),h[0]===WS))return h;if("children"in c&&c.children){const g=c;if(g.children&&h[0]!==h8)for(k=(r?g.children.length:-1)+a,b=u.concat(g);k>-1&&k<g.children.length;){const v=g.children[k];if(y=l(v,k,b)(),y[0]===WS)return y;k=typeof y[1]=="number"?y[1]:k+a}}return h}}}function g8(e){return Array.isArray(e)?e:typeof e=="number"?[p8,e]:e==null?cA:[e]}function uA(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),m8(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 ow={}.hasOwnProperty,y8={};function x8(e,t){const n=t||y8,r=new Map,s=new Map,i=new Map,a={...e8,...n.handlers},l={all:d,applyData:v8,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:w8,wrap:k8};return uA(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(ow.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,g=Bh(b);return g.children=l.all(u),g}return Bh(u)}return(l.options.unknownHandler||b8)(l,u,f)}function d(u){const f=[];if("children"in u){const p=u.children;let h=-1;for(;++h<p.length;){const y=l.one(p[h],u);if(y){if(h&&p[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=VS(y.value)),!Array.isArray(y)&&y.type==="element")){const k=y.children[0];k&&k.type==="text"&&(k.value=VS(k.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function w8(e,t){e.position&&(t.position=nB(e))}function v8(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,Bh(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function b8(e,t){const n=t.data||{},r="value"in t&&!(ow.call(n,"hProperties")||ow.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 k8(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 VS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function KS(e,t){const n=x8(e,t),r=n.one(e,void 0),s=a8(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 S8(e,t){return e&&"run"in e?async function(n,r){const s=KS(n,{file:r,...t});await e.run(s,r)}:function(n,r){return KS(n,{file:r,...e||t})}}function qS(e){if(e)throw e}var Zp=Object.prototype.hasOwnProperty,dA=Object.prototype.toString,YS=Object.defineProperty,GS=Object.getOwnPropertyDescriptor,XS=function(t){return typeof Array.isArray=="function"?Array.isArray(t):dA.call(t)==="[object Array]"},JS=function(t){if(!t||dA.call(t)!=="[object Object]")return!1;var n=Zp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Zp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Zp.call(t,s)},QS=function(t,n){YS&&n.name==="__proto__"?YS(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ZS=function(t,n){if(n==="__proto__")if(Zp.call(t,n)){if(GS)return GS(t,n).value}else return;return t[n]},N8=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=ZS(l,n),s=ZS(t,n),l!==s&&(u&&s&&(JS(s)||(i=XS(s)))?(i?(i=!1,a=r&&XS(r)?r:[]):a=r&&JS(r)?r:{},QS(l,{name:n,newValue:e(u,a,s)})):typeof s<"u"&&QS(l,{name:n,newValue:s}));return l};const uy=wa(N8);function aw(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 j8(){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?C8(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 C8(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 Mi={basename:E8,dirname:_8,extname:P8,join:A8,sep:"/"};function E8(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 _8(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 P8(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 A8(...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?".":I8(n)}function I8(e){hf(e);const t=e.codePointAt(0)===47;let n=T8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function T8(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 R8={cwd:L8};function L8(){return"/"}function lw(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function O8(e){if(typeof e=="string")e=new URL(e);else if(!lw(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 M8(e)}function M8(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 dy=["history","path","basename","stem","extname","dirname"];class fA{constructor(t){let n;t?lw(t)?n={path:t}:typeof t=="string"||$8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":R8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<dy.length;){const i=dy[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)dy.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Mi.basename(this.path):void 0}set basename(t){py(t,"basename"),fy(t,"basename"),this.path=Mi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Mi.dirname(this.path):void 0}set dirname(t){eN(this.basename,"dirname"),this.path=Mi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Mi.extname(this.path):void 0}set extname(t){if(fy(t,"extname"),eN(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=Mi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){lw(t)&&(t=O8(t)),py(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Mi.basename(this.path,this.extname):void 0}set stem(t){py(t,"stem"),fy(t,"stem"),this.path=Mi.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 Tr(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 fy(e,t){if(e&&e.includes(Mi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Mi.sep+"`")}function py(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function eN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function $8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const D8=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},F8={}.hasOwnProperty;class tb extends D8{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=j8()}copy(){const t=new tb;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(uy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(gy("data",this.frozen),this.namespace[t]=n,this):F8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(gy("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=bp(t),r=this.parser||this.Parser;return hy("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),hy("process",this.parser||this.Parser),my("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=bp(t),c=r.parse(l);r.run(c,l,function(u,f,p){if(u||!f||!p)return d(u);const h=f,y=r.stringify(h,p);H8(y)?p.value=y:p.result=y,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(),hy("processSync",this.parser||this.Parser),my("processSync",this.compiler||this.Compiler),this.process(t,s),nN("processSync","process",n),r;function s(i,a){n=!0,qS(i),r=a}}run(t,n,r){tN(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=bp(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),nN("runSync","run",r),s;function i(a,l){qS(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=bp(n),s=this.compiler||this.Compiler;return my("stringify",s),tN(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(gy("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=uy(!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,...y]=u;const k=r[p][1];aw(k)&&aw(h)&&(h=uy(!0,k,h)),r[p]=[d,h,...y]}}}}const z8=new tb().freeze();function hy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function my(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function gy(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 tN(e){if(!aw(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function nN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bp(e){return B8(e)?e:new fA(e)}function B8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function H8(e){return typeof e=="string"||U8(e)}function U8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const W8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",rN=[],sN={allowDangerousHtml:!0},V8=/^(https?|ircs?|mailto|xmpp)$/i,K8=[{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=q8(e),n=Y8(e);return G8(t.runSync(t.parse(n),n),e)}function q8(e){const t=e.rehypePlugins||rN,n=e.remarkPlugins||rN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...sN}:sN;return z8().use(_6).use(n).use(S8,r).use(t)}function Y8(e){const t=e.children||"",n=new fA;return typeof t=="string"&&(n.value=t),n}function G8(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||X8;for(const u of K8)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+W8+u.id,void 0);return uA(e,d),aB(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 ay)if(Object.hasOwn(ay,h)&&Object.hasOwn(u.properties,h)){const y=u.properties[h],k=ay[h];(k===null||k.includes(u.tagName))&&(u.properties[h]=c(String(y||""),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 X8(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||V8.test(e.slice(0,t))?e:""}function J8(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Hh(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>Hh(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${Hh(t[r])}`).join(",")}}`}function iN(e){return Hh({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 oN(e){return Hh({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 aN(e,t){return!J8(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function lN(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 Q8(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?iN(w)===iN(v)?(a.add(v.id),w):(c.push(v.id),aN(v,w)):(l.push(v.id),v)}),u=lN(t),f=lN(r,!0),p=new Set,h=[],y=[],k=r.map(v=>{const w=Ud(v),j=u.get(w);return j?oN(j)===oN(v)?(p.add(w),j):(y.push(w),aN(v,j)):(h.push(w),v)}),b=e.filter(v=>!i.has(v.id)).map(v=>v.id),g=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:y,removedEdgeKeys:g},stats:{nodeAdded:l.length,nodeRemoved:b.length,nodeReused:a.size,edgeAdded:h.length,edgeRemoved:g.length,edgeReused:p.size,nextEdgeCount:f.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function pA(e){return typeof e>"u"||e===null}function Z8(e){return typeof e=="object"&&e!==null}function e9(e){return Array.isArray(e)?e:pA(e)?[]:[e]}function t9(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 n9(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function r9(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var s9=pA,i9=Z8,o9=e9,a9=n9,l9=r9,c9=t9,tr={isNothing:s9,isObject:i9,toArray:o9,repeat:a9,isNegativeZero:l9,extend:c9};function hA(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=hA(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+": "+hA(this,t)};var zr=Wd;function yy(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 xy(e,t){return tr.repeat(" ",t-e.length)+e}function u9(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=yy(e.buffer,r[a-c],s[a-c],e.position-(r[a]-r[a-c]),f),l=tr.repeat(" ",t.indent)+xy((e.line-c+1).toString(),u)+" | "+d.str+`
|
|
82
|
+
`+l;for(d=yy(e.buffer,r[a],s[a],e.position,f),l+=tr.repeat(" ",t.indent)+xy((e.line+1).toString(),u)+" | "+d.str+`
|
|
83
|
+
`,l+=tr.repeat("-",t.indent+u+3+d.pos)+`^
|
|
84
|
+
`,c=1;c<=t.linesAfter&&!(a+c>=s.length);c++)d=yy(e.buffer,r[a+c],s[a+c],e.position-(r[a]-r[a+c]),f),l+=tr.repeat(" ",t.indent)+xy((e.line+c+1).toString(),u)+" | "+d.str+`
|
|
85
|
+
`;return l.replace(/\n$/,"")}var d9=u9,f9=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],p9=["scalar","sequence","mapping"];function h9(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function m9(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(f9.indexOf(n)===-1)throw new zr('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=h9(t.styleAliases||null),p9.indexOf(this.kind)===-1)throw new zr('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var wr=m9;function cN(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 g9(){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 cw(e){return this.extend(e)}cw.prototype.extend=function(t){var n=[],r=[];if(t instanceof wr)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 zr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof wr))throw new zr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new zr("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 zr("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 wr))throw new zr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(cw.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=cN(s,"implicit"),s.compiledExplicit=cN(s,"explicit"),s.compiledTypeMap=g9(s.compiledImplicit,s.compiledExplicit),s};var mA=cw,gA=new wr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),yA=new wr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),xA=new wr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),wA=new mA({explicit:[gA,yA,xA]});function y9(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function x9(){return null}function w9(e){return e===null}var vA=new wr("tag:yaml.org,2002:null",{kind:"scalar",resolve:y9,construct:x9,predicate:w9,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function v9(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 b9(e){return e==="true"||e==="True"||e==="TRUE"}function k9(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var bA=new wr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:v9,construct:b9,predicate:k9,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 S9(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function N9(e){return 48<=e&&e<=55}function j9(e){return 48<=e&&e<=57}function C9(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(!S9(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!N9(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!j9(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function E9(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 _9(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!tr.isNegativeZero(e)}var kA=new wr("tag:yaml.org,2002:int",{kind:"scalar",resolve:C9,construct:E9,predicate:_9,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"]}}),P9=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function A9(e){return!(e===null||!P9.test(e)||e[e.length-1]==="_")}function I9(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 T9=/^[-+]?[0-9]+e/;function R9(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(tr.isNegativeZero(e))return"-0.0";return n=e.toString(10),T9.test(n)?n.replace("e",".e"):n}function L9(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||tr.isNegativeZero(e))}var SA=new wr("tag:yaml.org,2002:float",{kind:"scalar",resolve:A9,construct:I9,predicate:L9,represent:R9,defaultStyle:"lowercase"}),NA=wA.extend({implicit:[vA,bA,kA,SA]}),jA=NA,CA=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),EA=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 O9(e){return e===null?!1:CA.exec(e)!==null||EA.exec(e)!==null}function M9(e){var t,n,r,s,i,a,l,c=0,d=null,u,f,p;if(t=CA.exec(e),t===null&&(t=EA.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 $9(e){return e.toISOString()}var _A=new wr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:O9,construct:M9,instanceOf:Date,represent:$9});function D9(e){return e==="<<"||e===null}var PA=new wr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:D9}),nb=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
+
\r`;function F9(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=nb;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 z9(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=nb,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 B9(e){var t="",n=0,r,s,i=e.length,a=nb;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 H9(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var AA=new wr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:F9,construct:z9,predicate:H9,represent:B9}),U9=Object.prototype.hasOwnProperty,W9=Object.prototype.toString;function V9(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,W9.call(s)!=="[object Object]")return!1;for(i in s)if(U9.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 K9(e){return e!==null?e:[]}var IA=new wr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:V9,construct:K9}),q9=Object.prototype.toString;function Y9(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],q9.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function G9(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 TA=new wr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Y9,construct:G9}),X9=Object.prototype.hasOwnProperty;function J9(e){if(e===null)return!0;var t,n=e;for(t in n)if(X9.call(n,t)&&n[t]!==null)return!1;return!0}function Q9(e){return e!==null?e:{}}var RA=new wr("tag:yaml.org,2002:set",{kind:"mapping",resolve:J9,construct:Q9}),rb=jA.extend({implicit:[_A,PA],explicit:[AA,IA,TA,RA]}),ma=Object.prototype.hasOwnProperty,Uh=1,LA=2,OA=3,Wh=4,wy=1,Z9=2,uN=3,eU=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,tU=/[\x85\u2028\u2029]/,nU=/[,\[\]\{\}]/,MA=/^(?:!|!!|![a-z\-]+!)$/i,$A=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function dN(e){return Object.prototype.toString.call(e)}function Ki(e){return e===10||e===13}function rl(e){return e===9||e===32}function rs(e){return e===9||e===32||e===10||e===13}function oc(e){return e===44||e===91||e===93||e===123||e===125}function rU(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function sU(e){return e===120?2:e===117?4:e===85?8:0}function iU(e){return 48<=e&&e<=57?e-48:-1}function fN(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 oU(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function DA(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var FA=new Array(256),zA=new Array(256);for(var Fl=0;Fl<256;Fl++)FA[Fl]=fN(Fl)?1:0,zA[Fl]=fN(Fl);function aU(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||rb,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 BA(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=d9(n),new zr(t,n)}function Ke(e,t){throw BA(e,t)}function Vh(e,t){e.onWarning&&e.onWarning.call(null,BA(e,t))}var pN={YAML:function(t,n,r){var s,i,a;t.version!==null&&Ke(t,"duplication of %YAML directive"),r.length!==1&&Ke(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),s===null&&Ke(t,"ill-formed argument of the YAML directive"),i=parseInt(s[1],10),a=parseInt(s[2],10),i!==1&&Ke(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&Vh(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var s,i;r.length!==2&&Ke(t,"TAG directive accepts exactly two arguments"),s=r[0],i=r[1],MA.test(s)||Ke(t,"ill-formed tag handle (first argument) of the TAG directive"),ma.call(t.tagMap,s)&&Ke(t,'there is a previously declared suffix for "'+s+'" tag handle'),$A.test(i)||Ke(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{Ke(t,"tag prefix is malformed: "+i)}t.tagMap[s]=i}};function ua(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||Ke(e,"expected valid JSON character");else eU.test(l)&&Ke(e,"the stream contains non-printable characters");e.result+=l}}function hN(e,t,n,r){var s,i,a,l;for(tr.isObject(n)||Ke(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],ma.call(t,i)||(DA(t,i,n[i]),r[i]=!0)}function ac(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])&&Ke(e,"nested arrays are not supported inside keys"),typeof s=="object"&&dN(s[d])==="[object Object]"&&(s[d]="[object Object]");if(typeof s=="object"&&dN(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)hN(e,t,i[d],n);else hN(e,t,i,n);else!e.json&&!ma.call(n,s)&&ma.call(t,s)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,Ke(e,"duplicated mapping key")),DA(t,s,i),delete n[s];return t}function sb(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++):Ke(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(;rl(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(Ki(s))for(sb(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&&Vh(e,"deficient indentation"),r}function Um(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||rs(n)))}function ib(e,t){t===1?e.result+=" ":t>1&&(e.result+=tr.repeat(`
|
|
88
|
+
`,t-1))}function lU(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),rs(h)||oc(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),rs(s)||n&&oc(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),rs(s)||n&&oc(s))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),rs(r))break}else{if(e.position===e.lineStart&&Um(e)||n&&oc(h))break;if(Ki(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&&(ua(e,i,a,!1),ib(e,e.line-c),i=a=e.position,l=!1),rl(h)||(a=e.position+1),h=e.input.charCodeAt(++e.position)}return ua(e,i,a,!1),e.result?!0:(e.kind=f,e.result=p,!1)}function cU(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(ua(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 Ki(n)?(ua(e,r,s,!0),ib(e,Gn(e,!1,t)),r=s=e.position):e.position===e.lineStart&&Um(e)?Ke(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);Ke(e,"unexpected end of the stream within a single quoted scalar")}function uU(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 ua(e,n,e.position,!0),e.position++,!0;if(l===92){if(ua(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),Ki(l))Gn(e,!1,t);else if(l<256&&FA[l])e.result+=zA[l],e.position++;else if((a=sU(l))>0){for(s=a,i=0;s>0;s--)l=e.input.charCodeAt(++e.position),(a=rU(l))>=0?i=(i<<4)+a:Ke(e,"expected hexadecimal character");e.result+=oU(i),e.position++}else Ke(e,"unknown escape sequence");n=r=e.position}else Ki(l)?(ua(e,n,r,!0),ib(e,Gn(e,!1,t)),n=r=e.position):e.position===e.lineStart&&Um(e)?Ke(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}Ke(e,"unexpected end of the stream within a double quoted scalar")}function dU(e,t){var n=!0,r,s,i,a=e.tag,l,c=e.anchor,d,u,f,p,h,y=Object.create(null),k,b,g,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&&Ke(e,"expected the node content, but found ','"):Ke(e,"missed comma between flow collection entries"),b=k=g=null,f=p=!1,v===63&&(d=e.input.charCodeAt(e.position+1),rs(d)&&(f=p=!0,e.position++,Gn(e,!0,t))),r=e.line,s=e.lineStart,i=e.position,$c(e,t,Uh,!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),$c(e,t,Uh,!1,!0),g=e.result),h?ac(e,l,y,b,k,g,r,s,i):f?l.push(ac(e,null,y,b,k,g,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}Ke(e,"unexpected end of the stream within a flow collection")}function fU(e,t){var n,r,s=wy,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)wy===s?s=f===43?uN:Z9:Ke(e,"repeat of a chomping mode identifier");else if((u=iU(f))>=0)u===0?Ke(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?Ke(e,"repeat of an indentation width identifier"):(l=t+u-1,a=!0);else break;if(rl(f)){do f=e.input.charCodeAt(++e.position);while(rl(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!Ki(f)&&f!==0)}for(;f!==0;){for(sb(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),Ki(f)){c++;continue}if(e.lineIndent<l){s===uN?e.result+=tr.repeat(`
|
|
89
|
+
`,i?1+c:c):s===wy&&i&&(e.result+=`
|
|
90
|
+
`);break}for(r?rl(f)?(d=!0,e.result+=tr.repeat(`
|
|
91
|
+
`,i?1+c:c)):d?(d=!1,e.result+=tr.repeat(`
|
|
92
|
+
`,c+1)):c===0?i&&(e.result+=" "):e.result+=tr.repeat(`
|
|
93
|
+
`,c):e.result+=tr.repeat(`
|
|
94
|
+
`,i?1+c:c),i=!0,a=!0,c=0,n=e.position;!Ki(f)&&f!==0;)f=e.input.charCodeAt(++e.position);ua(e,n,e.position,!1)}return!0}function mN(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,Ke(e,"tab characters must not be used in indentation")),!(c!==45||(a=e.input.charCodeAt(e.position+1),!rs(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,$c(e,t,OA,!1,!0),i.push(e.result),Gn(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)Ke(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 pU(e,t,n){var r,s,i,a,l,c,d=e.tag,u=e.anchor,f={},p=Object.create(null),h=null,y=null,k=null,b=!1,g=!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,Ke(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,(v===63||v===58)&&rs(r))v===63?(b&&(ac(e,f,p,h,y,null,a,l,c),h=y=k=null),g=!0,b=!0,s=!0):b?(b=!1,s=!0):Ke(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,!$c(e,n,LA,!1,!0))break;if(e.line===i){for(v=e.input.charCodeAt(e.position);rl(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),rs(v)||Ke(e,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(ac(e,f,p,h,y,null,a,l,c),h=y=k=null),g=!0,b=!1,s=!1,h=e.tag,y=e.result;else if(g)Ke(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=u,!0}else if(g)Ke(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),$c(e,t,Wh,!0,s)&&(b?y=e.result:k=e.result),b||(ac(e,f,p,h,y,k,a,l,c),h=y=k=null),Gn(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&v!==0)Ke(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return b&&ac(e,f,p,h,y,null,a,l,c),g&&(e.tag=d,e.anchor=u,e.kind="mapping",e.result=f),g}function hU(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&&Ke(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)):Ke(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!rs(a);)a===33&&(r?Ke(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),MA.test(s)||Ke(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),nU.test(i)&&Ke(e,"tag suffix cannot contain flow indicator characters")}i&&!$A.test(i)&&Ke(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{Ke(e,"tag name is malformed: "+i)}return n?e.tag=i:ma.call(e.tagMap,s)?e.tag=e.tagMap[s]+i:s==="!"?e.tag="!"+i:s==="!!"?e.tag="tag:yaml.org,2002:"+i:Ke(e,'undeclared tag handle "'+s+'"'),!0}function mU(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&Ke(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!rs(n)&&!oc(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Ke(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function gU(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&&!rs(r)&&!oc(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Ke(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),ma.call(e.anchorMap,n)||Ke(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Gn(e,!0,-1),!0}function $c(e,t,n,r,s){var i,a,l,c=1,d=!1,u=!1,f,p,h,y,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=Wh===n||OA===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(;hU(e)||mU(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||Wh===n)&&(Uh===n||LA===n?k=t:k=t+1,b=e.position-e.lineStart,c===1?l&&(mN(e,b)||pU(e,b,k))||dU(e,k)?u=!0:(a&&fU(e,k)||cU(e,k)||uU(e,k)?u=!0:gU(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&Ke(e,"alias node should not have any properties")):lU(e,k,Uh===n)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(u=l&&mN(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"&&Ke(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,p=e.implicitTypes.length;f<p;f+=1)if(y=e.implicitTypes[f],y.resolve(e.result)){e.result=y.construct(e.result),e.tag=y.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(ma.call(e.typeMap[e.kind||"fallback"],e.tag))y=e.typeMap[e.kind||"fallback"][e.tag];else for(y=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){y=h[f];break}y||Ke(e,"unknown tag !<"+e.tag+">"),e.result!==null&&y.kind!==e.kind&&Ke(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+y.kind+'", not "'+e.kind+'"'),y.resolve(e.result,e.tag)?(e.result=y.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Ke(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 yU(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&&!rs(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),s=[],r.length<1&&Ke(e,"directive name must not be less than one character in length");a!==0;){for(;rl(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!Ki(a));break}if(Ki(a))break;for(n=e.position;a!==0&&!rs(a);)a=e.input.charCodeAt(++e.position);s.push(e.input.slice(n,e.position))}a!==0&&sb(e),ma.call(pN,r)?pN[r](e,r,s):Vh(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&&Ke(e,"directives end mark is expected"),$c(e,e.lineIndent-1,Wh,!1,!0),Gn(e,!0,-1),e.checkLineBreaks&&tU.test(e.input.slice(t,e.position))&&Vh(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Um(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Gn(e,!0,-1));return}if(e.position<e.length-1)Ke(e,"end of the stream or a document separator is expected");else return}function HA(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 aU(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,Ke(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;)yU(n);return n.documents}function xU(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=HA(e,n);if(typeof t!="function")return r;for(var s=0,i=r.length;s<i;s+=1)t(r[s])}function wU(e,t){var n=HA(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new zr("expected a single document in the stream, but found more")}}var vU=xU,bU=wU,UA={loadAll:vU,load:bU},WA=Object.prototype.toString,VA=Object.prototype.hasOwnProperty,ob=65279,kU=9,Vd=10,SU=13,NU=32,jU=33,CU=34,uw=35,EU=37,_U=38,PU=39,AU=42,KA=44,IU=45,Kh=58,TU=61,RU=62,LU=63,OU=64,qA=91,YA=93,MU=96,GA=123,$U=124,XA=125,Rr={};Rr[0]="\\0";Rr[7]="\\a";Rr[8]="\\b";Rr[9]="\\t";Rr[10]="\\n";Rr[11]="\\v";Rr[12]="\\f";Rr[13]="\\r";Rr[27]="\\e";Rr[34]='\\"';Rr[92]="\\\\";Rr[133]="\\N";Rr[160]="\\_";Rr[8232]="\\L";Rr[8233]="\\P";var DU=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],FU=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function zU(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&&VA.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[a]=l;return n}function BU(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 zr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+tr.repeat("0",r-t.length)+t}var HU=1,Kd=2;function UU(e){this.schema=e.schema||rb,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=tr.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=zU(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:HU,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 gN(e,t){for(var n=tr.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 dw(e,t){return`
|
|
98
|
+
`+tr.repeat(" ",e.indent*t)}function WU(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 qh(e){return e===NU||e===kU}function qd(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ob||65536<=e&&e<=1114111}function yN(e){return qd(e)&&e!==ob&&e!==SU&&e!==Vd}function xN(e,t,n){var r=yN(e),s=r&&!qh(e);return(n?r:r&&e!==KA&&e!==qA&&e!==YA&&e!==GA&&e!==XA)&&e!==uw&&!(t===Kh&&!s)||yN(t)&&!qh(t)&&e===uw||t===Kh&&s}function VU(e){return qd(e)&&e!==ob&&!qh(e)&&e!==IU&&e!==LU&&e!==Kh&&e!==KA&&e!==qA&&e!==YA&&e!==GA&&e!==XA&&e!==uw&&e!==_U&&e!==AU&&e!==jU&&e!==$U&&e!==TU&&e!==RU&&e!==PU&&e!==CU&&e!==EU&&e!==OU&&e!==MU}function KU(e){return!qh(e)&&e!==Kh}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 JA(e){var t=/^\n* /;return t.test(e)}var QA=1,fw=2,ZA=3,eI=4,Ul=5;function qU(e,t,n,r,s,i,a,l){var c,d=0,u=null,f=!1,p=!1,h=r!==-1,y=-1,k=VU(Vu(e,0))&&KU(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 Ul;k=k&&xN(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-y-1>r&&e[y+1]!==" ",y=c);else if(!qd(d))return Ul;k=k&&xN(d,u,l),u=d}p=p||h&&c-y-1>r&&e[y+1]!==" "}return!f&&!p?k&&!a&&!s(e)?QA:i===Kd?Ul:fw:n>9&&JA(e)?Ul:a?i===Kd?Ul:fw:p?eI:ZA}function YU(e,t,n,r,s){e.dump=function(){if(t.length===0)return e.quotingType===Kd?'""':"''";if(!e.noCompatMode&&(DU.indexOf(t)!==-1||FU.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 WU(e,d)}switch(qU(t,l,e.indent,a,c,e.quotingType,e.forceQuotes&&!r,s)){case QA:return t;case fw:return"'"+t.replace(/'/g,"''")+"'";case ZA:return"|"+wN(t,e.indent)+vN(gN(t,i));case eI:return">"+wN(t,e.indent)+vN(gN(GU(t,a),i));case Ul:return'"'+XU(t)+'"';default:throw new zr("impossible error: invalid scalar style")}}()}function wN(e,t){var n=JA(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 vN(e){return e[e.length-1]===`
|
|
103
|
+
`?e.slice(0,-1):e}function GU(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,bN(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
|
+
`:"")+bN(c,t),s=i}return r}function bN(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 XU(e){for(var t="",n=0,r,s=0;s<e.length;n>=65536?s+=2:s++)n=Vu(e,s),r=Rr[n],!r&&qd(n)?(t+=e[s],n>=65536&&(t+=e[s+1])):t+=r||BU(n);return t}function JU(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)),(So(e,t,l,!1,!1)||typeof l>"u"&&So(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=s,e.dump="["+r+"]"}function kN(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)),(So(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&So(e,t+1,null,!0,!0,!1,!0))&&((!r||s!=="")&&(s+=dw(e,t)),e.dump&&Vd===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}function QU(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)),So(e,t,c,!1,!1)&&(e.dump.length>1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),So(e,t,d,!1,!1)&&(u+=e.dump,r+=u));e.tag=s,e.dump="{"+r+"}"}function ZU(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 zr("sortKeys must be a boolean or a function");for(l=0,c=a.length;l<c;l+=1)p="",(!r||s!=="")&&(p+=dw(e,t)),d=a[l],u=n[d],e.replacer&&(u=e.replacer.call(n,d,u)),So(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+=dw(e,t)),So(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 SN(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,WA.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(VA.call(l.represent,c))r=l.represent[c](t,c);else throw new zr("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function So(e,t,n,r,s,i,a){e.tag=null,e.dump=n,SN(e,n,!1)||SN(e,n,!0);var l=WA.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?(ZU(e,t,e.dump,s),p&&(e.dump="&ref_"+f+e.dump)):(QU(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?kN(e,t-1,e.dump,s):kN(e,t,e.dump,s),p&&(e.dump="&ref_"+f+e.dump)):(JU(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&YU(e,e.dump,t,i,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new zr("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 eW(e,t){var n=[],r=[],s,i;for(pw(e,n,r),s=0,i=r.length;s<i;s+=1)t.duplicates.push(n[r[s]]);t.usedDuplicates=new Array(i)}function pw(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)pw(e[s],t,n);else for(r=Object.keys(e),s=0,i=r.length;s<i;s+=1)pw(e[r[s]],t,n)}function tW(e,t){t=t||{};var n=new UU(t);n.noRefs||eW(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),So(n,0,r,!0,!0)?n.dump+`
|
|
110
|
+
`:""}var nW=tW,rW={dump:nW};function ab(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 sW=wr,iW=mA,oW=wA,aW=NA,lW=jA,cW=rb,uW=UA.load,dW=UA.loadAll,fW=rW.dump,pW=zr,hW={binary:AA,float:SA,map:xA,null:vA,pairs:TA,set:RA,timestamp:_A,bool:bA,int:kA,merge:PA,omap:IA,seq:yA,str:gA},mW=ab("safeLoad","load"),gW=ab("safeLoadAll","loadAll"),yW=ab("safeDump","dump"),tI={Type:sW,Schema:iW,FAILSAFE_SCHEMA:oW,JSON_SCHEMA:aW,CORE_SCHEMA:lW,DEFAULT_SCHEMA:cW,load:uW,loadAll:dW,dump:fW,YAMLException:pW,types:hW,safeLoad:mW,safeLoadAll:gW,safeDump:yW};const ga=["requirement","planning","code","test","normal"],hw={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},xW=["agent","control","provide","condition","jump","condition_jump","start","end"];function wW(e){return xW.includes(e)?e:"agent"}function vW(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function bW(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=tI.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],y=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=vW(k),g=(h==null?void 0:h.label)!=null?String(h.label):p,v=(h==null?void 0:h.role)!=null?String(h.role).trim():"",w=hw[v]||v,j=ga.includes(w)?w:"normal",E=(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:wW(b),position:y,data:{label:g,definitionId:k,schemaType:b,role:j,model:E||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:cs.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,y,k;const n=b=>{const g={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&&(g.required=!0),(b==null?void 0:b.showOnNode)!=null&&(g.showOnNode=!!b.showOnNode),g},r={};for(const b of e){const g=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)??[],j=((a=b.data)==null?void 0:a.outputs)??[],E=((l=b.data)==null?void 0:l.role)!=null?String(b.data.role).trim():"",S=g.role!=null?String(g.role).trim():"",A=hw[E]||E,R=hw[S]||S,M=ga.includes(A)?A:ga.includes(R)?R:"normal",W=Array.isArray(w)?w.map(n):Array.isArray(g.input)?g.input.map(H=>n(H)):[],D=Array.isArray(j)?j.map(n):Array.isArray(g.output)?g.output.map(H=>n(H)):[],O=((c=b.data)==null?void 0:c.label)!=null?String(b.data.label):g.label!=null?String(g.label):b.id,K=(d=b.data)==null?void 0:d.body,$=K!=null?String(K):g.body!=null?String(g.body):"";let L=((u=b.data)==null?void 0:u.model)!=null&&String(b.data.model).trim()!==""?String(b.data.model).trim():g.model!=null&&String(g.model).trim()!==""?String(g.model).trim():void 0;(L===""||L==="default")&&(L=void 0);const I={...g,definitionId:v,label:O,role:M,model:L,input:W,output:D},z=((f=b.data)==null?void 0:f.marketplaceRef)||g.marketplaceRef;z?I.marketplaceRef=String(z):delete I.marketplaceRef;const _=((p=b.data)==null?void 0:p.marketplacePackageId)||g.marketplacePackageId;_?I.marketplacePackageId=String(_):delete I.marketplacePackageId;const T=((h=b.data)==null?void 0:h.marketplaceVersion)||g.marketplaceVersion;T?I.marketplaceVersion=String(T):delete I.marketplaceVersion,v.startsWith("provide_")||$.trim()===""?delete I.body:I.body=$;const C=Array.isArray((y=b.data)==null?void 0:y.images)?b.data.images:Array.isArray(g.images)?g.images:[];C.length>0?I.images=C:delete I.images;const J=(k=b.data)==null?void 0:k.script,Z=J!=null?String(J):g.script!=null?String(g.script):"";Z.trim()===""?delete I.script:I.script=Z,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 kW(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 nI(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 rI(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,kW(p.id,a));const c=e.nodes.map(p=>{var y,k;const h=l.get(p.id);return{...ud(p),id:h,selected:!0,dragging:!1,position:{x:Number(((y=p.position)==null?void 0:y.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 y=l.get(p.source),k=l.get(p.target);return{...ud(p),id:`e-${y}-${k}-${Date.now()}-${h}`,source:y,target:k,selected:!1}}),u={...r||{}};for(const[p,h]of l.entries()){const y=(f=e.instances)==null?void 0:f[p];y&&(u[h]={...ud(y),label:y.label!=null?String(y.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 NN(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 tI.dump(c,{lineWidth:-1})}function SW(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 NW(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]=SW(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:[]},y=h.inputNames.length,k=h.outputNames.length;if(!(p==="control_start"||p.startsWith("provide_"))&&y>0)for(let v=0;v<y;v++){const w=`input-${v}`;if(!((d=i.get(f.id))==null?void 0:d.has(w))){const E=h.inputNames[v]||w;l.push({nodeId:f.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:E,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 E=h.outputNames[v]||w;l.push({nodeId:f.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:E,handle:w}),key:`${f.id}-${w}-out`})}}}return l}const Yh=/\[image\s+(\d+)\]/gi;function ss(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 jW(e){return`image ${ss(e).length+1}`}function CW(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function EW(e,t){const n=ss(e),r=String(t||""),s=new Set;Yh.lastIndex=0;let i;for(;i=Yh.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function _W(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 sI(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 Gh(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 iI({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=ss(n);for(const a of r){const l=await _W(a),c=jW(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=CW(s,c)}return{body:s,images:i}}function mw(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 PW={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 AW(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(PW[e]||[]).includes(s)?r:s}const IW={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"])},TW={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 RW(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function LW(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 jN(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=IW[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=TW[e])!=null&&u.has(r.name)?{showOnNode:!1}:{}}})}function oI(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=mw(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,_,T,C,J,Z,H,te,ae,ce,ue,le,de,se,fe,ye,je,He,lt,Ge,Ct;const i=((z=e.data)==null?void 0:z.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(Me=>Me.id===i),l=t[e.id];let c=[],d=[],u=((_=e.data)==null?void 0:_.label)??e.id,f,p,h,y,k;const b=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(mw)),Array.isArray(l.output)&&(d=l.output.map(mw)),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)&&(y=l.images),l.script!=null&&(k=String(l.script)));const g=f??(typeof((T=e.data)==null?void 0:T.role)=="string"?e.data.role:"普通"),v=p??((C=e.data)==null?void 0:C.model)??void 0,w=(a==null?void 0:a.description)!=null?String(a.description).trim():"",j=w!==""?w:void 0,E=h??((J=e.data)==null?void 0:J.body)??"",S=Array.isArray(y)?y:Array.isArray((Z=e.data)==null?void 0:Z.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],W=(ae=M==null?void 0:M.label)==null?void 0:ae.label,D=M==null?void 0:M.body,O=M==null?void 0:M.description;b||(c.length===0&&((ce=a==null?void 0:a.inputs)!=null&&ce.length)&&(c=a.inputs.map(Me=>({...Me}))),d.length===0&&((ue=a==null?void 0:a.outputs)!=null&&ue.length)&&(d=a.outputs.map(Me=>({...Me}))));const K=LW(a,(a==null?void 0:a.id)??i),$=(l==null?void 0:l.marketplaceRef)||((le=e.data)==null?void 0:le.marketplaceRef)||RW(a);if(K==="agent_subAgent"&&!d.some(Me=>(Me==null?void 0:Me.name)==="result")){const Me=(de=a==null?void 0:a.outputs)==null?void 0:de.find(Ce=>(Ce==null?void 0:Ce.name)==="result");d=[...d,Me?{...Me}:{type:"text",name:"result",default:""}]}if((K==="display_markdown"||K==="display_mermaid"||K==="display_ascii"||K==="display_chart")&&!d.some(Me=>(Me==null?void 0:Me.name)==="next")){const Me=(se=a==null?void 0:a.outputs)==null?void 0:se.find(Ce=>(Ce==null?void 0:Ce.name)==="next");d=[...d,Me?{...Me}:{type:"node",name:"next",default:""}]}if(K==="workspace_run"){if(!c.some(Me=>(Me==null?void 0:Me.name)==="prev")){const Me=(fe=a==null?void 0:a.inputs)==null?void 0:fe.find(Ce=>(Ce==null?void 0:Ce.name)==="prev");c=[Me?{...Me}:{type:"node",name:"prev",default:""},...c]}if(!d.some(Me=>(Me==null?void 0:Me.name)==="next")){const Me=(ye=a==null?void 0:a.outputs)==null?void 0:ye.find(Ce=>(Ce==null?void 0:Ce.name)==="next");d=[...d,Me?{...Me}:{type:"node",name:"next",default:""}]}}c=jN(K,c,a==null?void 0:a.inputs),d=jN(K,d,a==null?void 0:a.outputs),K.startsWith("provide_")&&d[0]&&String(d[0].default??d[0].value??"").trim()===""&&String(E).trim()!==""&&(d=d.map((Me,Ce)=>Ce===0?{...Me,default:E,value:E}:Me));const L=AW(K,W||u,a),I=K==="tool_nodejs"||String(A).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:W||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)||((He=e.data)==null?void 0:He.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(lt=e.data)!=null&<.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((Ge=e.data)==null?void 0:Ge.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((Ct=e.data)==null?void 0:Ct.schemaType)??e.type??"agent",role:g,model:v,body:D||E,images:S,script:A,inputs:c,outputs:d,description:O||j,originalLabel:u,originalBody:E,...I?{script:A}:{}}}}function aI(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 CN(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 EN(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function Xh(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=CN(t==null?void 0:t.sourceHandle,"output"),i=CN(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=EN((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=EN((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}function Rn(e){switch(Jh(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function Jh(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 OW(e,t){const n=Jh(e),r=Jh(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const MW=new Set(["workspaceContext","skillsContext","mcpContext"]);function gw(e){const t=Jh(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&MW.has(n)?`${t}+${n}`:t}function lI(e){return gw(e)}function Dc(e,t){if(!e||!t||!OW(e.type,t.type))return!1;const n=gw(e),r=gw(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function $W(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 Fc(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=$W(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 ao(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function DW(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 FW(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 BW(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function HW(e,t){const n=`\\[${BW(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
124
|
+
`).replace(/\n{3,}/g,`
|
|
125
|
+
|
|
126
|
+
`).trimEnd()}function vy(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function UW(e){const t=String(e||"");let n="",r=0;Yh.lastIndex=0;let s;for(;s=Yh.exec(t);)n+=vy(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${vy(s[0])}</span>`,r=s.index+s[0].length;return n+=vy(t.slice(r)),n||" "}function WW(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 cI({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:d}){var Qt,rr;const{t:u}=un(),f=(e==null?void 0:e.inputs)??[],p=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),y=DW(e),k=FW(y),b=(e==null?void 0:e.isRunMode)??!1,g=(e==null?void 0:e.isExecuting)??!1,v=(e==null?void 0:e.isDim)??!1,w=(e==null?void 0:e.nodeStatus)??null,j=(e==null?void 0:e.nodeElapsed)??null,E=(e==null?void 0:e.definitionId)||"",S=E.startsWith("provide_"),A=E==="provide_bool",R=E==="provide_str",M=E==="provide_file",W=E==="agent_subAgent",D=W&&!b,O=A?zW(p[0]):!1,K=S?String(((Qt=p[0])==null?void 0:Qt.value)??((rr=p[0])==null?void 0:rr.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=ss(e==null?void 0:e.images),_=m.useRef(!1),T=m.useRef(!1),C=m.useRef(null),J=m.useRef(null),[Z,H]=m.useState(K),[te,ae]=m.useState($);m.useEffect(()=>{_.current||H(K)},[n,K]),m.useEffect(()=>{T.current||ae($)},[n,$]),m.useEffect(()=>{const pe=C.current;if(!pe)return;const Ie=WW(pe,te);pe.style.height=`${Ie}px`,J.current&&(J.current.style.height=`${Ie}px`)},[te]);const ce=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],ue=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],le=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],de=((e==null?void 0:e.model)??"").trim(),se=h==="agent"&&!E.startsWith("tool_nodejs"),fe=new Set(ce.map(ao)),ye=new Set(ue.map(ao)),je=new Set(le.map(ao)),He=de?de.startsWith("cursor:")||de.startsWith("opencode:")||de.startsWith("claude-code:")?de:je.has(de)?`claude-code:${de}`:ye.has(de)?`opencode:${de}`:fe.has(de)?`cursor:${de}`:de:"",lt=de&&!He.startsWith("cursor:")&&!He.startsWith("opencode:")&&!He.startsWith("claude-code:")&&!fe.has(de)&&!ye.has(de)&&!je.has(de),Ge=de.startsWith("cursor:")?de.slice(7):de.startsWith("opencode:")?de.slice(9):de.startsWith("claude-code:")?de.slice(12):de,Ct=pe=>{const Ie=pe.target.value;d&&d(n,Ie)},Me=pe=>{pe.stopPropagation(),r&&r(n)},Ce=pe=>{pe.stopPropagation(),s&&s()},Gt=pe=>{pe.stopPropagation(),i==null||i(n,pe.target.value==="true"?"true":"false")},Hn=pe=>{pe.stopPropagation();const Ie=pe.target.value;H(Ie),_.current||i==null||i(n,Ie)},Xt=pe=>{pe.stopPropagation(),_.current=!0},Cn=pe=>{pe.stopPropagation(),_.current=!1;const Ie=pe.currentTarget.value;H(Ie),i==null||i(n,Ie)},kr=()=>{i==null||i(n,Z)},cr=pe=>{pe.stopPropagation();const Ie=window.prompt("文件路径",Z);Ie!=null&&(H(Ie),i==null||i(n,Ie))},oe=pe=>{if(ae(pe),a==null||a(n,pe),l){const Ie=EW(z,pe);(Ie.length!==z.length||Ie.some((tn,ct)=>{var gn;return tn.id!==((gn=z[ct])==null?void 0:gn.id)}))&&l(n,Ie)}},ge=pe=>{pe.stopPropagation();const Ie=pe.target.value;T.current?ae(Ie):oe(Ie)},qe=pe=>{pe.stopPropagation(),T.current=!0},it=pe=>{pe.stopPropagation(),T.current=!1;const Ie=pe.currentTarget.value;oe(Ie)},tt=()=>{oe(te)},It=async pe=>{const Ie=await iI({files:pe,body:te,images:z});Ie&&(ae(Ie.body),a==null||a(n,Ie.body),l==null||l(n,Ie.images))},Ln=(pe,Ie)=>{pe.stopPropagation();const tn=z.filter(gn=>gn.id!==Ie.id),ct=HW(te,Ie.label);ae(ct),a==null||a(n,ct),l==null||l(n,tn)},Ft=pe=>{const Ie=sI(pe);Ie.length!==0&&(pe.preventDefault(),pe.stopPropagation(),It(Ie).catch(()=>{}))},On=pe=>{const Ie=Gh(pe);Ie.length!==0&&(pe.preventDefault(),pe.stopPropagation(),It(Ie).catch(()=>{}))},Jt=()=>{const pe=C.current,Ie=J.current;!pe||!Ie||(Ie.scrollTop=pe.scrollTop,Ie.scrollLeft=pe.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(g?" af-flow-node--executing":"")+(w==="success"?" af-flow-node--done":"")+(w==="failed"?" af-flow-node--failed":"")+(w==="running"&&!g?" af-flow-node--running-disk":"")+(v?" af-flow-node--dim":"")+" 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:y,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:He,onChange:Ct,onPointerDown:Kn,onMouseDown:Kn,onClick:Kn,"aria-label":u("flow:node.model"),title:Ge||u("flow:node.defaultModel"),children:[o.jsx("option",{value:"",children:u("flow:node.defaultModel")}),lt&&o.jsx("option",{value:de,children:de}),ce.length>0&&o.jsx("optgroup",{label:"Cursor",children:ce.map(pe=>o.jsx("option",{value:`cursor:${ao(pe)}`,children:ao(pe)},`c-${pe}`))}),ue.length>0&&o.jsx("optgroup",{label:"OpenCode",children:ue.map(pe=>o.jsx("option",{value:`opencode:${ao(pe)}`,children:ao(pe)},`o-${pe}`))}),le.length>0&&o.jsx("optgroup",{label:"Claude Code",children:le.map(pe=>o.jsx("option",{value:`claude-code:${ao(pe)}`,children:ao(pe)},`cc-${pe}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),g&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),w==="running"&&!g&&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:j!=null&&String(j).trim()!==""?j:"--"}),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:Me,"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((pe,Ie)=>{if(pe.showOnNode===!1)return null;const tn=u("flow:node.inputTooltip",{name:pe.name||`#${Ie}`,type:pe.type})+(pe.default!=null&&pe.default!==""?u("flow:node.defaultSuffix",{value:pe.default}):""),ct=pe.name||`#${Ie+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:tn,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[ct,pe.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(ds,{type:"target",position:Be.Left,id:`input-${Ie}`,className:"af-flow-node__handle",style:{background:Rn(pe.type)},title:tn})]},`in-${Ie}`)})}),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:Gt,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:Z,onChange:Hn,onCompositionStart:Xt,onCompositionEnd:Cn,onBlur:kr,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:Z,onChange:Hn,onCompositionStart:Xt,onCompositionEnd:Cn,onBlur:kr,placeholder:"选择或输入文件路径",title:Z||"选择或输入文件路径"}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",onClick:cr,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):W&&!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:UW(te)+`
|
|
127
|
+
`}}),o.jsx("textarea",{ref:C,className:"af-flow-node__prompt-editor nodrag",value:te,onChange:ge,onCompositionStart:qe,onCompositionEnd:it,onBlur:tt,onPaste:Ft,onDrop:On,onScroll:Jt,onDragOver:pe=>{Gh(pe).length>0&&pe.preventDefault()},placeholder:"输入 prompt",rows:2})]}):null,W&&z.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:z.map((pe,Ie)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:pe.name,children:[o.jsx("img",{src:pe.dataUrl,alt:""}),o.jsxs("span",{children:["[",pe.label||`image ${Ie+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",onClick:tn=>Ln(tn,pe),onPointerDown:Kn,onMouseDown:Kn,"aria-label":`删除 ${pe.label||`image ${Ie+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},pe.id||Ie))}):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((pe,Ie)=>{if(pe.showOnNode===!1)return null;const tn=u("flow:node.outputTooltip",{name:pe.name||`#${Ie}`,type:pe.type})+(pe.default!=null&&pe.default!==""?u("flow:node.defaultSuffix",{value:pe.default}):""),ct=pe.name||`#${Ie+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:tn,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[ct,pe.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(ds,{type:"source",position:Be.Right,id:`output-${Ie}`,className:"af-flow-node__handle",style:{background:Rn(pe.type)},title:tn})]},`out-${Ie}`)})})]})]})}const yf="flowNode";function uI(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 Qh(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function VW(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function KW({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=un(),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 g=requestAnimationFrame(()=>{var v;return(v=l.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(g)},[e,n]),!e)return null;const y=c.trim(),k=y===n;async function b(g){if(g.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:y})}),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:g=>{g.target===g.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:g=>g.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:g=>d(g.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.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 _N({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}=un(),p=m.useId(),h=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const g=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(g),window.removeEventListener("keydown",v)}},[e,u,d]),!e)return null;const y=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:g=>{g.target===g.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:g=>g.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:y})]})]})]})})}function qW({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=un(),l=m.useId(),c=m.useRef(null),[d,u]=m.useState(""),[f,p]=m.useState(!1),[h,y]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),y(""),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 g(v){if(v.preventDefault(),!b||f)return;p(!0),y("");let w=null;try{const j=new AbortController;w=setTimeout(()=>j.abort(),15e3);const E=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:k,flowArchived:s}),signal:j.signal}),S=await E.json().catch(()=>({}));if(!E.ok){y(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(j){if((j==null?void 0:j.name)==="AbortError"){y(a("project:deleteModal.deleteTimeout"));return}y(String((j==null?void 0:j.message)||j))}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:g,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 YW({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Uo({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(YW,{children:t})]},n))})}function dI({open:e,onClose:t}){const{t:n}=un(),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=VW()?"⌘":"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(Uo,{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(Uo,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Uo,{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(Uo,{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(Uo,{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(Uo,{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(Uo,{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(Uo,{keys:[i,"A"]})]})]})]})]})]})})}function GW(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 XW({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=un(),[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 y=requestAnimationFrame(()=>{var k;return(k=d.current)==null?void 0:k.focus()});return()=>cancelAnimationFrame(y)},[e]);const f=m.useMemo(()=>{const y=(r||[]).map(g=>{var v,w,j;return{id:g.id,label:((v=g.data)==null?void 0:v.label)||"",definitionId:((w=g.data)==null?void 0:w.definitionId)||"",schemaType:((j=g.data)==null?void 0:j.schemaType)||""}}),k=i.trim(),b=y.map(g=>({e:g,s:GW(g,k)})).filter(g=>g.s>0);return b.sort((g,v)=>v.s-g.s||g.e.id.localeCompare(v.e.id)),b.slice(0,50).map(g=>g.e)},[r,i]);if(m.useEffect(()=>{l>=f.length&&c(0)},[f.length,l]),m.useEffect(()=>{var k;const y=(k=u.current)==null?void 0:k.querySelector(`[data-idx="${l}"]`);y&&y.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=y=>{const k=f[y];k&&(n(k.id),t())},h=y=>{if(y.key==="Escape"){y.preventDefault(),t();return}if(y.key==="ArrowDown"){y.preventDefault(),c(k=>Math.min(f.length-1,k+1));return}if(y.key==="ArrowUp"){y.preventDefault(),c(k=>Math.max(0,k-1));return}y.key==="Enter"&&(y.preventDefault(),p(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:y=>y.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:y=>{a(y.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((y,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:y.id}),y.label&&y.label!==y.id&&o.jsx("span",{className:"af-jump-panel__label",children:y.label}),y.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:y.definitionId})]},y.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 JW({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,filePath:i,fileName:a,onSaved:l,onAiEdit:c}){const{t:d}=un(),u=m.useId(),f=m.useRef(null),p=m.useRef(null),[h,y]=m.useState(""),[k,b]=m.useState(""),[g,v]=m.useState(!1),[w,j]=m.useState(!1),[E,S]=m.useState(!1),[A,R]=m.useState(""),[M,W]=m.useState("");if(m.useEffect(()=>{if(!e||!i)return;y(""),b(""),R(""),W(""),v(!0),j(!1),S(!1);const I=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i});(async()=>{try{const _=await fetch(`/api/pipeline-file-content?${I}`),T=await _.json();if(!_.ok)throw new Error(T.error||"HTTP "+_.status);y(T.content||""),b(T.content||"")}catch(_){R(_.message||String(_))}finally{v(!1)}})();const z=requestAnimationFrame(()=>{var _;return(_=f.current)==null?void 0:_.focus()});return()=>cancelAnimationFrame(z)},[e,i,n,r,s]),!e)return null;const D=h!==k;async function O(I){if(I.preventDefault(),!w){j(!0),R(""),W("");try{const z=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i}),_=await fetch(`/api/pipeline-file-save?${z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),T=await _.json();if(!_.ok)throw new Error(T.error||"HTTP "+_.status);b(h),W(d("flow:fileEdit.saved")),l&&l()}catch(z){R(z.message||String(z))}finally{j(!1)}}}async function K(){if(!(!c||E||!h)){S(!0),R("");try{const I=await c(h);typeof I=="string"&&I&&y(I)}catch(I){R(I.message||String(I))}finally{S(!1)}}}function $(){y(k),R(""),W("")}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:g?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=>y(I.target.value),spellCheck:!1,placeholder:d("flow:fileEdit.placeholder")})]})}),(A||M)&&!g&&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||E,children:d("flow:fileEdit.reset")}),c&&o.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:K,disabled:E||w||!h,children:d(E?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),o.jsx("button",{type:"button",className:"af-btn-primary",onClick:O,disabled:!D||w||E,children:d(w?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const fI=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),QW=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function ZW(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 eV(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 PN(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 pI(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(fI.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 hI(e){return{inputNames:PN(e==null?void 0:e.inputs),outputNames:PN(e==null?void 0:e.outputs)}}function tV(e,t,n){const r=hI(t),s=eV(e),i=[];for(const a of s)if(!pI(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 nV(e,t){const n=hI(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=pI(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 rV(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function sV(e){return e.map(t=>{const n=rV(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 iV(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 QW)fI.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function oV(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 aV(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 kp({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}=un(),f=m.useId(),p=m.useRef(null),h=m.useRef(null),[y,k]=m.useState(0),[b,g]=m.useState(0),[v,w]=m.useState(null),j=m.useMemo(()=>ss(c),[c]),E=m.useMemo(()=>tV(e,a,u),[e,a,u]),S=E.length>0,A=m.useMemo(()=>nV(e,a),[e,a]),R=m.useMemo(()=>sV(A),[A]),M=m.useMemo(()=>n?null:ZW(e,y),[e,y,n]),W=m.useMemo(()=>{if(!M)return[];const I=iV(a,u);return oV(I,M.query)},[M,a,u]);m.useEffect(()=>{g(I=>{const z=Math.max(0,W.length-1);return Math.min(Math.max(0,I),z)})},[W.length]);const D=m.useCallback(()=>{const I=p.current;if(!I||!M||W.length===0){w(null);return}const z=aV(I,y);if(!z){w(null);return}const _=4,T=44,C=13.5*16,J=Math.min(W.length*T+8,C);let Z=z.bottom+_;Z+J>window.innerHeight-8&&(Z=Math.max(8,z.top-J-_));const H=288;let te=z.left;te=Math.max(8,Math.min(te,window.innerWidth-H-8)),w({top:Z,left:te})},[M,W.length,y]);m.useLayoutEffect(()=>{if(!M||W.length===0){w(null);return}const I=requestAnimationFrame(()=>D());return()=>cancelAnimationFrame(I)},[M,W.length,y,e,D]),m.useEffect(()=>{if(!M||W.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,W.length,D]);const O=m.useCallback(I=>{if(!M)return;const{atIndex:z}=M,_=e.slice(0,z)+"${"+I+"}"+e.slice(y);t(_);const T=z+I.length+3;queueMicrotask(()=>{const C=p.current;C&&(C.focus(),C.setSelectionRange(T,T)),k(T)})},[M,e,y,t]),K=m.useCallback(()=>{const I=p.current,z=h.current;!I||!z||(z.scrollTop=I.scrollTop,z.scrollLeft=I.scrollLeft,M&&W.length>0&&queueMicrotask(()=>D()))},[M,W.length,D]),$=m.useCallback(I=>{if(!n&&M&&W.length>0&&(I.key==="ArrowDown"||I.key==="ArrowUp"||I.key==="Enter")){if(I.key==="ArrowDown")I.preventDefault(),g(z=>(z+1)%W.length);else if(I.key==="ArrowUp")I.preventDefault(),g(z=>(z-1+W.length)%W.length);else if(I.key==="Enter"&&!I.shiftKey){I.preventDefault();const z=W[b];z&&O(z.insert)}}},[n,M,W,b,O]),L=m.useCallback(async I=>{if(n||typeof d!="function")return!1;const z=await iI({files:I,body:e,images:j});return z?(t(z.body),d(z.images),queueMicrotask(()=>{const _=p.current;if(!_)return;_.focus();const T=z.body.length;_.setSelectionRange(T,T),k(T)}),!0):!1},[n,j,t,d,e]);return o.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[j.length>0?o.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:j.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=sI(I);z.length!==0&&(I.preventDefault(),L(z).catch(()=>{}))},onDragOver:I=>{Gh(I).length>0&&I.preventDefault()},onDrop:I=>{const z=Gh(I);z.length!==0&&(I.preventDefault(),L(z).catch(()=>{}))},onScroll:K})]}),M&&W.length>0&&v?es.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:W.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:_=>_.preventDefault(),onMouseEnter:()=>g(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:E.map(I=>I.message).join(" · ")}):null]})}const mI=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Sp(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function AN({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=un(),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 y=n.map((k,b)=>{if(b!==f)return k;const g={...k,[p]:h};return p==="required"&&h===!0&&(g.showOnNode=!0),g});r(y)},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 gI({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}=un(),[h,y]=m.useState(!1),[k,b]=m.useState(!1),[g,v]=m.useState({status:"idle",message:""}),w=m.useCallback(O=>{t(K=>K&&{...K,...O})},[t]),{cursorList:j,opencodeList:E,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(Sp)),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,_=I&&!L.has(z)?I:"";return{cursorList:O,opencodeList:K,claudeCodeList:$,currentNotInLists:_}},[s,e==null?void 0:e.model]);if(!e)return null;const R=String(e.script??""),M=n==="tool_nodejs"||R.trim()!=="",W=typeof c=="function"&&!i&&(e==null?void 0:e.newId),D=async()=>{if(W){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:!W||g.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),g.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,g.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${g.status}`,children:g.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:ga.includes(e.role)?e.role:p("flow:roles.normal"),onChange:O=>w({role:O.target.value}),disabled:i,children:ga.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,j.length>0?o.jsx("optgroup",{label:"Cursor",children:j.map(O=>o.jsx("option",{value:Sp(O),children:O},`c-${O}`))}):null,E.length>0?o.jsx("optgroup",{label:"OpenCode",children:E.map(O=>o.jsx("option",{value:Sp(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:${Sp(O)}`,children:O},`cc-${O}`))}):null]})]}),o.jsx(AN,{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(AN,{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(kp,{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:()=>y(!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(kp,{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(kp,{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&&y(!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:()=>y(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(kp,{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 lb(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 lV(e){const t=lb(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 yI(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function IN({text:e}){const{t}=un(),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 TN({o:e}){var r;const{t}=un(),n=lb(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:yI(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 RN(e){return lV(e)}function LN(e){var r;if(!e)return null;const t=lb(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"?yI(String(n)):String(n)}function ON({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 MN=2e4,xI="af:run-node-ctx-width";function eh(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function Qo(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):Qo(eh())}function cV(){try{const e=localStorage.getItem(xI);if(e==null)return Qo(eh());const t=parseInt(e,10);return Number.isFinite(t)?Qo(t):Qo(eh())}catch{return Qo(eh())}}async function $N(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 uV(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function dV({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:s}){const{t:i}=un(),[a,l]=m.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,d]=m.useState(cV),u=m.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[f,p]=m.useState(!0),[h,y]=m.useState(""),[k,b]=m.useState([]),[g,v]=m.useState(null),[w,j]=m.useState(null),E=m.useRef(null),S=m.useRef(null),A=m.useRef(0),R=m.useRef(0);m.useLayoutEffect(()=>{const _=window.matchMedia("(max-width: 960px)"),T=()=>l(_.matches);return _.addEventListener("change",T),()=>_.removeEventListener("change",T)},[]),m.useEffect(()=>{function _(){d(T=>Qo(T))}return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const M=m.useCallback(()=>{d(_=>{const T=Qo(_);try{localStorage.setItem(xI,String(T))}catch{}return T})},[]),W=m.useCallback(_=>{if(a||_.button!==0)return;_.preventDefault();const T=_.currentTarget;u.current={active:!0,pointerId:_.pointerId,startX:_.clientX,startW:c},T.setPointerCapture(_.pointerId)},[a,c]),D=m.useCallback(_=>{const T=u.current;if(!T.active||_.pointerId!==T.pointerId)return;const C=T.startX-_.clientX;d(Qo(T.startW+C))},[]),O=m.useCallback(_=>{const T=u.current;if(!(!T.active||_.pointerId!==T.pointerId)){T.active=!1;try{_.currentTarget.releasePointerCapture(_.pointerId)}catch{}M()}},[M]),K=m.useCallback(()=>{const _=u.current;_.active&&(_.active=!1,M())},[M]),$=m.useCallback(_=>{const T=Array.isArray(_)?_:[];b(T),v(C=>C&&T.some(J=>J.execId===C)?C:T.length>0?T[T.length-1].execId:null)},[]),L=m.useCallback(()=>{if(!e||!t)return;const _=++A.current,T=new AbortController,C=window.setTimeout(()=>T.abort(),MN);(async()=>{try{const J=await $N(t,e,n,T.signal);if(_!==A.current)return;$(Array.isArray(J.rounds)?J.rounds:[])}catch{}finally{window.clearTimeout(C)}})()},[e,t,n,$]);m.useEffect(()=>{if(!e||!t){p(!1),y(""),b([]);return}const _=++R.current;p(!0),y(""),b([]),v(null);const T=new AbortController,C=window.setTimeout(()=>T.abort(),MN);return(async()=>{try{const J=await $N(t,e,n,T.signal);if(_!==R.current)return;$(Array.isArray(J.rounds)?J.rounds:[])}catch(J){if(_!==R.current)return;const Z=(J==null?void 0:J.name)==="AbortError"?"requestTimeout":J.message||String(J);y(Z)}finally{window.clearTimeout(C),_===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 _=k.length>0?k[k.length-1]:null;return(r==="running"&&k.length===0||!!(_&&_.status==="running"))&&e&&t&&(S.current=setInterval(()=>L(),2e3)),()=>clearInterval(S.current)},[k,e,t,n,r,L]),m.useEffect(()=>{E.current&&(E.current.scrollTop=0)},[g]);const I=k.find(_=>_.execId===g),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:W,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:uV(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--"+pV((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(g??""),onChange:_=>{const T=_.target.value;v(T==="latest"?"latest":Number(T))},children:[...k].reverse().map(_=>{const T=_.execId==="latest"?i("flow:runContext.latest"):`#${_.execId}`,C=hV(i,_.status),J=_.finishedAt?` · ${fV(_.finishedAt)}`:"";return o.jsx("option",{value:String(_.execId),children:`${T} · ${C}${J}`},_.execId)})})]}),I&&o.jsxs("div",{className:"af-run-ctx-body",ref:E,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((_,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:_.slot})}),o.jsx("pre",{className:"af-run-ctx-slot-text",children:_.value})]},`${_.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:()=>j("prompt"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(IN,{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:()=>j("output"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),I.outputs.map((_,T)=>{const C=RN(_),J=LN(_);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:_.slot}),C?o.jsx("span",{className:"af-run-ctx-format-badge",title:i("flow:runContext.detectedContentType"),children:C}):null,o.jsx(ON,{text:J,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(TN,{o:_})]},`${_.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:_=>{_.target===_.currentTarget&&j(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:()=>j(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(IN,{text:I.prompt}),w==="output"&&I.outputs&&I.outputs.map((_,T)=>{const C=RN(_),J=LN(_);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:_.slot}),C?o.jsx("span",{className:"af-run-ctx-format-badge",children:C}):null,o.jsx(ON,{text:J,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(TN,{o:_})]},`${_.slot}-${T}`)})]})]})})]})}function fV(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 pV(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 hV(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 mV({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:s,nodes:i,onCliInputsChange:a,onBackToEdit:l}){const{t:c}=un(),[d,u]=m.useState({}),[f,p]=m.useState(null),[h,y]=m.useState({}),[k,b]=m.useState(!0),[g,v]=m.useState(!1),[w,j]=m.useState(""),[E,S]=m.useState(!1),[A,R]=m.useState(null),M=m.useRef(null),W=m.useRef(!0),D=m.useRef({});m.useMemo(()=>{var C,J,Z;const T={};for(const H of r){const te=(Z=(J=(C=H.data)==null?void 0:C.outputs)==null?void 0:J[0])==null?void 0:Z.default;te!=null&&te!==""&&(T[H.id]=String(te))}return D.current=T,T},[r]);const O=m.useMemo(()=>{var C;const T={};for(const J of i){if(!((C=J.data)!=null&&C.inputs))continue;const Z=J.data.inputs;for(let H=0;H<Z.length;H++){const te=Z[H];if(!(te!=null&&te.name))continue;const ae=s.find(ue=>ue.target===J.id&&ue.targetHandle===`input-${H}`);if(!(ae!=null&&ae.source))continue;r.find(ue=>ue.id===ae.source)&&(T[ae.source]=te.name)}}return T},[i,s,r]);m.useEffect(()=>(W.current=!0,()=>{W.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(C=>{if(!C.ok)throw new Error(`HTTP ${C.status}`);return C.json()}).then(C=>{var Z;if(!W.current)return;u(C.presets||{}),p(C.activePreset||null);const J=C.activePreset&&((Z=C.presets)!=null&&Z[C.activePreset])?C.presets[C.activePreset]:{};y({...D.current,...J}),b(!1)}).catch(()=>{W.current&&(y(D.current),b(!1))})},[e,t,n]),m.useEffect(()=>{var C;if(!a)return;const T={};for(const[J,Z]of Object.entries(h)){const H=O[J];if(!H)continue;const te=r.find(ce=>ce.id===J);if(!te)continue;(((C=te.data)==null?void 0:C.definitionId)||"").startsWith("provide_file")?T[H]={type:"file",path:Z}:T[H]={type:"str",value:Z}}a(T)},[h,O,r,a]);const K=m.useCallback((T,C)=>{y(J=>({...J,[T]:C}))},[]),$=m.useCallback(T=>{T!==f&&(p(T),T&&d[T]?y({...D.current,...d[T]}):y(D.current))},[f,d]),L=m.useCallback(async()=>{if(w.trim()){v(!0);try{const T={...d,[w.trim()]:h},C={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(C)})).ok&&(u(T),p(w.trim()),j(""),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 C=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:C})})).ok&&(u(T),p(C),C&&T[C]?y({...D.current,...T[C]}):y(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]),_=Object.keys(d);return _.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:g,children:[o.jsx("option",{value:"",children:c("flow:runConfig.default")}),_.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:g,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:g,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:g,title:c("flow:runConfig.deletePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),E&&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=>j(T.target.value),disabled:g}),o.jsxs("div",{className:"af-run-config-save-actions",children:[o.jsx("button",{type:"button",className:"af-btn-primary",onClick:L,disabled:g||!w.trim(),children:c(g?"common.saving":"common.save")}),o.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{S(!1),j("")},disabled:g,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 ue,le;const C=((ue=T.data)==null?void 0:ue.definitionId)||"",J=C.startsWith("provide_file"),Z=C==="provide_bool",H=((le=T.data)==null?void 0:le.label)||T.id,te=T.id,ae=h[te]||"",ce=["true","1","yes","on"].includes(String(ae).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":Z?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-config-input-label",children:H}),Z?null:o.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>R({instanceId:te,label:H,content:ae}),"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}),Z?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ce?" af-run-config-bool-toggle--true":""),onClick:()=>K(te,ce?"false":"true"),"aria-pressed":ce,children:ce?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-config-input-field",value:ae,onChange:de=>K(te,de.target.value),placeholder:c(J?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},te)})})]}),A&&es.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 wI={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"]},gV={"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 yV(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function xV(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 wV(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 DN(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(wI))if(r.includes(e))return n;return"other"}function vV({event:e,defaultExpanded:t}){const[n,r]=m.useState(!!t),s=gV[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 y=i[h];return y==null?`${h}:null`:typeof y=="object"?`${h}:{…}`:`${h}:${String(y).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:xV(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 bV({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,y]=m.useState(!0),[k,b]=m.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[g,v]=m.useState(""),w=m.useRef(null),j=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]),E=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&&j()},[e,j]),m.useEffect(()=>{if(!(!e||!l))return E(l),w.current=setInterval(()=>E(l),2e3),()=>{w.current&&clearInterval(w.current),w.current=null}},[e,l,E]);const S=m.useMemo(()=>{const M=(d==null?void 0:d.events)||[],W=g.trim().toLowerCase();return M.filter(D=>{const O=DN(D.tag,D.payload);return!k[O]&&O!=="other"?!1:W?[D.tag,JSON.stringify(D.payload||"")].join(" ").toLowerCase().includes(W):!0})},[d,k,g]),A=m.useMemo(()=>{const M=(d==null?void 0:d.events)||[],W={};for(const D of M){const O=DN(D.tag,D.payload);W[O]=(W[O]||0)+1}return W},[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=>y(M.target.checked),disabled:!n}),"仅显示当前 flow"]}),o.jsx("button",{type:"button",onClick:j,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 W=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:W?"rgba(124,77,255,0.18)":"transparent",borderLeft:W?"3px solid #7c4dff":"3px solid transparent"},children:[o.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:wV(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:[yV(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(wI).map(M=>o.jsxs("button",{type:"button",onClick:()=>b(W=>({...W,[M]:!W[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:g,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,W)=>o.jsx(vV,{event:M,defaultExpanded:M.tag==="error"},`${M.ts}_${W}`))]})]})]})]}):null}const kV="0.1.36";function FN(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 by(e,t){return t==="running"?FN(e):e==null||!Number.isFinite(e)||e<=0?"--":FN(e)}const vI=m.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function SV(e){const{setNodes:t}=wl(),{modelLists:n,onModelChange:r}=m.useContext(vI),s=m.useCallback(d=>{t(u=>u.filter(f=>f.id!==d))},[t]),i=m.useCallback(()=>{var p,h,y,k,b,g,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=(y=e.data)==null?void 0:y.outputs)==null?void 0:k[0])==null?void 0:b.value)||((w=(v=(g=e.data)==null?void 0:g.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 y;if(p.id!==d)return p;const h=Array.isArray((y=p.data)==null?void 0:y.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:ss(u)}}:p))},[t]);return o.jsx(cI,{...e,deleteNode:s,onProvideExpand:i,onProvideValueChange:a,onNodeBodyChange:l,onNodeImagesChange:c,modelLists:n,onModelChange:r})}const NV={[yf]:SV},Ku=["CONTROL","TOOL","PROVIDE","AGENT"],jV=1200,zN="af-flow-node--sync-flash",BN="af-flow-edge--sync-flash";function HN(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function UN(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function cb(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 CV(e){const t=cb(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function Np(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 bI(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function kI(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function ky(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 WN(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 VN(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 EV(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function _V(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 SI(e,t,n,r,s){const i=CV(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 KN(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=Fc(i,e.sourceHandle||"output-0","source"),c=Fc(a,e.targetHandle||"input-0","target");return!l||!c?!1:Dc(l,c)}function PV(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=Fc(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:lI(a)}:null}function AV(e,t,n){var a;const r=SI(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"?Dc(n.slot,c):Dc(c,n.slot))return{slot:c,slotIndex:l,hydrated:r}}return null}function IV(e,t){return t?e.map((n,r)=>{const s=AV(n,e,t);if(!s)return null;const i=cb(n);return{def:n,order:r,category:i,categoryRank:Ku.indexOf(i),slot:s.slot,slotIndex:s.slotIndex,displayLabel:bI(s.hydrated.data||n),description:kI(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 TV=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function RV(e){const t=new Set,n=[];let r;const s=new RegExp(TV.source,"g");for(;(r=s.exec(e))!==null;){const i=r[1];t.has(i)||(t.add(i),n.push(i))}return n}function qN(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 uo(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function jp(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(uo),d=a.map(uo);return l.map(uo).includes(s)&&!c.includes(s)&&!d.includes(s)?`claude-code:${s}`:d.includes(s)&&!c.includes(s)?`opencode:${s}`:s}function LV(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function Sy(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 OV({steps:e}){const{t}=un();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:LV(s)}):null]}):null})]},n.index)})})}function MV(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 $V(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 DV(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 FV(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 YN({thread:e,liveSegments:t,running:n,className:r="",autoScroll:s=!0}){const{t:i}=un(),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(GN,{segments:c.segments,running:!1})},`composer-a-${d}`)),o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(GN,{segments:t,running:n})})]})}function GN({segments:e,running:t=!1}){const{t:n}=un(),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=MV(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=$V(c),u=!!(d.length>0||a);return o.jsxs(o.Fragment,{children:[d.map((f,p)=>o.jsxs("section",{className:FV(f.kind),children:[o.jsx("div",{className:"af-composer-ai-block-label",children:DV(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}=wl(),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 BV({onReady:e}){const t=NP();return m.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function XN(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}const th=1500,JN=500,HV=262144,UV=2e3;function Ny(e){return typeof e!="string"?"":e.length<=UV?e:`[log line truncated, ${e.length} chars]`}const WV=th;function VV(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:Ny(s)}}catch{return{ts:n,type:"info",text:Ny(s)}}return{ts:n,type:"log",text:Ny(`[${r}] ${s}`)}}function QN(e){if(!e)return[];const t=[],n=e.split(`
|
|
132
|
+
`);for(let r=n.length-1;r>=0&&t.length<WV;r--){const s=n[r];if(!s)continue;const i=VV(s);i&&t.push(i)}return t.reverse(),t}function KV(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 qV(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 YV({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:y,onDrop:k,onDragOver:b,hideMinimapAndControls:g,bottomSlot:v}){const{t:w}=un(),j=!s,E=j||t==="pan"?!0:[1,2],S=j?!1:t==="select",A="af-flow-canvas"+(j?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),R=m.useCallback(()=>{},[]),M=m.useMemo(()=>{const W=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 _=parseInt(z[1],16);return`rgba(${_>>16&255}, ${_>>8&255}, ${_&255}, ${I})`},$="#ff5169";return r.map(L=>{var fe,ye,je,He;const I=W.get(L.source),z=W.get(L.target),_=/^output-(\d+)$/.exec(L.sourceHandle||""),T=/^input-(\d+)$/.exec(L.targetHandle||""),C=I&&_?(ye=(fe=I.data)==null?void 0:fe.outputs)==null?void 0:ye[parseInt(_[1],10)]:null,J=z&&T?(He=(je=z.data)==null?void 0:je.inputs)==null?void 0:He[parseInt(T[1],10)]:null,Z=C!=null&&C.type?Rn(C.type):null,H=J!=null&&J.type?Rn(J.type):null,te=Z&&H&&Z!==H,ae=O&&(D.has(L.source)||D.has(L.target)),ce=L.style||{};if(te){const lt=L.selected?.95:ae?.85:.78,Ge=K($,lt);return{...L,className:((L.className||"")+" af-flow-edge--type-mismatch"+(ae?" af-flow-edge--adjacent":"")).trim(),style:{...ce,stroke:Ge,strokeWidth:ae?2.75:2.5,strokeDasharray:"6 4"},markerEnd:L.markerEnd&&typeof L.markerEnd=="object"?{...L.markerEnd,color:Ge}:{type:cs.ArrowClosed,color:Ge}}}const ue=Z||H;if(!ue)return ae?{...L,className:((L.className||"")+" af-flow-edge--adjacent").trim(),style:{...ce,strokeWidth:2.5}}:L;const le=ae||L.selected?.7:.38,de=K(ue,le),se=ae?2.5:ce.strokeWidth??2;return{...L,className:((L.className||"")+(ae?" af-flow-edge--adjacent":"")).trim(),style:{...ce,stroke:de,strokeWidth:se},markerEnd:L.markerEnd&&typeof L.markerEnd=="object"?{...L.markerEnd,color:de}:{type:cs.ArrowClosed,color:de}}})},[n,r]);return o.jsxs(SP,{className:A,nodes:n,edges:M,onNodesChange:s||R,onEdgesChange:i||R,onConnect:j?void 0:a,onConnectStart:j?void 0:l,onConnectEnd:j?void 0:c,isValidConnection:j?void 0:d,onNodesDelete:j?void 0:u,onNodeClick:f,onNodeDoubleClick:j?void 0:p,onEdgeClick:j?void 0:h,onInit:y,onDrop:j?void 0:k,onDragOver:j?void 0:b,nodeTypes:NV,selectionOnDrag:S,panOnDrag:E,nodesDraggable:!j,nodesConnectable:!j,elementsSelectable:!j,edgesFocusable:!j,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(_P,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),o.jsx(Mc,{position:"bottom-center",className:"af-flow-bottom-unified-panel"+(g?" af-flow-bottom-unified-panel--solo":""),children:o.jsxs("div",{className:"af-flow-bottom-unified-row"+(g?" af-flow-bottom-unified-row--solo":""),children:[g?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--minimap",children:o.jsx(o4,{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:W=>{var O;const D=(((O=W.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}),g?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:o.jsx(q5,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!g&&o.jsx(Mc,{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:W,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:W})]},W))}),o.jsx(zV,{fitViewEpoch:e}),!j&&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 ZN(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 GV(e){return e==="builtin"?"workspace":e??"user"}function zl(e,t){return t(e==="builtin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}const NI="af:run-console-height",dd=230,Lu={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},Cp={};function nh(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 XV(){try{const e=localStorage.getItem(NI);if(e==null)return dd;const t=parseInt(e,10);return Number.isFinite(t)?nh(t):dd}catch{return dd}}function JV(){var Gb,Xb;const{t:e,i18n:t}=un(),{navigate:n,path:r}=xl(),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),[y,k]=m.useState(""),[b,g]=m.useState(""),[v,w]=m.useState(""),[j,E]=m.useState(""),[S,A]=m.useState(!1),[R,M]=m.useState(""),[W,D]=m.useState(!1),[O,K]=m.useState(""),[$,L]=m.useState(!1),[I,z]=m.useState(!1),[_,T]=m.useState(!1),[C,J]=m.useState(null),[Z,H]=m.useState(!1),[te,ae]=m.useState(!1),ce=m.useRef(!1),[ue,le]=m.useState([]),[de,se]=m.useState(""),[fe,ye]=m.useState("nodes"),je=m.useRef(null),[He,lt]=m.useState([]),[Ge,Ct]=m.useState(!1),[Me,Ce]=m.useState(""),[Gt,Hn]=m.useState(!1),[Xt,Cn]=m.useState({name:"",id:"",description:""}),[kr,cr]=m.useState(!1),[oe,ge]=m.useState(""),[qe,it]=m.useState(""),tt=m.useRef(null),[It,Ln]=m.useState([]),[Ft,On]=m.useState(!1),[Jt,Qt]=m.useState(""),[rr,pe]=m.useState(""),[Ie,tn]=m.useState(null),[ct,gn]=m.useState(null),[qs,En]=m.useState([]),[Sr,ur]=m.useState(""),[Wr,Ys]=m.useState(!1),_o=m.useCallback(x=>{tt.current&&window.clearTimeout(tt.current),it(x),tt.current=window.setTimeout(()=>{it(""),tt.current=null},3800)},[]),Nr=m.useCallback(x=>{const N=String(x||"").trim();N&&window.requestAnimationFrame(()=>{var F;(F=s.current)==null||F.call(s,N)})},[]);m.useEffect(()=>()=>{tt.current&&window.clearTimeout(tt.current)},[]);const[Jn,Is]=m.useState(!1),[Je,Vt]=m.useState({files:[]}),[nn,ps]=m.useState(!1),[We,Un]=m.useState(!0);m.useEffect(()=>{let x=!1;const N=()=>{fetch("/api/flows",{method:"HEAD"}).then(U=>{x||Un(U.ok)}).catch(()=>{x||Un(!1)})};N();const F=window.setInterval(N,5e3);return()=>{x=!0,window.clearInterval(F)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/dev-info").then(N=>N.json()).then(N=>{x||ve(!!(N!=null&&N.isDev))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{u!=null&&u.id&&PE(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[Te,Bt]=m.useState("edit"),[Ts,mt]=m.useState([]),Vr=m.useRef(0),[dr,rn]=m.useState(new Set),[hs,Wn]=m.useState({}),[ms,fr]=m.useState(null),[Gs,jr]=m.useState(0),[gs,ys]=m.useState(!1),[q,ve]=m.useState(!1),[Le,Ve]=m.useState(!1),[vt,_n]=m.useState(XV),zt=m.useRef({active:!1,pointerId:-1,startY:0,startH:dd}),[bt,Zt]=m.useState(null),[Xs,Lr]=m.useState(null),[Js,Qs]=m.useState({}),pr=m.useRef(Js);m.useEffect(()=>{pr.current=Js},[Js]);const[Na,sr]=m.useState(!1),[ja,Kr]=m.useState(!1),[Po,ut]=m.useState({}),[Qn,Zi]=m.useState({}),[Ca,hr]=m.useState(null),[Pn,Mn]=m.useState(Lu),[eo,Sf]=m.useState(!1),[Rs,Qc]=m.useState(!1),[Ea,bi]=m.useState(""),[to,_a]=m.useState(""),[Ht,bl]=m.useState(Cp),[yn,Ao]=m.useState(null),Pa=m.useRef(0),Zs=m.useRef(null),Aa=m.useRef(null),kl=m.useRef(!0),no=m.useRef(!1),[nt,Io]=m.useState(null),[Ia,To]=m.useState(null),[Nf,ro]=m.useState(!1),[ki,Si]=m.useState(""),[Zc,Sl]=m.useState(!1),eu=m.useRef(null),[Cr,$n]=m.useState(null),[Ta,Ra]=m.useState(!1),[La,Oa]=m.useState(null),[Ma,tu]=m.useState(!1),[Ls,Nl]=m.useState(null),nu=m.useRef(null),[qr,Os]=m.useState(""),[jl,Ms]=m.useState(0),[Ni,Or]=m.useState(0),[Jm,ru]=m.useState("pan"),[Cl,$a]=m.useState(!1),[su,iu]=m.useState(!1),El=m.useRef(null),ou=m.useRef(null),Da=m.useRef(null),[Qm,_l]=m.useState(0),[gt,au]=m.useState(null),[Zm,Fa]=m.useState(""),[dt,eg]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[ji,mr]=m.useState(""),[lu,tg]=m.useState(""),[ei,jf]=m.useState([]),[Ci,P]=m.useState([]),[B,X]=m.useState(!1),[G,ee]=m.useState([]),[re,me]=m.useState(!1),[be,xe]=m.useState(()=>new Set),[_e,kt]=m.useState(!1),Tt=m.useRef(null),Ot=m.useRef(null),[xn,An]=m.useState({}),Dn=m.useCallback(x=>{if(!x)return null;const N=x.id,F=x.source??"user",U=x.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${N}:${F}${U?":"+U:""}`,activeKey:`af:composer-active-session:${N}:${F}${U?":"+U:""}`}},[]),Mr=m.useCallback(x=>{if(!x)return"";const N=x.id,F=x.source??"user",U=x.archived?"archived":"";return`af:composer-skills:pipeline:${N}:${F}${U?":"+U:""}`},[]),St=m.useCallback(x=>{const N=Dn(x);if(!N)return{sessions:[],activeSessionId:null};try{const F=localStorage.getItem(N.sessionsKey);if(!F)return{sessions:[],activeSessionId:null};const U=JSON.parse(F);if(!Array.isArray(U))return{sessions:[],activeSessionId:null};const V=U.filter(Q=>Q&&typeof Q.id=="string").map(Q=>({...Q,running:!1,statusLine:Q.running?e("flow:composer.pageRefreshReset"):Q.statusLine,steps:[]}));let Y=null;try{Y=localStorage.getItem(N.activeKey),Y&&!V.some(Q=>Q.id===Y)&&(Y=null)}catch{Y=null}return{sessions:V,activeSessionId:Y}}catch{return{sessions:[],activeSessionId:null}}},[Dn]),Pt=m.useCallback((x,N,F)=>{const U=Dn(x);if(U)try{localStorage.setItem(U.sessionsKey,JSON.stringify(N)),F?localStorage.setItem(U.activeKey,F):localStorage.removeItem(U.activeKey)}catch{}},[Dn]),Pe=m.useRef(0),ft=m.useRef({sessions:[],activeSessionId:null,flowKey:null}),[Fn,Ne]=m.useState([]),[Ye,Ze]=m.useState(null),Xe=m.useMemo(()=>Mr(u),[Mr,u]),[Oe,At]=m.useState(""),qt=m.useMemo(()=>{if(!u)return null;const x=u.id,N=u.source??"user",F=u.archived?"archived":"";return`${x}:${N}${F?":"+F:""}`},[u]),Nt=m.useRef(!1);m.useEffect(()=>{if(!qt){Ne([]),Ze(null),ft.current={sessions:[],activeSessionId:null,flowKey:null};return}const x=ft.current;if(x.flowKey===qt)return;x.flowKey=qt,Nt.current&&x.sessions.length>0&&Pt(u,x.sessions,x.activeSessionId);const{sessions:N,activeSessionId:F}=St(u);if(N.length===0){const U=`session-1-${Date.now()}`,V={id:U,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};x.sessions=[V],x.activeSessionId=U,Ne([V]),Ze(U)}else{const U=N[N.length-1];if(U&&(!U.thread||U.thread.length===0))Pe.current=Sy(N),x.sessions=N,x.activeSessionId=U.id,Ne(N),Ze(U.id);else{const Y=Sy(N)+1;Pe.current=Y;const Q=`session-${Y}-${Date.now()}`,ne={id:Q,label:e("flow:composer.conversationLabel",{n:Y}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},he=[...N,ne];x.sessions=he,x.activeSessionId=Q,Ne(he),Ze(Q)}}Nt.current=!0},[qt,u,St,Pt]);const Ue=m.useMemo(()=>Fn.find(x=>x.id===Ye)||null,[Fn,Ye]),et=(Ue==null?void 0:Ue.running)??!1,Wt=(Ue==null?void 0:Ue.statusLine)??"",Vn=(Ue==null?void 0:Ue.segments)??[],ti=(Ue==null?void 0:Ue.thread)??[],so=(Ue==null?void 0:Ue.steps)??[];Ue==null||Ue.outputDismissed;const ot=(Ue==null?void 0:Ue.phaseContext)??null,Ei=m.useRef([]),[cu,Pl]=m.useState(!1),Cf=m.useRef(null),Sb=m.useRef(null);m.useEffect(()=>{const x=Sb.current;x&&requestAnimationFrame(()=>{x.scrollTop=x.scrollHeight})},[ti,Vn]);const ng=m.useRef(null),rg=m.useRef(!1),mT=m.useRef(null),Nb=m.useCallback(x=>{const N=++Pe.current,F=`session-${N}-${Date.now()}`,U={id:F,label:x||e("flow:composer.conversationLabel",{n:N}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return Ne(V=>[...V,U]),Ze(F),F},[]);m.useEffect(()=>{!u||!Nt.current||(ft.current.sessions=Fn,ft.current.activeSessionId=Ye,Pt(u,Fn,Ye))},[Fn,Ye,u,Pt]),m.useEffect(()=>{Pe.current=Math.max(Pe.current,Sy(Fn))},[Fn]);const jb=m.useCallback(x=>{var N;ng.current===x&&((N=Cf.current)==null||N.abort()),Ne(F=>{const U=F.filter(Y=>Y.id!==x);if(F.some((Y,Q)=>Y.id===x&&F.findIndex(ne=>ne.id===Ye)===Q)||Ye===x){const Y=U;Y.length>0?Ze(Y[Y.length-1].id):setTimeout(()=>{Pe.current=0;const Q=++Pe.current,ne=`session-${Q}-${Date.now()}`,he={id:ne,label:e("flow:composer.conversationLabel",{n:Q}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};Ne(Ee=>[...Ee,he]),Ze(ne)},0)}return U})},[Ye]),Yr=m.useCallback(x=>{Ne(N=>{const F=N.findIndex(Y=>Y.id===Ye);if(F<0)return N;const U={...N[F]};x(U);const V=[...N];return V[F]=U,V})},[Ye]),Cb=m.useCallback(x=>{Yr(N=>{N.running=x})},[Yr]),_i=m.useCallback(x=>{Yr(N=>{N.statusLine=x})},[Yr]),Pi=m.useCallback(x=>{Yr(N=>{typeof x=="function"?N.segments=x(N.segments):N.segments=x})},[Yr]),Eb=m.useCallback(x=>{Yr(N=>{typeof x=="function"?N.thread=x(N.thread):N.thread=x})},[Yr]),uu=m.useCallback(x=>{Yr(N=>{typeof x=="function"?N.steps=x(N.steps):N.steps=x})},[Yr]),_b=m.useCallback(x=>{Yr(N=>{N.outputDismissed=x})},[Yr]),du=m.useCallback(x=>{Yr(N=>{N.phaseContext=typeof x=="function"?x(N.phaseContext):x})},[Yr]),Pb=m.useCallback(x=>{Ze(x),Ne(N=>{const F=N.findIndex(V=>V.id===x);if(F<0||!N[F].outputDismissed)return N;const U=[...N];return U[F]={...N[F],outputDismissed:!1},U})},[]);m.useEffect(()=>{Ei.current=Vn},[Vn]);const $r=m.useRef({}),Ab=m.useRef(!1),za=m.useRef(null),Ro=m.useRef(null),fu=m.useRef(!1),sg=m.useRef(0),Ef=m.useRef(""),[Rt,yt,gT]=jP([]),[kn,dn,yT]=CP([]),Ai=m.useRef(Rt),Al=m.useRef(kn),Ib=m.useRef(null),ig=m.useRef(null),Tb=m.useRef(null),_f=m.useRef(null),[Gr,Lo]=m.useState(null),ni=m.useMemo(()=>Rt.filter(x=>{var N;return(((N=x.data)==null?void 0:N.definitionId)||"").startsWith("provide_")}),[Rt]),Il=m.useMemo(()=>{var N;const x={};for(const F of Rt){if(!((N=F.data)!=null&&N.inputs))continue;const U=F.data.inputs;for(let V=0;V<U.length;V++){const Y=U[V];if(!(Y!=null&&Y.name))continue;const Q=kn.find(he=>he.target===F.id&&he.targetHandle===`input-${V}`);if(!(Q!=null&&Q.source))continue;ni.find(he=>he.id===Q.source)&&(x[Q.source]=Y.name)}}return x},[Rt,kn,ni]),pu=m.useMemo(()=>{if(Te==="edit"||dr.size===0)return null;const x=new Set(dr);for(const N of kn)dr.has(N.source)&&x.add(N.target),dr.has(N.target)&&x.add(N.source);return x},[Te,dr,kn]),xT=m.useMemo(()=>Te==="edit"?Rt:Rt.map(x=>{var N,F;return{...x,draggable:!1,connectable:!1,data:{...x.data,isRunMode:!0,isExecuting:dr.has(x.id),nodeStatus:((N=hs[x.id])==null?void 0:N.status)??null,nodeElapsed:((F=hs[x.id])==null?void 0:F.elapsed)??null,isDim:pu?!pu.has(x.id):!1}}}),[Te,Rt,dr,hs,pu]),wT=m.useMemo(()=>pu?kn.map(x=>{const N=dr.has(x.source)||dr.has(x.target),F=x.className?x.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",U=N?"af-flow-edge--focus":"af-flow-edge--dim";return{...x,className:(F?F+" ":"")+U}}):kn,[kn,dr,pu]);m.useEffect(()=>{if(!u){Zi({}),hr(null),Mn(Lu),bl(Cp),Ao(null),bi(""),_a("");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(N=>N.json()).then(N=>{Zi(N.presets||{}),hr(N.activePreset||null)}).catch(()=>{Zi({}),hr(null)})},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const Oo=m.useCallback(x=>{Pa.current+=1,Mn(x)},[]),Mo=m.useCallback(async(x,N={})=>{if(!x)return;const F=!!N.quiet,U=!!N.force,V=Pa.current;F||(Sf(!0),bi(""),_a(""));const Y=new URLSearchParams({flowId:x.id,flowSource:x.source||"user"});x.archived&&Y.set("archived","1");try{const Q=await fetch(`/api/flow/schedule?${Y.toString()}`),ne=await Q.json().catch(()=>({}));if(!Q.ok)throw new Error(ne.error||`HTTP ${Q.status}`);if(!U&&Pa.current!==V)return;Mn({...Lu,...ne.schedule||{}}),bl(ne.state&&typeof ne.state=="object"?ne.state:Cp),Ao(ne.status||null)}catch(Q){if(!U&&Pa.current!==V)return;Mn(Lu),bl(Cp),Ao(null),bi(String(Q.message||Q))}finally{Sf(!1)}},[]);m.useEffect(()=>{if(!u)return;let x=!1;return(async()=>{await Mo(u)})(),()=>{x=!0}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,Mo]),m.useEffect(()=>{var F,U,V,Y;if(!Ca||!Qn[Ca]||ni.length===0)return;const x=Qn[Ca],N={};for(const Q of ni){const ne=Il[Q.id];if(!ne)continue;const he=((F=Q.data)==null?void 0:F.definitionId)||"",Ee=x[Q.id]??((Y=(V=(U=Q.data)==null?void 0:U.outputs)==null?void 0:V[0])==null?void 0:Y.default)??"";he.startsWith("provide_file")?N[ne]={type:"file",path:Ee}:N[ne]={type:"str",value:Ee}}Object.keys(N).length>0&&Qs(N)},[Ca,Qn,ni,Il]);const vT=m.useCallback(()=>{if(!Ls||!nu.current)return;const x=nu.current.value;yt(N=>N.map(F=>{var U,V;return F.id!==Ls.instanceId?F:{...F,data:{...F.data,outputs:((V=(U=F.data)==null?void 0:U.outputs)==null?void 0:V.map((Y,Q)=>Q===0?{...Y,default:x}:Y))||[{type:"text",name:"value",default:x}]}}})),Nl(null)},[Ls,yt]),rt=m.useMemo(()=>{const x=Rt.filter(N=>N.selected);return x.length===1?x[0]:null},[Rt]),Ii=m.useMemo(()=>u?NW(Rt,kn,e):[],[u,Rt,kn,e]),bT=m.useMemo(()=>Ii.map(x=>x.key).join("|"),[Ii]),Rb=m.useMemo(()=>Ii.some(x=>String((x==null?void 0:x.level)||"warning").toLowerCase()==="error"),[Ii]);m.useLayoutEffect(()=>{H(Ii.length>0&&!Rb)},[bT,u==null?void 0:u.id,u==null?void 0:u.source,Ii.length,Rb]),Da.current=rt,m.useEffect(()=>{Ai.current=Rt},[Rt]),m.useEffect(()=>{Al.current=kn},[kn]),m.useEffect(()=>{Tb.current=Gr},[Gr]),m.useEffect(()=>{if(!Gr)return;const x=F=>{F.key==="Escape"&&Lo(null)},N=F=>{var U,V;(V=(U=F.target)==null?void 0:U.closest)!=null&&V.call(U,".af-connect-node-menu")||Lo(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",N),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",N)}},[Gr]),m.useEffect(()=>()=>{Ro.current!=null&&(clearTimeout(Ro.current),Ro.current=null)},[]);const og=m.useMemo(()=>{var N;if(!rt)return null;const x=(N=rt.data)==null?void 0:N.definitionId;return ue.find(F=>F.id===x)??null},[rt,ue]),ag=m.useMemo(()=>{const x={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const N of ue){const F=cb(N);x[F].push(N)}for(const N of Ku)x[N].sort((F,U)=>F.id.localeCompare(U.id));return x},[ue]),Pf=m.useMemo(()=>{const x=de.trim().toLowerCase();if(!x)return ag;const N={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const F of Ku)N[F]=ag[F].filter(U=>_V(U,x));return N},[ag,de]),kT=m.useMemo(()=>Ku.reduce((x,N)=>x+Pf[N].length,0),[Pf]),Af=m.useMemo(()=>ue.filter(x=>{const N=String(x.id??""),F=String(x.source??"");return N.startsWith("marketplace:")||F==="marketplace"||F==="collection"}),[ue]),Lb=m.useMemo(()=>{const x=new Set;for(const N of Af){const F=String(N.id??"");if(F&&(x.add(F),F.startsWith("marketplace:"))){const U=F.slice(12),[V]=U.split("@");V&&x.add(`marketplace:${V}`)}}return x},[Af]),If=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(()=>{If()},[If]),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 N=()=>{fetch("/api/model-lists").then(U=>U.json()).then(U=>{x||eg({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(()=>{})};N();const F=setTimeout(N,4e3);return()=>{x=!0,clearTimeout(F)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skills").then(N=>N.json()).then(N=>{if(x)return;const F=Array.isArray(N.skills)?N.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):""})):[];jf(F),X(!0)}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skill-collections").then(N=>N.json()).then(N=>{x||(ee(la(N)),me(!0))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{if(At(""),!(!B||!re)){if(!Xe){P([]);return}P(RE(Xe,"pipeline",ei,G)),At(Xe)}},[G,re,ei,B,Xe]),m.useEffect(()=>{if(!(Oe!==Xe||!Xe))try{localStorage.setItem(Xe,JSON.stringify(Ci))}catch{}},[Ci,Xe,Oe]);const Ob=m.useCallback(async x=>{const N=x.source??"user",F=!!x.archived,U=new URLSearchParams({flowId:x.id,flowSource:N});F&&U.set("archived","1");const V=new URLSearchParams({flowId:x.id,flowSource:N});F&&V.set("archived","1"),V.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[Y,Q]=await Promise.all([fetch("/api/flow?"+U.toString()),fetch("/api/nodes?"+V.toString())]),ne=await Y.json();if(!Y.ok||ne.error)throw new Error(ne.error||e("flow:nodePropsError.loadFlowFailed"));const he=await Q.json();if(!Q.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const Ee=Array.isArray(he)?he:Array.isArray(he==null?void 0:he.nodes)?he.nodes:[],$e=!Array.isArray(he)&&(he==null?void 0:he.pipelineTranslations)||{},ie=bW(ne.flowYaml||"");if(ie.error)throw new Error(ie.error);const Ae={...ie.instances||{}},we=ie.nodes.map(sn=>Yd(sn,Ae,Ee,$e,x.id)),st=aI(ie.edges,we);return{flowSource:N,paletteList:Ee,instances:Ae,flowDescriptionText:ie.description??"",nodes:we,edges:st}},[t.language,e]),$s=m.useCallback(async(x,N={})=>{const F=!!N.preserveComposer,U=F&&!!N.incrementalSync;fu.current=!1,sg.current+=1,f(x),g(""),F||(w(""),se(""),gn(null),k(""),M(""),K(""),Os(""),Eb([]),Pi([]),uu([]),_b(!1),du(null),ru("pan")),U||($r.current={},yt([]),dn([])),ZN(x);try{const V=await Ob(x);if(le(V.paletteList),$r.current=V.instances,k(V.flowDescriptionText),M(x.id||""),U){const Y=Ai.current,Q=Al.current;try{const ne=Q8(Y,Q,V.nodes,V.edges),he=new Set([...ne.changes.addedNodeIds,...ne.changes.updatedNodeIds]),Ee=new Set([...ne.changes.addedEdgeKeys,...ne.changes.updatedEdgeKeys]),$e=he.size>0?ne.nodes.map(Ae=>he.has(Ae.id)?{...Ae,className:HN(Ae.className,zN)}:Ae):ne.nodes,ie=Ee.size>0?ne.edges.map(Ae=>Ee.has(Ud(Ae))?{...Ae,className:HN(Ae.className,BN)}:Ae):ne.edges;yt($e),dn(ie),Ro.current!=null&&(clearTimeout(Ro.current),Ro.current=null),(he.size>0||Ee.size>0)&&(Ro.current=window.setTimeout(()=>{Ro.current=null,he.size>0&&yt(Ae=>Ae.map(we=>{if(!he.has(we.id))return we;const st=UN(we.className,zN);return st===String(we.className||"")?we:{...we,className:st}})),Ee.size>0&&dn(Ae=>Ae.map(we=>{if(!Ee.has(Ud(we)))return we;const st=UN(we.className,BN);return st===String(we.className||"")?we:{...we,className:st}}))},jV))}catch{yt(V.nodes),dn(V.edges)}}else yt(V.nodes),dn(V.edges),h(Y=>Y+1);ap(x.id,V.flowSource),_l(Y=>Y+1);try{Ef.current=NN(V.nodes,V.edges,V.instances,{description:V.flowDescriptionText})}catch{Ef.current=""}fu.current=!0}catch(V){g(String(V.message||V))}},[Ob,yt,dn]),Tf=m.useCallback(async()=>{if(!(u!=null&&u.id))return;const x=u.source??"user",N=new URLSearchParams({flowId:u.id,flowSource:x});u.archived&&N.set("archived","1"),N.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const F=await fetch("/api/nodes?"+N.toString()),U=await F.json();if(!F.ok)throw new Error((U==null?void 0:U.error)||e("flow:nodePropsError.loadNodesFailed"));const V=Array.isArray(U)?U:Array.isArray(U==null?void 0:U.nodes)?U.nodes:[];le(V)},[u,e,t.language]),lg=m.useCallback(async()=>{On(!0),Qt("");try{const x=await fetch("/api/marketplace/nodes"),N=await x.json().catch(()=>({}));if(!x.ok)throw new Error((N==null?void 0:N.error)||"Failed to load marketplace nodes");Ln(Array.isArray(N==null?void 0:N.nodes)?N.nodes:[])}catch(x){Qt(String(x.message||x)),Ln([])}finally{On(!1)}},[]),Rf=m.useCallback(async()=>{Ct(!0),Ce("");try{const x=await fetch("/api/marketplace/flow-snippets"),N=await x.json().catch(()=>({}));if(!x.ok)throw new Error((N==null?void 0:N.error)||"Failed to load flow snippets");lt(Array.isArray(N==null?void 0:N.snippets)?N.snippets:[])}catch(x){Ce(String(x.message||x)),lt([])}finally{Ct(!1)}},[]);m.useEffect(()=>{u&&(lg(),Rf())},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,lg,Rf]);const ST=m.useCallback(async x=>{if(!u||!x)return;const N=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`;if(N){pe(N),Qt("");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:N})}),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 Tf()}catch(F){Qt(String(F.message||F))}finally{pe("")}}},[u,Tf]),NT=m.useCallback(async(x,N)=>{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:N,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)}),V=await U.json();if(!U.ok||(V==null?void 0:V.ok)===!1)throw new Error((V==null?void 0:V.error)||"Publish failed");return await Tf(),V},[Tf,u]),Mb=m.useCallback(async()=>{var U;if(!u||ce.current)return;const x=u.id,N=u.source??"user",F=((U=Da.current)==null?void 0:U.id)??null;ce.current=!0,ae(!0);try{await $s({id:x,source:N,archived:u.archived},{preserveComposer:!0,incrementalSync:!0}),F&&yt(V=>V.map(Y=>({...Y,selected:Y.id===F})))}finally{ce.current=!1,ae(!1)}},[u,u==null?void 0:u.archived,$s,yt]);m.useEffect(()=>{if(Ab.current||a.length===0)return;const x=new URLSearchParams(window.location.search),N=x.get("flowId");if(!N)return;const F=x.get("flowSource")??"user",U=x.get("flowArchived")==="1",V=a.find(Y=>Y.id===N&&(Y.source??"user")===F&&!!Y.archived===U);V&&(Ab.current=!0,$s(V))},[a,$s]);const Lf=m.useRef(0);m.useEffect(()=>{if(!u)return;const x=u.id,N=u.source??"user",F=!!u.archived;Lf.current=0;let U=!1;const V=async()=>{var ne;if(U)return;const Q=new URLSearchParams({flowId:x,flowSource:N,v:String(Lf.current)});F&&Q.set("archived","1");try{const he=await fetch("/api/flow-editor-sync-poll?"+Q.toString());if(!he.ok||U)return;const Ee=await he.json();if(U)return;if(Ee.changed){Lf.current=Ee.version;const $e=((ne=Da.current)==null?void 0:ne.id)??null;await $s({id:x,source:N,archived:F},{preserveComposer:!0,incrementalSync:!0}),await Mo({id:x,source:N,archived:F},{quiet:!0,force:!0}),$e&&yt(ie=>ie.map(Ae=>({...Ae,selected:Ae.id===$e})))}else Lf.current=Ee.version}catch{}},Y=window.setInterval(V,2e3);return V(),()=>{U=!0,window.clearInterval(Y)}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,$s,Mo,yt]);const jT=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,N=window.setTimeout(()=>w(""),x);return()=>clearTimeout(N)},[v,e]),m.useEffect(()=>{E("")},[u==null?void 0:u.id,u==null?void 0:u.source]),m.useEffect(()=>{const x=()=>{window.__provideEditContent&&(Nl(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",x),()=>window.removeEventListener("provide-expand",x)},[]),m.useEffect(()=>{var ne,he,Ee,$e,ie,Ae,we;if(!rt){au(null);return}const x=$r.current[rt.id]||{},{inputs:N,outputs:F}=oI(rt),U=String(((ne=rt.data)==null?void 0:ne.definitionId)??rt.id??""),V=((he=rt.data)==null?void 0:he.script)!=null?String(rt.data.script):void 0,Y=x.script!=null?String(x.script):void 0,Q=U==="tool_nodejs"||V&&V.trim()!==""||Y&&Y.trim()!==""?String(V??Y??""):"";au({id:rt.id,newId:rt.id,label:String(((Ee=rt.data)==null?void 0:Ee.label)??rt.id),role:(($e=rt.data)==null?void 0:$e.role)??"普通",model:String(((ie=rt.data)==null?void 0:ie.model)??x.model??""),body:String(((Ae=rt.data)==null?void 0:Ae.body)??x.body??""),images:ss(((we=rt.data)==null?void 0:we.images)??x.images),script:Q,inputs:N,outputs:F})},[rt==null?void 0:rt.id,Qm]),m.useEffect(()=>{u&&(rt||(ou.current=null,gn(x=>x==="node"?null:x)))},[u,rt==null?void 0:rt.id]);const Of=m.useCallback(()=>{ou.current=null,gn(x=>x==="settings"||x==="history"?x:"node")},[]),CT=m.useCallback((x,N)=>{x.metaKey||x.ctrlKey||x.shiftKey||Te!=="edit"&&Lr((N==null?void 0:N.id)??null)},[Te]),ET=m.useCallback((x,N)=>{Te==="edit"&&(x.preventDefault(),yt(F=>F.map(U=>({...U,selected:U.id===N.id}))),dn(F=>F.map(U=>({...U,selected:!1}))),Of())},[Of,Te,dn,yt]),_T=m.useCallback((x,N)=>{if(Te!=="edit")return;const F=x.metaKey||x.ctrlKey||x.shiftKey;dn(U=>U.map(V=>V.id===N.id?{...V,selected:!V.selected||!F}:F?V:{...V,selected:!1})),F||yt(U=>U.map(V=>({...V,selected:!1})))},[Te,dn,yt]),PT=m.useCallback(x=>KN(x,Ai.current),[]),AT=m.useCallback(x=>{if(!KN(x,Ai.current)){w("端口类型不匹配,已取消连线");return}Lo(null),yt(N=>Xh(N,x)),dn(N=>{const F=N.filter(U=>!(U.target===x.target&&U.targetHandle===x.targetHandle));return zd({...x,markerEnd:{type:cs.ArrowClosed}},F)})},[dn,yt]),IT=m.useCallback((x,N)=>{ig.current=PV(N,Ai.current),Lo(null)},[]),TT=m.useCallback((x,N)=>{var we,st,sn,Yt;const F=ig.current;if(ig.current=null,!u||!F||N!=null&&N.toNode)return;const U=IV(ue,F);if(U.length===0){w(`没有匹配 ${F.slotType} 端口的节点`);return}const V=((st=(we=x==null?void 0:x.changedTouches)==null?void 0:we[0])==null?void 0:st.clientX)??(x==null?void 0:x.clientX),Y=((Yt=(sn=x==null?void 0:x.changedTouches)==null?void 0:sn[0])==null?void 0:Yt.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(V)||!Number.isFinite(Y))return;const Q=za.current,ne=document.querySelector(".af-pipeline-flow .react-flow");if(!Q||!ne)return;const he=ne.getBoundingClientRect(),Ee=320,$e=Math.min(440,104+U.length*58),ie=Math.max(12,Math.min(V-he.left,he.width-Ee-12)),Ae=Math.max(12,Math.min(Y-he.top,he.height-$e-12));Lo({left:ie,top:Ae,flowPosition:Q.screenToFlowPosition({x:V,y:Y}),draft:F,candidates:U,query:""})},[ue,u]),RT=m.useCallback(x=>{for(const N of x)delete $r.current[N.id]},[]),LT=m.useCallback(x=>{za.current=x},[]),OT=m.useCallback(x=>{yt(F=>F.map(U=>({...U,selected:U.id===x}))),dn(F=>F.map(U=>({...U,selected:!1}))),Of();const N=()=>{var he,Ee,$e;const F=za.current;if(!(F!=null&&F.getNode))return;const U=F.getNode(x);if(!U)return;const V=(he=F.getInternalNode)==null?void 0:he.call(F,x),Y=((Ee=V==null?void 0:V.measured)==null?void 0:Ee.width)??(V==null?void 0:V.width)??U.width??200,Q=(($e=V==null?void 0:V.measured)==null?void 0:$e.height)??(V==null?void 0:V.height)??U.height??88,{zoom:ne}=F.getViewport();F.setCenter(U.position.x+Y/2,U.position.y+Q/2,{zoom:XN(ne),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(N))},[yt,dn,Of]),MT=m.useCallback(x=>{yt(F=>F.map(U=>({...U,selected:U.id===x}))),dn(F=>F.map(U=>({...U,selected:!1})));const N=()=>{var Ee,$e,ie;const F=za.current;if(!(F!=null&&F.getNode))return;const U=F.getNode(x);if(!U)return;const V=(Ee=F.getInternalNode)==null?void 0:Ee.call(F,x),Y=(($e=V==null?void 0:V.measured)==null?void 0:$e.width)??(V==null?void 0:V.width)??U.width??200,Q=((ie=V==null?void 0:V.measured)==null?void 0:ie.height)??(V==null?void 0:V.height)??U.height??88,{zoom:ne}=F.getViewport(),he=XN(ne);F.setCenter(U.position.x+Y/2,U.position.y+Q/2,{zoom:he,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(N))},[yt,dn]),Tl=m.useCallback((x,N)=>{const F=`node-${Date.now()}`;return SI(x,F,N,$r.current,ue)},[ue]),$b=m.useCallback(x=>{if(!u||!x)return;let N={x:180,y:160};const F=za.current,U=document.querySelector(".af-pipeline-flow .react-flow");if(F&&U){const V=U.getBoundingClientRect();N=F.screenToFlowPosition({x:V.left+V.width*.45,y:V.top+V.height*.38})}yt(V=>[...V,Tl(x,N)])},[u,yt,Tl]),$T=m.useCallback(x=>{const N=Tb.current;if(!u||!N||!(x!=null&&x.def))return;const F=Tl(x.def,N.flowPosition),U=N.draft.handleType==="source"?{source:N.draft.nodeId,sourceHandle:N.draft.handleId,target:F.id,targetHandle:`input-${x.slotIndex}`}:{source:F.id,sourceHandle:`output-${x.slotIndex}`,target:N.draft.nodeId,targetHandle:N.draft.handleId};yt(V=>Xh([...V,F],U)),dn(V=>{const Y=V.filter(Q=>!(Q.target===U.target&&Q.targetHandle===U.targetHandle));return zd({...U,markerEnd:{type:cs.ArrowClosed}},Y)}),Lo(null)},[u,Tl,yt,dn]),DT=m.useCallback(x=>{x.preventDefault(),x.dataTransfer.dropEffect="move"},[]),FT=m.useCallback(x=>{var Q;if(x.preventDefault(),!u)return;const N=za.current;if(!N)return;const F=N.screenToFlowPosition({x:x.clientX,y:x.clientY}),U=x.dataTransfer.getData("application/agentflow-snippet");if(U){const ne=He.find(he=>`${he.id}@${he.version}`===U);ne&&((Q=_f.current)==null||Q.call(_f,ne,F));return}const V=x.dataTransfer.getData("application/agentflow-node");if(!V)return;const Y=ue.find(ne=>ne.id===V);Y&&yt(ne=>[...ne,Tl(Y,F)])},[u,ue,He,yt,Tl]),Ti=m.useCallback(async(x,N)=>{if(!u)return;const F=NN(x,N,$r.current,{description:y});if(F!==Ef.current){w(e("flow:status.saving"));try{const U=GV(u.source),V=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 V.json();if(!V.ok||!Y.success)throw new Error(Y.error||e("flow:status.saveFailed"));if(Ef.current=F,w(e("flow:status.saved")),u.source==="builtin"&&U==="workspace"){const Q={id:u.id,source:"workspace",path:void 0};f(Q),ZN(Q),ap(u.id,"workspace")}}catch(U){w(e("flow:status.saveFailed")+": "+(U.message||U))}}},[u,y]);m.useEffect(()=>{if(!u||!fu.current||Te!=="edit"||u.archived)return;const x=sg.current,N=setTimeout(()=>{x===sg.current&&fu.current&&Ti(Ai.current,Al.current)},400);return()=>clearTimeout(N)},[Rt,kn,y,Te,u,Ti]);const Mf=m.useCallback(async x=>{if(!u||u.archived)return;const N=u.source??"user";if(!(N!=="user"&&N!=="workspace")&&N!==x){A(!0),E("");try{const F=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,fromSource:N,toSource:x})}),U=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof U.error=="string"?U.error:e("flow:composer.requestFailed"));const V=U.flowSource==="workspace"||U.flowSource==="user"?U.flowSource:x;let Y={id:u.id,source:V,archived:u.archived};try{const Q=await fetch("/api/flows");if(Q.ok){const ne=await Q.json(),he=Array.isArray(ne)?ne.find(Ee=>Ee.id===u.id&&(Ee.source??"user")===V&&!!Ee.archived==!!u.archived):null;he&&(Y=he)}}catch{}await $s(Y,{preserveComposer:!0}),ap(u.id,V)}catch(F){E(String(F.message||F))}finally{A(!1)}}},[u,$s]),cg=m.useCallback(async()=>{if(u){Qc(!0),bi(""),_a("");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:Pn})}),N=await x.json().catch(()=>({}));if(!x.ok||!N.success)throw new Error(N.error||"Failed to save schedule");Mn({...Lu,...N.schedule||{}}),_a(e("flow:schedule.saved")),await Mo(u,{quiet:!0,force:!0})}catch(x){bi(String(x.message||x))}finally{Qc(!1)}}},[u,Pn,Mo,e]),zT=m.useCallback(async()=>{u&&(await Ti(Ai.current,Al.current),!u.archived&&u.source!=="builtin"&&await cg())},[u,Ti,cg]),$f=m.useCallback(async()=>{if(!u||!R.trim())return;const x=R.trim();if(x===u.id){K("");return}D(!0),K("");try{const N=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 N.json().catch(()=>({}));if(!N.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 V=await fetch("/api/flows");if(V.ok){const Y=await V.json(),Q=Array.isArray(Y)?Y.find(ne=>ne.id===F.flowId&&(ne.source??"user")===(F.flowSource??u.source)):null;Q&&(U=Q)}}catch{}await $s(U,{preserveComposer:!0}),ap(F.flowId,F.flowSource??u.source)}catch(N){K(String(N.message||N))}finally{D(!1)}},[u,R,$s]),Db=m.useCallback(x=>{navigator.clipboard.writeText(x).then(()=>{L(!0),setTimeout(()=>L(!1),2e3)}).catch(()=>{})},[]),ug=m.useCallback(()=>{Ti(Rt,kn)},[Ti,Rt,kn]),BT=m.useCallback((x,N)=>{const F=N.trim()===""||N==="default"?void 0:N.trim(),U=Rt.map(V=>V.id===x?{...V,data:{...V.data,model:F}}:V);yt(U),Ti(U,kn)},[Rt,kn,yt,Ti]),Df=m.useCallback(()=>{var st,sn;if(!gt||!u||!rt)return!1;const x=rt.id,N=gt.newId.trim();if(Fa(""),!mI.test(N))return Fa(e("flow:nodePropsError.invalidInstanceId")),!1;if(Rt.some(Yt=>Yt.id===N&&Yt.id!==x))return Fa(e("flow:nodePropsError.duplicateInstanceId")),!1;const F=gt.role.trim(),U=ga.includes(F)?F:"普通",V=gt.model.trim(),Y=Yt=>(Array.isArray(Yt)?Yt:[]).map(Mt=>({type:String((Mt==null?void 0:Mt.type)??"节点").trim()||"节点",name:String((Mt==null?void 0:Mt.name)??""),default:String((Mt==null?void 0:Mt.default)??""),required:!!(Mt!=null&&Mt.required),showOnNode:(Mt==null?void 0:Mt.showOnNode)!=null?Mt.showOnNode!==!1:!!(Mt!=null&&Mt.required)||String((Mt==null?void 0:Mt.type)??"节点").trim().toLowerCase()==="node"})),Q=Y(gt.inputs),ne=Y(gt.outputs),he=String(((st=rt.data)==null?void 0:st.definitionId)??N),Ee=he.startsWith("provide_"),$e={...rt.data,label:gt.label.trim()||N,role:U,model:V===""||V==="default"?void 0:V,body:Ee?"":gt.body,images:Ee?[]:ss(gt.images),inputs:Q,outputs:Ee&&Array.isArray((sn=rt.data)==null?void 0:sn.outputs)?rt.data.outputs:ne},ie=String(gt.script??"").trim();he==="tool_nodejs"||ie!==""?$e.script=String(gt.script??""):delete $e.script;let Ae,we=kn;if(N!==x){const Yt={...$r.current},Mt={...Yt[x]||{}};delete Yt[x],Yt[N]=Mt,$r.current=Yt,Ae=Rt.map(pt=>pt.id!==x?pt:{...pt,id:N,selected:!0,data:$e}),we=kn.map((pt,Re)=>({...pt,source:pt.source===x?N:pt.source,target:pt.target===x?N:pt.target,id:`e-${pt.source===x?N:pt.source}-${pt.target===x?N:pt.target}-${Re}`}))}else Ae=Rt.map(Yt=>Yt.id===x?{...Yt,data:$e}:Yt);return yt(Ae),dn(we),Nr(N),Ti(Ae,we),!0},[gt,u,rt,Rt,kn,yt,dn,Nr,Ti]),dg=m.useCallback(()=>{var sn,Yt;if(!gt||!u||!rt)return!1;const x=rt.id,N=gt.role.trim(),F=ga.includes(N)?N:"普通",U=gt.model.trim(),V=Mt=>(Array.isArray(Mt)?Mt:[]).map(pt=>({type:String((pt==null?void 0:pt.type)??"节点").trim()||"节点",name:String((pt==null?void 0:pt.name)??""),default:String((pt==null?void 0:pt.default)??""),required:!!(pt!=null&&pt.required),showOnNode:(pt==null?void 0:pt.showOnNode)!=null?pt.showOnNode!==!1:!!(pt!=null&&pt.required)||String((pt==null?void 0:pt.type)??"节点").trim().toLowerCase()==="node"})),Y=V(gt.inputs),Q=V(gt.outputs),ne=String(((sn=rt.data)==null?void 0:sn.definitionId)??x),he=ne.startsWith("provide_"),Ee=gt.label.trim()||x,$e=U===""||U==="default"?void 0:U,ie={...rt.data,label:Ee,role:F,model:$e,body:he?"":gt.body,images:he?[]:ss(gt.images),inputs:Y,outputs:he&&Array.isArray((Yt=rt.data)==null?void 0:Yt.outputs)?rt.data.outputs:Q},Ae=String(gt.script??"").trim();ne==="tool_nodejs"||Ae!==""?ie.script=String(gt.script??""):delete ie.script;const we=rt.data||{};return(we.label!==ie.label||we.role!==ie.role||we.model!==ie.model||we.body!==ie.body||JSON.stringify(ss(we.images))!==JSON.stringify(ie.images)||(we.script??void 0)!==(ie.script??void 0)||JSON.stringify(we.inputs||[])!==JSON.stringify(Y)||JSON.stringify(we.outputs||[])!==JSON.stringify(Q))&&(yt(Mt=>Mt.map(pt=>pt.id===x?{...pt,data:ie}:pt)),Nr(x)),!0},[gt,u,rt,yt,Nr]),Fb=m.useRef(dg);m.useEffect(()=>{Fb.current=dg},[dg]),m.useEffect(()=>{if(!gt||!u||!fu.current||Te!=="edit")return;const x=setTimeout(()=>{Fb.current()},400);return()=>clearTimeout(x)},[gt,u,Te]);const HT=m.useCallback(()=>{if(!(!gt||!rt)){if(gt.newId.trim()===rt.id){Fa("");return}Df()}},[gt,rt,Df]);m.useEffect(()=>{const x=N=>{var U,V,Y;if(Te!=="edit")return;const F=uI(N.target);if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="s"){if(ct==="node"&&rt&>){N.preventDefault(),N.stopPropagation(),Df()||ug();return}if(F)return;N.preventDefault(),N.stopPropagation(),ug();return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="k"){N.preventDefault(),N.stopPropagation(),iu(Q=>!Q);return}if(!su){if(Cl){if(N.key==="Escape"){N.preventDefault(),$a(!1);return}if(Qh(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),$a(!1);return}(N.key==="v"||N.key==="V"||N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey&&N.preventDefault();return}if(!F){if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="c"){const Q=nI(Ai.current,Al.current,$r.current);Q&&(N.preventDefault(),N.stopPropagation(),Ib.current=Q,w(`Copied ${Q.nodes.length} node${Q.nodes.length>1?"s":""}`));return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="v"){const Q=rI(Ib.current,Ai.current,Al.current,$r.current);Q&&(N.preventDefault(),N.stopPropagation(),$r.current=Q.instances,yt(Q.nodes),dn(Q.edges),w(`Pasted ${Q.pastedNodeIds.length} node${Q.pastedNodeIds.length>1?"s":""}`));return}if((N.key==="a"||N.key==="A")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),N.stopPropagation(),(U=je.current)==null||U.focus(),(Y=(V=je.current)==null?void 0:V.select)==null||Y.call(V);return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="a"){N.preventDefault(),N.stopPropagation(),yt(Q=>Q.map(ne=>({...ne,selected:!0}))),dn(Q=>Q.map(ne=>({...ne,selected:!1})));return}if(Qh(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),$a(Q=>!Q);return}if((N.key==="v"||N.key==="V")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),ru("select");return}if((N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),ru("pan");return}}}};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[ug,Cl,su,ct,rt,gt,Df,Te]),m.useEffect(()=>{if(Te!=="running"||ms==null)return;let x=Math.floor((Date.now()-ms)/1e3);const N=setInterval(()=>{const F=Date.now()-ms,U=Math.floor(F/1e3);U!==x&&(x=U,jr(F))},500);return()=>clearInterval(N)},[Te,ms]),m.useEffect(()=>{const x=Aa.current;!x||!x.parentElement||kl.current&&(no.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{no.current=!1}))},[Ts]),m.useEffect(()=>{const x=Aa.current;if(!x)return;const N=x.parentElement;if(!N)return;const F=()=>{if(no.current)return;const U=N.scrollHeight-N.scrollTop-N.clientHeight;kl.current=U<40};return N.addEventListener("scroll",F,{passive:!0}),()=>N.removeEventListener("scroll",F)},[gs,Te]),m.useEffect(()=>{if(Te==="edit"||!gs)return;kl.current=!0;const x=Aa.current;x&&(no.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{no.current=!1}))},[Te,gs]),m.useEffect(()=>{Ts.length>th+JN&&mt(x=>x.length>th+JN?x.slice(-th):x)},[Ts]);const UT=m.useCallback(x=>{if(x.button!==0)return;x.preventDefault();const N=x.currentTarget;zt.current={active:!0,pointerId:x.pointerId,startY:x.clientY,startH:vt},N.setPointerCapture(x.pointerId)},[vt]),WT=m.useCallback(x=>{const N=zt.current;if(!N.active||x.pointerId!==N.pointerId)return;const F=N.startY-x.clientY;_n(nh(N.startH+F))},[]),Ff=m.useCallback(()=>{_n(x=>{const N=nh(x);try{localStorage.setItem(NI,String(N))}catch{}return N})},[]),zb=m.useCallback(x=>{const N=zt.current;if(!(!N.active||x.pointerId!==N.pointerId)){N.active=!1;try{x.currentTarget.releasePointerCapture(x.pointerId)}catch{}Ff()}},[Ff]),VT=m.useCallback(()=>{const x=zt.current;x.active&&(x.active=!1,Ff())},[Ff]);m.useEffect(()=>{function x(){_n(N=>nh(N))}return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const Ri=m.useCallback(async(x={})=>{if(!u)return;const N=x.runUuid!=null&&String(x.runUuid).trim()?String(x.runUuid).trim():null,F=x.cliInputsOverride??pr.current,U=!!x.prepareOnly;if(Bt(U?"ready":"running"),mt(U?[]:[{ts:new Date().toISOString(),type:"info",text:N?e("flow:run.connectingApiResume",{uuid:N}):e("flow:run.connectingApi")}]),rn(new Set),Wn({}),ys(!U),gn(null),N||Zt(null),U)return;if(!N){const Y=Date.now();fr(Y),jr(0)}const V=new AbortController;Zs.current=V;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",...N?{uuid:N}:{},cliInputs:F}),signal:V.signal});if(!Y.ok){const ie=await Y.json().catch(()=>({error:e("flow:composer.requestFailed")}));mt(Ae=>[...Ae,{ts:new Date().toISOString(),type:"error",text:ie.error||e("flow:composer.requestFailed")}]),Bt("error");return}if(mt(ie=>[...ie,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!Y.body){mt(ie=>[...ie,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),Bt("error");return}const Q=Y.body.getReader(),ne=new TextDecoder;let he="";const Ee=ie=>{const Ae=ie.ts||new Date().toISOString();if(ie.type==="event")if(ie.event==="node-start")rn(we=>new Set(we).add(ie.instanceId)),Wn(we=>({...we,[ie.instanceId]:{status:"running",startMs:Date.now()}})),mt(we=>[...we,{ts:Ae,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"){rn(st=>{const sn=new Set(st);return sn.delete(ie.instanceId),sn});const we=ie.elapsed??null;Wn(st=>({...st,[ie.instanceId]:{status:"success",elapsed:we}})),mt(st=>[...st,{ts:Ae,type:"node-done",text:we?e("flow:run.nodeDoneWithElapsed",{instanceId:ie.instanceId,elapsed:we}):e("flow:run.nodeDone",{instanceId:ie.instanceId})}])}else if(ie.event==="node-failed")rn(we=>{const st=new Set(we);return st.delete(ie.instanceId),st}),Wn(we=>({...we,[ie.instanceId]:{status:"failed",elapsed:ie.elapsed??null}})),mt(we=>[...we,{ts:Ae,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:ie.instanceId})}]);else if(ie.event==="apply-start"){if(ie.uuid&&Zt(String(ie.uuid)),typeof ie.runStartTime=="number"&&ie.runStartTime>0)fr(ie.runStartTime),jr(Math.max(0,Date.now()-ie.runStartTime));else if(typeof ie.totalExecutedMs=="number"&&ie.totalExecutedMs>0){const we=Date.now()-ie.totalExecutedMs;fr(we),jr(ie.totalExecutedMs)}mt(we=>[...we,{ts:Ae,type:"info",text:e("flow:run.pipelineStart",{uuid:ie.uuid||"?"})}])}else ie.event==="apply-done"?mt(we=>[...we,{ts:Ae,type:"info",text:ie.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:ie.totalElapsed}):e("flow:run.pipelineDone")}]):ie.event==="apply-paused"?mt(we=>[...we,{ts:Ae,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(ie.pendingNodes||[]).join(", ")})}]):mt(we=>[...we,{ts:Ae,type:"event",text:`[${ie.event}] ${JSON.stringify(ie)}`}]);else ie.type==="user-check-content"?(Io({instanceId:ie.instanceId,execId:ie.execId??1,inputPath:ie.inputPath,outputPath:ie.outputPath,content:ie.content||""}),To(ie.content||""),ro(!1),Si(""),Sl(!1),mt(we=>[...we,{ts:Ae,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:ie.instanceId})}])):ie.type==="user-ask-prompt"?($n({instanceId:ie.instanceId,execId:ie.execId??1,question:ie.question||"",options:Array.isArray(ie.options)?ie.options:[]}),Ra(!1),mt(we=>[...we,{ts:Ae,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:ie.instanceId,defaultValue:`等待用户选择 (${ie.instanceId})`})}])):ie.type==="tool-print-content"?(Oa({instanceId:ie.instanceId,execId:ie.execId??1,content:ie.content||"",createdAt:Date.now()}),tu(!1)):ie.type==="log"?mt(we=>[...we,{ts:Ae,type:"log",text:ie.text!=null?String(ie.text):""}]):ie.type==="error"?mt(we=>[...we,{ts:Ae,type:"error",text:ie.message||e("flow:run.unknownError")}]):ie.type==="done"?mt(we=>[...we,{ts:Ae,type:"done",text:e("flow:run.executionEnd",{exitCode:ie.exitCode??"?"})}]):mt(we=>[...we,{ts:Ae,type:"log",text:JSON.stringify(ie)}])},$e=ie=>{if(ie.trim())try{Ee(JSON.parse(ie))}catch{mt(Ae=>[...Ae,{ts:new Date().toISOString(),type:"log",text:ie}])}};for(;;){const{done:ie,value:Ae}=await Q.read();he+=ne.decode(Ae??new Uint8Array,{stream:!ie});const we=he.split(`
|
|
133
|
+
`);he=we.pop()??"";for(const st of we)$e(st);if(ie)break}he.trim()&&$e(he),Bt("done")}catch(Y){Y.name==="AbortError"?(mt(Q=>[...Q,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),Bt("stopped")):(mt(Q=>[...Q,{ts:new Date().toISOString(),type:"error",text:Y.message||e("flow:run.unknownError")}]),Bt("error"))}finally{Zs.current=null,rn(new Set)}},[u]),[KT,fg]=m.useState(!1),qT=m.useCallback(()=>{fg(!0)},[]),YT=m.useCallback(async()=>{if(fg(!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{}Bt("stopped"),rn(new Set)},[u]),Ba=m.useCallback(()=>{Bt("edit"),rn(new Set),Wn({}),Lr(null),Zt(null)},[]),[GT,zf]=m.useState(!1),XT=m.useCallback(async()=>{if(zf(!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{}Ba()},[u,Ba]),JT=m.useCallback(()=>{zf(!1),n("/projects")},[n]),QT=m.useCallback(x=>{const N=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;Zt(N);const U=x.status||"unknown";let V="stopped";U==="success"?V="done":U==="failed"?V="error":U==="running"?V="running":V="stopped",Bt(V);const Y=typeof x.at=="number"?x.at:null;if(V==="running"&&Y!=null?(fr(Y),jr(Math.max(0,Date.now()-Y))):Y!=null&&typeof x.endedAt=="number"&&x.endedAt>Y?(fr(null),jr(x.endedAt-Y)):(fr(null),jr(Math.max(0,x.durationMs??0))),mt([]),rn(new Set),Wn({}),Lr(null),gn(null),ys(!1),N&&F){const Q=new URLSearchParams({flowId:F,runId:N});fetch(`/api/run-node-statuses?${Q}`).then(ne=>ne.json()).then(ne=>{const he=ne.statuses&&typeof ne.statuses=="object"?ne.statuses:{},Ee={};for(const[$e,ie]of Object.entries(he))ie&&typeof ie=="object"&&typeof ie.status=="string"&&(Ee[$e]={status:ie.status,...ie.elapsed!=null&&String(ie.elapsed).trim()!==""?{elapsed:String(ie.elapsed)}:{}});Wn(Ee)}).catch(()=>{})}},[u==null?void 0:u.id]);m.useEffect(()=>{if(!(u!=null&&u.id)||Te!=="edit")return;let x=!1;return(async()=>{try{const N=await fetch("/api/pipeline-recent-runs"),F=await N.json();if(x||!N.ok)return;const V=(Array.isArray(F.runs)?F.runs:[]).find(ne=>ne.flowId===u.id&&ne.status==="running");if(!V||x)return;const Y=V.runId||null;Zt(Y),Bt("running"),ys(!0),fr(V.at||Date.now()),Vr.current=0;const Q=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${Y},已恢复运行视图`}];if(Y){const ne=new URLSearchParams({flowId:u.id,runId:Y}),Ee=await(await fetch(`/api/run-node-statuses?${ne}`)).json();if(x)return;const $e=Ee.statuses&&typeof Ee.statuses=="object"?Ee.statuses:{},ie={},Ae=new Set;for(const[we,st]of Object.entries($e))st&&typeof st=="object"&&typeof st.status=="string"&&(ie[we]={status:st.status,...st.elapsed!=null&&String(st.elapsed).trim()!==""?{elapsed:String(st.elapsed)}:{}},st.status==="running"&&Ae.add(we));Wn(ie),rn(Ae);try{const we=new URLSearchParams({flowId:u.id,runId:Y,sinceBytes:"0",tailBytes:"262144"}),st=await fetch(`/api/run-log?${we}`);if(st.ok){const sn=await st.json();if(!x){Vr.current=Number(sn.bytes||0);const Yt=QN(typeof sn.text=="string"?sn.text:"");mt([...Yt,...Q]);return}}}catch{}}mt(Q)}catch{}})(),()=>{x=!0}},[u==null?void 0:u.id]),m.useEffect(()=>{if(Te==="edit"||!(u!=null&&u.id)||!bt)return;let x=!1,N=null;const F=async()=>{try{const U=new URLSearchParams({flowId:u.id,runId:bt}),V=await fetch(`/api/run-node-statuses?${U}`);if(!V.ok)return;const Y=await V.json();if(x)return;const Q=Y.statuses&&typeof Y.statuses=="object"?Y.statuses:{},ne={},he=new Set;for(const[Ee,$e]of Object.entries(Q))$e&&typeof $e=="object"&&typeof $e.status=="string"&&(ne[Ee]={status:$e.status,...$e.elapsed!=null&&String($e.elapsed).trim()!==""?{elapsed:String($e.elapsed)}:{}},$e.status==="running"&&he.add(Ee));Wn(Ee=>KV(Ee,ne)?Ee:ne),rn(Ee=>qV(Ee,he)?Ee:he);try{const Ee=new URLSearchParams({flowId:u.id,runId:bt,sinceBytes:String(Vr.current||0),tailBytes:String(HV)}),$e=await fetch(`/api/run-log?${Ee}`);if($e.ok){const ie=await $e.json();if(x)return;const Ae=Number(ie.bytes||0),we=typeof ie.text=="string"?ie.text:"";if(we){const st=QN(we);st.length>0&&mt(sn=>[...sn,...st])}Vr.current=Ae}}catch{}try{const Ee=await fetch("/api/pipeline-recent-runs");if(!Ee.ok)return;const $e=await Ee.json();if(x)return;const Ae=(Array.isArray($e.runs)?$e.runs:[]).find(we=>we.flowId===u.id&&we.runId===bt);if(Ae&&Ae.status){const we=Ae.status;we==="running"?Bt(st=>st==="running"?st:"running"):we==="success"?Bt("done"):we==="failed"?Bt("error"):(we==="stopped"||we==="interrupted")&&Bt("stopped")}}catch{}}catch{}};return F(),N=window.setInterval(F,2500),()=>{x=!0,N&&window.clearInterval(N)}},[Te,u==null?void 0:u.id,bt]),m.useEffect(()=>{if(ct!=="history"||!u)return;let x=!1;return(async()=>{Ys(!0),ur("");try{const N=await fetch("/api/pipeline-recent-runs"),F=await N.json();if(!N.ok)throw new Error(F.error||"HTTP "+N.status);x||En(Array.isArray(F.runs)?F.runs:[])}catch(N){x||(ur(String(N.message||N)),En([]))}finally{x||Ys(!1)}})(),()=>{x=!0}},[ct,u]),m.useEffect(()=>{if(!u){Vt({files:[]});return}let x=!1;return(async()=>{ps(!0);try{const N=new URLSearchParams({flowId:u.id,flowSource:u.source||"user",archived:u.archived?"1":"0"}),F=await fetch(`/api/pipeline-files?${N}`),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(N){x||Vt({files:[],error:N.message||String(N)})}finally{x||ps(!1)}})(),()=>{x=!0}},[u]);const hu=m.useMemo(()=>u?qs.filter(x=>x&&x.flowId===u.id).sort((x,N)=>N.at-x.at):[],[qs,u]),Dr=m.useMemo(()=>{let x=0,N=0,F=0,U=0,V=0;for(const Y of hu){const Q=Y.status||"unknown";Q==="success"?x+=1:Q==="failed"?N+=1:Q==="running"?F+=1:Q==="stopped"?U+=1:Q==="interrupted"&&(V+=1)}return{success:x,failed:N,running:F,stopped:U,interrupted:V}},[hu]),mu=m.useMemo(()=>u?qN(qr,jl):null,[u,qr,jl]),ri=m.useMemo(()=>{if(!mu||!u)return[];const x=mu.query.toLowerCase(),N=V=>x?V.some(Y=>Y&&String(Y).toLowerCase().includes(x)):!0,F=Rt.map(V=>{var Ee,$e;const Y=V.id,Q=String(((Ee=V.data)==null?void 0:Ee.label)??Y),ne=($e=V.data)!=null&&$e.definitionId?String(V.data.definitionId):"",he=[Q!==Y?Q:"",ne&&ne!==Y?ne:""].filter(Boolean);return{id:Y,label:Q,defId:ne,subs:he}}).filter(({id:V,label:Y,defId:Q})=>N([V,Y,Q])).sort((V,Y)=>V.id.localeCompare(Y.id)).slice(0,18).map(({id:V,label:Y,defId:Q})=>{const ne=[Y!==V?Y:null,Q||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:V,title:V,subtitle:ne}}),U=ue.filter(V=>V&&V.id&&N([V.id,V.label,V.description])).sort((V,Y)=>V.id.localeCompare(Y.id)).slice(0,22).map(V=>({kind:"definition",id:V.id,title:V.id,subtitle:V.label&&V.label!==V.id?String(V.label):String(V.type||"")}));return[...F,...U]},[mu,Rt,ue,u]),gu=m.useMemo(()=>{const x=ri.filter(F=>F.kind==="instance"),N=ri.filter(F=>F.kind==="definition");return{instances:x,definitions:N}},[ri]);m.useEffect(()=>{Or(x=>{const N=Math.max(0,ri.length-1);return Math.min(Math.max(0,x),N)})},[ri]);const Bb=m.useMemo(()=>RV(qr),[qr]),gr=m.useMemo(()=>Rt.filter(x=>x.selected),[Rt]),pg=m.useMemo(()=>new Set(gr.map(x=>x.id)),[gr]),Bf=m.useMemo(()=>kn.filter(x=>pg.has(x.source)&&pg.has(x.target)),[kn,pg]),Hb=m.useMemo(()=>{const x=de.trim().toLowerCase();return x?He.filter(N=>[N.id,N.version,N.displayName,N.name,N.description,...Array.isArray(N.tags)?N.tags:[]].filter(Boolean).some(F=>String(F).toLowerCase().includes(x))):He},[He,de]),Ub=m.useCallback((x,N)=>{const F=String(x||"snippet-node").trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"snippet-node",U=Date.now().toString(36);let V=`${F}-${U}`,Y=2;for(;N.has(V);)V=`${F}-${U}-${Y}`,Y+=1;return N.add(V),V},[]),Wb=m.useCallback((x,N)=>{var pt;if(!u||!x)return;const F=x.snippet&&typeof x.snippet=="object"?x.snippet:{},U=F.instances&&typeof F.instances=="object"?F.instances:{},V=Object.keys(U);if(V.length===0)return;const Y=new Set(Ai.current.map(Re=>Re.id)),Q={};for(const Re of V)Q[Re]=Ub(Re,Y);const ne=(pt=F.ui)!=null&&pt.nodePositions&&typeof F.ui.nodePositions=="object"?F.ui.nodePositions:{},he=V.map(Re=>{const $t=ne[Re];return{id:Re,x:typeof($t==null?void 0:$t.x)=="number"?$t.x:0,y:typeof($t==null?void 0:$t.y)=="number"?$t.y:0}}),Ee=Math.min(...he.map(Re=>Re.x)),$e=Math.min(...he.map(Re=>Re.y));let ie=N||{x:180,y:160};const Ae=za.current,we=document.querySelector(".af-pipeline-flow .react-flow");if(!N&&Ae&&we){const Re=we.getBoundingClientRect();ie=Ae.screenToFlowPosition({x:Re.left+Re.width*.48,y:Re.top+Re.height*.32})}const st={};for(const Re of V)st[Q[Re]]={...U[Re]||{}};$r.current={...$r.current,...st};const sn=V.map(Re=>{const $t=U[Re]||{},Zn=he.find(io=>io.id===Re)||{x:0,y:0},$o={id:Q[Re],type:"flowNode",selected:!0,position:{x:ie.x+(Zn.x-Ee),y:ie.y+(Zn.y-$e)},data:{label:$t.label||Q[Re],definitionId:$t.definitionId||Re,role:$t.role||"normal",body:$t.body||"",script:$t.script||""}};return Yd($o,$r.current,ue,{},u.id)}),Yt=new Set(V),Mt=(Array.isArray(F.edges)?F.edges:[]).filter(Re=>Yt.has(Re==null?void 0:Re.source)&&Yt.has(Re==null?void 0:Re.target)).map((Re,$t)=>({id:`e-${Q[Re.source]}-${Q[Re.target]}-${Date.now()}-${$t}`,source:Q[Re.source],target:Q[Re.target],sourceHandle:Re.sourceHandle??void 0,targetHandle:Re.targetHandle??void 0,markerEnd:{type:cs.ArrowClosed}}));yt(Re=>[...Re.map($t=>({...$t,selected:!1})),...sn]),dn(Re=>[...Re.map($t=>({...$t,selected:!1})),...Mt]),w(`已添加流程片段:${x.displayName||x.id}`)},[Ub,ue,u,dn,yt]);_f.current=Wb;const ZT=m.useCallback(()=>{var F,U;if(gr.length<2){Ce("请先在画布上选择至少两个节点。"),ye("flows");return}const x=gr[0],N=gr.length===2?`${((F=x.data)==null?void 0:F.label)||x.id} 片段`:`${((U=x.data)==null?void 0:U.label)||x.id} 等 ${gr.length} 个节点`;Cn({name:N,id:N.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),ge(""),Hn(!0),ye("flows")},[gr]),e2=m.useCallback(async()=>{var V,Y;if(!u||gr.length<2)return;const x=Xt.name.trim();if(!x){ge("请填写片段名称。");return}const N=gf(gr,$r.current),F={};for(const Q of gr)F[Q.id]={x:((V=Q.position)==null?void 0:V.x)||0,y:((Y=Q.position)==null?void 0:Y.y)||0};const U=Bf.map(Q=>({source:Q.source,target:Q.target,sourceHandle:Q.sourceHandle??null,targetHandle:Q.targetHandle??null}));cr(!0),ge("");try{const Q=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:N,edges:U,ui:{nodePositions:F}}})}),ne=await Q.json().catch(()=>({}));if(!Q.ok||(ne==null?void 0:ne.ok)===!1)throw new Error((ne==null?void 0:ne.error)||"Publish failed");Hn(!1),w(`流程片段已发布:${ne.id||x}`),_o(`流程片段已发布:${ne.id||x}`),await Rf(),ye("flows")}catch(Q){ge(String(Q.message||Q))}finally{cr(!1)}},[u,gr,Bf,Xt,Rf,_o]),Hf=m.useMemo(()=>{const x=[],N=new Set;for(const V of gr)N.add(V.id),x.push({node:V,kind:"canvas"});const F=new Map(Rt.map(V=>[V.id,V])),U=new Map(ue.map(V=>[V.id,V]));for(const V of Bb){if(N.has(V))continue;const Y=F.get(V);if(Y){N.add(V),x.push({node:Y,kind:"mention"});continue}const Q=U.get(V);Q&&(N.add(V),x.push({definition:Q,kind:"definition"}))}return x},[gr,Bb,Rt,ue]),Xr=m.useMemo(()=>{const x=Array.isArray(dt==null?void 0:dt.cursor)?dt.cursor:[],N=Array.isArray(dt==null?void 0:dt.opencode)?dt.opencode:[],F=Array.isArray(dt==null?void 0:dt.claudeCode)?dt.claudeCode:[],U=N.map(Ee=>`opencode:${uo(Ee)}`),V=F.map(Ee=>`claude-code:${uo(Ee)}`),Y=new Set([...x,...N,...F].map(uo).concat(U).concat(V)),Q=(ji||"").trim(),ne=jp(ji,x,N,F),he=ne&&!Y.has(ne)&&!Y.has(Q)?Q:"";return{cursorList:x,opencodeList:N,claudeCodeList:F,currentNotInLists:he}},[dt,ji]),hg=m.useMemo(()=>new Set(Ci),[Ci]),mg=Ci.length,Uf=m.useMemo(()=>{const x=new Map(ei.map(Y=>[Y.key,Y])),N=new Set,F=new Set,U=G.map(Y=>{const Q=ha(Y,ei).map(ne=>x.get(ne)).filter(Boolean);for(const ne of Q)N.add(ne.key),F.add(String(ne.name||ne.id||ne.key||"").trim());return{...Y,skills:Q}}).filter(Y=>Y.skills.length>0),V=ei.filter(Y=>{const Q=String(Y.name||Y.id||Y.key||"").trim();return!N.has(Y.key)&&!F.has(Q)});return{groups:U,ungrouped:V}},[G,ei]),Rl=m.useCallback(()=>{const x=Tt.current;if(!x)return;const N=x.getBoundingClientRect(),F=Math.min(400,Math.max(300,window.innerWidth-24)),U=Math.min(Math.max(12,N.right-F),window.innerWidth-F-12),V=Math.max(140,N.top-22),Y=Math.min(360,V);An({position:"fixed",left:`${U}px`,top:`${Math.max(12,N.top-Y-10)}px`,width:`${F}px`,maxHeight:`${Y}px`})},[]);m.useEffect(()=>{const x=Array.isArray(dt==null?void 0:dt.cursor)?dt.cursor:[],N=Array.isArray(dt==null?void 0:dt.opencode)?dt.opencode:[],F=Array.isArray(dt==null?void 0:dt.claudeCode)?dt.claudeCode:[];mr(U=>{const V=jp(U,x,N,F);return V===U?U:V})},[dt.cursor,dt.opencode,dt.claudeCode]),m.useEffect(()=>{if(!_e)return;Rl();const x=F=>{var V,Y;const U=F.target;(V=Tt.current)!=null&&V.contains(U)||(Y=Ot.current)!=null&&Y.contains(U)||kt(!1)},N=F=>{F.key==="Escape"&&kt(!1)};return window.addEventListener("resize",Rl),window.addEventListener("scroll",Rl,!0),document.addEventListener("pointerdown",x),document.addEventListener("keydown",N),()=>{window.removeEventListener("resize",Rl),window.removeEventListener("scroll",Rl,!0),document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",N)}},[_e,Rl]);const Ha=m.useCallback(async(x,N={})=>{var pt;if(!u||rg.current)return;const F=N.phaseContextSnapshot,U=(typeof x=="string"?x:qr).trim();if(!U)return;const V=Ei.current;rg.current=!0,Cb(!0),_i(e("flow:composer.connecting")),gn(Re=>Re!=="composer"?"composer":Re);const Y=[...ti];if(V.length>0&&Y.push({type:"assistant",segments:[...V]}),Eb([...Y,{type:"user",text:U}]),Y.filter(Re=>Re.type==="user").length===0){const Re=U.replace(/\s+/g," ").slice(0,30)+(U.length>30?"…":"");Ne($t=>$t.map(Zn=>Zn.id===Ye?{...Zn,label:Re}:Zn))}const Q=Y.map(Re=>Re.type==="user"?{role:"user",text:Re.text}:{role:"assistant",text:(Re.segments||[]).filter(Zn=>Zn.kind==="assistant"||Zn.kind==="result").map(Zn=>Zn.text).join(`
|
|
134
|
+
`)}).filter(Re=>Re.text),ne=F??ot;Os(""),Pi([]),uu([]),_b(!1);const he=new AbortController;Cf.current=he,ng.current=Ye;let Ee=null;const $e=Array.isArray(dt==null?void 0:dt.cursor)?dt.cursor:[],ie=Array.isArray(dt==null?void 0:dt.opencode)?dt.opencode:[],Ae=Array.isArray(dt==null?void 0:dt.claudeCode)?dt.claudeCode:[],we=jp(ji,$e,ie,Ae),st=Hf.filter(Re=>Re.kind!=="definition"&&Re.node).map(Re=>Re.node.id),sn=u;let Yt=!1,Mt=!1;try{Ee=setTimeout(()=>he.abort(),12e4);const Re={prompt:U,model:we,flowId:u.id,flowSource:u.source??"user",...u.archived?{flowArchived:!0}:{},contextInstanceIds:st,thread:Q,selectedSkills:Ci};ne&&ne.nextPhase&&!ne.isLastPhase&&(Re.phaseContext={phaseIndex:ne.nextPhase.index,phases:ne.phases,userPromptOriginal:ne.userPromptOriginal||U}),lu&&(Re.phaseRole=lu);const $t=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Re),signal:he.signal});if(Ee&&(clearTimeout(Ee),Ee=null),!$t.ok){let xu=$t.statusText||e("flow:composer.requestFailed");try{const wu=await $t.json();wu&&wu.error&&(xu=String(wu.error))}catch{}_i(xu),Pi([{kind:"error",text:xu}]);return}const Zn=(pt=$t.body)==null?void 0:pt.getReader();if(!Zn){_i(e("flow:composer.cannotReadStream"));return}const $o=new TextDecoder;let io="";for(;;){const{done:xu,value:wu}=await Zn.read();if(xu)break;for(io+=$o.decode(wu,{stream:!0});;){const xg=io.indexOf(`
|
|
135
|
+
`);if(xg<0)break;const Jb=io.slice(0,xg).trim();if(io=io.slice(xg+1),!Jb)continue;let ze;try{ze=JSON.parse(Jb)}catch{continue}if(ze.type==="status"&&typeof ze.line=="string"&&_i(ze.line),ze.type==="natural"&&typeof ze.text=="string"&&ze.text){const on=typeof ze.kind=="string"&&ze.kind?ze.kind:"assistant";Pi(en=>[...en,{kind:on,text:ze.text}])}if(ze.type==="error"&&ze.message){Mt=!0;const on=ze.code?` [${ze.code}]`:"",en=String(ze.message)+on;_i(en),Pi(Jr=>[...Jr,{kind:"error",text:en}])}if(ze.type==="plan"&&Array.isArray(ze.steps)){uu(ze.steps.map(en=>({...en,status:"pending"})));const on=ze.steps.map((en,Jr)=>`${Jr+1}. ${en.description||en.type}`).join(`
|
|
136
|
+
`);Pi(en=>[...en,{kind:"assistant",text:e("flow:composer.taskPlan",{count:ze.steps.length,summary:on})}])}if(ze.type==="step-start"){const on=ze.index??0,en=ze.total??0,Jr=ze.tier?` [${ze.tier}]`:"",o2=ze.model?` (${ze.model})`:"";_i(e("flow:composer.step",{current:on+1,total:en,description:(ze.description||"")+Jr+o2})),uu(a2=>a2.map(Ll=>Ll.index===on?{...Ll,status:"running",model:ze.model,tier:ze.tier,nodeRole:ze.nodeRole??Ll.nodeRole,instanceId:ze.instanceId??Ll.instanceId,instanceLabel:ze.instanceLabel??Ll.instanceLabel}:Ll))}if(ze.type==="step-progress"){const on=ze.index??0,en=ze.total??0;_i(e("flow:composer.step",{current:on+1,total:en,description:ze.description||""}))}if(ze.type==="step-done"){const on=ze.index??0;uu(en=>en.map(Jr=>Jr.index===on?{...Jr,status:ze.success?"done":"error"}:Jr))}if(ze.type==="phase-plan"&&Array.isArray(ze.phases)){du(en=>({...en||{},phases:ze.phases,currentPhase:ze.currentPhase??0,phaseTotal:ze.phaseTotal??ze.phases.length,phaseName:ze.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(en==null?void 0:en.userPromptOriginal)||U}));const on=ze.phases.map((en,Jr)=>`${Jr+1}. ${en.label}`).join(" → ");Pi(en=>[...en,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:ze.phases.length,labels:on,current:ze.phaseName||""})}])}ze.type==="phase-complete"&&(du(on=>{var Jr;return{...on||{},phases:ze.phases||(on==null?void 0:on.phases)||[],currentPhase:ze.phaseIndex??0,phaseTotal:ze.phaseTotal??((Jr=ze.phases)==null?void 0:Jr.length)??0,phaseName:ze.phaseName||"",isLastPhase:!!ze.isLastPhase,nextPhase:ze.nextPhase||null,userPromptOriginal:ze.userPromptOriginal||(on==null?void 0:on.userPromptOriginal)||U}}),!ze.isLastPhase&&ze.nextPhase&&Pi(on=>[...on,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:ze.phaseName||e("flow:composer.nextPhase"),nextPhase:ze.nextPhase.label})}])),ze.type==="done"&&(Yt=!0,_i(on=>on||e("flow:composer.done")))}}}catch(Re){const $t=Re;if($t.name==="AbortError"){const Zn=e(Ee?"flow:composer.connectTimeout":"flow:composer.aborted");_i(Zn),Pi($o=>[...$o,{kind:"error",text:Zn}])}else{const Zn=$t.code||$t.name||"UNKNOWN",$o=`${$t.message||String(Re)} [${Zn}]`;_i($o),Pi(io=>[...io,{kind:"error",text:$o}])}}finally{if(rg.current=!1,Cb(!1),Cf.current=null,ng.current=null,Ee&&clearTimeout(Ee),Yt&&sn){const Re={id:sn.id,source:sn.source??"user",archived:sn.archived};(async()=>(await $s(Re,{preserveComposer:!0,incrementalSync:!0}),await Mo(Re,{quiet:!0,force:!0})))()}}},[u,qr,ji,dt,Hf,$s,Mo,ti,Ye,ot,lu,Ci]);mT.current=Ha;const Vb=m.useCallback(()=>{!ot||ot.isLastPhase||(du(null),Ha(e("flow:composer.skipRemainingPhases")))},[ot,Ha]),Kb=m.useCallback(()=>{if(!ot||ot.isLastPhase||!ot.nextPhase)return;const x=String(ot.nextPhase.label||"").trim()||e("flow:composer.nextPhase");Ha(e("flow:composer.continuePhase",{label:x}),{phaseContextSnapshot:ot})},[ot,Ha]);m.useEffect(()=>{if(!cu)return;const x=N=>{N.key==="Escape"&&Pl(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[cu]),m.useEffect(()=>{Te!=="edit"&&Pl(!1)},[Te]),m.useLayoutEffect(()=>{const x=El.current;if(!x)return;if(!u){x.style.height="";return}x.style.height="0px";const N=getComputedStyle(x),F=parseFloat(N.lineHeight),U=(parseFloat(N.paddingTop)||0)+(parseFloat(N.paddingBottom)||0),V=Number.isFinite(F)&&F>0?F:13*1.45,Y=U+V*2,Q=U+V*10,ne=Math.min(Math.max(x.scrollHeight,Y),Q);x.style.height=`${ne}px`},[qr,u]);const gg=m.useCallback(x=>{const N=qr,F=jl,U=qN(N,F);if(!U)return;const V=N.slice(0,U.atIndex)+`@${x} `+N.slice(F);Os(V);const Y=U.atIndex+x.length+2;queueMicrotask(()=>{const Q=El.current;Q&&(Q.focus(),Q.setSelectionRange(Y,Y)),Ms(Y)})},[qr,jl]),yg=m.useCallback(x=>{Os(N=>{const F=`@${x}`,U=N.indexOf(F);return U<0?N:N.slice(0,U)+N.slice(U+F.length)})},[]),qb=m.useCallback(x=>{x.kind==="canvas"?yt(N=>N.map(F=>F.id===x.node.id?{...F,selected:!1}:F)):x.kind==="mention"?yg(x.node.id):yg(x.definition.id)},[yt,yg]),t2=m.useCallback(()=>{gn(x=>x==="history"?null:"history")},[]),n2=m.useCallback(()=>{gn(x=>x==="settings"?null:"settings")},[]),r2=m.useCallback(()=>{gn(x=>x==="composer"?null:"composer")},[]),yu=m.useCallback(()=>{gn(x=>(x==="node"&&Da.current&&(ou.current=Da.current.id),null))},[]),Yb=m.useCallback(()=>{$a(x=>!x)},[]),s2=()=>{if(!u)return null;const x=Rs||u.archived||u.source==="builtin",N=yn!=null&&yn.running?e("flow:schedule.running"):Pn.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),F=yn!=null&&yn.running?"running":Pn.enabled?"waiting":"disabled",U=It.slice(0,12),V=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:yu,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(),$f())},onBlur:()=>{R.trim()&&R.trim()!==u.id&&$f()},placeholder:u.id,disabled:W,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:zl(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:zl(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:y,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:()=>Db(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:()=>Mf("workspace"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:S,onClick:()=>Mf("user"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),j?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:j}):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:lg,disabled:Ft,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(Ft?"common:common.loading":"common:common.refresh")]})]}),Jt?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Jt}):null,Ft?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 Q=Y.definitionId||`marketplace:${Y.id}${Y.version?`@${Y.version}`:""}`,ne=Lb.has(Q)||Lb.has(`marketplace:${Y.id}`),he=Af.find(Ae=>String(Ae.id)===Q||String(Ae.id)===`marketplace:${Y.id}`),Ee=rr===Q,$e=Np(Y.inputs||Y.input),ie=Np(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}`:Q})]}),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(Ae=>o.jsx("span",{className:"af-pipeline-market-chip",children:Ae},`in-${Q}-${Ae}`)):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(Ae=>o.jsx("span",{className:"af-pipeline-market-chip",children:Ae},`out-${Q}-${Ae}`)):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:()=>tn(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:V||Ee,onClick:()=>{ne&&he?($b(he),gn(null)):ST(Y)},children:e(Ee?"flow:settings.installingNode":ne?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},Q)})}):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")})]}),eo?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:!!Pn.enabled,disabled:x,onChange:Y=>Oo(Q=>({...Q,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:Pn.cron||"",disabled:x,onChange:Y=>Oo(Q=>({...Q,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:Pn.timezone||"",disabled:x,onChange:Y=>Oo(Q=>({...Q,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:Pn.preset||"",disabled:x,onChange:Y=>Oo(Q=>({...Q,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:Pn.nextRunAt?e("flow:schedule.nextRun",{time:new Date(Pn.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),o.jsxs("span",{children:[e("flow:schedule.runtime"),":",N]})]}),o.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[Ht.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Ht.lastTriggeredAt).toLocaleString()})]}):null,Ht.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Ht.lastSkippedAt).toLocaleString(),Ht.lastSkipReason?` · ${Ht.lastSkipReason}`:""]})]}):null,Ht.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Ht.lastRunUuid})]}):null,Ht.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Ht.lastExitCode)})]}):null,Ht.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Ht.lastFinishedAt).toLocaleString()})]}):null]}),yn!=null&&yn.lastError||Ht.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(yn==null?void 0:yn.lastError)||Ht.lastError}):null,u.archived||u.source==="builtin"?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Ea?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Ea}):null,to?o.jsx("p",{className:"af-pipeline-drawer-muted",children:to}):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:[Rt.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:Af.length})]}),o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:zl(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:N})]})]}),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:Rt.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:zl(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 zT(),disabled:Rs,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(Rs?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:yu,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")})]})]})]})},i2=()=>{const x=Ie;if(!x)return null;const N=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`,F=x.displayName||x.label||x.id,U=Np(x.inputs||x.input),V=Np(x.outputs||x.output);return es.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&&tn(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:()=>tn(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,Q)=>o.jsx("span",{title:Y},`preview-in-${Q}`))}),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:N})]}),o.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(V.length>0?V:[""]).slice(0,4).map((Y,Q)=>o.jsx("span",{title:Y},`preview-out-${Q}`))})]})}),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:V.length>0?V.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:N})]}),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(zv,{children:[o.jsx(BV,{onReady:i}),o.jsxs(vI.Provider,{value:{modelLists:dt,onModelChange:BT},children:[o.jsxs("div",{className:"af-pipeline-page"+(Te!=="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:()=>{Te==="running"?zf(!0):Te!=="edit"?Ba():n("/projects")},"aria-label":e(Te!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(Te!=="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",kV,"-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(bv(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"+(Le?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>Ve(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"description"})}),Te==="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:by(Gs,"running")})]}),Te==="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:by(Gs,"stopped")})]}),(Te==="done"||Te==="error")&&o.jsxs("div",{className:"af-run-timer"+(Te==="error"?" af-run-timer--error":" af-run-timer--done"),children:[o.jsx("span",{className:"af-run-timer__label",children:Te==="error"?"FAILED":"COMPLETED"}),o.jsx("span",{className:"af-run-timer__value",children:by(Gs,Te)})]}),Te!=="edit"&&o.jsx("button",{type:"button",className:"af-icon-btn"+(gs?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>ys(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),Te==="edit"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(ct==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!u,onClick:t2,children:o.jsx("span",{className:"material-symbols-outlined",children:"history"})}),o.jsx("button",{type:"button",className:"af-icon-btn"+(ct==="settings"?" af-icon-btn--active":""),onClick:n2,"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"+(ct==="composer"?" af-composer-topbar-btn--active":"")+(et?" af-composer-topbar-btn--running":""),onClick:r2,"aria-label":"AI Composer",title:"AI Composer",disabled:!u,children:"AI"}),o.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(Cl?" af-icon-btn--active":""),onClick:Yb,"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"})]}),Te==="running"?o.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:qT,title:e("flow:run.pauseRun"),children:[o.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):Te==="ready"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void Ri(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Ba,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Te==="stopped"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void Ri({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:Ba,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Te==="done"||Te==="error"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void Ri(),title:e("flow:topbar.rerunTitle"),children:"Run"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Ba,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 Ri(),children:"Run"}),o.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!u,onClick:()=>sr(x=>!x),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":Na,children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),Na&&u&&o.jsxs("div",{className:"af-run-dropdown-menu",children:[o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var N,F,U,V,Y;sr(!1);const x={};for(const Q of ni){const ne=Il[Q.id];ne&&(x[ne]=((N=Js[ne])==null?void 0:N.value)??((F=Js[ne])==null?void 0:F.path)??((Y=(V=(U=Q.data)==null?void 0:U.outputs)==null?void 0:V[0])==null?void 0:Y.default)??"")}ut(x),Kr(!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:()=>{sr(!1),Ri({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:()=>{sr(!1),Ri()},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;sr(!1);const N=Qn[x]||{},F={};for(const V of ni){const Y=Il[V.id];if(!Y)continue;const Q=((U=V.data)==null?void 0:U.definitionId)||"",ne=N[V.id]??"";Q.startsWith("provide_file")?F[Y]={type:"file",path:ne}:F[Y]={type:"str",value:ne}}Ri({cliInputsOverride:F})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),x]},x))]})]})]})]})]}),qe?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:qe}),o.jsx("button",{type:"button",onClick:()=>it(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-pipeline-body"+(Te!=="edit"?" af-pipeline-body--run-mode":""),children:[Te==="edit"&&ct!=="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${Jn?" af-palette-workspace--expanded":""}`,children:[o.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>Is(x=>!x),"aria-expanded":Jn,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:Jn?"expand_less":"expand_more"})]}),o.jsx("div",{className:"af-palette-workspace-path",title:u&&(u.path||Je.path)||"",children:u?u.id:e("flow:palette2.noPipelineSelected")}),Jn&&o.jsx("div",{className:"af-palette-workspace-tree",children:nn?o.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):Je.error?o.jsx("div",{className:"af-palette-workspace-empty",children:Je.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:["(",Je.files.length,")"]})]}),Je.files.length>0?o.jsx("ul",{className:"af-palette-workspace-list",children:Je.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))}):Je.files.filter(x=>x.type==="directory").length===0?o.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),Je.files.filter(x=>{var N;return x.type==="directory"&&((N=x.children)==null?void 0:N.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(N=>o.jsxs("li",{className:`af-palette-workspace-item${N.type==="file"?" af-palette-workspace-item--clickable":""}`,title:N.path,onClick:N.type==="file"?()=>J({filePath:N.path,fileName:N.name}):void 0,children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:N.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:N.name}),N.type==="file"&&N.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:N.size<1024?`${N.size}B`:N.size<1024*1024?`${(N.size/1024).toFixed(1)}KB`:`${(N.size/1024/1024).toFixed(1)}MB`})]},N.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:fe==="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:de,onChange:x=>se(x.target.value),placeholder:(fe==="flows"?"搜索流程片段":e("flow:palette.searchNodes"))+"…","aria-label":fe==="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":fe==="nodes",className:"af-palette-tab"+(fe==="nodes"?" af-palette-tab--active":""),onClick:()=>ye("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":fe==="flows",className:"af-palette-tab"+(fe==="flows"?" af-palette-tab--active":""),onClick:()=>ye("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:fe==="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:ZT,disabled:!u||gr.length<2,title:gr.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:["已选 ",gr.length," 节点 / ",Bf.length," 连线"]})]})}),Me?o.jsx("p",{className:"af-err af-palette-list-err",children:Me}):null,Ge?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段…"}):Hb.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:Hb.map(x=>{const N=`${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:()=>Wb(x),draggable:!!u,onDragStart:V=>{V.dataTransfer.setData("application/agentflow-snippet",N),V.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"]})]})]},N)})})]}):o.jsx("p",{className:"af-palette-empty",children:de.trim()?"无匹配流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Ku.filter(x=>Pf[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:Pf[x].map(N=>{const F=VN(N.inputs,"input"),U=VN(N.outputs,"output"),Y=N.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":kI(N),Q=bI(N);return o.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>$b(N),draggable:!!u,onDragStart:ne=>{ne.dataTransfer.setData("application/agentflow-node",N.id),ne.dataTransfer.effectAllowed="move"},disabled:!u,title:Y||N.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:EV(x)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:Q}),Q!==N.id?o.jsx("span",{className:"af-palette-card-id",children:N.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,he)=>o.jsxs("span",{className:"af-palette-card-port",title:WN("input",ne,he),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Rn(ne==null?void 0:ne.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:ky(ne,he)})]},`in-${he}`)),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,he)=>o.jsxs("span",{className:"af-palette-card-port",title:WN("output",ne,he),children:[o.jsx("span",{className:"af-palette-card-port-name",children:ky(ne,he)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Rn(ne==null?void 0:ne.type)}})]},`out-${he}`)),U.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",U.hidden]}):null]})]})]})]},N.id)})})]},x)),u&&ue.length===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,u&&ue.length>0&&de.trim()&&kT===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"+(We?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),o.jsx("span",{className:"af-palette-engine-label",children:e(We?"common:engine.online":"common:engine.offline")})]}),v?o.jsx("div",{className:"af-palette-tip"+jT,role:"status","aria-live":"polite",children:v}):null]})]}):Te!=="edit"&&u?o.jsx(mV,{flowId:u.id,flowSource:u.source||"user",flowArchived:u.archived,provideNodes:ni,edges:kn,nodes:Rt,onCliInputsChange:Qs,onBackToEdit:Ba}):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&&Ii.length>0&&!Z?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 Mb(),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:Ii.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:N=>{N.preventDefault(),OT(x.nodeId)},children:x.nodeId}),'"',x.suffix]},x.key))})]}):null,u&&Ii.length>0&&Z?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:Ii.length})}),o.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:Yb,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 Mb(),children:e("common:common.refresh")})]})]}):null,ct==="settings"&&u&&Te==="edit"?s2():o.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:u?o.jsxs(o.Fragment,{children:[o.jsx(YV,{fitViewEpoch:p,canvasTool:Jm,nodes:xT,edges:wT,onNodesChange:Te!=="edit"?void 0:gT,onEdgesChange:Te!=="edit"?void 0:yT,onConnect:Te!=="edit"?void 0:AT,onConnectStart:Te!=="edit"?void 0:IT,onConnectEnd:Te!=="edit"?void 0:TT,isValidConnection:Te!=="edit"?void 0:PT,onNodesDelete:Te!=="edit"?void 0:RT,onNodeClick:CT,onNodeDoubleClick:ET,onEdgeClick:_T,onFlowInit:LT,onDrop:FT,onDragOver:DT,hideMinimapAndControls:!!(u&&ct),bottomSlot:Te==="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:Hf.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):Hf.map((x,N)=>{var he,Ee;if(x.kind==="definition"){const $e=x.definition,ie=String($e.label??$e.id),Ae=[$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:Ae,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:ie}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>qb(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,V=String(((he=F.data)==null?void 0:he.label)??F.id),Y=(Ee=F.data)!=null&&Ee.definitionId?String(F.data.definitionId):"",Q=Y&&Y!==V?`${V} · ${F.id} · ${Y}`:`${V} · ${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:Q,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:V}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>qb(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:El,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!u,value:qr,rows:2,onChange:x=>{Os(x.target.value),Ms(x.target.selectionStart??x.target.value.length)},onSelect:x=>{const N=x.target;N instanceof HTMLTextAreaElement&&Ms(N.selectionStart??0)},onKeyDown:x=>{if((x.metaKey||x.ctrlKey)&&x.key==="Enter"){x.preventDefault(),Ha();return}if(mu&&ri.length>0&&(x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="Enter")){if(x.key==="ArrowDown")x.preventDefault(),Or(N=>(N+1)%ri.length);else if(x.key==="ArrowUp")x.preventDefault(),Or(N=>(N-1+ri.length)%ri.length);else if(x.key==="Enter"){x.preventDefault();const N=ri[Ni];N&&gg(N.id)}}},onKeyUp:x=>{const N=x.target;N instanceof HTMLTextAreaElement&&Ms(N.selectionStart??N.value.length)},onClick:x=>{const N=x.target;N instanceof HTMLTextAreaElement&&Ms(N.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),mu&&u&&ri.length>0?o.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[gu.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,gu.instances.map((x,N)=>{const F=N;return o.jsx("li",{role:"option","aria-selected":F===Ni,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(F===Ni?" af-composer-mention-item--active":""),onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>Or(F),onClick:()=>gg(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}`)}),gu.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,gu.definitions.map((x,N)=>{const F=gu.instances.length+N;return o.jsx("li",{role:"option","aria-selected":F===Ni,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(F===Ni?" af-composer-mention-item--active":""),onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>Or(F),onClick:()=>gg(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:[Fn.length>0&&o.jsx("label",{className:"af-composer-session-field",children:o.jsxs("select",{className:"af-composer-session-select",value:Ye||"",onChange:x=>{x.target.value==="__new__"?Nb():Pb(x.target.value)},disabled:et,"aria-label":e("flow:composer.switchConversation"),children:[Fn.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:Tt,type:"button",className:"af-composer-skills-button"+(mg>0?" af-composer-skills-button--active":""),disabled:!u||et,"aria-haspopup":"listbox","aria-expanded":_e,onClick:()=>kt(x=>!x),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:mg>0?`Skills ${mg}`:"Skills"})]}),_e&&!et?es.createPortal(o.jsx("div",{ref:Ot,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:xn,children:ei.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[Uf.groups.map(x=>{const N=ha(x,ei),F=TE(x,hg,ei),U=be.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:N.length===0,onChange:V=>{const Y=V.target.checked;P(Q=>Y?AE(Q,N):IE(Q,N))}}),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:()=>{xe(V=>{const Y=new Set(V);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(V=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:hg.has(V.key),onChange:Y=>{const Q=Y.target.checked;P(ne=>Q?ne.includes(V.key)?ne:[...ne,V.key]:ne.filter(he=>he!==V.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:V.name}),V.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:V.description}):null]})]},`${x.id}:${V.key}`))})]},x.id)}),Uf.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:Uf.ungrouped.length})]}),Uf.ungrouped.map(x=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:hg.has(x.key),onChange:N=>{const F=N.target.checked;P(U=>F?U.includes(x.key)?U:[...U,x.key]:U.filter(V=>V!==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:(ji||"").trim()?Xr.currentNotInLists?Xr.currentNotInLists:jp(ji,Xr.cursorList,Xr.opencodeList,Xr.claudeCodeList):"",onChange:x=>mr(x.target.value),disabled:!u||et,"aria-label":e("flow:composer.modelAriaLabel"),children:[o.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),Xr.currentNotInLists?o.jsxs("option",{value:Xr.currentNotInLists,children:[Xr.currentNotInLists,e("flow:composer.modelNotInList")]}):null,Xr.cursorList.length>0?o.jsx("optgroup",{label:"Cursor",children:Xr.cursorList.map(x=>o.jsx("option",{value:uo(x),children:x},`composer-c-${x}`))}):null,Xr.opencodeList.length>0?o.jsx("optgroup",{label:"OpenCode",children:Xr.opencodeList.map(x=>o.jsx("option",{value:`opencode:${uo(x)}`,children:x},`composer-o-${x}`))}):null,Xr.claudeCodeList.length>0?o.jsx("optgroup",{label:"Claude Code",children:Xr.claudeCodeList.map(x=>o.jsx("option",{value:`claude-code:${uo(x)}`,children:x},`composer-cc-${x}`))}):null]})]}),o.jsx("button",{type:"button",className:"af-composer-send"+(u&&qr.trim()&&!et?" af-composer-send--active":"")+(et?" af-composer-send--stop":""),disabled:!u||!et&&!qr.trim(),"aria-label":e(et?"flow:composer.stopGeneration":"flow:composer.send"),title:et?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var x;if(et){(x=Cf.current)==null||x.abort();return}Ha()},children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:et?"stop":"arrow_upward"})})]})]}),cu?es.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&&Pl(!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"+(et?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:Wt||void 0,children:et&&!Wt?e("flow:composer.executing"):Wt||e("flow:composer.ready")})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Pl(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),so.length>1&&!(ot&&Array.isArray(ot.phases)&&ot.phases.length>1)?o.jsx("div",{className:"af-composer-steps-track-wrap",children:o.jsx(OV,{steps:so})}):null,ot&&Array.isArray(ot.phases)&&ot.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:ot.phases.map((x,N)=>{const F=x.status||(N<(ot.currentPhase??0)?"done":N===(ot.currentPhase??0)?et?"running":ot.nextPhase||ot.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:N+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||N)})}):null,o.jsx("div",{className:"af-composer-thread-dialog-scroll",children:o.jsx(YN,{thread:ti,liveSegments:Vn,running:et})}),ot&&!ot.isLastPhase&&ot.nextPhase&&!et?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:ot.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:Kb,children:e("flow:composer.phaseReviewContinue",{label:ot.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:Vb,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),Gr&&Te==="edit"?(()=>{var U;const x=String(Gr.query||"").trim().toLowerCase(),N=x?Gr.candidates.filter(V=>{var Y,Q,ne;return[(Y=V.def)==null?void 0:Y.id,V.displayLabel,V.description,(Q=V.slot)==null?void 0:Q.name,(ne=V.slot)==null?void 0:ne.type].filter(Boolean).some(he=>String(he).toLowerCase().includes(x))}):Gr.candidates,F=Gr.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:Gr.left,top:Gr.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:Rn((U=Gr.draft.slot)==null?void 0:U.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",Gr.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>Lo(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:Gr.query,onChange:V=>Lo(Y=>Y&&{...Y,query:V.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[N.map(V=>{var ne,he;const Y=V.displayLabel||((ne=V.def)==null?void 0:ne.id),Q=ky(V.slot,V.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>$T(V),title:V.description||V.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!==V.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:V.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:Rn((he=V.slot)==null?void 0:he.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:Q})]})]},`${V.def.id}-${V.slotIndex}`)}),N.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")})})]}),Te!=="edit"&&gs&&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:UT,onPointerMove:WT,onPointerUp:zb,onPointerCancel:zb,onLostPointerCapture:VT}),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:[Te==="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:()=>ys(!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:[Ts.map((x,N)=>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):""})]},N)),o.jsx("div",{ref:Aa})]})]})]}),Te!=="edit"&&Xs&&u?o.jsx(dV,{instanceId:Xs,flowId:u.id,runId:bt,nodeStatus:((Gb=hs[Xs])==null?void 0:Gb.status)??null,onClose:()=>Lr(null)}):null,ct&&ct!=="settings"&&u&&Te==="edit"?o.jsx("aside",{className:"af-pipeline-drawer"+(ct==="node"?" af-pipeline-drawer--wide":"")+(ct==="composer"?" af-pipeline-drawer--wide":""),"aria-label":ct==="settings"?e("flow:settings.title"):ct==="history"?e("flow:history.title"):ct==="composer"?"AI Composer":e("flow:nodeProps.title"),children:ct==="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:yu,"aria-label":e("flow:composer.closeSidebar"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Fn.length>0&&o.jsxs("div",{className:"af-composer-session-tabs",children:[Fn.map(x=>o.jsxs("button",{type:"button",ref:N=>{N&&x.id===Ye&&N.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",x.id===Ye?"af-composer-session-tab--active":"",x.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>Pb(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:N=>{N.stopPropagation(),jb(x.id)},onKeyDown:N=>{N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),N.stopPropagation(),jb(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:()=>Nb(),title:e("flow:composer.newConversation"),children:o.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),o.jsx("div",{className:"af-composer-sidebar-status"+(et?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:et&&!Wt?e("flow:composer.executing"):Wt||e("flow:composer.ready")}),ot&&Array.isArray(ot.phases)&&ot.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:ot.phases.map((x,N)=>{const F=x.status||(N<(ot.currentPhase??0)?"done":N===(ot.currentPhase??0)?et?"running":ot.isLastPhase&&N===ot.phases.length-1||ot.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:N+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||N)})}):null,o.jsx("div",{className:"af-composer-sidebar-thread",ref:Sb,children:o.jsx(YN,{thread:ti,liveSegments:Vn,running:et})}),ot&&!ot.isLastPhase&&ot.nextPhase&&!et?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:ot.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:Kb,children:e("flow:composer.phaseReviewContinue",{label:ot.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:Vb,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):ct==="node"&&rt?gt?o.jsx(gI,{draft:gt,setDraft:au,definitionId:String(((Xb=rt.data)==null?void 0:Xb.definitionId)??rt.id),systemPromptReadonly:String((og==null?void 0:og.description)??""),modelLists:dt,disabled:!u,onIdBlur:HT,onClose:yu,onPublishToMarketplace:NT,error:Zm,ioSlots:{inputs:Array.isArray(gt==null?void 0:gt.inputs)?gt.inputs:[],outputs:Array.isArray(gt==null?void 0:gt.outputs)?gt.outputs:[]}}):o.jsx("div",{className:"af-pipeline-drawer-body",children:o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.loadingProps")})}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:e(ct==="settings"?"flow:settings.title":"flow:history.title")}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:yu,"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:ct==="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(),$f())},onBlur:()=>{R.trim()&&R.trim()!==u.id&&$f()},placeholder:u.id,disabled:W,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:zl(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:zl(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:()=>Db(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:()=>Mf("workspace"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:S,onClick:()=>Mf("user"),children:e(S?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),j?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:j}):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:y,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")}),eo?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:!!Pn.enabled,disabled:Rs||u.archived||u.source==="builtin",onChange:x=>Oo(N=>({...N,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:Pn.cron||"",disabled:Rs||u.archived||u.source==="builtin",onChange:x=>Oo(N=>({...N,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:Pn.timezone||"",disabled:Rs||u.archived||u.source==="builtin",onChange:x=>Oo(N=>({...N,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:Pn.preset||"",disabled:Rs||u.archived||u.source==="builtin",onChange:x=>Oo(N=>({...N,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")})}),Pn.nextRunAt?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(Pn.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:yn!=null&&yn.running?e("flow:schedule.running"):Pn.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),Ht.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Ht.lastTriggeredAt).toLocaleString()})]}):null,Ht.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Ht.lastSkippedAt).toLocaleString(),Ht.lastSkipReason?` · ${Ht.lastSkipReason}`:""]})]}):null,Ht.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Ht.lastRunUuid})]}):null,Ht.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Ht.lastExitCode)})]}):null,Ht.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Ht.lastFinishedAt).toLocaleString()})]}):null]}),yn!=null&&yn.lastError||Ht.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(yn==null?void 0:yn.lastError)||Ht.lastError}):null,u.archived||u.source==="builtin"?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Ea?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Ea}):null,to?o.jsx("p",{className:"af-pipeline-drawer-muted",children:to}):null,o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:Rs||u.archived||u.source==="builtin",onClick:cg,children:e(Rs?"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:[Rt.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})]}),Wr?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):Sr?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Sr}):hu.length===0?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):o.jsxs(o.Fragment,{children:[Dr.success+Dr.failed+Dr.running+Dr.stopped+Dr.interrupted>0?o.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[Dr.success>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:Dr.success})}):null,Dr.failed>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:Dr.failed})}):null,Dr.stopped>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:Dr.stopped})}):null,Dr.interrupted>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:Dr.interrupted})}):null,Dr.running>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:Dr.running})}):null]}):null,o.jsx("ul",{className:"af-exec-history-list",children:hu.map((x,N)=>{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",V=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",Q=x.runId||`${x.at}-${N}`,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:hu.length-N});return o.jsx("li",{className:"af-exec-history-list-item",children:o.jsxs("button",{type:"button",className:`af-exec-history-card ${U}`,onClick:()=>QT(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:Rx(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}),V]}),o.jsxs("span",{className:"af-exec-history-card-duration",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),oO(x.durationMs,e)]})]})]})},`${u.id}-${Q}`)})})]})]})})]})}):null]}),o.jsx(_N,{open:KT,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:YT,onCancel:()=>fg(!1)}),o.jsx(_N,{open:GT,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:JT,onSecondary:XT,onCancel:()=>zf(!1)}),o.jsx(dI,{open:Cl,onClose:()=>$a(!1)}),i2(),o.jsx(XW,{open:su,onClose:()=>iu(!1),onJump:MT,nodes:Rt}),o.jsx(bV,{open:Le,onClose:()=>Ve(!1),flowId:(u==null?void 0:u.id)??""}),o.jsx(KW,{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 If(),n("/projects?tab=archived")}}),o.jsx(qW,{open:_&&!!(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),yt([]),dn([]),du(null),await If(),n("/projects")}}),Gt&&es.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:()=>Hn(!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 N=x.target.value;Cn(F=>({...F,name:N,id:F.id?F.id:N.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=>Cn(N=>({...N,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=>Cn(N=>({...N,description:x.target.value})),placeholder:"这段流程适合什么场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",gr.length," 个节点和 ",Bf.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:()=>Hn(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:kr||!Xt.name.trim(),onClick:()=>void e2(),children:kr?"发布中…":"发布"})]})]})}),document.body),o.jsx(JW,{open:!!C,onClose:()=>J(null),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),filePath:(C==null?void 0:C.filePath)??"",fileName:(C==null?void 0:C.fileName)??"",onSaved:()=>{Vt(x=>({...x}))}})]}),nt&&Te!=="edit"&&es.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:nt.instanceId})]}),o.jsx("div",{className:"af-user-check-modal__actions",children:Nf?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(!nt||!u||!bt)return;const x=Ia||nt.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:nt.instanceId,content:x})})).ok?(Io(F=>F&&{...F,content:x}),ro(!1),mt(F=>[...F,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):mt(F=>[...F,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{mt(N=>[...N,{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:()=>{To(nt.content),ro(!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:()=>ro(!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:()=>Io(null),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),o.jsx("div",{className:"af-user-check-modal__body",children:Nf?o.jsx("textarea",{ref:eu,className:"af-user-check-modal__textarea",value:Ia||nt.content,onChange:x=>To(x.target.value)}):o.jsx("div",{className:"af-user-check-modal__preview",children:o.jsx("pre",{children:Ia||nt.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:ki,onChange:x=>Si(x.target.value),disabled:Zc}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:Zc||!ki.trim(),onClick:()=>{!nt||!u||!bt||!ki.trim()||(Sl(!0),mt(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:nt.instanceId,content:Ia||nt.content,prompt:ki})}).then(x=>x.json()).then(x=>{Sl(!1),x.ok&&x.content?(To(x.content),ro(!0),Si(""),mt(N=>[...N,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):mt(N=>[...N,{ts:new Date().toISOString(),type:"error",text:x.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{Sl(!1),mt(x=>[...x,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[Zc?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(!nt||!u||!bt)return;const x=Ia||nt.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:nt.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:nt.instanceId,execId:nt.execId})}),Io(null),Si(""),Ri({runUuid:bt})):mt(F=>[...F,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{mt(N=>[...N,{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),Cr&&Te!=="edit"&&es.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:Cr.instanceId})]}),o.jsx("div",{className:"af-user-ask-modal__actions",children:o.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>$n(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:[Cr.question.trim()?o.jsx("div",{className:"af-user-ask-modal__question",children:o.jsx("pre",{children:Cr.question})}):null,Cr.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:Cr.options.map(x=>o.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:Ta,onClick:async()=>{if(!(!Cr||!u||!bt)){Ra(!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:Cr.instanceId,execId:Cr.execId,branch:x.name,selectedIndex:x.index,selectedLabel:x.label})})).ok?($n(null),Ra(!1),Ri({runUuid:bt})):(Ra(!1),mt(F=>[...F,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{Ra(!1),mt(N=>[...N,{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(Ta?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),La&&Te!=="edit"&&o.jsxs("div",{className:"af-tool-print-toast"+(Ma?" 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:La.instanceId})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>tu(x=>!x),"aria-label":e(Ma?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(Ma?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:Ma?"close_fullscreen":"open_in_full"})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Oa(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:La.content})})})]}),Ls&&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:Ls.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>Nl(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:nu,className:"af-provide-edit-modal__textarea",defaultValue:Ls.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:vT,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:()=>Nl(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),ja&&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:()=>Kr(!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:ni.length===0?o.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):o.jsx("div",{className:"af-run-params-list",children:ni.map(x=>{var he,Ee;const N=Il[x.id];if(!N)return null;const F=((he=x.data)==null?void 0:he.definitionId)||"",U=F.startsWith("provide_file"),V=F==="provide_bool",Y=((Ee=x.data)==null?void 0:Ee.label)||x.id,Q=Po[N]??"",ne=["true","1","yes","on"].includes(String(Q).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":V?"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:N})]}),V?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ne?" af-run-config-bool-toggle--true":""),onClick:()=>ut($e=>({...$e,[N]:ne?"false":"true"})),"aria-pressed":ne,children:ne?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-params-item__input",value:Q,onChange:$e=>ut(ie=>({...ie,[N]:$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 N;const x={};for(const F of ni){const U=Il[F.id];if(!U)continue;const V=((N=F.data)==null?void 0:N.definitionId)||"",Y=Po[U]??"";V.startsWith("provide_file")?x[U]={type:"file",path:Y}:x[U]={type:"str",value:Y}}Kr(!1),sr(!1),Ri({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:()=>Kr(!1),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})]})}const QV="modulepreload",ZV=function(e){return"/"+e},ej={},e7=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=ZV(c),c in ej)return;ej[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":QV,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)})},t7=new Set(["echarts"]),n7=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),r7=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),s7=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function da(e){return e&&typeof e=="object"&&!Array.isArray(e)}function hl(e,t){if(!da(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:da(n[r])&&da(s)&&(n[r]=hl(n[r],s));return n}function Wm(e,t){return e==null?e:Array.isArray(e)?e.map(n=>da(n)?hl(n,t):n):da(e)?hl(e,t):e}function i7(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 yw(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)=>yw(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||r7.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);yw(r,`${t}.${n}`)}}}function o7(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(!n7.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function a7(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:hl(e,t)}function l7(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(!da(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return hl(i,n)}):da(e)?hl(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function c7(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:Wm(e,n)}function tj(e,t="rgba(255, 255, 255, 0.62)"){return Wm(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 u7(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:Wm(e,n)}function d7(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:Wm(e,t)}function f7(e,t,n){const r=l7(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>da(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??s7,textStyle:hl(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:a7(e.tooltip),legend:c7(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?u7(e.grid,s||i):e.grid,xAxis:tj(e.xAxis),yAxis:tj(e.yAxis),radar:d7(e.radar),series:t}}function p7(e){const t=i7(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(!t7.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");yw(n);const r=o7(n.option.series),s=n.title==null?"":String(n.title),i=f7(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 h7="af:workspace-graph:v2",Wl=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],m7=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),g7={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:""}]},y7={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}]},x7={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}]},w7="0.1.36";function v7(){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 Ep(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 b7(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 k7(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function S7(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 nj(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=String((e==null?void 0:e.text)||"").trim();if(!t)return"";try{const n=JSON.parse(t);if((n==null?void 0:n.type)!=="thinking")return"";const r=String((n==null?void 0:n.subtype)||"");return r&&r!=="delta"?"":String((n==null?void 0:n.text)||(n==null?void 0:n.delta)||(n==null?void 0:n.thinking)||"").trim()}catch{return""}}function jI(e,t){const n=String(e||(t==null?void 0:t.id)||"").toLowerCase();return n.startsWith("control_")?"control":n.startsWith("provide_")?"provide":n.startsWith("tool_")?"agent":(t==null?void 0:t.type)||"agent"}function CI(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function ub(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(ub(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 rj(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function Zh(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 Zh(e)}function xw(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function jy(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 sj(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 ij(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 oj(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=Fc(s.get(n),e.sourceHandle||"output-0","source"),a=Fc(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&Dc(i,a))}function N7(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=Fc(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:lI(a)}:null}function j7(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"?Dc(t.slot,a):Dc(a,t.slot)))continue;const c=qu(n);return{def:n,order:r,category:c,categoryRank:Wl.indexOf(c),slot:a,slotIndex:i,displayLabel:Yu(n),description:xw(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 C7(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 E7(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 _7(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function _p(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:_7(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 Cy(e,t){var f,p;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=EI(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 y=r[h]||{},k=y.definitionId||h,b=t.find(A=>A.id===k),g=ub(b)||k,v=t.find(A=>A.id===g)||b,w=y.marketplaceRef||CI(b),j=i[h]&&typeof i[h].x=="number"&&typeof i[h].y=="number"?i[h]:{x:320+l.size*20,y:180+l.size*12},E=a[h]&&typeof a[h].width=="number"&&typeof a[h].height=="number"?{width:a[h].width,height:a[h].height}:null,S=!!ks(g);return{id:h,type:yf,position:j,...S&&E?{width:E.width,height:E.height}:{},data:{label:y.label||Zh(b)||Zh(v)||h,definitionId:g,...w?{marketplaceRef:w}:{},...b!=null&&b.packageId?{marketplacePackageId:b.packageId}:{},...b!=null&&b.version?{marketplaceVersion:b.version}:{},schemaType:jI(g,v||b),role:y.role||"normal",model:y.model||void 0,body:y.body||"",script:y.script||"",...S&&E?{displaySize:E}:{}}}}).map(h=>Yd(h,r,t)),u=s.filter(h=>(h==null?void 0:h.source)&&(h==null?void 0:h.target)).map((h,y)=>({id:h.id||`we-${h.source}-${h.target}-${y}`,source:String(h.source),target:String(h.target),sourceHandle:h.sourceHandle??void 0,targetHandle:h.targetHandle??void 0,markerEnd:{type:cs.ArrowClosed}}));return{nodes:d,edges:aI(u,d),instances:r}}function Pp(e,t,n){var l,c,d,u,f,p,h,y,k;const r=EI(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)if(i[b.id]={x:((l=b.position)==null?void 0:l.x)||0,y:((c=b.position)==null?void 0:c.y)||0},ks((d=b.data)==null?void 0:d.definitionId)){const g=Number(((f=(u=b.data)==null?void 0:u.displaySize)==null?void 0:f.width)||b.width||((p=b.measured)==null?void 0:p.width)||0),v=Number(((y=(h=b.data)==null?void 0:h.displaySize)==null?void 0:y.height)||b.height||((k=b.measured)==null?void 0:k.height)||0);g>0&&v>0&&(a[b.id]={width:g,height:v})}return{version:1,instances:r,edges:s,ui:{nodePositions:i,nodeSizes:a}}}function EI(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!ks(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 ks(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=ks(e==null?void 0:e.definitionId)==="image"?"src":"content",s=t.find(i=>(i==null?void 0:i.name)===r&&String((i==null?void 0:i.default)||"").trim())||t.find(i=>(i==null?void 0:i.name)==="filePath"&&String((i==null?void 0:i.default)||"").trim())||t.find(i=>(i==null?void 0:i.type)==="text"&&String((i==null?void 0:i.default)||"").trim());return String((e==null?void 0:e.body)||(s==null?void 0:s.default)||"")}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 P7(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.default)||(e==null?void 0:e.label)||"Image preview")}function A7(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":"article"}function lc(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 I7(e){const t=lc(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function T7(e){return lc(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function R7(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&&lc(l).length>1&&I7(t[a+1])){i();const c=lc(l),d=T7(t[a+1]),u=[];for(a+=2;a<t.length&&t[a].trim()&&lc(t[a]).length>1;)u.push(lc(t[a])),a++;n.push({type:"table",headers:c,align:d,rows:u});continue}r.push(l),a++}return i(),n}function aj({children:e}){return o.jsx(mf,{components:{p:({children:t})=>o.jsx(o.Fragment,{children:t})},children:String(e||"")})}function L7({content:e}){const t=m.useMemo(()=>R7(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(aj,{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(aj,{children:s[l]||""})},l))},i))})]})},`table-${r}`))})}function O7(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 M7({code:e}){const t=m.useMemo(()=>O7(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 y=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:y,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 Ua({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,y=h?Math.max(12,p/f*100):100,k=Math.max(0,100-y),b=h?Math.min(k,u.scrollTop/Math.max(1,f-p)*k):0;i({visible:h,top:b,height:y})},[]);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(),y=s.height/100*h.height,k=Math.max(1,h.height-y);return(u-h.top-f)/k},[s.height]),d=m.useCallback(u=>{var j,E;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,y=s.height/100*p.height,b=u.clientY>=p.top+h&&u.clientY<=p.top+h+y?u.clientY-p.top-h:y/2;l(c(u.clientY,b));const g=u.pointerId;(E=(j=u.currentTarget).setPointerCapture)==null||E.call(j,g);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 $7({content:e}){const t=m.useRef(null),n=m.useMemo(()=>p7(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:""}),e7(()=>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 D7({data:e,htmlFrameRef:t,htmlFrameVersion:n=0}){const r=ks(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(Ua,{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:"",srcDoc:i},n)}):r==="image"?o.jsx(Ua,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:i,alt:P7(e),loading:"lazy"})}):r==="markdown"?o.jsx(Ua,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(L7,{content:i})}):r==="chart"?o.jsx(Ua,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx($7,{content:i})}):r==="mermaid"?o.jsxs(Ua,{className:"af-work-display-body",children:[o.jsx(M7,{code:i}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:i})]}):o.jsx(Ua,{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(Ua,{className:"af-work-display-empty",children:"No display content"})}function F7({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=String(s.candidateContent||""),c=!!s.running,d=String(s.error||"");return!n&&!r?null:n?o.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:u=>u.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 u;return(u=t==null?void 0:t.onCloseNodeChat)==null?void 0:u.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||c||d||l.trim()?o.jsxs("div",{className:"af-work-node-chat__messages",children:[i.slice(-4).map((u,f)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${u.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:u.role==="assistant"?"AI":"你"}),o.jsx("p",{children:u.text})]},`${u.at||f}-${f}`)),c?o.jsx("div",{className:"af-work-node-chat__pending",children:"生成中..."}):null,d?o.jsx("div",{className:"af-work-node-chat__error",children:d}):null]}):null,o.jsxs("div",{className:"af-work-node-chat__composer",children:[o.jsx("button",{type:"button",className:"af-work-node-chat__add",disabled:c,"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:a,disabled:c,placeholder:"描述你想怎么调整这个展示",onChange:u=>{var f;return(f=t==null?void 0:t.onUpdateNodeChatDraft)==null?void 0:f.call(t,e,u.target.value)},onKeyDown:u=>{var f;(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&(u.preventDefault(),(f=t==null?void 0:t.onSendNodeChat)==null||f.call(t,e))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:c||!a.trim(),onClick:()=>{var u;return(u=t==null?void 0:t.onSendNodeChat)==null?void 0:u.call(t,e)},"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:c||!l.trim(),onClick:()=>{var u;return(u=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:u.call(t,e,"replace")},children:"替换当前内容"}),o.jsx("button",{type:"button",disabled:c||!l.trim(),onClick:()=>{var u;return(u=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:u.call(t,e,"append")},children:"追加"})]})]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:u=>{var f;u.stopPropagation(),(f=t==null?void 0:t.onToggleNodeChat)==null||f.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 B7(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":e==="chart"?"json":"md"}function H7(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function U7(e,t){const n=ks(t==null?void 0:t.definitionId)||"markdown";return`outputs/${H7((t==null?void 0:t.label)||e||n)}.${B7(n)}`}function W7({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((v,w)=>({slot:v,idx:w})).sort((v,w)=>{var R,M,W,D;const j=String(((R=v.slot)==null?void 0:R.name)||"").trim(),E=String(((M=w.slot)==null?void 0:M.name)||"").trim();if(j==="next"&&E!=="next")return-1;if(E==="next"&&j!=="next")return 1;const S=String(((W=v.slot)==null?void 0:W.type)||"").trim(),A=String(((D=w.slot)==null?void 0:D.type)||"").trim();return S==="node"&&A!=="node"?-1:A==="node"&&S!=="node"?1:v.idx-w.idx}),l=ks(t==null?void 0:t.definitionId),c=m.useRef(null),[d,u]=m.useState(0),[f,p]=m.useState(!1),[h,y]=m.useState(""),k=l==="markdown"?fd(t):"";m.useEffect(()=>{f||y(String(k||""))},[k,f]);const b=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="image"?"Image":l==="chart"?"Chart":"Markdown"),g=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"+(g?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(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:g?{width:g.width,height:g.height}:void 0,children:[o.jsx(u4,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,maxWidth:1200,maxHeight:1e3,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((v,w)=>{if(v.showOnNode===!1)return null;const j=`${4.15+w*1.75}rem`,E=v.name||`#${w+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:j},children:E}),o.jsx(ds,{type:"target",position:Be.Left,id:`input-${w}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:j,background:Rn(v.type)},title:`${E} · ${v.type}`})]},`in-${w}`)}),a.map(({slot:v,idx:w},j)=>{if(v.showOnNode===!1)return null;const E=`${4.15+j*1.75}rem`,S=v.name||`#${w+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:E},children:S}),o.jsx(ds,{type:"source",position:Be.Right,id:`output-${w}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:E,background:Rn(v.type)},title:`${S} · ${v.type}`})]},`out-${w}`)}),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:A7(l)}),o.jsx("strong",{children:b}),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:v=>v.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var v,w,j,E;try{(E=(j=(w=(v=c.current)==null?void 0:v.contentWindow)==null?void 0:w.history)==null?void 0:j.back)==null||E.call(j)}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 v,w,j,E;try{(E=(j=(w=(v=c.current)==null?void 0:v.contentWindow)==null?void 0:w.history)==null?void 0:j.forward)==null||E.call(j)}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(v=>v+1),"aria-label":"刷新",title:"刷新",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}):null,l==="markdown"?f?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:v=>v.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var v;(v=t==null?void 0:t.onSetDisplayNodeContent)==null||v.call(t,e,h,"replace",{logChat:!1,statusMessage:"已更新 Markdown 内容"}),p(!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:()=>{y(String(k||"")),p(!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:v=>{v.stopPropagation(),y(String(k||"")),p(!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 v;return(v=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:v.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"&&f?o.jsx(F7,{value:h,onChange:y}):o.jsx(D7,{data:t,htmlFrameRef:c,htmlFrameVersion:d}),o.jsx(z7,{nodeId:e,data:t})]})}function V7({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(ds,{type:"target",position:Be.Left,id:`input-${d}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:u,background:Rn(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(ds,{type:"source",position:Be.Right,id:`output-${d}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:u,background:Rn(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 K7(e){var d,u,f,p,h,y,k,b,g,v,w;const{setEdges:t,setNodes:n}=wl(),r=(d=e.data)==null?void 0:d.onSyncNodePropDraft,s=m.useCallback(j=>{n(E=>E.filter(S=>S.id!==j)),t(E=>E.filter(S=>S.source!==j&&S.target!==j))},[t,n]),i=m.useCallback((j,E)=>{n(S=>S.map(A=>A.id===j?{...A,data:{...A.data,model:E}}:A)),r==null||r(j,{model:E})},[n,r]),a=m.useCallback((j,E)=>{n(S=>S.map(A=>{var M;if(A.id!==j)return A;const R=Array.isArray((M=A.data)==null?void 0:M.outputs)&&A.data.outputs.length?A.data.outputs.map((W,D)=>D===0?{...W,default:E,value:E}:W):[{type:"bool",name:"value",default:E,value:E}];return{...A,data:{...A.data,body:"",outputs:R}}})),r==null||r(j,S=>({body:"",outputs:Array.isArray(S==null?void 0:S.outputs)&&S.outputs.length?S.outputs.map((R,M)=>M===0?{...R,default:E,value:E}:R):[{type:"bool",name:"value",default:E,value:E}]}))},[n,r]),l=m.useCallback((j,E)=>{n(S=>S.map(A=>A.id===j?{...A,data:{...A.data,body:E}}:A)),r==null||r(j,{body:E})},[n,r]),c=m.useCallback((j,E)=>{const S=ss(E);n(A=>A.map(R=>R.id===j?{...R,data:{...R.data,images:S}}:R)),r==null||r(j,{images:S})},[n,r]);return ks((u=e.data)==null?void 0:u.definitionId)?o.jsx(W7,{...e,deleteNode:s}):((f=e.data)==null?void 0:f.definitionId)==="workspace_run"?o.jsx(V7,{...e,deleteNode:s}):((p=e.data)==null?void 0:p.definitionId)==="control_load_skills"?o.jsx(tK,{...e,deleteNode:s,skills:(h=e.data)==null?void 0:h.skills,skillCollections:(y=e.data)==null?void 0:y.skillCollections,onChangeSkillKeys:(k=e.data)==null?void 0:k.onChangeLoadSkillKeys}):((b=e.data)==null?void 0:b.definitionId)==="control_load_mcp"?o.jsx(nK,{...e,deleteNode:s,servers:(g=e.data)==null?void 0:g.mcpServers,onChangeMcpNames:(v=e.data)==null?void 0:v.onChangeLoadMcpNames}):o.jsx("div",{className:"af-work-flow-node",children:o.jsx(cI,{...e,deleteNode:s,modelLists:(w=e.data)==null?void 0:w.modelLists,onModelChange:i,onProvideValueChange:a,onNodeBodyChange:l,onNodeImagesChange:c})})}const q7={[yf]:K7};function PI(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&PI(n.children,t);return t}function AI(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&AI(n.children,t));return t}function II({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||C7(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(II,{items:c.children,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:s,onCreateFolder:i,onDelete:a,onFileDragStart:l}):null]},c.path)})})}function Y7({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 em(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 G7(e){const t=em((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 em((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function X7(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function J7(e){const t=em((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 em((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function Q7(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function lj(e){var r,s,i,a,l,c;if(!e)return null;const{inputs:t,outputs:n}=oI(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:ss((l=e.data)==null?void 0:l.images),script:String(((c=e.data)==null?void 0:c.script)??""),inputs:t,outputs:n}}function Z7(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function eK(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"])Z7(e[s],t[s])&&(r[s]=n[s]);return r}function tK({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,y]=m.useState(""),[k,b]=m.useState(()=>new Set),g=m.useRef(null),v=m.useRef(null),[w,j]=m.useState({visible:!1,top:0,height:100}),E=m.useMemo(()=>new Set(G7(t)),[t]),S=m.useMemo(()=>new Map(d.map(L=>[L.key,L])),[d]),A=m.useMemo(()=>{const L=new Set,I=u.map(_=>{const T=ha(_,d).map(C=>S.get(C)).filter(Boolean);for(const C of T)L.add(C.key);return{..._,skills:T}}).filter(_=>_.skills.length>0),z=d.filter(_=>!L.has(_.key));return{collectionGroups:I,ungrouped:z}},[S,u,d]);m.useEffect(()=>{b(L=>{let I=!1;const z=new Set(L);for(const _ of A.collectionGroups)z.has(_.id)||(z.add(_.id),I=!0);return I?z:L})},[A.collectionGroups]);const R=m.useMemo(()=>{const L=h.trim().toLowerCase();if(!L)return A;const I=_=>[_==null?void 0:_.key,_==null?void 0:_.name,_==null?void 0:_.description].map(C=>String(C||"").toLowerCase()).join(" ").includes(L);return{collectionGroups:A.collectionGroups.map(_=>{const C=[_==null?void 0:_.id,_==null?void 0:_.name,_==null?void 0:_.description].map(J=>String(J||"").toLowerCase()).join(" ").includes(L)?_.skills:_.skills.filter(I);return{..._,skills:C}}).filter(_=>_.skills.length>0),ungrouped:A.ungrouped.filter(I)}},[A,h]),M=m.useCallback((L,I)=>{const z=new Set(E);for(const _ of L)I?z.add(_):z.delete(_);a==null||a(e,Array.from(z))},[e,E,a]),W=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=g.current;if(!L)return;const I=Math.max(1,L.scrollHeight),z=Math.max(1,L.clientHeight),_=I>z+1,T=_?Math.max(12,z/I*100):100,C=Math.max(0,100-T),J=_?Math.min(C,L.scrollTop/Math.max(1,I-z)*C):0;j({visible:_,top:J,height:T})},[]);m.useEffect(()=>{if(!f)return;const L=requestAnimationFrame(D);return()=>cancelAnimationFrame(L)},[k,R,E.size,f,D]);const O=m.useCallback(L=>{const I=g.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 _=z.getBoundingClientRect(),T=w.height/100*_.height,C=Math.max(1,_.height-T);return(L-_.top-I)/C},[w.height]),$=m.useCallback(L=>{var ae,ce;if(!w.visible)return;L.preventDefault(),L.stopPropagation();const I=v.current;if(!I)return;const z=I.getBoundingClientRect(),_=w.top/100*z.height,T=w.height/100*z.height,J=L.clientY>=z.top+_&&L.clientY<=z.top+_+T?L.clientY-z.top-_:T/2;O(K(L.clientY,J));const Z=L.pointerId;(ce=(ae=L.currentTarget).setPointerCapture)==null||ce.call(ae,Z);const H=ue=>{ue.preventDefault(),O(K(ue.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`,_=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:_}),o.jsx(ds,{type:"target",position:Be.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:z,background:Rn(L.type)},title:`${_} · ${L.type}`})]},`in-${I}`)}),c.map((L,I)=>{if(L.showOnNode===!1)return null;const z=`${2.6+I*1.7}rem`,_=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:_}),o.jsx(ds,{type:"source",position:Be.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:z,background:Rn(L.type)},title:`${_} · ${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:E.size>0?`${E.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=>y(L.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?o.jsx("button",{type:"button",onClick:()=>y(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:g,className:"af-work-load-skills-menu",onScroll:D,children:[R.collectionGroups.map(L=>{const I=L.skills.map(C=>C.key),z=I.filter(C=>E.has(C)).length,_=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:_,onChange:C=>M(I,C.target.checked),"aria-label":`选择 ${L.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>W(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:()=>W(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(C=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:E.has(C.key),onChange:J=>M([C.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:C.name}),C.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:C.description}):null]})]},`${L.id}:${C.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:E.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 nK({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(J7(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]),y=m.useMemo(()=>{const b=u.trim().toLowerCase();return b?h.filter(g=>[g.name,g.description,g.detail,g.type].join(" ").toLowerCase().includes(b)):h},[u,h]),k=m.useCallback((b,g)=>{const v=new Set(p);for(const w of b)g?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,g)=>{if(b.showOnNode===!1)return null;const v=`${2.6+g*1.7}rem`,w=b.name||`#${g+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(ds,{type:"target",position:Be.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:v,background:Rn(b.type)},title:`${w} · ${b.type}`})]},`in-${g}`)}),l.map((b,g)=>{if(b.showOnNode===!1)return null;const v=`${2.6+g*1.7}rem`,w=b.name||`#${g+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(ds,{type:"source",position:Be.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:v,background:Rn(b.type)},title:`${w} · ${b.type}`})]},`out-${g}`)}),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 g;b.stopPropagation(),c||(g=t==null?void 0:t.onRefreshMcps)==null||g.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:y.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:y.map(b=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:p.has(b.name),onChange:g=>k([b.name],g.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))})]}),y.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 rK(){var jf,Ci;const{i18n:e}=un(),{navigate:t}=xl(),n=wl(),r=NP(),s=m.useMemo(v7,[]),[i,a]=jP([]),[l,c,d]=CP([]),u=m.useRef([]),f=m.useRef([]),p=m.useRef(null),h=m.useRef(null),y=m.useRef(null),[k,b]=m.useState(null),[g,v]=m.useState({}),w=m.useRef({}),j=m.useRef(!1),E=m.useRef(null),[S,A]=m.useState([]),[R,M]=m.useState(""),[W,D]=m.useState("nodes"),[O,K]=m.useState([]),[$,L]=m.useState(!1),[I,z]=m.useState(""),[_,T]=m.useState(!1),[C,J]=m.useState({name:"",id:"",description:""}),[Z,H]=m.useState(!1),[te,ae]=m.useState(""),[ce,ue]=m.useState(""),le=m.useRef(null),[de,se]=m.useState(!1),[fe,ye]=m.useState("nodes"),[je,He]=m.useState(""),[lt,Ge]=m.useState(0),[Ct,Me]=m.useState(""),[Ce,Gt]=m.useState(null),[Hn,Xt]=m.useState(""),[Cn,kr]=m.useState([]),[cr,oe]=m.useState(""),[ge,qe]=m.useState(""),[it,tt]=m.useState(()=>new Set),[It,Ln]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[Ft,On]=m.useState(""),[Jt,Qt]=m.useState([]),[rr,pe]=m.useState(!1),[Ie,tn]=m.useState([]),[ct,gn]=m.useState([]),[qs,En]=m.useState(!1),[Sr,ur]=m.useState([]),Wr=m.useCallback(P=>{le.current&&window.clearTimeout(le.current),ue(P),le.current=window.setTimeout(()=>{ue(""),le.current=null},3800)},[]),Ys=m.useCallback(P=>{const B=String(P||"").trim();B&&window.requestAnimationFrame(()=>{r(B)})},[r]);m.useEffect(()=>()=>{le.current&&window.clearTimeout(le.current)},[]);const[_o,Nr]=m.useState(()=>new Set),[Jn,Is]=m.useState(!1),Je=m.useRef(null),Vt=m.useRef(null),nn=m.useRef(null),[ps,We]=m.useState({}),[Un,Te]=m.useState(""),[Bt,Ts]=m.useState(!1),[mt,Vr]=m.useState([]),[dr,rn]=m.useState([]),[hs,Wn]=m.useState("workspace"),[ms,fr]=m.useState(!1),[Gs,jr]=m.useState(!1),[gs,ys]=m.useState(""),[q,ve]=m.useState({}),[Le,Ve]=m.useState(!1),[vt,_n]=m.useState(!1),[zt,bt]=m.useState("pan"),[Zt,Xs]=m.useState(null),[Lr,Js]=m.useState(""),Qs=m.useRef(null),pr=m.useRef(!1),[Na,sr]=m.useState(()=>new Set),[ja,Kr]=m.useState({}),[Po,ut]=m.useState(""),Qn=m.useMemo(()=>b7(s),[s]),[Zi,Ca]=m.useState("");m.useEffect(()=>{s.flowId&&PE(s.flowId,s.flowSource||"user","workspace",!!s.archived)},[s]),m.useEffect(()=>{Vr([]),rn([]),Wn("workspace")},[s]);const hr=m.useCallback(async()=>{const P=Ep(s),B=await fetch(`/api/workspace/files?${P.toString()}`),X=await B.json();if(!B.ok)throw new Error(X.error||"读取 workspace 失败");const G=X.files||[];kr(G),tt(new Set(AI(G))),oe(X.root||"")},[s]),Pn=m.useCallback(async()=>{L(!0),z("");try{const P=await fetch("/api/marketplace/flow-snippets"),B=await P.json().catch(()=>({}));if(!P.ok)throw new Error(B.error||"读取流程片段失败");K(Array.isArray(B.snippets)?B.snippets:[])}catch(P){z(String(P.message||P)),K([])}finally{L(!1)}},[]),Mn=m.useCallback(async(P=i,B=l)=>{var re;if(!j.current)return;const X=Pp(P,B,w.current),G=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,graph:X})}),ee=await G.json();if(!G.ok)throw new Error(ee.error||"保存 workspace graph 失败");w.current=((re=ee.graph)==null?void 0:re.instances)||X.instances,v(w.current),ut("Workspace graph saved")},[l,s,i]),eo=m.useCallback(async()=>{j.current=!1;const P=Ep(s),B=Ep(s);B.set("lang",String(e.language||"zh").startsWith("zh")?"zh":"en");const[X,G]=await Promise.all([fetch(`/api/nodes?${B.toString()}`),fetch(`/api/workspace/graph?${P.toString()}`),hr()]),ee=await X.json(),re=await G.json();if(!X.ok)throw new Error(ee.error||"读取节点定义失败");if(!G.ok)throw new Error(re.error||"读取 workspace graph 失败");const me=[...(Array.isArray(ee)?ee:ee.nodes||[]).filter(_e=>!m7.has(_e.id)),y7,x7,g7];A(me);const be=re.graph||JSON.parse(localStorage.getItem(h7)||"null")||{},xe=Cy(be,me);w.current=xe.instances,v(xe.instances),a(xe.nodes),c(xe.edges),ut(re.writable?"Workspace ready":"Readonly workspace"),j.current=!0},[s,e.language,hr,c,a]),Sf=m.useCallback(async(P,B)=>{const X={packageId:(P==null?void 0:P.newId)||(P==null?void 0:P.id)||(P==null?void 0:P.label),label:(P==null?void 0:P.label)||(P==null?void 0:P.newId)||(P==null?void 0:P.id),version:"1.0.0",definitionId:B,body:(P==null?void 0:P.body)||"",script:(P==null?void 0:P.script)||"",inputs:Array.isArray(P==null?void 0:P.inputs)?P.inputs:[],outputs:Array.isArray(P==null?void 0:P.outputs)?P.outputs:[],flowId:s.flowId,flowSource:s.flowSource||"user",archived:!!s.archived},G=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)}),ee=await G.json().catch(()=>({}));if(!G.ok||(ee==null?void 0:ee.ok)===!1)throw new Error((ee==null?void 0:ee.error)||"Publish failed");return await eo(),ut(`Published node ${ee.definitionId||ee.id||X.packageId}`),ee},[s,eo]),Rs=m.useCallback((P="workspace")=>{fr(!0),jr(!1),Gt(null),Wn(P||"workspace")},[]),Qc=m.useCallback(async(P="")=>{const B=String(P||Lr||"").trim();if(B){pr.current=!0,Qs.current&&(Qs.current.abort(),Qs.current=null),Js(""),sr(new Set),Kr(X=>{const G={...X};for(const[ee,re]of Object.entries(G))(re==null?void 0:re.status)==="running"&&(G[ee]={status:"stopped"});return G[B]={status:"stopped"},G}),ut(`Workspace run stopped: ${B}`),rn(X=>X.map(G=>G.runNodeId===B&&G.status==="running"?{...G,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(G.messages)?G.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:G));try{await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,runNodeId:B})})}catch{}}},[s,Lr]),Ea=m.useCallback(async P=>{if(!P||Lr)return;const B=Pp(i,l,w.current),X=`run-${Date.now()}-${String(P).replace(/[^a-z0-9_-]+/gi,"_")}`,G=`Run ${P}`,ee=new AbortController;Qs.current=ee,pr.current=!1,Js(P),sr(new Set([P])),Kr({[P]:{status:"running"}}),ut(`Running ${P}...`),Wn(X),rn(re=>[...re.slice(-7),{id:X,label:G,runNodeId:P,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);try{await Mn(i,l);const re=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:ee.signal,body:JSON.stringify({...s,graph:B,runNodeId:P,model:Ft,selectedSkills:Ie,stream:!0})});if(!re.ok){const Ne=await re.json().catch(()=>({}));throw new Error(Ne.error||"Workspace run failed")}if(!re.body)throw new Error("Workspace run stream unavailable");const me=re.body.getReader(),be=new TextDecoder;let xe="",_e=[],kt=[],Tt=P;const Ot=(Ne,Ye)=>{var At,qt;const Ze=i.find(Nt=>Nt.id===Ne),Xe=String(((At=Ze==null?void 0:Ze.data)==null?void 0:At.label)||Ne||"").trim(),Oe=String(Ye||((qt=Ze==null?void 0:Ze.data)==null?void 0:qt.definitionId)||"").trim();return Oe&&Oe!==Xe?`${Xe} (${Oe})`:Xe},xn=(Ne,Ye,Ze)=>{const Xe=String(Ne||"").trim();Xe&&rn(Oe=>Oe.map(At=>{if(At.id!==X)return At;const Nt=[...Array.isArray(At.steps)?At.steps:[]],Ue=Nt.findIndex(Ei=>Ei.id===Xe),et={id:Xe,label:Ot(Xe,Ye),status:Ze};Ue>=0?Nt[Ue]={...Nt[Ue],...et}:Nt.push(et);const Wt=Nt.map((Ei,cu)=>{const Pl=Ei.status==="done"?"[done]":Ei.status==="failed"?"[failed]":"[running]";return`${cu+1}. ${Pl} ${Ei.label}`}).join(`
|
|
140
|
+
`),Vn=Array.isArray(At.messages)?At.messages:[],ti=Vn.findIndex(Ei=>Ei.kind==="run-summary"),so={role:"assistant",kind:"run-summary",text:Wt||"准备运行...",at:Date.now()},ot=[...Vn];return ti>=0?ot[ti]=so:ot.unshift(so),{...At,steps:Nt,messages:ot.slice(-160)}}))},An=Ne=>{const Ye=String(Ne||"").trim();if(!Ye)return;const Ze=Tt;Tt=Ye,sr(new Set([Ye])),Kr(Xe=>{var Oe;return{...Xe,...Ze&&Ze!==Ye&&((Oe=Xe[Ze])==null?void 0:Oe.status)==="running"?{[Ze]:{status:"success"}}:{},[Ye]:{status:"running"}}})},Dn=Ne=>{const Ye=String(Ne||"").trim();Ye&&(sr(Ze=>{const Xe=new Set(Ze);return Xe.delete(Ye),Xe}),Kr(Ze=>({...Ze,[Ye]:{status:"success"}})))},Mr=(Ne,Ye)=>{const Ze=String(Ye||"");if(!Ze.trim())return;const Xe=["assistant","thinking","result","error","prompt"].includes(Ne)?Ne:"assistant";rn(Oe=>Oe.map(At=>{if(At.id!==X)return At;let qt=Array.isArray(At.messages)?At.messages:[];if(Xe==="result"){const et=[...qt].reverse().find(Wt=>Wt.kind==="assistant");if(String((et==null?void 0:et.text)||"").trim()===Ze.trim())return At}if(Xe==="assistant"){const et=qt.findIndex(Wt=>Wt.kind==="result"&&String(Wt.text||"").trim()===Ze.trim());et>=0&&(qt=qt.filter((Wt,Vn)=>Vn!==et))}const Nt=[...qt],Ue=Nt[Nt.length-1];return Ue&&Ue.kind===Xe&&!Ue.error?Nt[Nt.length-1]={...Ue,text:`${Ue.text||""}${Ue.text?`
|
|
141
|
+
`:""}${Ze}`}:Nt.push({role:"assistant",kind:Xe,text:Ze,...Xe==="error"?{error:!0}:{},at:Date.now()}),{...At,messages:Nt.slice(-160)}}))},St=Ne=>{const Ye=String(Ne||"");Ye.trim()&&rn(Ze=>Ze.map(Xe=>{var Nt;if(Xe.id!==X)return Xe;const Oe=Array.isArray(Xe.messages)?Xe.messages:[],At=Oe.findIndex(Ue=>Ue.kind==="thinking"),qt=[...Oe];if(At>=0){const Ue=String(((Nt=qt[At])==null?void 0:Nt.text)||"");qt[At]={...qt[At],text:`${Ue}${Ue&&!Ue.endsWith(`
|
|
142
|
+
`),""}${Ye}`,at:Date.now()}}else{const Ue=qt.findIndex(et=>et.kind==="activity");qt.splice(Ue>=0?Ue+1:qt.length,0,{role:"assistant",kind:"thinking",text:Ye,at:Date.now()})}return{...Xe,messages:qt.slice(-160)}}))},Pt=Ne=>{const Ye=S7(Ne);Ye&&rn(Ze=>Ze.map(Xe=>{if(Xe.id!==X)return Xe;const Oe=Array.isArray(Xe.activities)?Xe.activities:[],At=Oe[Oe.length-1]===Ye?Oe:[...Oe,Ye].slice(-8),qt=Array.isArray(Xe.messages)?Xe.messages:[],Nt=qt.findIndex(Wt=>Wt.kind==="activity"),Ue={role:"assistant",kind:"activity",text:At.map((Wt,Vn)=>`${Vn+1}. ${Wt}`).join(`
|
|
143
|
+
`),at:Date.now()},et=[...qt];if(Nt>=0)et[Nt]=Ue;else{const Wt=et.findIndex(Vn=>Vn.kind==="run-summary");et.splice(Wt>=0?Wt+1:0,0,Ue)}return{...Xe,activities:At,messages:et.slice(-160)}}))},Pe=Ne=>{const Ye=String((Ne==null?void 0:Ne.source)||"runner"),Ze=String((Ne==null?void 0:Ne.stream)||""),Xe=String((Ne==null?void 0:Ne.eventType)||"event"),Oe=String((Ne==null?void 0:Ne.text)||"").trim();if(!Oe)return;const At=`[${Ye}${Ze?`:${Ze}`:""}] ${Xe}
|
|
144
|
+
${Oe}`;rn(qt=>qt.map(Nt=>{if(Nt.id!==X)return Nt;const et=[...Array.isArray(Nt.rawTrace)?Nt.rawTrace:[],At].slice(-80),Wt=Array.isArray(Nt.messages)?Nt.messages:[],Vn=Wt.findIndex(ot=>ot.kind==="raw"),ti={role:"assistant",kind:"raw",text:et.join(`
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
`),at:Date.now()},so=[...Wt];return Vn>=0?so[Vn]=ti:so.push(ti),{...Nt,rawTrace:et,messages:so.slice(-160)}}))},ft=Ne=>{rn(Ye=>Ye.map(Ze=>Ze.id===X?{...Ze,status:Ne,endedAt:Date.now()}:Ze))},Fn=Ne=>{const Ye=Cy(Ne||B,S),Ze=new Map(Ye.nodes.map(Oe=>[Oe.id,Oe])),Xe=Ye.instances||{};a(Oe=>{const At=new Set(Oe.map(Ue=>Ue.id)),Nt={...Pp(Oe,f.current,w.current).instances||{}};for(const[Ue,et]of Object.entries(Xe)){if(!At.has(Ue))continue;const Wt=Nt[Ue];ks((et==null?void 0:et.definitionId)||(Wt==null?void 0:Wt.definitionId))&&(Nt[Ue]=et)}return w.current=Nt,v(Nt),Oe.map(Ue=>{var Wt,Vn;const et=Ze.get(Ue.id);return!et||!ks(((Wt=et.data)==null?void 0:Wt.definitionId)||((Vn=Ue.data)==null?void 0:Vn.definitionId))?Ue:{...Ue,data:{...Ue.data,...et.data}}})})};for(;;){const{value:Ne,done:Ye}=await me.read();if(Ye)break;xe+=be.decode(Ne,{stream:!0});const Ze=xe.split(`
|
|
149
|
+
`);xe=Ze.pop()||"";for(const Xe of Ze){if(!Xe.trim())continue;const Oe=JSON.parse(Xe);if(Oe.type==="error")throw new Error(Oe.error||"Workspace run failed");if(Oe.type==="stopped"){pr.current=!0,_e=Array.isArray(Oe.order)?Oe.order:_e;continue}if(Oe.type==="node-start"&&(ut(`Running ${Oe.nodeId}...`),An(Oe.nodeId),xn(Oe.nodeId,Oe.definitionId,"running")),Oe.type==="node-done"&&(Dn(Oe.nodeId),xn(Oe.nodeId,Oe.definitionId,"done")),Oe.type==="status"&&Pt(Oe.line||Oe.message||""),Oe.type==="paused"&&(kt=Array.isArray(Oe.nodeIds)?Oe.nodeIds:[]),Oe.type==="natural"&&(Oe.kind==="thinking"?St(Oe.text||""):Mr(Oe.kind,Oe.text||"")),Oe.type==="raw"){const At=nj(Oe);At&&St(At),Pe(Oe)}Oe.type==="graph"&&Oe.graph&&Fn(Oe.graph),Oe.type==="done"&&(Oe.graph&&Fn(Oe.graph),_e=Array.isArray(Oe.order)?Oe.order:[],kt=Array.isArray(Oe.pauseNodeIds)?Oe.pauseNodeIds:kt)}}if(xe.trim()){const Ne=JSON.parse(xe);if(Ne.type==="error")throw new Error(Ne.error||"Workspace run failed");if(Ne.type==="stopped"&&(pr.current=!0),Ne.type==="node-start"&&(ut(`Running ${Ne.nodeId}...`),An(Ne.nodeId),xn(Ne.nodeId,Ne.definitionId,"running")),Ne.type==="node-done"&&(Dn(Ne.nodeId),xn(Ne.nodeId,Ne.definitionId,"done")),Ne.type==="status"&&Pt(Ne.line||Ne.message||""),Ne.type==="paused"&&(kt=Array.isArray(Ne.nodeIds)?Ne.nodeIds:[]),Ne.type==="natural"&&(Ne.kind==="thinking"?St(Ne.text||""):Mr(Ne.kind,Ne.text||"")),Ne.type==="raw"){const Ye=nj(Ne);Ye&&St(Ye),Pe(Ne)}Ne.type==="graph"&&Ne.graph&&Fn(Ne.graph),Ne.type==="done"&&(Ne.graph&&Fn(Ne.graph),_e=Array.isArray(Ne.order)?Ne.order:[],kt=Array.isArray(Ne.pauseNodeIds)?Ne.pauseNodeIds:kt)}pr.current&&(sr(new Set),Kr(Ne=>{var Ze;const Ye=((Ze=Object.entries(Ne).find(([,Xe])=>(Xe==null?void 0:Xe.status)==="running"))==null?void 0:Ze[0])||P;return Ye?{...Ne,[Ye]:{status:"stopped"}}:Ne})),ut(pr.current?`Workspace run stopped: ${P}`:kt.length?`Workspace run paused at ${kt.join(", ")}`:`Workspace run done: ${_e.length?_e.join(" -> "):P}`),ft(pr.current?"stopped":kt.length?"paused":"done"),pr.current||await hr()}catch(re){if(pr.current||(re==null?void 0:re.name)==="AbortError"){sr(new Set),Kr(me=>{var xe;const be=((xe=Object.entries(me).find(([,_e])=>(_e==null?void 0:_e.status)==="running"))==null?void 0:xe[0])||P;return be?{...me,[be]:{status:"stopped"}}:me}),ut(`Workspace run stopped: ${P}`),rn(me=>me.map(be=>be.id===X?{...be,status:"stopped",endedAt:Date.now()}:be));return}sr(new Set),Kr(me=>{var xe;const be=(xe=Object.entries(me).find(([,_e])=>(_e==null?void 0:_e.status)==="running"))==null?void 0:xe[0];return be?{...me,[be]:{status:"failed"}}:me}),ut(String(re.message||re)),rn(me=>me.map(be=>be.id===X?{...be,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(be.messages)?be.messages:[],{role:"assistant",error:!0,text:String(re.message||re),at:Date.now()}].slice(-160)}:be))}finally{Qs.current===ee&&(Qs.current=null),Js(""),sr(new Set)}},[Ft,l,s,hr,i,S,Lr,Mn,Ie,c,a]),bi=m.useCallback(async()=>{try{const B=await(await fetch("/api/skills")).json().catch(()=>({})),X=Array.isArray(B.skills)?B.skills.map(G=>({key:String(G.key),name:String(G.name||G.id||G.key),description:G.description?String(G.description):"",sourceLabel:G.sourceLabel?String(G.sourceLabel):""})):[];Qt(X),pe(!0)}catch{pe(!0)}},[]),to=m.useCallback(async()=>{try{const B=await(await fetch("/api/mcps")).json().catch(()=>({})),X=Array.isArray(B.servers)?B.servers.map(G=>({name:String((G==null?void 0:G.name)||""),type:String((G==null?void 0:G.type)||""),url:String((G==null?void 0:G.url)||""),command:String((G==null?void 0:G.command)||""),args:Array.isArray(G==null?void 0:G.args)?G.args.map(String):[],description:String((G==null?void 0:G.description)||"")})).filter(G=>G.name):[];ur(X)}catch{ur([])}},[]);m.useEffect(()=>{eo().catch(P=>ut(String(P.message||P))),Pn(),fetch("/api/model-lists").then(P=>P.json()).then(P=>Ln({cursor:Array.isArray(P.cursor)?P.cursor.map(String):[],opencode:Array.isArray(P.opencode)?P.opencode.map(String):[],claudeCode:Array.isArray(P.claudeCode)?P.claudeCode.map(String):[]})).catch(()=>{}),bi(),to(),fetch("/api/skill-collections").then(P=>P.json()).then(P=>{gn(la(P)),En(!0)}).catch(()=>{}),fetch("/api/auth/me").then(P=>P.json()).then(P=>Xs(P.user||null)).catch(()=>Xs(null))},[eo,Pn,to,bi,Qn]),m.useEffect(()=>{if(Ca(""),!(!rr||!qs)){if(!Qn){tn([]);return}tn(RE(Qn,"workspace",Jt,ct)),Ca(Qn)}},[ct,qs,Jt,rr,Qn]),m.useEffect(()=>{if(!(Zi!==Qn||!Qn))try{localStorage.setItem(Qn,JSON.stringify(Ie))}catch{}},[Ie,Qn,Zi]),m.useEffect(()=>{w.current=g},[g]),m.useEffect(()=>{u.current=i},[i]),m.useEffect(()=>{f.current=l},[l]),m.useEffect(()=>{y.current=k},[k]),m.useEffect(()=>{if(!k)return;const P=X=>{X.key==="Escape"&&b(null)},B=X=>{var G,ee;(ee=(G=X.target)==null?void 0:G.closest)!=null&&ee.call(G,".af-connect-node-menu")||b(null)};return document.addEventListener("keydown",P),document.addEventListener("pointerdown",B),()=>{document.removeEventListener("keydown",P),document.removeEventListener("pointerdown",B)}},[k]),m.useEffect(()=>{if(j.current)return E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{Mn().catch(P=>ut(String(P.message||P)))},650),()=>{E.current&&window.clearTimeout(E.current)}},[i,l,Mn]);const _a=m.useCallback((P,B)=>{const X=X7(B),G=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:X,value:X}):[],ee=i.map(xe=>{var _e;return xe.id!==P?xe:{...xe,data:{...xe.data,body:X,inputs:G((_e=xe.data)==null?void 0:_e.inputs)}}}),re=w.current||{},me=re[P]&&typeof re[P]=="object"?re[P]:{},be={...re,[P]:{...me,body:X,input:G(me.input)}};w.current=be,a(ee),v(be),Gt(xe=>!xe||xe.id!==P?xe:{...xe,body:X,inputs:G(xe.inputs)}),Mn(ee,l).catch(xe=>ut(String(xe.message||xe)))},[l,i,Mn,a]),Ht=m.useCallback((P,B)=>{const X=Q7(B),G=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:X,value:X}):[],ee=i.map(xe=>{var _e;return xe.id!==P?xe:{...xe,data:{...xe.data,body:X,inputs:G((_e=xe.data)==null?void 0:_e.inputs)}}}),re=w.current||{},me=re[P]&&typeof re[P]=="object"?re[P]:{},be={...re,[P]:{...me,body:X,input:G(me.input)}};w.current=be,a(ee),v(be),Gt(xe=>!xe||xe.id!==P?xe:{...xe,body:X,inputs:G(xe.inputs)}),Mn(ee,l).catch(xe=>ut(String(xe.message||xe)))},[l,i,Mn,a]),bl=m.useCallback(P=>{const B=String(P||"").trim();B&&(ys(X=>X===B?"":B),ve(X=>({...X,[B]:X[B]||{sessionId:`nodechat_${Date.now()}_${B.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),yn=m.useCallback((P,B)=>{const X=String(P||"").trim();X&&ve(G=>({...G,[X]:{...G[X]||{sessionId:`nodechat_${Date.now()}_${X.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(B||""),error:""}}))},[]),Ao=m.useCallback((P,B,X="replace",G={})=>{var Mr;const ee=String(P||"").trim();if(!ee)return;const re=u.current.find(St=>St.id===ee),me=ks((Mr=re==null?void 0:re.data)==null?void 0:Mr.definitionId),be=me==="html"?_I(B):String(B||""),xe=re?fd(re.data):"",_e=X==="append"&&String(xe||"").trim()?`${String(xe).replace(/\s+$/g,"")}
|
|
150
|
+
|
|
151
|
+
${be.trim()}`:be,kt=me==="image"?"src":"content",Tt=St=>{let Pt=!1;return(Array.isArray(St)?St:[]).map(ft=>{const Fn=String((ft==null?void 0:ft.name)||""),Ne=String((ft==null?void 0:ft.type)||"");return!Pt&&(Fn===kt||Fn==="filePath"||Ne==="text")?(Pt=!0,{...ft,default:_e,value:_e}):ft})},Ot=u.current.map(St=>{var Pt,Pe;return St.id!==ee?St:{...St,data:{...St.data,body:_e,inputs:Tt((Pt=St.data)==null?void 0:Pt.inputs),outputs:Tt((Pe=St.data)==null?void 0:Pe.outputs)}}}),xn=w.current||{},An=xn[ee]&&typeof xn[ee]=="object"?xn[ee]:{},Dn={...xn,[ee]:{...An,body:_e,input:Tt(An.input),output:Tt(An.output)}};w.current=Dn,a(Ot),v(Dn),Gt(St=>(St==null?void 0:St.id)===ee?{...St,body:_e}:St),(G==null?void 0:G.logChat)!==!1&&ve(St=>{var Pt;return{...St,[ee]:{...St[ee]||{},candidateContent:"",messages:[...(Pt=St[ee])!=null&&Pt.messages&&Array.isArray(St[ee].messages)?St[ee].messages:[],{role:"assistant",text:X==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),Mn(Ot,f.current).catch(St=>ut(String(St.message||St))),ut(String((G==null?void 0:G.statusMessage)||"")||(X==="append"?"已追加节点内容":"已替换节点内容"))},[Mn,a]),Pa=m.useCallback((P,B="replace")=>{var ee;const X=String(P||"").trim(),G=String(((ee=q[X])==null?void 0:ee.candidateContent)||"").trim();!X||!G||Ao(X,G,B)},[q,Ao]),Zs=m.useCallback(async P=>{var xe,_e,kt;const B=String(P||"").trim();if(!B)return;const X=q[B]||{},G=String(X.draft||"").trim();if(!G||X.running)return;const ee=u.current.find(Tt=>Tt.id===B);if(!ee)return;const re={role:"user",text:G,at:Date.now()},me=Array.isArray(X.messages)?X.messages:[],be=X.sessionId||`nodechat_${Date.now()}_${B.replace(/[^a-z0-9_-]+/gi,"_")}`;ve(Tt=>({...Tt,[B]:{...X,sessionId:be,messages:[...me,re],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:be,node:{id:B,label:((xe=ee.data)==null?void 0:xe.label)||B,definitionId:((_e=ee.data)==null?void 0:_e.definitionId)||""},nodeKind:ks((kt=ee.data)==null?void 0:kt.definitionId)||"markdown",currentContent:fd(ee.data),messages:me,message:G,model:Ft})}),Ot=await Tt.json().catch(()=>({}));if(!Tt.ok)throw new Error(Ot.error||"节点微调失败");const xn=String(Ot.candidateContent||Ot.reply||"").trim();ve(An=>{var Dn;return{...An,[B]:{...An[B]||{},sessionId:String(Ot.sessionId||be),running:!1,candidateContent:xn,messages:[...(Dn=An[B])!=null&&Dn.messages&&Array.isArray(An[B].messages)?An[B].messages:[...me,re],{role:"assistant",text:xn||"已生成候选内容。",at:Date.now()}]}}})}catch(Tt){const Ot=String(Tt.message||Tt);ve(xn=>({...xn,[B]:{...xn[B]||{},running:!1,error:Ot}})),ut(Ot)}},[Ft,s,q]),Aa=m.useCallback(async(P,B)=>{const X=fd(B);if(!String(X||"").trim()){ut("展示节点没有可保存内容");return}const G=U7(P,B),ee=window.prompt("保存到 workspace 相对路径",G);if(ee)try{const re=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:ee,content:X})}),me=await re.json().catch(()=>({}));if(!re.ok)throw new Error(me.error||"保存文件失败");ut(`已保存 ${me.path||ee}`),await hr()}catch(re){ut(String(re.message||re))}},[s,hr]),kl=m.useCallback((P,B)=>{const X=String(P||"");X&&Gt(G=>{if(!G||G.id!==X)return G;const ee=typeof B=="function"?B(G):B;return!ee||typeof ee!="object"?G:{...G,...ee}})},[]),no=m.useMemo(()=>i.map(P=>{var B,X;return{...P,data:{...P.data,selected:P.selected===!0,modelLists:It,showBodyPreview:!0,isExecuting:Na.has(P.id),nodeStatus:((B=ja[P.id])==null?void 0:B.status)??null,nodeElapsed:((X=ja[P.id])==null?void 0:X.elapsed)??null,onRunWorkspaceNode:Ea,onStopWorkspaceNode:Qc,runningRunNodeId:Lr,skills:Jt,skillCollections:ct,onChangeLoadSkillKeys:_a,onRefreshSkills:bi,mcpServers:Sr,onChangeLoadMcpNames:Ht,onRefreshMcps:to,onSaveDisplayNodeToFile:Aa,nodeChatActive:gs===P.id,nodeChat:q[P.id]||null,onSetDisplayNodeContent:Ao,onToggleNodeChat:bl,onCloseNodeChat:()=>ys(""),onUpdateNodeChatDraft:yn,onSendNodeChat:Zs,onApplyNodeChatCandidate:Pa,onSyncNodePropDraft:kl}}}),[gs,Pa,Ht,_a,Sr,It,q,i,to,bi,Ea,Lr,Aa,Zs,Ao,ct,Jt,Qc,kl,bl,yn,Na,ja]),nt=m.useMemo(()=>i.find(P=>P.id===Ct)||null,[i,Ct]),Io=m.useRef({id:"",draft:null}),Ia=m.useMemo(()=>{const P=lj(nt);return P?JSON.stringify(P):""},[nt]);m.useEffect(()=>{if(!nt){Io.current={id:"",draft:null},Gt(null),Xt("");return}const P=lj(nt),B=Io.current;Io.current={id:nt.id,draft:P},Gt(X=>!X||X.id!==nt.id||B.id!==nt.id||!B.draft?P:eK(X,B.draft,P)),Xt("")},[nt==null?void 0:nt.id,Ia]);const To=m.useCallback((P=!1)=>{var Mr,St;if(!Ce||!nt)return!1;const B=nt.id,X=String(Ce.newId||"").trim(),G=P?X:B;if(Xt(""),P){if(!mI.test(G))return Xt("Invalid instance id"),!1;if(i.some(Pt=>Pt.id===G&&Pt.id!==B))return Xt("Duplicate instance id"),!1}const ee=String(Ce.role||"").trim(),re=ga.includes(ee)?ee:"normal",me=String(Ce.model||"").trim(),be=Pt=>(Array.isArray(Pt)?Pt:[]).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(((Mr=nt.data)==null?void 0:Mr.definitionId)??G),_e=xe.startsWith("provide_"),kt={...nt.data,label:String(Ce.label||"").trim()||G,role:re,model:me===""||me==="default"?void 0:me,body:_e?"":String(Ce.body??""),images:_e?[]:ss(Ce.images),inputs:be(Ce.inputs),outputs:_e&&Array.isArray((St=nt.data)==null?void 0:St.outputs)?nt.data.outputs:be(Ce.outputs)},Tt=String(Ce.script??"").trim();xe==="tool_nodejs"||Tt!==""?kt.script=String(Ce.script??""):delete kt.script;const Ot=nt.data||{};if(!(G!==B||Ot.label!==kt.label||Ot.role!==kt.role||Ot.model!==kt.model||Ot.body!==kt.body||JSON.stringify(ss(Ot.images))!==JSON.stringify(kt.images)||(Ot.script??void 0)!==(kt.script??void 0)||JSON.stringify(Ot.inputs||[])!==JSON.stringify(kt.inputs||[])||JSON.stringify(Ot.outputs||[])!==JSON.stringify(kt.outputs||[])))return!0;let An=i.map(Pt=>Pt.id===B?{...Pt,id:G,selected:!0,data:kt}:Pt),Dn=l;if(G!==B){const Pt={...w.current},Pe={...Pt[B]||{}};delete Pt[B],Pt[G]=Pe,w.current=Pt,v(Pt),Dn=l.map((ft,Fn)=>({...ft,source:ft.source===B?G:ft.source,target:ft.target===B?G:ft.target,id:`we-${ft.source===B?G:ft.source}-${ft.target===B?G:ft.target}-${Fn}`})),Me(G)}return a(An),c(Dn),Ys(G),!0},[l,Ce,i,nt,c,a,Ys]);m.useEffect(()=>{if(!Ce||!nt)return;const P=window.setTimeout(()=>{To(!1)},350);return()=>window.clearTimeout(P)},[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)||[]),To,nt==null?void 0:nt.id]);const Nf=m.useMemo(()=>{const P=new Map(no.map(B=>[B.id,B]));return l.map(B=>{var _e,kt,Tt,Ot;const X=P.get(B.source),G=P.get(B.target),ee=/^output-(\d+)$/.exec(B.sourceHandle||""),re=/^input-(\d+)$/.exec(B.targetHandle||""),me=X&&ee?(kt=(_e=X.data)==null?void 0:_e.outputs)==null?void 0:kt[parseInt(ee[1],10)]:null,be=G&&re?(Ot=(Tt=G.data)==null?void 0:Tt.inputs)==null?void 0:Ot[parseInt(re[1],10)]:null,xe=me!=null&&me.type?Rn(me.type):be!=null&&be.type?Rn(be.type):"";return xe?{...B,style:{...B.style||{},stroke:xe,strokeWidth:2},markerEnd:{type:cs.ArrowClosed,color:xe}}:B})},[l,no]),ro=m.useMemo(()=>{const P=R.trim().toLowerCase(),B={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const X of S)P&&![X.id,X.label,X.displayName,X.description].some(G=>String(G||"").toLowerCase().includes(P))||B[qu(X)].push(X);for(const X of Wl)B[X].sort((G,ee)=>G.id.localeCompare(ee.id));return B},[S,R]),ki=m.useMemo(()=>{const P=je.trim().toLowerCase();return S.filter(B=>!P||[B.id,B.label,B.displayName,B.description].some(X=>String(X||"").toLowerCase().includes(P))).sort((B,X)=>{const G=Wl.indexOf(qu(B)),ee=Wl.indexOf(qu(X));return G!==ee?G-ee:Yu(B).localeCompare(Yu(X))}).slice(0,30)},[S,je]),Si=m.useMemo(()=>{const P=je.trim().toLowerCase();return O.filter(B=>!P||[B.id,B.version,B.displayName,B.name,B.description,...Array.isArray(B.tags)?B.tags:[]].some(X=>String(X||"").toLowerCase().includes(P))).sort((B,X)=>String(B.displayName||B.name||B.id).localeCompare(String(X.displayName||X.name||X.id))).slice(0,30)},[O,je]);m.useEffect(()=>{Ge(0)},[je,de,fe]),m.useEffect(()=>{if(!de)return;const P=window.setTimeout(()=>{var B;return(B=nn.current)==null?void 0:B.focus()},0);return()=>window.clearTimeout(P)},[de]);const Zc=m.useMemo(()=>{const P=ge.trim().toLowerCase();return P?PI(Cn).filter(B=>B.path.toLowerCase().includes(P)):Cn},[ge,Cn]),Sl=[...(It.cursor||[]).map(P=>({label:`Cursor · ${P.split(" - ")[0]}`,value:`cursor:${P.split(" - ")[0]}`})),...(It.opencode||[]).map(P=>({label:`OpenCode · ${P.split(" - ")[0]}`,value:`opencode:${P.split(" - ")[0]}`})),...(It.claudeCode||[]).map(P=>({label:`Claude · ${P.split(" - ")[0]}`,value:`claude-code:${P.split(" - ")[0]}`}))],eu=m.useMemo(()=>new Set(Ie),[Ie]),Cr=m.useMemo(()=>{const P=new Map(Jt.map(re=>[re.key,re])),B=new Set,X=new Set,G=ct.map(re=>{const me=ha(re,Jt).map(be=>P.get(be)).filter(Boolean);for(const be of me)B.add(be.key),X.add(String(be.name||be.id||be.key||"").trim());return{...re,skills:me}}).filter(re=>re.skills.length>0),ee=Jt.filter(re=>{const me=String(re.name||re.id||re.key||"").trim();return!B.has(re.key)&&!X.has(me)});return{groups:G,ungrouped:ee}},[ct,Jt]);m.useEffect(()=>{Nr(P=>{let B=!1;const X=new Set(P);for(const G of Cr.groups)X.has(G.id)||(X.add(G.id),B=!0);return B?X:P})},[Cr.groups]);const $n=m.useMemo(()=>{const P=i.filter(B=>B.selected);return P.length>0?P:Ct?i.filter(B=>B.id===Ct):[]},[i,Ct]),Ta=m.useMemo(()=>$n.map(P=>P.id),[$n]),Ra=m.useMemo(()=>{const P=String((Zt==null?void 0:Zt.username)||(Zt==null?void 0:Zt.userId)||"").trim();return P?P.slice(0,1).toUpperCase():"?"},[Zt]),La=m.useMemo(()=>new Set(Ta),[Ta]),Oa=m.useMemo(()=>l.filter(P=>La.has(P.source)&&La.has(P.target)),[l,La]),Ma=m.useMemo(()=>{const P=R.trim().toLowerCase();return P?O.filter(B=>[B.id,B.version,B.displayName,B.name,B.description,...Array.isArray(B.tags)?B.tags:[]].filter(Boolean).some(X=>String(X).toLowerCase().includes(P))):O},[O,R]),tu=m.useCallback((P,B)=>{const X=String(P||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let G=`${X}_${Date.now().toString(36)}`,ee=2;for(;B.has(G);)G=`${X}_${Date.now().toString(36)}_${ee}`,ee+=1;return B.add(G),G},[]),Ls=m.useCallback((P,B)=>{var Pt;const X=P!=null&&P.snippet&&typeof P.snippet=="object"?P.snippet:{},G=X.instances&&typeof X.instances=="object"?X.instances:{},ee=Object.keys(G);if(ee.length===0)return;const re=new Set(u.current.map(Pe=>Pe.id)),me={};for(const Pe of ee)me[Pe]=tu(Pe,re);const be=(Pt=X.ui)!=null&&Pt.nodePositions&&typeof X.ui.nodePositions=="object"?X.ui.nodePositions:{},xe=ee.map(Pe=>{const ft=be[Pe];return{id:Pe,x:typeof(ft==null?void 0:ft.x)=="number"?ft.x:0,y:typeof(ft==null?void 0:ft.y)=="number"?ft.y:0}}),_e=Math.min(...xe.map(Pe=>Pe.x)),kt=Math.min(...xe.map(Pe=>Pe.y));let Tt=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 ft=Pe.getBoundingClientRect();Tt=n.screenToFlowPosition({x:ft.left+ft.width*.48,y:ft.top+ft.height*.32})}}const Ot={},xn={};for(const Pe of xe){const ft=me[Pe.id];Ot[ft]={...G[Pe.id]||{}},xn[ft]={x:Tt.x+(Pe.x-_e),y:Tt.y+(Pe.y-kt)}}const An=new Set(ee),Dn=(Array.isArray(X.edges)?X.edges:[]).filter(Pe=>An.has(Pe==null?void 0:Pe.source)&&An.has(Pe==null?void 0:Pe.target)).map(Pe=>({source:me[Pe.source],target:me[Pe.target],sourceHandle:Pe.sourceHandle??null,targetHandle:Pe.targetHandle??null})),Mr=Cy({instances:Ot,edges:Dn,ui:{nodePositions:xn}},S),St=Mr.nodes.map(Pe=>({...Pe,selected:!0}));w.current={...w.current,...Mr.instances},v(w.current),a(Pe=>[...Pe.map(ft=>({...ft,selected:!1})),...St]),c(Pe=>[...Pe.map(ft=>({...ft,selected:!1})),...Mr.edges]),ut(`已添加流程片段:${P.displayName||P.id}`)},[tu,S,n,c,a]),Nl=m.useCallback(()=>{var X,G;if($n.length<2){z("请先在 workspace 画布上选择至少两个节点。"),D("flows");return}const P=$n[0],B=$n.length===2?`${((X=P.data)==null?void 0:X.label)||P.id} 片段`:`${((G=P.data)==null?void 0:G.label)||P.id} 等 ${$n.length} 个节点`;J({name:B,id:B.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),ae(""),T(!0),D("flows")},[$n]),nu=m.useCallback(async()=>{var G,ee;if($n.length<2)return;const P=C.name.trim();if(!P){ae("请填写片段名称。");return}const B={};for(const re of $n)B[re.id]={x:((G=re.position)==null?void 0:G.x)||0,y:((ee=re.position)==null?void 0:ee.y)||0};const X=Oa.map(re=>({source:re.source,target:re.target,sourceHandle:re.sourceHandle??null,targetHandle:re.targetHandle??null}));H(!0),ae("");try{const re=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:C.id,name:P,displayName:P,version:"1.0.0",description:C.description,snippet:{instances:gf($n,w.current),edges:X,ui:{nodePositions:B}}})}),me=await re.json().catch(()=>({}));if(!re.ok||me.ok===!1)throw new Error(me.error||"发布流程片段失败");T(!1),ut(`流程片段已发布:${me.id||P}`),Wr(`流程片段已发布:${me.id||P}`),await Pn(),D("flows")}catch(re){ae(String(re.message||re))}finally{H(!1)}},[Pn,C,Oa,$n,Wr]),qr=m.useCallback(P=>{a(B=>B.map(X=>X.id===P?{...X,selected:!1}:X)),Me(B=>B===P?"":B)},[a]),Os=m.useCallback(()=>{const P=Je.current;if(!P)return;const B=P.getBoundingClientRect(),X=Math.min(420,Math.max(320,B.width+160)),G=12,ee=Math.max(180,B.top-G*2),re=Math.min(560,ee);We({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-X-12,B.left)),top:Math.max(G,B.top-re-G),width:X,maxHeight:re,zIndex:1e4})},[]);m.useEffect(()=>{if(!Jn)return;Os();const P=X=>{var ee,re;const G=X.target;(ee=Je.current)!=null&&ee.contains(G)||(re=Vt.current)!=null&&re.contains(G)||Is(!1)},B=X=>{X.key==="Escape"&&Is(!1)};return window.addEventListener("pointerdown",P),window.addEventListener("keydown",B),window.addEventListener("resize",Os),window.addEventListener("scroll",Os,!0),()=>{window.removeEventListener("pointerdown",P),window.removeEventListener("keydown",B),window.removeEventListener("resize",Os),window.removeEventListener("scroll",Os,!0)}},[Jn,Os]);const jl=m.useCallback(P=>{var X,G;const B=new Map;for(const ee of P||[])(ee==null?void 0:ee.type)==="dimensions"&&((X=ee.dimensions)!=null&&X.width)&&((G=ee.dimensions)!=null&&G.height)&&B.set(ee.id,{width:Math.round(Number(ee.dimensions.width)),height:Math.round(Number(ee.dimensions.height))});a(ee=>Dv(P,ee).map(re=>{var be;const me=B.get(re.id);return!me||!ks((be=re.data)==null?void 0:be.definitionId)?re:{...re,data:{...re.data,displaySize:me}}}))},[a]),Ms=m.useCallback(()=>{const P=document.querySelector(".af-workspace-canvas .react-flow");if(P){const B=P.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]),Ni=m.useCallback(()=>{var P,B,X;if(nt){const G=Number(((P=nt.measured)==null?void 0:P.width)||nt.width||260);return{x:Number(((B=nt.position)==null?void 0:B.x)||0)+G+140,y:Number(((X=nt.position)==null?void 0:X.y)||0)}}return Ms()},[Ms,nt]),Or=m.useCallback((P,B={})=>{if(!P)return null;const X=ub(P)||P.id,G=CI(P),ee=B.id||E7(X,i),re=_p(P.inputs),me=_p(P.outputs),be={definitionId:X,...G?{marketplaceRef:G}:{},...P.packageId?{marketplacePackageId:P.packageId}:{},...P.version?{marketplaceVersion:P.version}:{},label:B.label||Zh(P),role:"normal",body:B.body||"",input:B.inputs||re,output:B.outputs||me},xe={id:ee,type:yf,position:B.position||Ms(),data:{label:be.label,definitionId:X,...G?{marketplaceRef:G}:{},...P.packageId?{marketplacePackageId:P.packageId}:{},...P.version?{marketplaceVersion:P.version}:{},schemaType:jI(X,P),role:"normal",body:be.body,inputs:be.input,outputs:be.output}},_e={...Yd(xe,{...w.current,[ee]:be},S),selected:!0};return a(kt=>[...kt.map(Tt=>({...Tt,selected:!1})),_e]),B.openProperties&&Me(ee),ee},[Ms,i,S,a]),Jm=m.useCallback(P=>oj(P,u.current),[]),ru=m.useCallback(P=>{if(!oj(P,u.current)){ut("端口类型不匹配,已取消连线");return}b(null),a(B=>Xh(B,P)),c(B=>{const X=B.filter(G=>!(G.target===P.target&&G.targetHandle===P.targetHandle));return zd({...P,markerEnd:{type:cs.ArrowClosed}},X)})},[c,a]),Cl=m.useCallback((P,B)=>{h.current=N7(B,u.current),b(null)},[]),$a=m.useCallback((P,B)=>{var Ot,xn,An,Dn;const X=h.current;if(h.current=null,!X||B!=null&&B.toNode)return;const G=j7(S,X);if(G.length===0){ut(`没有匹配 ${X.slotType} 端口的节点`);return}const ee=((xn=(Ot=P==null?void 0:P.changedTouches)==null?void 0:Ot[0])==null?void 0:xn.clientX)??(P==null?void 0:P.clientX),re=((Dn=(An=P==null?void 0:P.changedTouches)==null?void 0:An[0])==null?void 0:Dn.clientY)??(P==null?void 0:P.clientY);if(!Number.isFinite(ee)||!Number.isFinite(re))return;const me=document.querySelector(".af-workspace-canvas .react-flow");if(!me)return;const be=me.getBoundingClientRect(),xe=320,_e=Math.min(440,104+G.length*58),kt=Math.max(12,Math.min(ee-be.left,be.width-xe-12)),Tt=Math.max(12,Math.min(re-be.top,be.height-_e-12));b({left:kt,top:Tt,flowPosition:n.screenToFlowPosition({x:ee,y:re}),draft:X,candidates:G,query:""})},[S,n]),su=m.useCallback(P=>{const B=y.current;if(!B||!(P!=null&&P.def))return;const X=Or(P.def,{position:B.flowPosition});if(!X)return;const G=B.draft.handleType==="source"?{source:B.draft.nodeId,sourceHandle:B.draft.handleId,target:X,targetHandle:`input-${P.slotIndex}`}:{source:X,sourceHandle:`output-${P.slotIndex}`,target:B.draft.nodeId,targetHandle:B.draft.handleId};a(ee=>Xh(ee,G)),c(ee=>{const re=ee.filter(me=>!(me.target===G.target&&me.targetHandle===G.targetHandle));return zd({...G,markerEnd:{type:cs.ArrowClosed}},re)}),b(null)},[Or,c]),iu=m.useCallback(P=>{P&&(Or(P,{position:Ni()}),se(!1),He(""))},[Or,Ni]),El=m.useCallback(P=>{P&&(Ls(P,Ni()),se(!1),He(""))},[Ls,Ni]);m.useEffect(()=>{const P=B=>{if(B.defaultPrevented)return;const X=uI(B.target)||k7(B.target);if((B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="s"){B.preventDefault(),Mn().catch(G=>ut(String(G.message||G)));return}if(vt){(B.key==="Escape"||Qh(B))&&(B.preventDefault(),_n(!1));return}if(!X){if((B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="c"){const G=nI(u.current,f.current,w.current);G&&(B.preventDefault(),B.stopPropagation(),p.current=G,ut(`Copied ${G.nodes.length} node${G.nodes.length>1?"s":""}`));return}if((B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="v"){const G=rI(p.current,u.current,f.current,w.current);G&&(B.preventDefault(),B.stopPropagation(),w.current=G.instances,v(G.instances),a(G.nodes),c(G.edges),ut(`Pasted ${G.pastedNodeIds.length} node${G.pastedNodeIds.length>1?"s":""}`));return}if(Qh(B)&&!B.metaKey&&!B.ctrlKey&&!B.altKey){B.preventDefault(),_n(!0);return}if(B.key==="a"||B.key==="A"){if(B.metaKey||B.ctrlKey){B.preventDefault(),a(G=>G.map(ee=>({...ee,selected:!0}))),c(G=>G.map(ee=>({...ee,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",P,!0),()=>window.removeEventListener("keydown",P,!0)},[Mn,vt,c,a]);const ou=m.useCallback(P=>{tt(B=>{const X=new Set(B);return X.has(P)?X.delete(P):X.add(P),X})},[]),Da=m.useCallback((P,B)=>{P.dataTransfer.effectAllowed="copy",P.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:B.path,name:B.name,type:B.type})),P.dataTransfer.setData("text/plain",B.path)},[]),Qm=m.useCallback((P,B)=>{P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("application/agentflow-node",B.id),P.dataTransfer.setData("text/plain",B.id)},[]),_l=m.useCallback(async(P,B)=>{const X=S.find(_e=>_e.id==="display_markdown");if(!X){ut("Markdown Display 节点不可用");return}const G=Ep(s);G.set("path",P.path);const ee=await fetch(`/api/workspace/file?${G.toString()}`),re=await ee.json();if(!ee.ok)throw new Error(re.error||"读取文件失败");const me=String(re.content||""),be=_p(X.inputs).map(_e=>_e.name==="content"?{..._e,default:me}:_e),xe=_p(X.outputs).map(_e=>_e.name==="content"?{..._e,default:me}:_e);Or(X,{label:P.name||"Markdown",body:me,inputs:be,outputs:xe,position:B}),ut(`已创建 Markdown 展示:${P.path}`)},[Or,s,S]),gt=m.useCallback(P=>{_l(P,Ms()).catch(B=>ut(String(B.message||B)))},[_l,Ms]),au=m.useCallback(P=>{const B=P.dataTransfer.getData("application/x-agentflow-workspace-file");if(B){P.preventDefault();let me;try{me=JSON.parse(B)}catch{return}if(!(me!=null&&me.path))return;const be=n.screenToFlowPosition({x:P.clientX,y:P.clientY});_l(me,be).catch(xe=>ut(String(xe.message||xe)));return}const X=P.dataTransfer.getData("application/agentflow-snippet");if(X){const me=O.find(xe=>`${xe.id}@${xe.version}`===X);if(!me)return;P.preventDefault();const be=n.screenToFlowPosition({x:P.clientX,y:P.clientY});Ls(me,be);return}const G=P.dataTransfer.getData("application/agentflow-node");if(!G)return;const ee=S.find(me=>me.id===G);if(!ee)return;P.preventDefault();const re=n.screenToFlowPosition({x:P.clientX,y:P.clientY});Or(ee,{position:re})},[_l,Or,O,Ls,S,n]),Zm=m.useCallback(P=>{const B=Array.from(P.dataTransfer.types||[]);!B.includes("application/x-agentflow-workspace-file")&&!B.includes("application/agentflow-node")&&!B.includes("application/agentflow-snippet")||(P.preventDefault(),P.dataTransfer.dropEffect=B.includes("application/agentflow-node")||B.includes("application/agentflow-snippet")?"move":"copy")},[]),Fa=m.useCallback(async(P="")=>{const B=window.prompt("新文件名",P?`${P}/notes.md`:"notes.md");if(!B)return;const X=P&&!B.includes("/")?`${P}/${B}`:B;try{const G=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:X,content:""})}),ee=await G.json();if(!G.ok)throw new Error(ee.error||"创建文件失败");ut(`已创建 ${ee.path}`),await hr()}catch(G){ut(String(G.message||G))}},[s,hr]),dt=m.useCallback(async(P="")=>{const B=window.prompt("新文件夹名",P?`${P}/docs`:"docs");if(!B)return;const X=P&&!B.includes("/")?`${P}/${B}`:B;try{const G=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:X})}),ee=await G.json();if(!G.ok)throw new Error(ee.error||"创建文件夹失败");tt(re=>{const me=new Set(re);return P&&me.delete(P),me}),ut(`已创建 ${ee.path}`),await hr()}catch(G){ut(String(G.message||G))}},[s,hr]),eg=m.useCallback(async P=>{if(!(!(P!=null&&P.path)||!window.confirm(`删除 ${P.path}?`)))try{const B=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:P.path})}),X=await B.json();if(!B.ok)throw new Error(X.error||"删除失败");ut(`已删除 ${X.path}`),await hr()}catch(B){ut(String(B.message||B))}},[s,hr]),ji=m.useCallback(async()=>{const P=Un.trim();if(!P||Bt)return;const B=Pp(i,l,w.current);Te(""),Ts(!0),Rs("workspace"),Vr(X=>[...X,{role:"user",text:P,at:Date.now()}]);try{await Mn(i,l);const X=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,prompt:P,outputKind:"markdown",workspaceGraph:B,allowFlowYaml:!1,model:Ft,selectedSkills:Ie,selectedNodeIds:Ta})}),G=await X.json();if(!X.ok)throw new Error(G.error||"生成失败");const ee=String(G.content||"").trim();Vr(re=>[...re,{role:"assistant",text:ee,at:Date.now()}]),await eo(),ut("AI 生成完成")}catch(X){const G=String(X.message||X);Vr(ee=>[...ee,{role:"assistant",text:G,error:!0,at:Date.now()}]),ut(G)}finally{Ts(!1)}},[Ft,Bt,Un,l,s,eo,i,Rs,Mn,Ta,Ie]),mr=dr.find(P=>P.id===hs)||null,lu=mr?Array.isArray(mr.messages)?mr.messages:[]:mt,tg=mr?mr.status==="running":Bt,ei=mr?mr.status==="running"?`${mr.label} running`:mr.status==="paused"?`${mr.label} paused`:mr.status==="failed"?`${mr.label} failed`:`${mr.label} done`:Bt?"Workspace agent running":mt.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} · ${cr}`:cr||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",w7,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",onClick:()=>{t(bv({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:Po}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>_n(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(ms?" af-composer-topbar-btn--active":"")+(Bt?" af-composer-topbar-btn--running":""),onClick:()=>fr(P=>!P),children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",onClick:()=>Mn().catch(P=>ut(String(P.message||P))),children:"Save"})]})]}),ce?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:ce}),o.jsx("button",{type:"button",onClick:()=>ue(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(ms||Ce?" af-workspace-body--drawer":"")+(Le?" af-workspace-body--sidebar-collapsed":""),children:[Le?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:()=>Ve(!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:()=>Ve(!1),"aria-label":"展开侧边栏",title:(Zt==null?void 0:Zt.username)||(Zt==null?void 0:Zt.userId)||"展开侧边栏",children:Ra})]})}):null,o.jsxs("aside",{className:"af-workspace-sidebar","aria-hidden":Le,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:()=>Ve(!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:()=>Fa(""),"aria-label":"新增文件",title:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>dt(""),"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 hr(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),o.jsx("input",{className:"af-workspace-search",value:ge,onChange:P=>qe(P.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",children:o.jsx(II,{items:Zc,onOpen:gt,collapsedDirs:it,onToggleDir:ou,onCreateFile:Fa,onCreateFolder:dt,onDelete:eg,onFileDragStart:Da})})]}),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:W==="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:P=>M(P.target.value),placeholder:W==="flows"?"搜索流程片段...":"搜索节点...","aria-label":W==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":W==="nodes",className:"af-palette-tab"+(W==="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":W==="flows",className:"af-palette-tab"+(W==="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:W==="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:Nl,disabled:$n.length<2,title:$n.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:["已选 ",$n.length," 节点 / ",Oa.length," 连线"]})]})}),I?o.jsx("p",{className:"af-err af-palette-list-err",children:I}):null,$?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):Ma.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:Ma.map(P=>{const B=`${P.id}@${P.version}`,X=P.displayName||P.name||P.id,G=P.description||`${P.nodeCount||0} 个节点,${P.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:ee=>{ee.dataTransfer.effectAllowed="move",ee.dataTransfer.setData("application/agentflow-snippet",B),ee.dataTransfer.setData("text/plain",B)},onClick:()=>Ls(P),title:G,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:X}),o.jsxs("span",{className:"af-palette-card-id",children:[P.id,"@",P.version]})]})]}),G?o.jsx("span",{className:"af-palette-card-desc",children:G}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[P.nodeCount||0," nodes"]}),o.jsxs("span",{children:[P.edgeCount||0," edges"]})]})]},B)})})]}):o.jsx("p",{className:"af-palette-empty",children:R.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Wl.map(P=>{var B;return(B=ro[P])!=null&&B.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${P}`,children:[o.jsx("h3",{className:"af-palette-cat",children:P}),o.jsx("div",{className:"af-palette-cards",children:ro[P].map(X=>{const G=ij(X.inputs,"input"),ee=ij(X.outputs,"output"),re=xw(X),me=Yu(X);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:be=>Qm(be,X),onClick:()=>Or(X),title:re||X.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:rj(P)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:me}),me!==X.id?o.jsx("span",{className:"af-palette-card-id",children:X.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:[G.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[G.shown.map((be,xe)=>o.jsxs("span",{className:"af-palette-card-port",title:sj("input",be,xe),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Rn(be==null?void 0:be.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:jy(be,xe)})]},`in-${xe}`)),G.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",G.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:[ee.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[ee.shown.map((be,xe)=>o.jsxs("span",{className:"af-palette-card-port",title:sj("output",be,xe),children:[o.jsx("span",{className:"af-palette-card-port-name",children:jy(be,xe)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Rn(be==null?void 0:be.type)}})]},`out-${xe}`)),ee.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",ee.hidden]}):null]})]})]})]},X.id)})})]},P):null}),S.length>0&&R.trim()&&Wl.every(P=>{var B;return!((B=ro[P])!=null&&B.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),o.jsxs("main",{className:"af-workspace-canvas",children:[o.jsx(SP,{className:"af-flow-canvas af-workspace-flow"+(zt==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),nodes:no,edges:Nf,nodeTypes:q7,onNodesChange:jl,onEdgesChange:d,onConnect:ru,onConnectStart:Cl,onConnectEnd:$a,isValidConnection:Jm,onNodeClick:(P,B)=>{Ct&&Me(B.id)},onNodeDoubleClick:(P,B)=>{P.preventDefault(),fr(!1),a(X=>X.map(G=>({...G,selected:G.id===B.id}))),c(X=>X.map(G=>({...G,selected:!1}))),Me(B.id)},onPaneClick:()=>Me(""),onDrop:au,onDragOver:Zm,selectionOnDrag:zt==="select",panOnDrag:zt==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(_P,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),k?(()=>{var G;const P=String(k.query||"").trim().toLowerCase(),B=P?k.candidates.filter(ee=>{var re,me,be;return[(re=ee.def)==null?void 0:re.id,ee.displayLabel,ee.description,(me=ee.slot)==null?void 0:me.name,(be=ee.slot)==null?void 0:be.type].filter(Boolean).some(xe=>String(xe).toLowerCase().includes(P))}):k.candidates,X=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:Rn((G=k.draft.slot)==null?void 0:G.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:ee=>b(re=>re&&{...re,query:ee.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[B.map(ee=>{var be,xe;const re=ee.displayLabel||((be=ee.def)==null?void 0:be.id),me=jy(ee.slot,ee.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>su(ee),title:ee.description||ee.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!==ee.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:ee.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:X}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Rn((xe=ee.slot)==null?void 0:xe.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:me})]})]},`${ee.def.id}-${ee.slotIndex}`)}),B.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,Gs?o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>jr(!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:()=>jr(!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:$n.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):$n.map(P=>{var ee,re;const B=String(((ee=P.data)==null?void 0:ee.label)??P.id),X=(re=P.data)!=null&&re.definitionId?String(P.data.definitionId):"",G=X&&X!==B?`${B} · ${P.id} · ${X}`:`${B} · ${P.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:G,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:X||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:B}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>qr(P.id),"aria-label":`取消选择 ${P.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},P.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:Un,rows:2,onChange:P=>Te(P.target.value),onKeyDown:P=>{(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&(P.preventDefault(),ji())},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:Je,type:"button",className:"af-composer-skills-button"+(Ie.length>0?" af-composer-skills-button--active":""),disabled:Bt,"aria-haspopup":"listbox","aria-expanded":Jn,onClick:()=>Is(P=>!P),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:Ie.length>0?`Skills ${Ie.length}`:"Skills"})]}),Jn&&!Bt?es.createPortal(o.jsx("div",{ref:Vt,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:ps,children:Jt.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[Cr.groups.map(P=>{const B=ha(P,Jt),X=TE(P,eu,Jt),G=_o.has(P.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(G?" 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:X==="all",disabled:B.length===0,onChange:ee=>{const re=ee.target.checked;tn(me=>re?AE(me,B):IE(me,B))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:P.name}),P.builtin?o.jsx("em",{children:"built-in"}):null,X==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":G?`展开 ${P.name}`:`收起 ${P.name}`,onClick:()=>{Nr(ee=>{const re=new Set(ee);return re.has(P.id)?re.delete(P.id):re.add(P.id),re})},children:[o.jsx("span",{children:P.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:G?"expand_more":"expand_less"})]})]}),G?null:o.jsx("div",{className:"af-composer-skill-group-items",children:P.skills.map(ee=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:eu.has(ee.key),onChange:re=>{const me=re.target.checked;tn(be=>me?be.includes(ee.key)?be:[...be,ee.key]:be.filter(xe=>xe!==ee.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:ee.name}),ee.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:ee.description}):null]})]},`${P.id}:${ee.key}`))})]},P.id)}),Cr.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:Cr.ungrouped.length})]}),Cr.ungrouped.map(P=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:eu.has(P.key),onChange:B=>{const X=B.target.checked;tn(G=>X?G.includes(P.key)?G:[...G,P.key]:G.filter(ee=>ee!==P.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:P.name}),P.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:P.description}):null]})]},`ungrouped:${P.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:Ft,onChange:P=>On(P.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),Sl.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(Un.trim()&&!Bt?" af-composer-send--active":"")+(Bt?" af-composer-send--stop":""),disabled:Bt||!Un.trim(),"aria-label":Bt?"Running":"Send",onClick:()=>void ji(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Bt?"sync":"arrow_upward"})})]})]})]})})]}),ms?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:()=>fr(!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"+(hs==="workspace"?" af-composer-session-tab--active":""),onClick:()=>Wn("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),dr.map(P=>o.jsx("button",{type:"button",className:"af-composer-session-tab"+(hs===P.id?" af-composer-session-tab--active":"")+(P.status==="running"?" af-composer-session-tab--running":""),onClick:()=>Wn(P.id),title:P.runNodeId||P.label,children:o.jsx("span",{className:"af-composer-session-label",children:P.label})},P.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(tg?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:ei}),o.jsx("div",{className:"af-composer-sidebar-thread",children:o.jsx(Y7,{messages:lu,running:tg,showRunningIndicator:!mr})})]})}):Ce&&nt?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(gI,{draft:Ce,setDraft:Gt,definitionId:String(((jf=nt.data)==null?void 0:jf.definitionId)||nt.id),systemPromptReadonly:String(((Ci=nt.data)==null?void 0:Ci.description)||""),modelLists:It,disabled:!1,onIdBlur:()=>To(!0),onClose:()=>Me(""),onPublishToMarketplace:Sf,error:Hn,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(dI,{open:vt,onClose:()=>_n(!1)}),_?es.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:C.name,onChange:P=>{const B=P.target.value;J(X=>({...X,name:B,id:X.id?X.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:C.id,onChange:P=>J(B=>({...B,id:P.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:C.description,onChange:P=>J(B=>({...B,description:P.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",$n.length," 个节点和 ",Oa.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:Z||!C.name.trim(),onClick:()=>void nu(),children:Z?"发布中...":"发布"})]})]})}),document.body):null,de?es.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:P=>P.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":fe==="nodes",className:"af-workspace-quick-add__tab"+(fe==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>ye("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":fe==="flows",className:"af-workspace-quick-add__tab"+(fe==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>ye("flows"),children:"流程"})]}),o.jsxs("div",{className:"af-workspace-quick-add__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:nn,value:je,onChange:P=>He(P.target.value),onKeyDown:P=>{if(P.key==="Escape")P.preventDefault(),se(!1);else if(P.key==="ArrowDown"){P.preventDefault();const B=fe==="flows"?Si.length:ki.length;Ge(X=>Math.min(Math.max(0,B-1),X+1))}else P.key==="ArrowUp"?(P.preventDefault(),Ge(B=>Math.max(0,B-1))):P.key==="Tab"?(P.preventDefault(),ye(B=>B==="nodes"?"flows":"nodes")):P.key==="Enter"&&(P.preventDefault(),fe==="flows"?El(Si[lt]||Si[0]):iu(ki[lt]||ki[0]))},placeholder:fe==="flows"?"搜索流程片段...":"搜索节点...","aria-label":fe==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:fe==="flows"?Si.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:$?"正在加载流程片段...":I||"没有匹配的流程片段"}):Si.map((P,B)=>{const X=P.displayName||P.name||P.id,G=P.snippet&&typeof P.snippet=="object"?P.snippet.instances:null,ee=P.snippet&&typeof P.snippet=="object"?P.snippet.edges:null,re=Number.isFinite(Number(P.nodeCount))?Number(P.nodeCount):Object.keys(G||{}).length,me=Number.isFinite(Number(P.edgeCount))?Number(P.edgeCount):Array.isArray(ee)?ee.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(B===lt?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Ge(B),onClick:()=>El(P),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:X}),o.jsxs("span",{className:"af-workspace-quick-add__meta",children:[P.id,P.version?` · v${P.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:P.description||`${re} 节点 / ${me} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${P.id}@${P.version}`)}):ki.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):ki.map((P,B)=>{const X=qu(P),G=Yu(P),ee=xw(P);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(B===lt?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Ge(B),onClick:()=>iu(P),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:rj(X)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:G}),o.jsx("span",{className:"af-workspace-quick-add__meta",children:P.id}),ee?o.jsx("span",{className:"af-workspace-quick-add__desc",children:ee}):null]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:X})]},P.id)})})]})}),document.body):null]})]})}function sK(){return o.jsx(zv,{children:o.jsx(rK,{})})}const ht=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},cj=e=>e==null?"":""+e,iK=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},oK=/###/g,uj=e=>e&&e.indexOf("###")>-1?e.replace(oK,"."):e,dj=e=>!e||ht(e),pd=(e,t,n)=>{const r=ht(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(dj(e))return{};const i=uj(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return dj(e)?{}:{obj:e,k:uj(r[s])}},fj=(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},aK=(e,t,n,r)=>{const{obj:s,k:i}=pd(e,t,Object);s[i]=s[i]||[],s[i].push(n)},tm=(e,t)=>{const{obj:n,k:r}=pd(e,t);if(n)return n[r]},lK=(e,t,n)=>{const r=tm(e,n);return r!==void 0?r:tm(t,n)},TI=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?ht(e[r])||e[r]instanceof String||ht(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):TI(e[r],t[r],n):e[r]=t[r]);return e},Bl=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var cK={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const uK=e=>ht(e)?e.replace(/[&<>"'\/]/g,t=>cK[t]):e;class dK{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 fK=[" ",",","?","!",";"],pK=new dK(20),hK=(e,t,n)=>{t=t||"",n=n||"";const r=fK.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=pK.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},ww=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},nm=e=>e&&e.replace("_","-"),mK={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 rm{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||mK,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,s){return s&&!this.debug?null:(ht(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new rm(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new rm(this.logger,t)}}var Hi=new rm;class Vm{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 pj extends Vm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.indexOf(".")>-1?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):ht(r)&&i?l.push(...r.split(i)):l.push(r)));const c=tm(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!ht(r)?c:ww(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),fj(this.data,l,s),i.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(ht(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),s=r,r=n,n=l[1]),this.addNamespaces(n);let c=tm(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?TI(c,r,i):c={...c,...r},fj(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 RI={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 hj={};class sm extends Vm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),iK(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Hi.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&&!hK(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:ht(i)?[i]:i};const d=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(d[0])>-1)&&(i=d.shift()),t=d.join(s)}return{key:t,namespaces:ht(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],d=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(u){const j=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${j}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${j}${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,y=f&&f.exactUsedKey||a,k=Object.prototype.toString.apply(p),b=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!ht(p)&&typeof p!="boolean"&&typeof p!="number";if(v&&p&&w&&b.indexOf(k)<0&&!(ht(g)&&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 j=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=j,f.usedParams=this.getUsedParamsDetails(n),f):j}if(i){const j=Array.isArray(p),E=j?[]:{},S=j?y:h;for(const A in p)if(Object.prototype.hasOwnProperty.call(p,A)){const R=`${S}${i}${A}`;E[A]=this.translate(R,{...n,joinArrays:!1,ns:l}),E[A]===R&&(E[A]=p[A])}p=E}}else if(v&&ht(g)&&Array.isArray(p))p=p.join(g),p&&(p=this.extendTranslation(p,t,n,r));else{let j=!1,E=!1;const S=n.count!==void 0&&!ht(n.count),A=sm.hasDefaultValue(n),R=S?this.pluralResolver.getSuffix(d,n.count,n):"",M=n.ordinal&&S?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",W=S&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),D=W&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${R}`]||n[`defaultValue${M}`]||n.defaultValue;!this.isValidLookup(p)&&A&&(j=!0,p=D),this.isValidLookup(p)||(E=!0,p=a);const K=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&E?void 0:p,$=A&&D!==p&&this.options.updateMissing;if(E||j||$){if(this.logger.log($?"updateKey":"missingKey",d,c,a,$?D:p),i){const _=this.resolve(a,{...n,keySeparator:!1});_&&_.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 _=0;_<I.length;_++)L.push(I[_]);else this.options.saveMissingTo==="all"?L=this.languageUtils.toResolveHierarchy(n.lng||this.language):L.push(n.lng||this.language);const z=(_,T,C)=>{const J=A&&C!==p?C:K;this.options.missingKeyHandler?this.options.missingKeyHandler(_,c,T,J,$,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(_,c,T,J,$,n),this.emit("missingKey",_,c,T,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?L.forEach(_=>{const T=this.pluralResolver.getSuffixes(_,n);W&&n[`defaultValue${this.options.pluralSeparator}zero`]&&T.indexOf(`${this.options.pluralSeparator}zero`)<0&&T.push(`${this.options.pluralSeparator}zero`),T.forEach(C=>{z([_],a+C,n[`defaultValue${C}`]||D)})}):z(L,a,D))}p=this.extendTranslation(p,t,n,f,r),E&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${c}:${a}`),(E||j)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,j?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=ht(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&&!ht(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),y=0;y<p;y++)h[y]=arguments[y];return i&&i[0]===h[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):a.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=ht(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=RI.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,a,l;return ht(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),u=d.key;s=u;let f=d.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const p=n.count!==void 0&&!ht(n.count),h=p&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(ht(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,!hj[`${k[0]}-${b}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(hj[`${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(g=>{if(this.isValidLookup(r))return;a=g;const v=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,u,g,b,n);else{let j;p&&(j=this.pluralResolver.getSuffix(g,n.count,n));const E=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(v.push(u+j),n.ordinal&&j.indexOf(S)===0&&v.push(u+j.replace(S,this.options.pluralSeparator)),h&&v.push(u+E)),y){const A=`${u}${this.options.contextSeparator}${n.context}`;v.push(A),p&&(v.push(A+j),n.ordinal&&j.indexOf(S)===0&&v.push(A+j.replace(S,this.options.pluralSeparator)),h&&v.push(A+E))}}let w;for(;w=v.pop();)this.isValidLookup(r)||(i=w,r=this.getResource(g,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&&!ht(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const i of n)delete s[i]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const Ey=e=>e.charAt(0).toUpperCase()+e.slice(1);class mj{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Hi.create("languageUtils")}getScriptPartFromCode(t){if(t=nm(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=nm(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ht(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let s=Intl.getCanonicalLocales(t)[0];if(s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s)return s}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Ey(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]=Ey(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Ey(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),ht(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],i=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return ht(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):ht(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let gK=[{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}],yK={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 xK=["v1","v2","v3"],wK=["v4"],gj={zero:0,one:1,two:2,few:3,many:4,other:5},vK=()=>{const e={};return gK.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:yK[t.fc]}})}),e};class bK{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Hi.create("pluralResolver"),(!this.options.compatibilityJSON||wK.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=vK(),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=nm(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)=>gj[s]-gj[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!xK.includes(this.options.compatibilityJSON)}}const yj=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=lK(e,t,n);return!i&&s&&ht(n)&&(i=ww(e,n,r),i===void 0&&(i=ww(t,n,r))),i},_y=e=>e.replace(/\$/g,"$$$$");class kK{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Hi.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:y,nestingSuffixEscaped:k,nestingOptionsSeparator:b,maxReplaces:g,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:uK,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Bl(i):a||"{{",this.suffix=l?Bl(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=u?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=p?Bl(p):h||Bl("$t("),this.nestingSuffix=y?Bl(y):k||Bl(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=g||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 g=yj(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...s,...n,interpolationkey:h}):g}const y=h.split(this.formatSeparator),k=y.shift().trim(),b=y.join(this.formatSeparator).trim();return this.format(yj(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=>_y(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?_y(this.escape(h)):_y(h)}].forEach(h=>{for(l=0;i=h.regex.exec(t);){const y=i[1].trim();if(a=d(y),a===void 0)if(typeof u=="function"){const b=u(t,i,s);a=ht(b)?b:""}else if(s&&Object.prototype.hasOwnProperty.call(s,y))a="";else if(f){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${t}`),a="";else!ht(a)&&!this.useRawValueToEscape&&(a=cj(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),y=p.match(/"/g);(h&&h.length%2===0&&!y||y.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&&!ht(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let d=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const 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&&!ht(i))return i;ht(i)||(i=cj(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 SK=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}},Hl=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(nm(r),s),t[a]=l),l(n)}};class NK{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Hi.create("formatter"),this.options=t,this.formats={number:Hl((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:Hl((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:Hl((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:Hl((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:Hl((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()]=Hl(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}=SK(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 jK=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class CK extends Vm{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=Hi.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=>{aK(c.loaded,[i],a),jK(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();ht(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ht(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,l),this.loaded(t,a,l)})}saveMissing(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...a,isUpdate:i},d=this.backend.create.bind(this.backend);if(d.length<6)try{let 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 xj=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),ht(e[1])&&(t.defaultValue=e[1]),ht(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),wj=e=>(ht(e.ns)&&(e.ns=[e.ns]),ht(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ht(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Ap=()=>{},EK=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Gd extends Vm{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=wj(t),this.services={},this.logger=Hi,this.modules={external:[]},EK(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(ht(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=xj();this.options={...s,...this.options,...wj(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?Hi.init(i(this.modules.logger),this.options):Hi.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=NK);const f=new mj(this.options);this.store=new pj(this.options.resources,this.options);const p=this.services;p.logger=Hi,p.resourceStore=this.store,p.languageUtils=f,p.pluralResolver=new bK(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 kK(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new CK(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(h){for(var y=arguments.length,k=new Array(y>1?y-1:0),b=1;b<y;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 sm(this.services,this.options),this.translator.on("*",function(h){for(var y=arguments.length,k=new Array(y>1?y-1:0),b=1;b<y;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=Ap),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]:Ap;const s=ht(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(d=>{d!=="cimode"&&i.indexOf(d)<0&&i.push(d)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>a(c)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const s=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=Ap),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"&&RI.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=ht(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);d&&(this.language||i(d),this.translator.language||this.translator.changeLanguage(d),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(d)),this.loadResources(d,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(y=>`${c.keyPrefix}${p}${y}`):h=c.keyPrefix?`${c.keyPrefix}${p}${a}`:a,s.t(h,c)};return ht(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!s||a(i,t)))}loadNamespaces(t,n){const r=Ou();return this.options.ns?(ht(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Ou();ht(t)&&(t=[t]);const s=this.options.preload||[],i=t.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return i.length?(this.options.preload=s.concat(i),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new mj(xj());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]:Ap;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 pj(this.store.data,s),i.services.resourceStore=i.store),i.translator=new sm(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 br=Gd.createInstance();br.createInstance=Gd.createInstance;br.createInstance;br.dir;br.init;br.loadResources;br.reloadResources;br.use;br.changeLanguage;br.getFixedT;br.t;br.exists;br.setDefaultNamespace;br.hasLoadedNamespace;br.loadNamespaces;br.loadLanguages;function _K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xd(e){"@babel/helpers - typeof";return Xd=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},Xd(e)}function PK(e,t){if(Xd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Xd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function AK(e){var t=PK(e,"string");return Xd(t)=="symbol"?t:t+""}function IK(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,AK(r.key),r)}}function TK(e,t,n){return t&&IK(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var LI=[],RK=LI.forEach,LK=LI.slice;function OK(e){return RK.call(LK.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var vj=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,MK=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(!vj.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!vj.test(s.path))throw new TypeError("option path is invalid");a+="; Path=".concat(s.path)}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(s.expires.toUTCString())}if(s.httpOnly&&(a+="; HttpOnly"),s.secure&&(a+="; Secure"),s.sameSite){var c=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite;switch(c){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},bj={create:function(t,n,r,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),s&&(i.domain=s),document.cookie=MK(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)}},$K={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=bj.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&bj.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},DK={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,kj=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},FK={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&kj()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&kj()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},$u=null,Sj=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&&Sj()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Sj()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},BK={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}},HK={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}},UK={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}},WK={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]}},OI=!1;try{document.cookie,OI=!0}catch{}var MI=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];OI||MI.splice(1,1);function VK(){return{order:MI,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var $I=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};_K(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return TK(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=OK(r,this.options||{},VK()),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($K),this.addDetector(DK),this.addDetector(FK),this.addDetector(zK),this.addDetector(BK),this.addDetector(HK),this.addDetector(UK),this.addDetector(WK)}},{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)}))}}])}();$I.type="languageDetector";const KK={name:"AgentFlow",tagline:"AI Workflow Orchestration"},qK={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},YK={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"},GK={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},XK={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},JK={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},QK={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},ZK={app:KK,nav:qK,common:YK,status:GK,nodeTypes:XK,engine:JK,links:QK},eq="Flow Editor",tq="Nodes",nq="Edges",rq="Properties",sq={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"},iq={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}}"},oq={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},aq={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},lq={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"},cq={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)"},uq={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},dq={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},fq={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},pq={node:"Node",text:"Text",file:"File",bool:"Boolean"},hq={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"},mq={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"},gq={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},yq={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."},xq={mainNav:"Main Navigation"},wq={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'},vq={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}}"},bq={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"},kq={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},Sq={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}}"},Nq={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"},jq={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"},Cq={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"},Eq={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"},_q={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"},Pq={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},Aq={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},Iq={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"},Tq={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."},Rq={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},Lq={save:"Save",cancel:"Cancel"},Oq={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},Mq={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},$q={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"},Dq={title:eq,nodes:tq,edges:nq,properties:rq,node:sq,nodeProps:iq,actions:oq,panel:aq,palette:lq,pipeline:cq,status:uq,roles:dq,phases:fq,types:pq,runContext:hq,shortcuts:mq,jumpPalette:gq,emptyCanvas:yq,sidebar:xq,validation:wq,composer:vq,topbar:bq,palette2:kq,run:Sq,fileEdit:Nq,settings:jq,schedule:Cq,history:Eq,nodePropsError:_q,placeholder:Pq,time:Aq,userCheck:Iq,userAsk:Tq,toolPrint:Rq,provideEdit:Lq,runParams:Oq,runPreset:Mq,runConfig:$q},Fq="Settings",zq={engine:"Engine Settings",preferences:"Global Preferences"},Bq={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)."},Hq={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..."}},Uq={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."},Wq={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."},Vq={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)"},Kq={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},qq={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},Yq={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},Gq={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."},Xq={title:Fq,crumb:zq,workspace:Bq,cursor:Hq,opencode:Uq,claudeCode:Wq,env:Vq,system:Kq,shortcuts:qq,language:Yq,onboarding:Gq},Jq={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},Qq={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)"},Zq={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},eY={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},tY={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},nY={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},rY={aiLabels:Jq,placeholders:Qq,actions:Zq,labels:eY,tooltips:tY,rightPanel:nY},sY="Projects",iY="All",oY="Archived",aY="Nodes",lY="My Nodes",cY="My Flows",uY="Skills",dY="Active Projects",fY="Archived Pipelines",pY="Global Nodes",hY="Manage node versions published to the current workspace marketplace, {{count}} total.",mY="Manage flow snippets published to the current workspace marketplace, {{count}} total.",gY="Global Skills",yY="Create New Project",xY="New Pipeline",wY="SEARCH PIPELINES...",vY="SEARCH NODES...",bY="SEARCH FLOW SNIPPETS...",kY="SEARCH SKILLS...",SY="Refresh Resources",NY="Loading pipelines...",jY="Loading global resources...",CY="Filter result: {{count}} items (matching title, description, path and tags)",EY="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",_Y="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",PY="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",AY="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",IY="Executable building blocks for pipeline runtime",TY="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.",RY="Published local node packages",LY="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",OY="Published flow snippets",MY="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",$Y="Operating guides for Composer and agents",DY="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",FY="No archived projects.",zY="No active pipelines; archived items are in the Archived tab.",BY="No global nodes available.",HY="No marketplace nodes have been published.",UY="No flow snippets have been published. Select multiple canvas nodes and publish them first.",WY="No skills available.",VY="No description.",KY='No node matches "{{query}}".',qY='No flow snippet matches "{{query}}".',YY='No skill matches "{{query}}".',GY="{{inputs}} in / {{outputs}} out",XY="Flow Snippet",JY="{{nodes}} nodes / {{edges}} edges",QY="Skill",ZY="Node detail",eG="Flow snippet detail",tG="Skill detail",nG="Type",rG="Source",sG="Package",iG="Version",oG="Path",aG="Editable",lG="Read only",cG="Editable",uG="Schema",dG="Inputs",fG="Outputs",pG="Runtime",hG="Node Body",mG="Files",gG="Usage",yG="No runtime manifest.",xG="No node body or README.",wG="No previewable files.",vG="Select a file to preview.",bG="Binary file preview is not supported.",kG="Large file; showing the first 256KB only.",SG="No pipelines using this node were found.",NG="Node Management",jG="Delete Node Version",CG="Deleting...",EG="AgentFlow checks all flow references before deleting; installed or used versions are kept.",_G="Delete {{id}}@{{version}}? This cannot be undone.",PG="Deleted {{id}}@{{version}}.",AG="{{count}} flow(s) still use it.",IG="No slots",TG="Purpose",RG="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",LG="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.",OG="Scale",MG="Snippet JSON",$G="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",DG="SKILL.md Preview",FG="No preview content available.",zG="Select a resource to inspect details.",BG="Failed to load pipeline list.",HG="No pipelines in current workspace.",UG="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.",WG='No pipelines found matching "{{query}}". Try different keywords or clear the search.',VG="Recent Activity",KG="No recent activity",qG="No recent activity matching the keyword",YG="Recent Run",GG="Recent Open",XG={builtin:"Built-in",workspace:"Workspace",user:"User"},JG={flow:"Flow",global:"Global",marketplace:"Marketplace"},QG={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},ZG={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},eX="Open to edit this pipeline in the node canvas.",tX={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>"},nX={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"},rX={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"},sX={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"},iX={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"},oX={title:sY,all:iY,archived:oY,nodes:aY,myNodes:lY,myFlows:cY,skills:uY,activeProjects:dY,archivedPipelines:fY,globalNodes:pY,myNodesHint:hY,myFlowsHint:mY,globalSkills:gY,createNew:yY,newPipeline:xY,searchPipelines:wY,searchNodes:vY,searchFlows:bY,searchSkills:kY,refreshResources:SY,loadingPipelines:NY,loadingResources:jY,filterResult:CY,archivedHint:EY,activeHint:_Y,nodesHint:PY,skillsHint:AY,nodesPurposeTitle:IY,nodesPurposeDesc:TY,myNodesPurposeTitle:RY,myNodesPurposeDesc:LY,myFlowsPurposeTitle:OY,myFlowsPurposeDesc:MY,skillsPurposeTitle:$Y,skillsPurposeDesc:DY,noArchived:FY,noActive:zY,noNodes:BY,noMyNodes:HY,noMyFlows:UY,noSkills:WY,noDescription:VY,noNodeMatch:KY,noFlowSnippetMatch:qY,noSkillMatch:YY,nodeSlots:GY,flowSnippet:XY,flowSnippetNodes:JY,skill:QY,nodeDetail:ZY,flowDetail:eG,skillDetail:tG,detailType:nG,detailSource:rG,detailPackage:sG,detailVersion:iG,detailPath:oG,detailEditable:aG,readOnly:lG,editable:cG,nodeSchema:uG,nodeInputs:dG,nodeOutputs:fG,nodeRuntime:pG,nodeBody:hG,nodeFiles:mG,nodeUsage:gG,noRuntimeManifest:yG,noNodeBody:xG,noNodeFiles:wG,selectNodeFile:vG,binaryFile:bG,fileTruncated:kG,noNodeUsage:SG,myNodeManagement:NG,deleteMyNode:jG,deletingMyNode:CG,deleteMyNodeHint:EG,deleteMyNodeConfirm:_G,deleteMyNodeSuccess:PG,deleteMyNodeUsedBy:AG,noSlots:IG,resourceMeaning:TG,nodesMeaning:RG,myFlowsMeaning:LG,flowSnippetScale:OG,flowSnippetPreview:MG,skillsMeaning:$G,skillPreview:DG,skillPreviewEmpty:FG,selectResource:zG,loadFailed:BG,noPipelines:HG,emptyHint:UG,noMatch:WG,recentActivity:VG,noRecentActivity:KG,noMatchRecent:qG,recentRun:YG,recentOpen:GG,sourceBadge:XG,resourceSource:JG,resourceFilter:QG,nodeDetailTabs:ZG,defaultCardDesc:eX,hubCard:tX,newPipelineModal:nX,importModal:rX,deleteModal:sX,archiveModal:iX},aX="Back",lX="Next",cX="Skip",uX="Done",dX="Start Creating",fX={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.`},pX={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.`},hX={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"},mX={back:aX,next:lX,skip:cX,done:uX,startCreate:dX,projects:fX,flow:pX,newPipeline:hX},gX={name:"AgentFlow",tagline:"AI 工作流编排"},yX={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",flowEditor:"流程编辑器",settings:"设置",back:"返回"},xX={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},wX={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},vX={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},bX={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},kX={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},SX={app:gX,nav:yX,common:xX,status:wX,nodeTypes:vX,engine:bX,links:kX},NX="流程编辑器",jX="节点",CX="连线",EX="属性",_X={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:"编辑内容"},PX={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}}"},AX={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},IX={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},TX={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},RX={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},LX={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},OX={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},MX={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},$X={node:"节点",text:"文本",file:"文件",bool:"布尔"},DX={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:"等待"},FX={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",selectAll:"全选所有节点"},zX={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},BX={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},HX={mainNav:"主导航"},UX={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},WX={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}}"},VX={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},KX={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},qX={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}} 的分支"},YX={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},GX={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:"已复制"},XX={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:"定时配置已保存"},JX={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},QX={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},ZX={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},eJ={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},tJ={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},nJ={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},rJ={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},sJ={save:"保存",cancel:"取消"},iJ={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},oJ={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},aJ={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},lJ={title:NX,nodes:jX,edges:CX,properties:EX,node:_X,nodeProps:PX,actions:AX,panel:IX,palette:TX,pipeline:RX,status:LX,roles:OX,phases:MX,types:$X,runContext:DX,shortcuts:FX,jumpPalette:zX,emptyCanvas:BX,sidebar:HX,validation:UX,composer:WX,topbar:VX,palette2:KX,run:qX,fileEdit:YX,settings:GX,schedule:XX,history:JX,nodePropsError:QX,placeholder:ZX,time:eJ,userCheck:tJ,userAsk:nJ,toolPrint:rJ,provideEdit:sJ,runParams:iJ,runPreset:oJ,runConfig:aJ},cJ="设置",uJ={engine:"引擎设置",preferences:"全局首选项"},dJ={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},fJ={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},pJ={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},hJ={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},mJ={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",saving:"正在保存...",key:"键",value:"值",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},gJ={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},yJ={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},xJ={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},wJ={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},vJ={title:cJ,crumb:uJ,workspace:dJ,cursor:fJ,opencode:pJ,claudeCode:hJ,env:mJ,system:gJ,shortcuts:yJ,language:xJ,onboarding:wJ},bJ={thinking:"思考",result:"结果",reply:"回复",error:"错误"},kJ={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},SJ={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},NJ={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},jJ={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},CJ={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},EJ={aiLabels:bJ,placeholders:kJ,actions:SJ,labels:NJ,tooltips:jJ,rightPanel:CJ},_J="项目",PJ="全部",AJ="已归档",IJ="Nodes",TJ="我的 Nodes",RJ="我的流程",LJ="Skills",OJ="活跃项目",MJ="已归档流水线",$J="全局 Nodes",DJ="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",FJ="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",zJ="全局 Skills",BJ="创建新项目",HJ="新建流水线",UJ="搜索流水线…",WJ="搜索 nodes…",VJ="搜索流程片段…",KJ="搜索 skills…",qJ="刷新资源",YJ="加载流水线列表…",GJ="加载全局资源…",XJ="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",JJ="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",QJ="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",ZJ="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",eQ="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",tQ="流程运行时的可执行积木",nQ="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",rQ="已发布的本地节点包",sQ="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",iQ="已发布的流程片段",oQ="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",aQ="Composer/Agent 的操作指南",lQ="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",cQ="暂无归档项目。",uQ="暂无未归档流水线;已归档项在 Archived 标签中查看。",dQ="暂无可用全局 nodes。",fQ="暂无已发布的 marketplace nodes。",pQ="暂无已发布的流程片段。可在画布中选中多个节点后发布。",hQ="暂无可用 skills。",mQ="暂无描述。",gQ="未找到与「{{query}}」匹配的 node。",yQ="未找到与「{{query}}」匹配的流程片段。",xQ="未找到与「{{query}}」匹配的 skill。",wQ="{{inputs}} in / {{outputs}} out",vQ="流程片段",bQ="{{nodes}} 节点 / {{edges}} 连线",kQ="Skill",SQ="Node 详情",NQ="流程片段详情",jQ="Skill 详情",CQ="类型",EQ="来源",_Q="包",PQ="版本",AQ="路径",IQ="可编辑",TQ="只读",RQ="可编辑",LQ="Schema",OQ="输入",MQ="输出",$Q="Runtime",DQ="节点内容",FQ="Files",zQ="Usage",BQ="暂无 runtime manifest。",HQ="暂无节点正文或 README。",UQ="暂无可预览文件。",WQ="请选择文件查看内容。",VQ="二进制文件暂不支持预览。",KQ="文件较大,仅显示前 256KB。",qQ="暂未发现使用此 node 的流水线。",YQ="节点管理",GQ="删除节点版本",XQ="删除中…",JQ="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",QQ="确定删除 {{id}}@{{version}}?此操作不可撤销。",ZQ="已删除 {{id}}@{{version}}。",eZ="仍有 {{count}} 个 Flow 使用它。",tZ="无槽位",nZ="作用",rZ="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",sZ="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",iZ="规模",oZ="片段 JSON",aZ="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",lZ="SKILL.md 预览",cZ="暂无可预览内容。",uZ="请选择一个资源查看详情。",dZ="未能加载流水线列表。",fZ="当前工作区暂无流水线。",pZ="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",hZ="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",mZ="最近打开或最近运行",gZ="暂无打开或运行记录",yZ="暂无与关键词匹配的最近记录",xZ="最近运行",wZ="最近打开",vZ={builtin:"内置",workspace:"工作区",user:"用户"},bZ={flow:"Flow",global:"Global",marketplace:"Marketplace"},kZ={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},SZ={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},NZ="打开以在节点画布中编辑此流水线。",jZ={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},CZ={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:"关闭"},EZ={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},_Z={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},PZ={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},AZ={title:_J,all:PJ,archived:AJ,nodes:IJ,myNodes:TJ,myFlows:RJ,skills:LJ,activeProjects:OJ,archivedPipelines:MJ,globalNodes:$J,myNodesHint:DJ,myFlowsHint:FJ,globalSkills:zJ,createNew:BJ,newPipeline:HJ,searchPipelines:UJ,searchNodes:WJ,searchFlows:VJ,searchSkills:KJ,refreshResources:qJ,loadingPipelines:YJ,loadingResources:GJ,filterResult:XJ,archivedHint:JJ,activeHint:QJ,nodesHint:ZJ,skillsHint:eQ,nodesPurposeTitle:tQ,nodesPurposeDesc:nQ,myNodesPurposeTitle:rQ,myNodesPurposeDesc:sQ,myFlowsPurposeTitle:iQ,myFlowsPurposeDesc:oQ,skillsPurposeTitle:aQ,skillsPurposeDesc:lQ,noArchived:cQ,noActive:uQ,noNodes:dQ,noMyNodes:fQ,noMyFlows:pQ,noSkills:hQ,noDescription:mQ,noNodeMatch:gQ,noFlowSnippetMatch:yQ,noSkillMatch:xQ,nodeSlots:wQ,flowSnippet:vQ,flowSnippetNodes:bQ,skill:kQ,nodeDetail:SQ,flowDetail:NQ,skillDetail:jQ,detailType:CQ,detailSource:EQ,detailPackage:_Q,detailVersion:PQ,detailPath:AQ,detailEditable:IQ,readOnly:TQ,editable:RQ,nodeSchema:LQ,nodeInputs:OQ,nodeOutputs:MQ,nodeRuntime:$Q,nodeBody:DQ,nodeFiles:FQ,nodeUsage:zQ,noRuntimeManifest:BQ,noNodeBody:HQ,noNodeFiles:UQ,selectNodeFile:WQ,binaryFile:VQ,fileTruncated:KQ,noNodeUsage:qQ,myNodeManagement:YQ,deleteMyNode:GQ,deletingMyNode:XQ,deleteMyNodeHint:JQ,deleteMyNodeConfirm:QQ,deleteMyNodeSuccess:ZQ,deleteMyNodeUsedBy:eZ,noSlots:tZ,resourceMeaning:nZ,nodesMeaning:rZ,myFlowsMeaning:sZ,flowSnippetScale:iZ,flowSnippetPreview:oZ,skillsMeaning:aZ,skillPreview:lZ,skillPreviewEmpty:cZ,selectResource:uZ,loadFailed:dZ,noPipelines:fZ,emptyHint:pZ,noMatch:hZ,recentActivity:mZ,noRecentActivity:gZ,noMatchRecent:yZ,recentRun:xZ,recentOpen:wZ,sourceBadge:vZ,resourceSource:bZ,resourceFilter:kZ,nodeDetailTabs:SZ,defaultCardDesc:NZ,hubCard:jZ,newPipelineModal:CZ,importModal:EZ,deleteModal:_Z,archiveModal:PZ},IZ="返回",TZ="下一步",RZ="跳过",LZ="完成",OZ="开始创建",MZ={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
168
|
+
|
|
169
|
+
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
170
|
+
|
|
171
|
+
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},$Z={intro:`现在进入流程编辑器。
|
|
172
|
+
|
|
173
|
+
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
174
|
+
|
|
175
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
176
|
+
|
|
177
|
+
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
178
|
+
|
|
179
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`},DZ={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},FZ={back:IZ,next:TZ,skip:RZ,done:LZ,startCreate:OZ,projects:MZ,flow:$Z,newPipeline:DZ},zZ={en:{common:ZK,flow:Dq,settings:Xq,composer:rY,project:oX,onboarding:mX},zh:{common:SX,flow:lJ,settings:vJ,composer:EJ,project:AZ,onboarding:FZ}};br.use($I).use(YL).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 BZ=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function HZ(e){return br.changeLanguage(e)}const vw="agentflow-settings-opencode-plan-v1";function Py(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 DI(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function UZ(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function Ip(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()||DI();!r&&!s||t.push({id:i,key:r,value:s})}return t}function Nj(){try{return localStorage.getItem(vw)??""}catch{return""}}function WZ(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function VZ(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 KZ(){const{t:e,i18n:t}=un(["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,y]=m.useState(!1),[k,b]=m.useState(""),[g,v]=m.useState([]),[w,j]=m.useState(""),[E,S]=m.useState(!1),[A,R]=m.useState(""),[M,W]=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 fe=await se.json();s(typeof fe.workspaceRoot=="string"?fe.workspaceRoot:"")}catch(se){a(String(se.message||se)),s("")}},[]),_=m.useCallback(async()=>{u(""),p(!0);try{const se=await fetch("/api/model-lists");if(!se.ok)throw new Error("HTTP "+se.status);const fe=await se.json();c(Py(fe))}catch(se){u(String(se.message||se))}finally{p(!1)}},[]),T=m.useCallback(async()=>{j("");try{const se=await fetch("/api/user-env"),fe=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof fe.error=="string"?fe.error:"HTTP "+se.status);const ye=Ip(Array.isArray(fe.env)?fe.env:[]);I.current=JSON.stringify(ye),v(ye)}catch(se){v([]),j(String(se.message||se))}finally{L.current=!0}},[]),C=m.useCallback(async se=>{const fe=Ip(se);S(!0),j("");try{const ye=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:fe})}),je=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ye.status);const He=Ip(Array.isArray(je.env)?je.env:[]);I.current=JSON.stringify(He),v(He)}catch(ye){j(String(ye.message||ye))}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()})}),fe=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof fe.error=="string"?fe.error:"HTTP "+se.status);c(Py(fe.modelLists))}catch(se){u(String(se.message||se))}finally{p(!1)}},[D]);m.useEffect(()=>{z(),_(),T(),(async()=>{try{const se=await fetch("/api/agentflow-config");if(se.ok){const fe=await se.json(),ye=typeof fe.opencodeProvider=="string"?fe.opencodeProvider:"";O(ye),K.current=ye;try{localStorage.setItem(vw,ye)}catch{}}else{const fe=Nj();O(fe),K.current=fe}}catch{const se=Nj();O(se),K.current=se}finally{$.current=!0}})()},[z,_,T]),m.useEffect(()=>{if(!L.current||JSON.stringify(Ip(g))===I.current)return;const fe=setTimeout(()=>{C(g)},350);return()=>clearTimeout(fe)},[g,C]),m.useEffect(()=>{if(!$.current)return;const se=D.trim();if(se===K.current)return;const fe=setTimeout(()=>{(async()=>{y(!0),b("");try{const ye=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:se})}),je=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ye.status);K.current=se;try{localStorage.setItem(vw,se)}catch{}je.modelLists&&c(Py(je.modelLists))}catch(ye){b(String(ye.message||ye))}finally{y(!1)}})()},450);return()=>clearTimeout(fe)},[D]);const Z=l.cursor.length>0,H=l.opencode.length>0,te=l.claudeCode.length>0,ae=m.useCallback(()=>{var se;r&&((se=navigator.clipboard)==null||se.writeText(r))},[r]),ce=m.useCallback(()=>{const se=A.trim(),fe=M;if(se){if(!UZ(se)){j(e("settings:env.invalidKey"));return}v(ye=>[...ye,{id:DI(),key:se,value:fe}]),R(""),W("")}},[A,M,e]),ue=m.useCallback(se=>{v(fe=>fe.filter(ye=>ye.id!==se))},[]),le=m.useCallback(se=>{const fe=se.target.value;HZ(fe)},[]),de=se=>{const fe=VZ(se,n);return fe?e("settings:cursor.modelList.fetchedAt",{time:fe}):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:ae,"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"+(Z?" af-set-badge--ok":" af-set-badge--muted"),children:e(Z?"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:Z?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:e(Z?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:Z?e("settings:cursor.modelList.count",{count:l.cursor.length})+" · "+de(l.cursorFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),Z?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})+" · "+de(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})+" · "+de(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(E?"settings:env.saving":"settings:env.note")})]}),o.jsxs("div",{className:"af-set-env-rows",children:[g.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:WZ(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:()=>ue(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=>W(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:ce,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:le,"aria-label":e("settings:language.description"),children:BZ.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 FI(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function jj(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:FI(),key:r,value:String(s??""),private:n.has(r)}))}function Cj(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 rh(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:jj(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:jj(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 Ay(){return rh({name:"",raw:{command:""}})}function qZ(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=Cj(e.envRows),s=Cj(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 Ej(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function _j(e){return e?e.ok?"ok":"error":"unknown"}function Pj({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:FI(),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 YZ(){var O;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,i]=m.useState(Ay),[a,l]=m.useState(""),[c,d]=m.useState(!1),[u,f]=m.useState(!1),[p,h]=m.useState(!1),[y,k]=m.useState({}),[b,g]=m.useState(""),[v,w]=m.useState(""),j=m.useMemo(()=>n.find(K=>K.name===a)||null,[a,n]),E=j&&y[j.name]||null,S=m.useCallback(async()=>{d(!0),g("");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(rh(L.find(I=>I.name===a)))}catch(K){g(String(K.message||K))}finally{d(!1)}},[a]);m.useEffect(()=>{S()},[S]);const A=()=>{l(""),i(Ay()),w(""),g("")},R=K=>{l(K.name),i(rh(K)),w(""),g("")},M=async(K="")=>{h(!0),g(""),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 _={...z};for(const T of I)T!=null&&T.name&&(_[T.name]=T);return _}),w(K?`已检测 ${K}。`:"已检测所有 MCP。")}catch($){g(String($.message||$))}finally{h(!1)}},W=async()=>{f(!0),g(""),w("");try{const K=qZ(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(rh(I.find(z=>z.name===K.nextName)||null)),k(z=>{const _={...z};return s.originalName&&s.originalName!==K.nextName&&delete _[s.originalName],delete _[K.nextName],_}),w("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(K){g(String(K.message||K))}finally{f(!1)}},D=async K=>{if(K!=null&&K.name&&window.confirm(`删除 MCP "${K.name}"?`)){f(!0),g(""),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(Ay()),k(I=>{const z={...I};return delete z[K.name],z}),w("已删除。")}catch($){g(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--${_j(y[K.name])}`,children:Ej(y[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:j?"编辑 MCP":"新增 MCP"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),j?o.jsxs("div",{className:"af-mcp-editor-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>M(j.name),disabled:p||u,children:p?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>D(j),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,E?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${_j(E)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:Ej(E)}),o.jsxs("span",{children:[E.elapsedMs||0,"ms"]})]}),E.error?o.jsx("p",{children:E.error}):null,(O=E.tools)!=null&&O.length?o.jsx("div",{className:"af-mcp-tools-list",children:E.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(Pj,{title:"Headers",rows:s.headerRows,onChange:K=>i($=>({...$,headerRows:K})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(Pj,{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:W,disabled:u,children:u?"保存中...":"保存 MCP"})]})]})]})]})})]})}function zI(e){return t=>typeof t===e}var GZ=zI("function"),XZ=e=>e===null,Aj=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Ij=e=>!JZ(e)&&!XZ(e)&&(GZ(e)||typeof e=="object"),JZ=zI("undefined");function QZ(e,t,n){return iee(n,e,t)?!0:(oee(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?ZZ(e,t,n):e instanceof Map&&t instanceof Map?nee(e,t,n):e instanceof Set&&t instanceof Set?see(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?eee(e,t):Aj(e)&&Aj(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?tee(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():ree(e,t,n))}function xf(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!Ij(e)||!t||!Ij(t)?!1:QZ(e,t,n)}function ZZ(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 eee(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 tee(e,t,n){return e.message===t.message&&e.name===t.name&&xf(e.cause,t.cause,n)}function nee(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 ree(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 see(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 iee(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function oee(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function db(e,t){return xf(e,t,new WeakMap)}function Iy(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function aee(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function lee(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function cee(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function uee(e,t){const n=cee();m.useEffect(()=>{if(!n)return e()},t)}function BI(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function dee(e,t){const n=m.useRef(t);return db(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function fee(e){m.useEffect(()=>{e()},[])}function pee(e=0){const[t,n]=m.useState({height:Iy()?window.innerHeight:0,width:Iy()?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(!Iy())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),lee(window,"resize",i),()=>{aee(window,"resize",i)}},[]),t}var hee=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],mee=["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(gee(t))return t}function vi(e){return t=>wf(t)===e}function gee(e){return hee.includes(e)}function qc(e){return t=>typeof t===e}function yee(e){return mee.includes(e)}var xee=["innerHTML","ownerDocument","style","attributes","nodeValue"],vf=e=>Array.isArray(e),wee=e=>wf(e)==="AsyncGeneratorFunction",vee=vi("AsyncFunction"),bee=qc("bigint"),kee=e=>e===!0||e===!1,See=vi("Date"),Nee=vi("Error"),ya=qc("function"),jee=vi("GeneratorFunction"),Cee=e=>typeof e=="number"&&Number.isInteger(e),bw=vi("Map"),HI=e=>Number.isNaN(e),fb=e=>e===null,UI=vi("Function"),Eee=vi("Promise"),_ee=vi("RegExp"),kw=vi("Set"),bf=qc("string"),Pee=qc("symbol"),pb=qc("undefined"),Aee=vi("WeakMap"),Iee=vi("WeakSet"),hb=e=>fb(e)||pb(e),WI=e=>!pb(e),Tee=e=>qc("number")(e)&&!HI(e),Ree=e=>bf(e)&&e.trim().length>0,Lee=e=>{if(!bf(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},Km=e=>!hb(e)&&(ya(e)||typeof e=="object"),VI=e=>{if(wf(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Oee=e=>fb(e)||yee(typeof e),Mee=e=>wf(e)==="URL",KI=e=>!hb(e)&&ya(e[Symbol.iterator]),$ee=e=>KI(e)&&ya(e.next)&&ya(e.throw),Dee=e=>ya(e)&&/^class\s/.test(e.toString()),Fee=(e,t)=>!vf(e)||!ya(t)?!1:e.every(n=>t(n)),zee=e=>Km(e)&&!VI(e)&&e.nodeType===1&&bf(e.nodeName)&&xee.every(t=>t in e),Bee=e=>bf(e)&&e.length===0||vf(e)&&e.length===0||Km(e)&&!bw(e)&&!kw(e)&&Object.keys(e).length===0||kw(e)&&e.size===0||bw(e)&&e.size===0,Hee=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,Uee=(e,t)=>vf(e)?e.indexOf(t)>-1:!1,Wee=(e,t,n)=>{if(!Km(e)||!t)return!1;const r=e[t];return ya(n)?n(r):WI(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(UI(e))return"Function";const t=wf(e);return t||"Object"}wt.array=vf;wt.arrayOf=Fee;wt.asyncGeneratorFunction=wee;wt.asyncFunction=vee;wt.bigint=bee;wt.boolean=kee;wt.class=Dee;wt.date=See;wt.defined=WI;wt.domElement=zee;wt.empty=Bee;wt.error=Nee;wt.function=ya;wt.generator=$ee;wt.generatorFunction=jee;wt.instanceOf=Hee;wt.integer=Cee;wt.iterable=KI;wt.map=bw;wt.nan=HI;wt.null=fb;wt.nullOrUndefined=hb;wt.nonEmptyString=Ree;wt.number=Tee;wt.numericString=Lee;wt.object=Km;wt.oneOf=Uee;wt.plainFunction=UI;wt.plainObject=VI;wt.primitive=Oee;wt.promise=Eee;wt.propertyOf=Wee;wt.regexp=_ee;wt.set=kw;wt.string=bf;wt.symbol=Pee;wt.undefined=pb;wt.url=Mee;wt.weakMap=Aee;wt.weakSet=Iee;var Ar=wt;/* v8 ignore next -- @preserve */var Vee=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},Kee=function(e,t){return e+Jd(t)},Jd=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(Kee,""):Vee(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Jd(e.props.children):""};Jd.default=Jd;var qee=Jd;const Ty=wa(qee);var qI={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(E){return E!=="constructor"&&E!=="prototype"&&E!=="__proto__"}function a(E){let S=0;const A=E.length,R=new Array(A);for(S;S<A;++S)R[S]=g(E[S]);return R}function l(E){const S={};if(p&&Object.getPrototypeOf(E)!==t)return p(E);const A=f(E);let R,M,W;for(R=0,M=A.length;R<M;++R)i(W=A[R])&&(S[W]=g(E[W]));return S}function c(E,S){const A=E.length,R=S.length;let M=0;const W=new Array(A+R);for(M;M<A;++M)W[M]=g(E[M]);for(M=0;M<R;++M)W[M+A]=g(S[M]);return W}const d=Object.prototype.propertyIsEnumerable;function u(E){const S=Object.keys(E),A=Object.getOwnPropertySymbols(E);for(let R=0,M=A.length;R<M;++R)d.call(E,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(),y=(s==null?void 0:s.onlyDefinedProperties)===!0;function k(E){return typeof E!="object"||E===null}const b=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:g,deepmerge:w,getKeys:f,isMergeableObject:h}):c;function g(E){return h(E)?Array.isArray(E)?a(E):l(E):E}function v(E,S){const A={},R=f(E),M=f(S);let W,D,O;for(W=0,D=R.length;W<D;++W)i(O=R[W])&&M.indexOf(O)===-1&&(A[O]=g(E[O]));for(W=0,D=M.length;W<D;++W)if(i(O=M[W]))if(O in E)R.indexOf(O)!==-1&&(p&&h(S[O])&&Object.getPrototypeOf(S[O])!==t?A[O]=p(S[O]):A[O]=w(E[O],S[O]));else{if(y&&typeof S[O]>"u")continue;A[O]=g(S[O])}return A}function w(E,S){if(y&&typeof S>"u")return g(E);const A=Array.isArray(S),R=Array.isArray(E);return k(S)?S:h(E)?A&&R?b(E,S):A!==R?g(S):v(E,S):g(S)}function j(){switch(arguments.length){case 0:return{};case 1:return g(arguments[0]);case 2:return w(arguments[0],arguments[1])}let E;for(let S=0,A=arguments.length;S<A;++S)E=w(E,arguments[S]);return E}return s!=null&&s.all?j:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(qI);var Yee=qI.exports;const Gee=wa(Yee);var Xee=new Error("Element already at target scroll position"),Jee=new Error("Scroll cancelled"),Qee=Math.min,Tj=Date.now,Zee={left:Rj("scrollLeft"),top:Rj("scrollTop")};function Rj(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=tte);var a=Tj(),l=n[e],c=s.ease||ete,d=isNaN(s.duration)?350:+s.duration,u=!1;return l===r?i(Xee,n[e]):requestAnimationFrame(p),f;function f(){u=!0}function p(h){if(u)return i(Jee,n[e]);var y=Tj(),k=Qee(1,(y-a)/d),b=c(k);n[e]=b*(r-l)+l,k<1?requestAnimationFrame(p):requestAnimationFrame(function(){i(null,n[e])})}}}function ete(e){return .5*(1-Math.cos(Math.PI*e))}function tte(){}const nte=wa(Zee);var YI={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})})(YI);var rte=YI.exports;const GI=wa(rte),ste=["top","right","bottom","left"],Lj=["start","end"],Oj=ste.reduce((e,t)=>e.concat(t,t+"-"+Lj[0],t+"-"+Lj[1]),[]),zc=Math.min,sl=Math.max,im=Math.round,Tp=Math.floor,qi=e=>({x:e,y:e}),ite={left:"right",right:"left",bottom:"top",top:"bottom"};function Sw(e,t,n){return sl(e,zc(t,n))}function Yc(e,t){return typeof e=="function"?e(t):e}function No(e){return e.split("-")[0]}function Yi(e){return e.split("-")[1]}function XI(e){return e==="x"?"y":"x"}function mb(e){return e==="y"?"height":"width"}function Zo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function gb(e){return XI(Zo(e))}function JI(e,t,n){n===void 0&&(n=!1);const r=Yi(e),s=gb(e),i=mb(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=am(a)),[a,am(a)]}function ote(e){const t=am(e);return[om(e),t,om(t)]}function om(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Mj=["left","right"],$j=["right","left"],ate=["top","bottom"],lte=["bottom","top"];function cte(e,t,n){switch(e){case"top":case"bottom":return n?t?$j:Mj:t?Mj:$j;case"left":case"right":return t?ate:lte;default:return[]}}function ute(e,t,n,r){const s=Yi(e);let i=cte(No(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(om)))),i}function am(e){const t=No(e);return ite[t]+e.slice(t.length)}function dte(e){return{top:0,right:0,bottom:0,left:0,...e}}function QI(e){return typeof e!="number"?dte(e):{top:e,right:e,bottom:e,left:e}}function lm(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 Dj(e,t,n){let{reference:r,floating:s}=e;const i=Zo(t),a=gb(t),l=mb(a),c=No(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(Yi(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 fte(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}=Yc(t,e),y=QI(h),b=l[p?f==="floating"?"reference":"floating":f],g=lm(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)),j=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},E=lm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:c}):v);return{top:(g.top-E.top+y.top)/j.y,bottom:(E.bottom-g.bottom+y.bottom)/j.y,left:(g.left-E.left+y.left)/j.x,right:(E.right-g.right+y.right)/j.x}}const pte=50,hte=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:fte},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}=Dj(d,r,c),p=r,h=0;const y={};for(let k=0;k<i.length;k++){const b=i[k];if(!b)continue;const{name:g,fn:v}=b,{x:w,y:j,data:E,reset:S}=await v({x:u,y:f,initialPlacement:r,placement:p,strategy:s,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});u=w??u,f=j??f,y[g]={...y[g],...E},S&&h<pte&&(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}=Dj(d,p,c)),k=-1)}return{x:u,y:f,placement:p,strategy:s,middlewareData:y}},mte=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}=Yc(e,t)||{};if(d==null)return{};const f=QI(u),p={x:n,y:r},h=gb(s),y=mb(h),k=await a.getDimensions(d),b=h==="y",g=b?"top":"left",v=b?"bottom":"right",w=b?"clientHeight":"clientWidth",j=i.reference[y]+i.reference[h]-p[h]-i.floating[y],E=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[y]);const R=j/2-E/2,M=A/2-k[y]/2-1,W=zc(f[g],M),D=zc(f[v],M),O=W,K=A-k[y]-D,$=A/2-k[y]/2+R,L=Sw(O,$,K),I=!c.arrow&&Yi(s)!=null&&$!==L&&i.reference[y]/2-($<O?W:D)-k[y]/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 gte(e,t,n){return(e?[...n.filter(s=>Yi(s)===e),...n.filter(s=>Yi(s)!==e)]:n.filter(s=>No(s)===s)).filter(s=>e?Yi(s)===e||(t?om(s)!==s:!1):!0)}const yte=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=Oj,autoAlignment:h=!0,...y}=Yc(e,t),k=f!==void 0||p===Oj?gte(f||null,h,p):p,b=await c.detectOverflow(t,y),g=((n=a.autoPlacement)==null?void 0:n.index)||0,v=k[g];if(v==null)return{};const w=JI(v,i,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==v)return{reset:{placement:k[0]}};const j=[b[No(v)],b[w[0]],b[w[1]]],E=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:j}],S=k[g+1];if(S)return{data:{index:g+1,overflows:E},reset:{placement:S}};const A=E.map(W=>{const D=Yi(W.placement);return[W.placement,D&&u?W.overflows.slice(0,2).reduce((O,K)=>O+K,0):W.overflows[0],W.overflows]}).sort((W,D)=>W[1]-D[1]),M=((s=A.filter(W=>W[2].slice(0,Yi(W[0])?2:3).every(D=>D<=0))[0])==null?void 0:s[0])||A[0][0];return M!==l?{data:{index:g+1,overflows:E},reset:{placement:M}}:{}}}},xte=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:y="none",flipAlignment:k=!0,...b}=Yc(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=No(s),v=Zo(l),w=No(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(d.floating)),E=p||(w||!k?[am(l)]:ote(l)),S=y!=="none";!p&&S&&E.push(...ute(l,k,y,j));const A=[l,...E],R=await c.detectOverflow(t,b),M=[];let W=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&M.push(R[g]),f){const $=JI(s,a,j);M.push(R[$[0]],R[$[1]])}if(W=[...W,{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!==Zo(L):!1)||W.every(_=>Zo(_.placement)===v?_.overflows[0]>0:!0)))return{data:{index:$,overflows:W},reset:{placement:L}};let I=(O=W.filter(z=>z.overflows[0]<=0).sort((z,_)=>z.overflows[1]-_.overflows[1])[0])==null?void 0:O.placement;if(!I)switch(h){case"bestFit":{var K;const z=(K=W.filter(_=>{if(S){const T=Zo(_.placement);return T===v||T==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(T=>T>0).reduce((T,C)=>T+C,0)]).sort((_,T)=>_[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{}}}},wte=new Set(["left","top"]);async function vte(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=No(n),l=Yi(n),c=Zo(n)==="y",d=wte.has(a)?-1:1,u=i&&c?-1:1,f=Yc(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(h=l==="end"?y*-1:y),c?{x:h*u,y:p*d}:{x:p*d,y:h*u}}const bte=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 vte(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}}}}},kte=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:g=>{let{x:v,y:w}=g;return{x:v,y:w}}},...d}=Yc(e,t),u={x:n,y:r},f=await i.detectOverflow(t,d),p=Zo(No(s)),h=XI(p);let y=u[h],k=u[p];if(a){const g=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=y+f[g],j=y-f[v];y=Sw(w,y,j)}if(l){const g=p==="y"?"top":"left",v=p==="y"?"bottom":"right",w=k+f[g],j=k-f[v];k=Sw(w,k,j)}const b=c.fn({...t,[h]:y,[p]:k});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[h]:a,[p]:l}}}}}};function qm(){return typeof window<"u"}function Gc(e){return ZI(e)?(e.nodeName||"").toLowerCase():"#document"}function Cs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qi(e){var t;return(t=(ZI(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ZI(e){return qm()?e instanceof Node||e instanceof Cs(e).Node:!1}function yi(e){return qm()?e instanceof Element||e instanceof Cs(e).Element:!1}function Eo(e){return qm()?e instanceof HTMLElement||e instanceof Cs(e).HTMLElement:!1}function Fj(e){return!qm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Cs(e).ShadowRoot}function kf(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=xi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Ste(e){return/^(table|td|th)$/.test(Gc(e))}function Ym(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Nte=/transform|translate|scale|rotate|perspective|filter/,jte=/paint|layout|strict|content/,Wa=e=>!!e&&e!=="none";let Ry;function yb(e){const t=yi(e)?xi(e):e;return Wa(t.transform)||Wa(t.translate)||Wa(t.scale)||Wa(t.rotate)||Wa(t.perspective)||!xb()&&(Wa(t.backdropFilter)||Wa(t.filter))||Nte.test(t.willChange||"")||jte.test(t.contain||"")}function Cte(e){let t=xa(e);for(;Eo(t)&&!Bc(t);){if(yb(t))return t;if(Ym(t))return null;t=xa(t)}return null}function xb(){return Ry==null&&(Ry=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ry}function Bc(e){return/^(html|body|#document)$/.test(Gc(e))}function xi(e){return Cs(e).getComputedStyle(e)}function Gm(e){return yi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xa(e){if(Gc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Fj(e)&&e.host||Qi(e);return Fj(t)?t.host:t}function eT(e){const t=xa(e);return Bc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Eo(t)&&kf(t)?t:eT(t)}function Qd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=eT(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=Cs(s);if(i){const l=Nw(a);return t.concat(a,a.visualViewport||[],kf(s)?s:[],l&&n?Qd(l):[])}else return t.concat(s,Qd(s,[],n))}function Nw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tT(e){const t=xi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Eo(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=im(n)!==i||im(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function wb(e){return yi(e)?e:e.contextElement}function vc(e){const t=wb(e);if(!Eo(t))return qi(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=tT(t);let a=(i?im(n.width):n.width)/r,l=(i?im(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Ete=qi(0);function nT(e){const t=Cs(e);return!xb()||!t.visualViewport?Ete:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _te(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Cs(e)?!1:t}function ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=wb(e);let a=qi(1);t&&(r?yi(r)&&(a=vc(r)):a=vc(e));const l=_te(i,n,r)?nT(i):qi(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=Cs(i),h=r&&yi(r)?Cs(r):r;let y=p,k=Nw(y);for(;k&&r&&h!==y;){const b=vc(k),g=k.getBoundingClientRect(),v=xi(k),w=g.left+(k.clientLeft+parseFloat(v.paddingLeft))*b.x,j=g.top+(k.clientTop+parseFloat(v.paddingTop))*b.y;c*=b.x,d*=b.y,u*=b.x,f*=b.y,c+=w,d+=j,y=Cs(k),k=Nw(y)}}return lm({width:u,height:f,x:c,y:d})}function Xm(e,t){const n=Gm(e).scrollLeft;return t?t.left+n:ml(Qi(e)).left+n}function rT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Xm(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Pte(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=Qi(r),l=t?Ym(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=qi(1);const u=qi(0),f=Eo(r);if((f||!f&&!i)&&((Gc(r)!=="body"||kf(a))&&(c=Gm(r)),f)){const h=ml(r);d=vc(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const p=a&&!f&&!i?rT(a,c):qi(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:n.y*d.y-c.scrollTop*d.y+u.y+p.y}}function Ate(e){return Array.from(e.getClientRects())}function Ite(e){const t=Qi(e),n=Gm(e),r=e.ownerDocument.body,s=sl(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=sl(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Xm(e);const l=-n.scrollTop;return xi(r).direction==="rtl"&&(a+=sl(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const zj=25;function Tte(e,t){const n=Cs(e),r=Qi(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=xb();(!u||u&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=Xm(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,y=Math.abs(r.clientWidth-f.clientWidth-h);y<=zj&&(i-=y)}else d<=zj&&(i+=d);return{width:i,height:a,x:l,y:c}}function Rte(e,t){const n=ml(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Eo(e)?vc(e):qi(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:a,height:l,x:c,y:d}}function Bj(e,t,n){let r;if(t==="viewport")r=Tte(e,n);else if(t==="document")r=Ite(Qi(e));else if(yi(t))r=Rte(t,n);else{const s=nT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return lm(r)}function sT(e,t){const n=xa(e);return n===t||!yi(n)||Bc(n)?!1:xi(n).position==="fixed"||sT(n,t)}function Lte(e,t){const n=t.get(e);if(n)return n;let r=Qd(e,[],!1).filter(l=>yi(l)&&Gc(l)!=="body"),s=null;const i=xi(e).position==="fixed";let a=i?xa(e):e;for(;yi(a)&&!Bc(a);){const l=xi(a),c=yb(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||kf(a)&&!c&&sT(e,a))?r=r.filter(u=>u!==a):s=l,a=xa(a)}return t.set(e,r),r}function Ote(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?Ym(t)?[]:Lte(t,this._c):[].concat(n),r],l=Bj(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=Bj(t,a[p],s);c=sl(h.top,c),d=zc(h.right,d),u=zc(h.bottom,u),f=sl(h.left,f)}return{width:d-f,height:u-c,x:f,y:c}}function Mte(e){const{width:t,height:n}=tT(e);return{width:t,height:n}}function $te(e,t,n){const r=Eo(t),s=Qi(t),i=n==="fixed",a=ml(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=qi(0);function d(){c.x=Xm(s)}if(r||!r&&!i)if((Gc(t)!=="body"||kf(s))&&(l=Gm(t)),r){const h=ml(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?rT(s,l):qi(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 Ly(e){return xi(e).position==="static"}function Hj(e,t){if(!Eo(e)||xi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qi(e)===n&&(n=n.ownerDocument.body),n}function iT(e,t){const n=Cs(e);if(Ym(e))return n;if(!Eo(e)){let s=xa(e);for(;s&&!Bc(s);){if(yi(s)&&!Ly(s))return s;s=xa(s)}return n}let r=Hj(e,t);for(;r&&Ste(r)&&Ly(r);)r=Hj(r,t);return r&&Bc(r)&&Ly(r)&&!yb(r)?n:r||Cte(e)||n}const Dte=async function(e){const t=this.getOffsetParent||iT,n=this.getDimensions,r=await n(e.floating);return{reference:$te(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Fte(e){return xi(e).direction==="rtl"}const zte={convertOffsetParentRelativeRectToViewportRelativeRect:Pte,getDocumentElement:Qi,getClippingRect:Ote,getOffsetParent:iT,getElementRects:Dte,getClientRects:Ate,getDimensions:Mte,getScale:vc,isElement:yi,isRTL:Fte};function oT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bte(e,t){let n=null,r;const s=Qi(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 y=Tp(f),k=Tp(s.clientWidth-(u+p)),b=Tp(s.clientHeight-(f+h)),g=Tp(u),w={rootMargin:-y+"px "+-k+"px "+-b+"px "+-g+"px",threshold:sl(0,zc(1,c))||1};let j=!0;function E(S){const A=S[0].intersectionRatio;if(A!==c){if(!j)return a();A?a(!1,A):r=setTimeout(()=>{a(!1,1e-7)},1e3)}A===1&&!oT(d,e.getBoundingClientRect())&&a(),j=!1}try{n=new IntersectionObserver(E,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(E,w)}n.observe(e)}return a(!0),i}function Uj(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=wb(e),u=s||i?[...d?Qd(d):[],...t?Qd(t):[]]:[];u.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=d&&l?Bte(d,n):null;let p=-1,h=null;a&&(h=new ResizeObserver(g=>{let[v]=g;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 y,k=c?ml(e):null;c&&b();function b(){const g=ml(e);k&&!oT(k,g)&&n(),k=g,y=requestAnimationFrame(b)}return n(),()=>{var g;u.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,c&&cancelAnimationFrame(y)}}const Hte=bte,Ute=yte,Wte=kte,Vte=xte,Wj=mte,Kte=(e,t,n)=>{const r=new Map,s={platform:zte,...n},i={...s.platform,_c:r};return hte(e,t,{...s,platform:i})};var qte=typeof document<"u",Yte=function(){},sh=qte?m.useLayoutEffect:Yte;function cm(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(!cm(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)&&!cm(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function aT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vj(e,t){const n=aT(e);return Math.round(t*n)/n}function Oy(e){const t=m.useRef(e);return sh(()=>{t.current=e}),t}function Kj(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);cm(p,r)||h(r);const[y,k]=m.useState(null),[b,g]=m.useState(null),v=m.useCallback(_=>{_!==S.current&&(S.current=_,k(_))},[]),w=m.useCallback(_=>{_!==A.current&&(A.current=_,g(_))},[]),j=i||y,E=a||b,S=m.useRef(null),A=m.useRef(null),R=m.useRef(u),M=c!=null,W=Oy(c),D=Oy(s),O=Oy(d),K=m.useCallback(()=>{if(!S.current||!A.current)return;const _={placement:t,strategy:n,middleware:p};D.current&&(_.platform=D.current),Kte(S.current,A.current,_).then(T=>{const C={...T,isPositioned:O.current!==!1};$.current&&!cm(R.current,C)&&(R.current=C,es.flushSync(()=>{f(C)}))})},[p,t,n,D,O]);sh(()=>{d===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,f(_=>({..._,isPositioned:!1})))},[d]);const $=m.useRef(!1);sh(()=>($.current=!0,()=>{$.current=!1}),[]),sh(()=>{if(j&&(S.current=j),E&&(A.current=E),j&&E){if(W.current)return W.current(j,E,K);K()}},[j,E,K,W,M]);const L=m.useMemo(()=>({reference:S,floating:A,setReference:v,setFloating:w}),[v,w]),I=m.useMemo(()=>({reference:j,floating:E}),[j,E]),z=m.useMemo(()=>{const _={position:n,left:0,top:0};if(!I.floating)return _;const T=Vj(I.floating,u.x),C=Vj(I.floating,u.y);return l?{..._,transform:"translate("+T+"px, "+C+"px)",...aT(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:T,top:C}},[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 Gte=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?Wj({element:r.current,padding:s}).fn(n):{}:r?Wj({element:r,padding:s}).fn(n):{}}}},qj=(e,t)=>{const n=Hte(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xte=(e,t)=>{const n=Wte(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jte=(e,t)=>{const n=Vte(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qte=(e,t)=>{const n=Ute(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zte=(e,t)=>{const n=Gte(e);return{name:n.name,fn:n.fn,options:[e,t]}},ene={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},tne={beaconOptions:{offset:-18}},lT={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},nne={isFixed:!1,locale:lT,placement:"bottom"},rne={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},_t={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},ir={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"},De={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},Di={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},jt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},sne="react-joyride-portal";function ine(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function cc(...e){return Gee({all:!0,isMergeableObject:t=>!(!Ar.plainObject(t)||m.isValidElement(t))})(...e)}function cT(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function fo(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Ty(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&&cT(e.type)==="function")try{i=fo(e.type({}),t)}catch{i=Ty(n)}else i=Ty(n);return i}function ar(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 one(e,t){const n=ine(t);return{...e,...n}}function Zd(){}function ane(e){return Object.keys(e)}function um(e,...t){if(!Ar.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 Yj(e,...t){if(!Ar.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 jw(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(cT(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(Ar.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):jw(i,t,n))});if(Ar.function(e.type)&&!Object.values(e.props).length)try{return jw(e.type({}),t,n)}catch{return e}return e}function Gj(e){return ane(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function vb(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function Xj(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 bb(e){return e?e.getBoundingClientRect():null}function lne(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 Hs(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 cne(e,t,n){const r=bb(e),s=Xc(e),i=s?!s.isSameNode(is()):!1,a=n??Jc(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(is())||(c+=is().scrollTop)),Math.floor(c-t)}function Xc(e,t){if(!e)return is();const n=GI(e);if(n){if(n.isSameNode(is()))return t?document:is();if(!(n.scrollHeight>n.offsetHeight))return is()}return n}function une(e){const t=e.getBoundingClientRect(),n=is(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function dne(e,t){if(!e)return 0;const n=GI(e)??is(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=bb(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(uT(e)||fne(e))){const u=e.getBoundingClientRect(),f=u.top-((s==null?void 0:s.top)??0),p=f+u.height,h=n.clientHeight,y=h*.2;f>=y&&p<=h-y?c=i:c=f+i}const d=Math.floor(c-t-r);return d<0?0:d}function fne(e){return e.offsetParent!==document.body}function uT(e){if(!e)return!1;const t=Xc(e);return t?!t.isSameNode(is()):!1}function Jc(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?Jc(e.parentNode,t):!1}function Rp(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 Jj(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==De.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?Xc(s):is(),l=a?!a.isSameNode(is()):!1;return(r.isFixed||Jc(s))&&!l?!1:a.scrollHeight>a.clientHeight}function is(){return document.scrollingElement??document.documentElement}function Qj(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=nte.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function pne(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 dT={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Lp={...dT,borderRadius:4,padding:8};function hne(e,t){const{styles:n}=e,r=cc(n??{},t.styles??{});let{width:s}=t;vb()&&(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 cc({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...dT,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(${pne(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:{...Lp,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Lp,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Lp,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Lp,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 mne=["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 kb(e,t){if(!t)return null;const n=cc(nne,Yj(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=cc(ene,e.options??{},Yj(t,...mne)),s=hne(e,{...n,...r}),i=cc(tne,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:cc(lT,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:gne(r.spotlightPadding),styles:s}}function gne(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 yne(e,t,n){const{action:r}=t,s=n&&[_t.PREV,_t.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function fT(e,t=!1){return Ar.plainObject(e)?e.target?!0:(ar(t,"tour","target is missing from the step"),!1):(ar(t,"tour","step must be an object"),!1)}function pT(e,t=!1){return Ar.array(e)?e.every(n=>fT(n,t)):(ar(t,"tour","steps must be an array"),!1)}var xne=class{constructor(e){In(this,"beaconPosition",null);In(this,"debug");In(this,"eventListeners",new Map);In(this,"listeners",new Set);In(this,"props");In(this,"snapshot");In(this,"state");In(this,"steps");In(this,"tooltipPosition",null);In(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});In(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);In(this,"getServerSnapshot",()=>this.snapshot);In(this,"getSnapshot",()=>this.snapshot);In(this,"getEventState",()=>um(this.snapshot,"positioned"));In(this,"getState",()=>um(this.snapshot,"positioned"));In(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&ar(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===De.BEACON_BEFORE||this.state.lifecycle===De.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)});In(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});In(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});In(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)}});In(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));In(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,!db(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=Ar.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,Ar.number(t)&&ar(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Ar.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&ar(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:_t.INIT,controlled:s,index:i,lifecycle:De.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?jt.READY:jt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===jt.WAITING&&e.size>0?{...e,status:jt.RUNNING}:e}getStep(e){return kb(this.props,this.steps[e??this.state.index])}};function wne(e){return new xne(e)}function Zj(e,t){return Math.min(Math.max(e,0),t)}function vne(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:g,status:v}=i();v===jt.RUNNING&&e.current.updateState({action:_t.CLOSE,index:g+1,origin:b,lifecycle:De.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:b=>{const{controlled:g,size:v,status:w}=i();if(g){ar(r.current,"tour","go() is not supported in controlled mode");return}w===jt.RUNNING&&e.current.updateState({action:_t.GO,index:b,lifecycle:De.COMPLETE,positioned:!1,scrolling:!1,status:b<v?w:jt.FINISHED,waiting:!1})},info:()=>um(e.current.getSnapshot(),"positioned"),next:b=>{const{index:g,size:v,status:w}=i();w===jt.RUNNING&&e.current.updateState({action:_t.NEXT,index:Zj(g+1,v),lifecycle:De.COMPLETE,origin:b,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:b}=i();b===jt.RUNNING&&e.current.updateState({action:_t.UPDATE,lifecycle:De.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:b=>{const{index:g,size:v,status:w}=i();w===jt.RUNNING&&e.current.updateState({action:_t.PREV,index:Zj(g-1,v),lifecycle:De.COMPLETE,origin:b,positioned:!1,scrolling:!1,waiting:!1})},reset:(b=!1)=>{const{controlled:g}=i();if(g){ar(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:_t.RESET,index:0,lifecycle:De.INIT,positioned:!1,scrolling:!1,status:b?jt.RUNNING:jt.READY,waiting:!1})},skip:b=>{const{status:g}=i();g===jt.RUNNING&&e.current.updateState({action:_t.SKIP,lifecycle:De.COMPLETE,origin:b,positioned:!1,scrolling:!1,status:jt.SKIPPED,waiting:!1})},start:b=>{const{index:g,size:v}=i();s.current(),e.current.updateState({action:_t.START,index:Ar.number(b)?b:g,lifecycle:De.INIT,positioned:!1,scrolling:!1,status:v?jt.RUNNING:jt.WAITING,waiting:!1},!0)},stop:(b=!1)=>{const{index:g,status:v}=i();[jt.FINISHED,jt.SKIPPED].includes(v)||e.current.updateState({action:_t.STOP,index:g+(b?1:0),lifecycle:De.COMPLETE,positioned:!1,scrolling:!1,status:jt.PAUSED,waiting:!1})}}},[e])}const bne=new Set(["origin","positioned"]);function kne(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return ar(!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]&&!bne.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||ar(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function Sne(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 Ko(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 Nne(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:y,status:k}=a,b=BI(l)??null,g=m.useRef(null),v=m.useRef(i),w=m.useRef(a),j=m.useRef(s),E=m.useRef(l),S=m.useRef(b),A=m.useRef(n),R=m.useRef(null),M=m.useRef(null),W=m.useRef(null);v.current=i,w.current=a,j.current=s,E.current=l,S.current=b,A.current=n;const D=()=>{R.current&&(clearInterval(R.current),R.current=null),M.current=null,W.current&&(W.current.cancel(),W.current=null)};m.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O}=Ko(w.current,j.current);(O("action",[_t.NEXT,_t.PREV,_t.SKIP,_t.CLOSE])||g.current===_t.CLOSE&&d===_t.START)&&(g.current=d)},[d]),m.useEffect(()=>{if(!j.current)return()=>{D()};const{hasChanged:O}=Ko(w.current,j.current),K=E.current;if(O("index")&&D(),k!==jt.RUNNING||!K||f!==De.INIT)return()=>{D()};const{hasChangedTo:$}=Ko(w.current,j.current);$("status",jt.RUNNING)&&[jt.IDLE,jt.READY,jt.PAUSED].includes(j.current.status)&&r(ir.TOUR_START,K),c.current.cleanupPositionData();const{debug:L}=v.current;if(K.before&&!W.current){ar(L,`step:${u}`,"before()",K),W.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(ir.STEP_BEFORE_HOOK,K,{action:g.current??w.current.action});const I=()=>{W.current=null,c.current.updateState({action:g.current??w.current.action,waiting:!1,lifecycle:De.READY})},z=new AbortController,_=K.beforeTimeout;W.current={cancel:()=>z.abort()};const T=_?setTimeout(()=>{z.signal.aborted||(ar(L,`step:${u}`,"before()","timed out",`${_}ms`),z.abort(),t(K,"before_hook"),r(ir.ERROR,K,{error:new Error("Step before hook timed out")}),I())},_):null;K.before({...c.current.getState(),action:g.current??c.current.getState().action,step:K}).then(()=>{z.signal.aborted||(T&&clearTimeout(T),I())}).catch(C=>{z.signal.aborted||(T&&clearTimeout(T),t(K,"before_hook"),r(ir.ERROR,K,{error:C instanceof Error?C:new Error(String(C))}),I())})}else if(!W.current){R.current&&M.current!==K.target&&D();const I=Hs(K.target);if(I&&Rp(I))D(),c.current.updateState({action:g.current??_t.UPDATE,lifecycle:De.READY,waiting:!1});else if(K.targetWaitTimeout===0)c.current.updateState({action:g.current??_t.UPDATE,lifecycle:De.READY,waiting:!1});else if(!R.current){const{targetWaitTimeout:z}=K,_=Date.now();M.current=K.target,ar(L,`step:${u}`,"polling","started",`${z}ms`),c.current.updateState({waiting:!0}),R.current=setInterval(()=>{const T=Hs(K.target),C=Date.now()-_,J=C>=z;(T&&Rp(T)||J)&&(ar(L,`step:${u}`,"polling",T&&Rp(T)?"found":"timed out",`${C}ms`),D(),c.current.updateState({action:g.current??_t.UPDATE,lifecycle:De.READY,waiting:!1}))},100)}}return()=>{D()}},[t,r,u,f,k,c]),m.useEffect(()=>{if(!j.current)return;const{hasChanged:O,hasChangedTo:K,previous:$}=Ko(w.current,j.current),L=E.current;if(!L)return;const I=Hs(L.target),z=!!I;if(z&&Rp(I)){if(K("lifecycle",De.READY)&&$.lifecycle===De.INIT&&r(ir.STEP_BEFORE,L,{action:g.current??w.current.action}),K("lifecycle",De.READY)){const _=w.current,T=yne(L,_,v.current.continuous)?De.TOOLTIP:De.BEACON,C=Hs(L.scrollTarget??L.spotlightTarget??L.target),J=Jj({isFirstStep:_.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:L,target:C,targetLifecycle:T}),Z=T===De.TOOLTIP?De.TOOLTIP_BEFORE:De.BEACON_BEFORE;ar(v.current.debug,`step:${u}`,"scroll",J?"needed":"skipped"),c.current.updateState({action:_t.UPDATE,lifecycle:Z,scrolling:J})}}else if(w.current.status===jt.RUNNING&&f!==De.INIT&&f!==De.COMPLETE&&O("lifecycle")){ar(v.current.debug,`step:${u}`,z?"Target not visible":"Target not mounted",L),t(L,"target_not_found"),r(ir.TARGET_NOT_FOUND,L);const _=w.current;_.controlled||c.current.updateState({action:_t.UPDATE,index:_.index+(_.action===_t.PREV?-1:1),lifecycle:De.INIT})}},[t,r,u,f,c]),m.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O,previous:K}=Ko(w.current,j.current),$=E.current,L=S.current;if($&&O("lifecycle",De.TOOLTIP_BEFORE)&&K.lifecycle===De.BEACON){const _=Hs($.scrollTarget??$.spotlightTarget??$.target);if(Jj({isFirstStep:w.current.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:$,target:_,targetLifecycle:De.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const I=f===De.BEACON_BEFORE||f===De.TOOLTIP_BEFORE;if($&&I&&!h){const _=f===De.TOOLTIP_BEFORE?De.TOOLTIP:De.BEACON;c.current.updateState({action:_t.UPDATE,lifecycle:_})}$&&O("lifecycle",De.BEACON)&&r(ir.BEACON,$),$&&O("lifecycle",De.TOOLTIP)&&r(ir.TOOLTIP,$);const z=w.current;if((z.status===jt.RUNNING||z.controlled&&z.status===jt.PAUSED&&$)&&L&&O("lifecycle",De.COMPLETE)&&K.lifecycle===De.TOOLTIP&&(r(ir.STEP_AFTER,L,{action:g.current??_t.UPDATE,index:K.index??z.index,lifecycle:z.lifecycle}),L.after)){r(ir.STEP_AFTER_HOOK,L,{action:g.current??_t.UPDATE,index:K.index??z.index,lifecycle:z.lifecycle});try{L.after({...c.current.getState(),action:g.current??_t.UPDATE,index:K.index??z.index,lifecycle:z.lifecycle,step:L})}catch{}}},[r,f,p,h,c]),m.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O,previous:K}=Ko(w.current,j.current),$=E.current,L=S.current;y&&!$&&f===De.INIT&&c.current.updateState({action:_t.UPDATE,lifecycle:De.COMPLETE,status:jt.FINISHED}),!w.current.controlled&&k===jt.RUNNING&&O("lifecycle",De.COMPLETE)&&u<y&&c.current.updateState({action:_t.UPDATE,lifecycle:De.INIT}),O("lifecycle",De.COMPLETE)&&u>=y&&c.current.updateState({action:_t.UPDATE,lifecycle:De.COMPLETE,status:jt.FINISHED});const I=$??L??kb(v.current,v.current.steps[u-1]);if(I&&O("status",[jt.FINISHED,jt.SKIPPED])){let z;$?z=u:L?z=K.index??u:z=u-1,r(ir.TOUR_END,I,{index:z}),w.current.controlled||A.current.reset(),g.current=null}$&&O("action",_t.STOP)&&(g.current=null,r(ir.TOUR_STATUS,$)),$&&O("action",_t.RESET)&&(r(ir.TOUR_STATUS,$),g.current=null)},[d,r,u,f,y,k,c])}function jne({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:y}=Ko(n,h);if(db(h.steps,d)||(pT(d,i)?s.current.setSteps(d):(ar(i,"tour","Steps are not valid",d),t(ir.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),y("run"))l?s.current.getState().size&&p.current.start(c??a):p.current.stop();else if(Ar.number(c)&&y("stepIndex")){const k=Ar.number(h.stepIndex)&&h.stepIndex<c?_t.NEXT:_t.PREV;[jt.FINISHED,jt.SKIPPED].includes(f.current.status)||s.current.updateState({action:k,index:c,lifecycle:De.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,d,s])}function Cne(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===De.BEACON_BEFORE&&(n!=null&&n.placement)){const f=Ene(n);["bottom"].includes(n.placement)||(a+=Math.floor(f-s))}else if(r===De.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,y=i.offset+i.spotlightPadding.top+h;a-=p+y}else if(f==="left"||f==="right"){const p=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,h=((u=Hs(i.target))==null?void 0:u.getBoundingClientRect().height)??0,y=s+i.spotlightPadding.top+h/2-p/2;y<s&&(a-=s-y)}}return Math.max(0,a)}function Ene(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 _ne({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),y=m.useRef(n),k=m.useRef(s);p.current=r,h.current=t,y.current=n,k.current=s,m.useEffect(()=>()=>{var b;(b=f.current)==null||b.call(f)},[]),m.useEffect(()=>{var E;if(!h.current||!k.current)return;const{hasChangedTo:b}=Ko(p.current,h.current),g=k.current,{debug:v}=y.current,{scrollDuration:w}=g,j=l===De.BEACON_BEFORE||l===De.TOOLTIP_BEFORE;if(u===jt.RUNNING&&j&&d&&b("positioned",!0)){const S=Hs(g.scrollTarget??g.spotlightTarget??g.target),A=i.current.getPositionData("beacon"),R=Xc(S),M=R?!R.isSameNode(is()):!1;(E=f.current)==null||E.call(f),(async()=>{if(M&&!Jc(R)){const z=is(),_=une(R),T={initial:z.scrollTop,target:_,element:z,duration:w};e(ir.SCROLL_START,g,{scroll:T});const{cancel:C,promise:J}=Qj(_,{element:z,duration:w});f.current=C,await J,e(ir.SCROLL_END,g,{scroll:T})}const D=Math.floor(dne(S,g.scrollOffset))||0,O=M?D:Cne(D,{beaconPosition:A,lifecycle:l,scrollOffset:g.scrollOffset,step:g});ar(v,`step:${a}`,"scroll",M?"custom":"document",`${D} → ${O}`);const K=R,$={initial:K.scrollTop,target:O,element:K,duration:w};e(ir.SCROLL_START,g,{scroll:$});const{cancel:L,promise:I}=Qj(O,{element:K,duration:w});f.current=L,await I,e(ir.SCROLL_END,g,{scroll:$}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,d,u,i])}function Pne(e){const t=dee(()=>one(rne,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=m.useRef(wne(t)),d=V_.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[u,f]=m.useState([]),p=m.useCallback((E,S)=>{f(A=>[...A,{reason:S,step:E}])},[]),h=m.useCallback(()=>{f([])},[]);kne(c,n);const y=vne(c,n,h),k=Sne(s,y,c),{index:b,size:g,status:v}=d,w=BI(d),j=m.useMemo(()=>kb(t,l[b]),[b,t,l]);return fee(()=>{i&&g&&pT(l,n)&&y.start(a??r)}),uee(()=>{i&&g&&v===jt.IDLE&&c.current.updateState({status:jt.READY})},[i,g,v]),jne({controls:y,emitEvent:k,props:t,state:d,store:c}),Nne({addFailure:p,controls:y,emitEvent:k,previousState:w,props:t,state:d,step:j,store:c}),_ne({emitEvent:k,previousState:w,props:t,state:d,step:j,store:c}),{controls:y,failures:u,mergedProps:t,state:d,step:j,store:c}}function Ane(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(Ar.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=sne,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Ine={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Tne({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=Qe.createElement(c,{step:t})}else l=Qe.createElement("div",{style:{...Ine,height:s,width:i,borderTopColor:t.primaryColor}});return Qe.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const Rne={height:0,isFixed:!1,left:0,top:0,width:0};function Du(e,t){const n=Hs(e);if(!n)return Rne;const r=bb(n),s=Jc(n),i=cne(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 Lne(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=y=>{a.current=Xc(y,!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(y)),s(Du(e,t))},h=Hs(e);return h?p(h):(f=new MutationObserver(()=>{const y=Hs(e);y&&(f==null||f.disconnect(),f=null,p(y))}),f.observe(document.body,{childList:!0,subtree:!0})),()=>{var y;f==null||f.disconnect(),a.current&&a.current.removeEventListener("scroll",d),window.removeEventListener("scroll",d),window.removeEventListener("resize",d),(y=c.current)==null||y.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 One(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function e1(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 Mne=[De.BEACON_BEFORE,De.BEACON];function $ne(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:y,waiting:k}=e,b=pee(),g=Lne(p??y,u,d||k),v=m.useRef(null),w=(s===De.TOOLTIP||s===De.TOOLTIP_BEFORE)&&l!=="center",[j,E]=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)??lne()??b.height,M=((z=h.overlay)==null?void 0:z.backgroundColor)??"rgba(0, 0, 0, 0.5)",W=m.useMemo(()=>{const{backgroundColor:_,mixBlendMode:T,...C}=h.overlay;return{height:R,pointerEvents:"none",...C}},[R,h.overlay]),D=w&&!d&&!k;m.useEffect(()=>{D?requestAnimationFrame(()=>E(!0)):E(!1)},[D]);const O=n&&Mne.includes(s),K=!n&&s!==De.TOOLTIP;if(r||!k&&(O||K))return null;let $="";if(D)if(c&&S){const _=Hs(p??y);if(_){const T=Xj(_),C=Xj(S);$=e1(T.left-C.left-u.left,T.top-C.top-u.top,_.offsetWidth+u.left+u.right,_.offsetHeight+u.top+u.bottom,f)}}else $=e1(g.left,g.top,g.width,g.height,f);const L=One(A,R,$);return Qe.createElement("div",{ref:v,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:W},Qe.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:R,left:0,position:g.isFixed?"fixed":"absolute",top:0,width:A}},Qe.createElement("path",{d:L,fill:M,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),$&&Qe.createElement("path",{d:$,fill:M,style:{opacity:j?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),$&&Object.keys(h.spotlight).length>0&&Qe.createElement("path",{d:$,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function hT(e){const{children:t,element:n}=e;return n?es.createPortal(t,n):null}const Dne='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function Fne(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(Dne)],{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 go(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`,...go(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...go(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...go(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...go(e,t,n)};default:return null}}function Bne(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...go(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...go(e,r,n)};case"left":return{right:-n,top:t.y??0,...go(e,r,n)};case"right":return{left:-n,top:t.y??0,...go(e,r,n)};default:return{}}}function Hne({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let c=null;if(l){if(!go(r,n,i))return null;c=Qe.createElement("span",{style:{flexShrink:0}},Qe.createElement(l,{base:n,placement:r,size:i}))}else{const d=zne(r,n,i);if(!d)return null;c=Qe.createElement("svg",{height:d.height,width:d.width,xmlns:"http://www.w3.org/2000/svg"},Qe.createElement("polygon",{fill:"currentColor",points:d.points}))}return Qe.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...Bne(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function Une(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 g=setTimeout(()=>{Ar.domElement(p.current)&&c&&p.current.focus()},0);return()=>{clearTimeout(g);const v=document.getElementById("joyride-beacon-animation");v!=null&&v.parentNode&&v.parentNode.removeChild(v)}},[h,a,c]);const y=fo(i.open);let k;if(t){const b=t;k=Qe.createElement(b,{continuous:n,index:r,isLastStep:s,size:d,step:u})}else k=Qe.createElement("span",{style:f.beacon},Qe.createElement("span",{style:f.beaconOuter}),Qe.createElement("span",{style:f.beaconInner}));return Qe.createElement("button",{ref:p,"aria-label":y,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:f.beaconWrapper,title:y,type:"button"},k)}function Wne({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return Qe.createElement("button",{style:i,type:"button",...t},Qe.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"},Qe.createElement("g",null,Qe.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 Vne(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=Qe.createElement("button",{"data-testid":"button-primary",style:f.buttonPrimary,type:"button",...i})),d.includes("skip")&&!s&&(h.skip=Qe.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:f.buttonSkip,type:"button",...a})),d.includes("back")&&r>0&&(h.back=Qe.createElement("button",{"data-testid":"button-back",style:f.buttonBack,type:"button",...t})),h.close=d.includes("close")&&Qe.createElement(Wne,{"data-testid":"button-close",styles:f.buttonClose,...n});const y=p?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":fo(u),"aria-describedby":"joyride-tooltip-content"};return Qe.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:f.tooltip,...c,...y},Qe.createElement("div",{style:f.tooltipContainer},p&&Qe.createElement("h4",{id:"joyride-tooltip-title",style:f.tooltipTitle},p),Qe.createElement("div",{id:"joyride-tooltip-content",style:f.tooltipContent},u)),d.some(k=>k==="back"||k==="primary"||k==="skip")&&Qe.createElement("div",{style:f.tooltipFooter},Qe.createElement("div",{style:f.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function Kne(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=g=>{g.preventDefault(),n.prev(Di.BUTTON_BACK)},c=g=>{g.preventDefault(),a.closeButtonAction==="skip"?n.skip(Di.BUTTON_CLOSE):n.close(Di.BUTTON_CLOSE)},d=g=>{if(g.preventDefault(),!t){n.close(Di.BUTTON_PRIMARY);return}n.next(Di.BUTTON_PRIMARY)},u=g=>{g.preventDefault(),n.skip(Di.BUTTON_SKIP)},f=()=>{const{back:g,close:v,last:w,next:j,nextWithProgress:E,skip:S}=a.locale,A=fo(g),R=fo(v),M=fo(w),W=fo(j),D=fo(S);let O=v,K=R;if(t){if(O=j,K=W,a.showProgress&&!s){const $=fo(E,{step:r+1,steps:i});O=jw(E,r+1,i),K=$}s&&(O=w,K=M)}return{backProps:{"aria-label":A,children:g,"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:y,...k}=a;let b;if(y){const g=y;b=Qe.createElement(g,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:k})}else b=Qe.createElement(Vne,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:k});return b}function qne(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function Yne(e,t,n){var r,s;return e?[Qte()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[Jte({crossAxis:!1,fallbackPlacements:qne(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function Gne(e){var T,C,J,Z,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:y}=e,k=m.useRef(null),b=m.useRef({}),g=m.useRef({}),v=p.placement==="center",w=p.placement==="auto",j=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})}),[]),E=m.useMemo(()=>uT(h)?Xc(h):void 0,[h]),S=m.useMemo(()=>Jc(h),[h]),A=m.useMemo(()=>E?{boundary:E,rootBoundary:"viewport"}:{},[E]),R=v||w?"bottom":p.placement,M=v?"fixed":((T=p.floatingOptions)==null?void 0:T.strategy)??(p.isFixed||S?"fixed":"absolute"),W=m.useMemo(()=>{var te,ae,ce,ue;return v?[{name:"center",fn:({rects:le})=>({x:(window.innerWidth-le.floating.width)/2,y:(window.innerHeight-le.floating.height)/2})}]:[qj(({placement:le})=>{var fe;let de="right";le.startsWith("top")?de="top":le.startsWith("bottom")?de="bottom":le.startsWith("left")&&(de="left");const se=p.spotlightTarget?0:p.spotlightPadding[de];return p.offset+se+((fe=p.floatingOptions)!=null&&fe.hideArrow?0:p.arrowSize)},[p.offset,p.spotlightPadding,p.spotlightTarget,p.arrowSize,(te=p.floatingOptions)==null?void 0:te.hideArrow]),...Yne(w,p,R),Xte({padding:10,...A,...(ae=p.floatingOptions)==null?void 0:ae.shiftOptions}),...(ce=p.floatingOptions)!=null&&ce.hideArrow?[]:[Zte({element:k,padding:p.arrowSpacing},[p.arrowSpacing,p.arrowBase])],...((ue=p.floatingOptions)==null?void 0:ue.middleware)??[]]},[v,p,w,R,A]),D=Kj({...v?{elements:{reference:j}}:{},placement:R,strategy:M,middleware:W}),O=Kj({strategy:M,placement:p.beaconPlacement??(w||v?"bottom":p.placement),middleware:m.useMemo(()=>{var te,ae;return[qj(((ae=(te=p.floatingOptions)==null?void 0:te.beaconOptions)==null?void 0:ae.offset)??-18)]},[(J=(C=p.floatingOptions)==null?void 0:C.beaconOptions)==null?void 0:J.offset]),whileElementsMounted:Uj});g.current=D.middlewareData,b.current=O.middlewareData,m.useEffect(()=>{var ce;const{floating:te,reference:ae}=D.elements;if(!(!ae||!te||s!==De.TOOLTIP))return Uj(ae,te,D.update,(ce=p.floatingOptions)==null?void 0:ce.autoUpdate)},[s,D.update,(Z=p.floatingOptions)==null?void 0:Z.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:g.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"||y({lifecycle:De.TOOLTIP_BEFORE,positioned:!1})},[p.beaconTrigger,y]),L=m.useCallback(te=>{te&&(D.refs.setFloating(te),d(te))},[D.refs,d]),{arrow:I,floater:z}=p.styles;let _=null;if(s===De.TOOLTIP||s===De.TOOLTIP_BEFORE){const te=Gj({...z,...D.floatingStyles,zIndex:K,opacity:a&&D.isPositioned?1:0,...!a&&{transition:"none"}});_=Qe.createElement("div",{ref:L,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:te},Qe.createElement(Kne,{continuous:t,controls:n,index:r,isLastStep:r+1===f,size:f,step:p}),!v&&!((H=p.floatingOptions)!=null&&H.hideArrow)&&Qe.createElement(Hne,{arrowComponent:p.arrowComponent,arrowRef:k,base:p.arrowBase,placement:D.placement,position:D.middlewareData.arrow,size:p.arrowSize,styles:I}))}else(s===De.BEACON||s===De.BEACON_BEFORE)&&(_=Qe.createElement("div",{ref:O.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:Gj({...O.floatingStyles,zIndex:K})},Qe.createElement(Une,{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 Qe.createElement(hT,{element:l},_)}function Xne(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);Fne(u.disableFocusTrap?null:p,"[data-action=primary]");const y=Hs(u.target),k=s===De.TOOLTIP;return!fT(u)||!Ar.domElement(y)?null:Qe.createElement(Gne,{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:y,updateState:f})}function Jne({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:c,scrollToFirstStep:d}=t,u=Ane(c),{index:f,lifecycle:p,status:h}=n,y=h===jt.RUNNING,[k,b]=m.useState(!1),g=m.useRef(null),v=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?v===0?b(!0):g.current=setTimeout(()=>{b(!0)},v):b(!1),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[v,n.waiting]),m.useEffect(()=>{if(!y)return;const E=S=>{!r||p!==De.TOOLTIP||S.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(Di.KEYBOARD):e.close(Di.KEYBOARD))};return document.body.addEventListener("keydown",E,{passive:!0}),()=>{document.body.removeEventListener("keydown",E)}},[e,y,p,r]);const w=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(Di.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(Di.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!y)return null;const j=n.action===_t.START&&!r.skipBeacon&&r.placement!=="center";return Qe.createElement(Qe.Fragment,null,p!==De.INIT&&Qe.createElement(Xne,{...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}),Qe.createElement(hT,{element:u},Qe.createElement(Qe.Fragment,null,k&&Qe.createElement(Tne,{nonce:l,step:r}),!j&&Qe.createElement($ne,{...r,continuous:i,lifecycle:p,onClickOverlay:w,portalElement:c?u:null,scrolling:n.scrolling,waiting:n.waiting}))))}function Qne(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=Pne(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>a.current.on(l,c),[a]),state:m.useMemo(()=>um(s,"positioned"),[s]),step:i,Tour:vb()?Qe.createElement(Jne,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function Zne(e){const{Tour:t}=Qne(e);return t}function ere(e){return vb()?Qe.createElement(Zne,e):null}function tre(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 nre(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function rre(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const My="af:onboarding";function sre({page:e,hasNodes:t=!1}){const{t:n}=un(),[r,s]=m.useState(!1),[i,a]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?tre(n):t?nre(n):rre(n),[e,t,n]);return m.useEffect(()=>{const d=localStorage.getItem(My);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 y;const f=u.target.closest("button");if(!f||!f.closest(".react-joyride__tooltip"))return;const h=(y=f.textContent)==null?void 0:y.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const k=localStorage.getItem(My)||"{}",b=JSON.parse(k);h===n("onboarding:skip")?(b.projects=!0,b.flow=!0,b.completed=!0):b[e]=!0,localStorage.setItem(My,JSON.stringify(b)),a([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const g=document.querySelector(".af-create-btn");g&&g.click()},500))}};return document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[r,e,n]),!r||i.length===0?null:o.jsx(ere,{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 ire(){const{navigate:e,path:t}=xl(),[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 y=await h.json();if(u)return;const k=Array.isArray(y.runs)?y.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 ore 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 are(){const{path:e}=xl();return e==="/projects"||e==="/"?o.jsx(Ml,{}):e==="/nodes"?o.jsx(Ml,{resourceKind:"nodes"}):e==="/my-nodes"?o.jsx(Ml,{resourceKind:"my-nodes"}):e==="/my-flows"?o.jsx(Ml,{resourceKind:"my-flows"}):e==="/skills"?o.jsx(Ml,{resourceKind:"skills"}):e==="/mcps"?o.jsx(YZ,{}):e==="/flow"?o.jsx(JV,{}):e==="/workspace"?o.jsx(sK,{}):e==="/settings"?o.jsx(KZ,{}):o.jsx(Ml,{})}function lre({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 y=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!y.authenticated,user:y.user||null,setupRequired:!!y.setupRequired}),u(y.error?String(y.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 y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),k=await y.json().catch(()=>({}));if(!y.ok)throw new Error(k.error||"登录失败");n({loading:!1,authenticated:!0,user:k.user||null,setupRequired:!1})}catch(y){u(String(y.message||y))}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 cre({authUser:e,onLogout:t}){const{path:n}=xl(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(sre,{page:r?"flow":"projects"}):null,r?null:o.jsx(tO,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(are,{})}),o.jsx(ire,{})]})}function ure(){return o.jsx(ore,{children:o.jsx(ML,{children:o.jsx(lre,{children:({user:e,onLogout:t})=>o.jsx(cre,{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 t1=document.querySelector('link[rel="icon"]');t1&&(t1.href=yE);$y.createRoot(document.getElementById("root")).render(o.jsx(Qe.StrictMode,{children:o.jsx(ure,{})}));
|