@fieldwangai/agentflow 0.1.66 → 0.1.68
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/ui-server.mjs +213 -24
- package/builtin/web-ui/dist/assets/{index-BFZ6_IPB.css → index-B7EYZmUN.css} +1 -1
- package/builtin/web-ui/dist/assets/index-D3NG6W8U.js +264 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-Ct8AjXGS.js +0 -264
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
var OR=Object.defineProperty;var $R=(e,t,n)=>t in e?OR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var tr=(e,t,n)=>$R(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 Nf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var LC={exports:{}},Rg={},MC={exports:{}},Ht={};/**
|
|
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 dp=Symbol.for("react.element"),DR=Symbol.for("react.portal"),FR=Symbol.for("react.fragment"),zR=Symbol.for("react.strict_mode"),HR=Symbol.for("react.profiler"),BR=Symbol.for("react.provider"),WR=Symbol.for("react.context"),VR=Symbol.for("react.forward_ref"),UR=Symbol.for("react.suspense"),KR=Symbol.for("react.memo"),qR=Symbol.for("react.lazy"),hk=Symbol.iterator;function YR(e){return e===null||typeof e!="object"?null:(e=hk&&e[hk]||e["@@iterator"],typeof e=="function"?e:null)}var OC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$C=Object.assign,DC={};function ed(e,t,n){this.props=e,this.context=t,this.refs=DC,this.updater=n||OC}ed.prototype.isReactComponent={};ed.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")};ed.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function FC(){}FC.prototype=ed.prototype;function Jb(e,t,n){this.props=e,this.context=t,this.refs=DC,this.updater=n||OC}var Qb=Jb.prototype=new FC;Qb.constructor=Jb;$C(Qb,ed.prototype);Qb.isPureReactComponent=!0;var mk=Array.isArray,zC=Object.prototype.hasOwnProperty,Zb={current:null},HC={key:!0,ref:!0,__self:!0,__source:!0};function BC(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)zC.call(t,r)&&!HC.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var u=Array(l),d=0;d<l;d++)u[d]=arguments[d+2];s.children=u}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:dp,type:e,key:i,ref:a,props:s,_owner:Zb.current}}function GR(e,t){return{$$typeof:dp,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ev(e){return typeof e=="object"&&e!==null&&e.$$typeof===dp}function XR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var gk=/\/+/g;function Iy(e,t){return typeof e=="object"&&e!==null&&e.key!=null?XR(""+e.key):t.toString(36)}function Zh(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 dp:case DR:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+Iy(a,0):r,mk(s)?(n="",e!=null&&(n=e.replace(gk,"$&/")+"/"),Zh(s,t,n,"",function(d){return d})):s!=null&&(ev(s)&&(s=GR(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(gk,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",mk(e))for(var l=0;l<e.length;l++){i=e[l];var u=r+Iy(i,l);a+=Zh(i,t,n,u,s)}else if(u=YR(e),typeof u=="function")for(e=u.call(e),l=0;!(i=e.next()).done;)i=i.value,u=r+Iy(i,l++),a+=Zh(i,t,n,u,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 ah(e,t,n){if(e==null)return e;var r=[],s=0;return Zh(e,r,"","",function(i){return t.call(n,i,s++)}),r}function JR(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 Ss={current:null},em={transition:null},QR={ReactCurrentDispatcher:Ss,ReactCurrentBatchConfig:em,ReactCurrentOwner:Zb};function WC(){throw Error("act(...) is not supported in production builds of React.")}Ht.Children={map:ah,forEach:function(e,t,n){ah(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ah(e,function(){t++}),t},toArray:function(e){return ah(e,function(t){return t})||[]},only:function(e){if(!ev(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ht.Component=ed;Ht.Fragment=FR;Ht.Profiler=HR;Ht.PureComponent=Jb;Ht.StrictMode=zR;Ht.Suspense=UR;Ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=QR;Ht.act=WC;Ht.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=$C({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Zb.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(u in t)zC.call(t,u)&&!HC.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&l!==void 0?l[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){l=Array(u);for(var d=0;d<u;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:dp,type:e.type,key:s,ref:i,props:r,_owner:a}};Ht.createContext=function(e){return e={$$typeof:WR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:BR,_context:e},e.Consumer=e};Ht.createElement=BC;Ht.createFactory=function(e){var t=BC.bind(null,e);return t.type=e,t};Ht.createRef=function(){return{current:null}};Ht.forwardRef=function(e){return{$$typeof:VR,render:e}};Ht.isValidElement=ev;Ht.lazy=function(e){return{$$typeof:qR,_payload:{_status:-1,_result:e},_init:JR}};Ht.memo=function(e,t){return{$$typeof:KR,type:e,compare:t===void 0?null:t}};Ht.startTransition=function(e){var t=em.transition;em.transition={};try{e()}finally{em.transition=t}};Ht.unstable_act=WC;Ht.useCallback=function(e,t){return Ss.current.useCallback(e,t)};Ht.useContext=function(e){return Ss.current.useContext(e)};Ht.useDebugValue=function(){};Ht.useDeferredValue=function(e){return Ss.current.useDeferredValue(e)};Ht.useEffect=function(e,t){return Ss.current.useEffect(e,t)};Ht.useId=function(){return Ss.current.useId()};Ht.useImperativeHandle=function(e,t,n){return Ss.current.useImperativeHandle(e,t,n)};Ht.useInsertionEffect=function(e,t){return Ss.current.useInsertionEffect(e,t)};Ht.useLayoutEffect=function(e,t){return Ss.current.useLayoutEffect(e,t)};Ht.useMemo=function(e,t){return Ss.current.useMemo(e,t)};Ht.useReducer=function(e,t,n){return Ss.current.useReducer(e,t,n)};Ht.useRef=function(e){return Ss.current.useRef(e)};Ht.useState=function(e){return Ss.current.useState(e)};Ht.useSyncExternalStore=function(e,t,n){return Ss.current.useSyncExternalStore(e,t,n)};Ht.useTransition=function(){return Ss.current.useTransition()};Ht.version="18.3.1";MC.exports=Ht;var h=MC.exports;const at=xl(h);/**
|
|
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 ZR=h,eL=Symbol.for("react.element"),tL=Symbol.for("react.fragment"),nL=Object.prototype.hasOwnProperty,rL=ZR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,sL={key:!0,ref:!0,__self:!0,__source:!0};function VC(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)nL.call(t,r)&&!sL.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:eL,type:e,key:i,ref:a,props:s,_owner:rL.current}}Rg.Fragment=tL;Rg.jsx=VC;Rg.jsxs=VC;LC.exports=Rg;var o=LC.exports,Zx={},UC={exports:{}},ci={},KC={exports:{}},qC={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(P,R){var E=P.length;P.push(R);e:for(;0<E;){var J=E-1>>>1,Z=P[J];if(0<s(Z,R))P[J]=R,P[E]=Z,E=J;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var R=P[0],E=P.pop();if(E!==R){P[0]=E;e:for(var J=0,Z=P.length,U=Z>>>1;J<U;){var se=2*(J+1)-1,pe=P[se],he=se+1,xe=P[he];if(0>s(pe,E))he<Z&&0>s(xe,pe)?(P[J]=xe,P[he]=E,J=he):(P[J]=pe,P[se]=E,J=se);else if(he<Z&&0>s(xe,E))P[J]=xe,P[he]=E,J=he;else break e}}return R}function s(P,R){var E=P.sortIndex-R.sortIndex;return E!==0?E:P.id-R.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 u=[],d=[],p=1,c=null,f=3,m=!1,y=!1,v=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(P){for(var R=n(d);R!==null;){if(R.callback===null)r(d);else if(R.startTime<=P)r(d),R.sortIndex=R.expirationTime,t(u,R);else break;R=n(d)}}function N(P){if(v=!1,x(P),!y)if(n(u)!==null)y=!0,I(_);else{var R=n(d);R!==null&&z(N,R.startTime-P)}}function _(P,R){y=!1,v&&(v=!1,g(H),H=-1),m=!0;var E=f;try{for(x(R),c=n(u);c!==null&&(!(c.expirationTime>R)||P&&!O());){var J=c.callback;if(typeof J=="function"){c.callback=null,f=c.priorityLevel;var Z=J(c.expirationTime<=R);R=e.unstable_now(),typeof Z=="function"?c.callback=Z:c===n(u)&&r(u),x(R)}else r(u);c=n(u)}if(c!==null)var U=!0;else{var se=n(d);se!==null&&z(N,se.startTime-R),U=!1}return U}finally{c=null,f=E,m=!1}}var C=!1,T=null,H=-1,L=5,F=-1;function O(){return!(e.unstable_now()-F<L)}function D(){if(T!==null){var P=e.unstable_now();F=P;var R=!0;try{R=T(!0,P)}finally{R?W():(C=!1,T=null)}}else C=!1}var W;if(typeof b=="function")W=function(){b(D)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,M=$.port2;$.port1.onmessage=D,W=function(){M.postMessage(null)}}else W=function(){k(D,0)};function I(P){T=P,C||(C=!0,W())}function z(P,R){H=k(function(){P(e.unstable_now())},R)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_continueExecution=function(){y||m||(y=!0,I(_))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(P){switch(f){case 1:case 2:case 3:var R=3;break;default:R=f}var E=f;f=R;try{return P()}finally{f=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,R){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var E=f;f=P;try{return R()}finally{f=E}},e.unstable_scheduleCallback=function(P,R,E){var J=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?J+E:J):E=J,P){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=E+Z,P={id:p++,callback:R,priorityLevel:P,startTime:E,expirationTime:Z,sortIndex:-1},E>J?(P.sortIndex=E,t(d,P),n(u)===null&&P===n(d)&&(v?(g(H),H=-1):v=!0,z(N,E-J))):(P.sortIndex=Z,t(u,P),y||m||(y=!0,I(_))),P},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(P){var R=f;return function(){var E=f;f=R;try{return P.apply(this,arguments)}finally{f=E}}}})(qC);KC.exports=qC;var iL=KC.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 oL=h,ai=iL;function _e(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 YC=new Set,jf={};function bc(e,t){Iu(e,t),Iu(e+"Capture",t)}function Iu(e,t){for(jf[e]=t,e=0;e<t.length;e++)YC.add(t[e])}var ha=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ew=Object.prototype.hasOwnProperty,aL=/^[: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]*$/,yk={},xk={};function lL(e){return ew.call(xk,e)?!0:ew.call(yk,e)?!1:aL.test(e)?xk[e]=!0:(yk[e]=!0,!1)}function cL(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 uL(e,t,n,r){if(t===null||typeof t>"u"||cL(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 Ns(e,t,n,r,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Kr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Kr[e]=new Ns(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Kr[t]=new Ns(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Kr[e]=new Ns(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Kr[e]=new Ns(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Kr[e]=new Ns(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Kr[e]=new Ns(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Kr[e]=new Ns(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Kr[e]=new Ns(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Kr[e]=new Ns(e,5,!1,e.toLowerCase(),null,!1,!1)});var tv=/[\-:]([a-z])/g;function nv(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(tv,nv);Kr[t]=new Ns(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(tv,nv);Kr[t]=new Ns(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(tv,nv);Kr[t]=new Ns(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Kr[e]=new Ns(e,1,!1,e.toLowerCase(),null,!1,!1)});Kr.xlinkHref=new Ns("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Kr[e]=new Ns(e,1,!1,e.toLowerCase(),null,!0,!0)});function rv(e,t,n,r){var s=Kr.hasOwnProperty(t)?Kr[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(uL(t,n,s,r)&&(n=null),r||s===null?lL(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 va=oL.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,lh=Symbol.for("react.element"),tu=Symbol.for("react.portal"),nu=Symbol.for("react.fragment"),sv=Symbol.for("react.strict_mode"),tw=Symbol.for("react.profiler"),GC=Symbol.for("react.provider"),XC=Symbol.for("react.context"),iv=Symbol.for("react.forward_ref"),nw=Symbol.for("react.suspense"),rw=Symbol.for("react.suspense_list"),ov=Symbol.for("react.memo"),Wa=Symbol.for("react.lazy"),JC=Symbol.for("react.offscreen"),wk=Symbol.iterator;function Ad(e){return e===null||typeof e!="object"?null:(e=wk&&e[wk]||e["@@iterator"],typeof e=="function"?e:null)}var Qn=Object.assign,Ty;function Yd(e){if(Ty===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ty=t&&t[1]||""}return`
|
|
34
|
+
`+Ty+e}var Ry=!1;function Ly(e,t){if(!e||Ry)return"";Ry=!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 u=`
|
|
37
|
+
`+s[a].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=a&&0<=l);break}}}finally{Ry=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Yd(e):""}function dL(e){switch(e.tag){case 5:return Yd(e.type);case 16:return Yd("Lazy");case 13:return Yd("Suspense");case 19:return Yd("SuspenseList");case 0:case 2:case 15:return e=Ly(e.type,!1),e;case 11:return e=Ly(e.type.render,!1),e;case 1:return e=Ly(e.type,!0),e;default:return""}}function sw(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 nu:return"Fragment";case tu:return"Portal";case tw:return"Profiler";case sv:return"StrictMode";case nw:return"Suspense";case rw:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case XC:return(e.displayName||"Context")+".Consumer";case GC:return(e._context.displayName||"Context")+".Provider";case iv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ov:return t=e.displayName||null,t!==null?t:sw(e.type)||"Memo";case Wa:t=e._payload,e=e._init;try{return sw(e(t))}catch{}}return null}function fL(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 sw(t);case 8:return t===sv?"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 dl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function QC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pL(e){var t=QC(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 ch(e){e._valueTracker||(e._valueTracker=pL(e))}function ZC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=QC(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Nm(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 iw(e,t){var n=t.checked;return Qn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function bk(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=dl(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 eE(e,t){t=t.checked,t!=null&&rv(e,"checked",t,!1)}function ow(e,t){eE(e,t);var n=dl(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")?aw(e,t.type,n):t.hasOwnProperty("defaultValue")&&aw(e,t.type,dl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function vk(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 aw(e,t,n){(t!=="number"||Nm(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Gd=Array.isArray;function wu(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=""+dl(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 lw(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(_e(91));return Qn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function kk(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(_e(92));if(Gd(n)){if(1<n.length)throw Error(_e(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:dl(n)}}function tE(e,t){var n=dl(t.value),r=dl(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 Sk(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function nE(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 cw(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?nE(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var uh,rE=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(uh=uh||document.createElement("div"),uh.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=uh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Cf(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var of={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},hL=["Webkit","ms","Moz","O"];Object.keys(of).forEach(function(e){hL.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),of[t]=of[e]})});function sE(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||of.hasOwnProperty(e)&&of[e]?(""+t).trim():t+"px"}function iE(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=sE(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var mL=Qn({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 uw(e,t){if(t){if(mL[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(_e(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(_e(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(_e(61))}if(t.style!=null&&typeof t.style!="object")throw Error(_e(62))}}function dw(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 fw=null;function av(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pw=null,bu=null,vu=null;function Nk(e){if(e=hp(e)){if(typeof pw!="function")throw Error(_e(280));var t=e.stateNode;t&&(t=Dg(t),pw(e.stateNode,e.type,t))}}function oE(e){bu?vu?vu.push(e):vu=[e]:bu=e}function aE(){if(bu){var e=bu,t=vu;if(vu=bu=null,Nk(e),t)for(e=0;e<t.length;e++)Nk(t[e])}}function lE(e,t){return e(t)}function cE(){}var My=!1;function uE(e,t,n){if(My)return e(t,n);My=!0;try{return lE(e,t,n)}finally{My=!1,(bu!==null||vu!==null)&&(cE(),aE())}}function Ef(e,t){var n=e.stateNode;if(n===null)return null;var r=Dg(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(_e(231,t,typeof n));return n}var hw=!1;if(ha)try{var Id={};Object.defineProperty(Id,"passive",{get:function(){hw=!0}}),window.addEventListener("test",Id,Id),window.removeEventListener("test",Id,Id)}catch{hw=!1}function gL(e,t,n,r,s,i,a,l,u){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(p){this.onError(p)}}var af=!1,jm=null,Cm=!1,mw=null,yL={onError:function(e){af=!0,jm=e}};function xL(e,t,n,r,s,i,a,l,u){af=!1,jm=null,gL.apply(yL,arguments)}function wL(e,t,n,r,s,i,a,l,u){if(xL.apply(this,arguments),af){if(af){var d=jm;af=!1,jm=null}else throw Error(_e(198));Cm||(Cm=!0,mw=d)}}function vc(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 dE(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 jk(e){if(vc(e)!==e)throw Error(_e(188))}function bL(e){var t=e.alternate;if(!t){if(t=vc(e),t===null)throw Error(_e(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 jk(s),e;if(i===r)return jk(s),t;i=i.sibling}throw Error(_e(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(_e(189))}}if(n.alternate!==r)throw Error(_e(190))}if(n.tag!==3)throw Error(_e(188));return n.stateNode.current===n?e:t}function fE(e){return e=bL(e),e!==null?pE(e):null}function pE(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=pE(e);if(t!==null)return t;e=e.sibling}return null}var hE=ai.unstable_scheduleCallback,Ck=ai.unstable_cancelCallback,vL=ai.unstable_shouldYield,kL=ai.unstable_requestPaint,lr=ai.unstable_now,SL=ai.unstable_getCurrentPriorityLevel,lv=ai.unstable_ImmediatePriority,mE=ai.unstable_UserBlockingPriority,Em=ai.unstable_NormalPriority,NL=ai.unstable_LowPriority,gE=ai.unstable_IdlePriority,Lg=null,Co=null;function jL(e){if(Co&&typeof Co.onCommitFiberRoot=="function")try{Co.onCommitFiberRoot(Lg,e,void 0,(e.current.flags&128)===128)}catch{}}var Qi=Math.clz32?Math.clz32:_L,CL=Math.log,EL=Math.LN2;function _L(e){return e>>>=0,e===0?32:31-(CL(e)/EL|0)|0}var dh=64,fh=4194304;function Xd(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 _m(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=Xd(l):(i&=a,i!==0&&(r=Xd(i)))}else a=n&~s,a!==0?r=Xd(a):i!==0&&(r=Xd(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-Qi(t),s=1<<n,r|=e[n],t&=~s;return r}function PL(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 AL(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Qi(i),l=1<<a,u=s[a];u===-1?(!(l&n)||l&r)&&(s[a]=PL(l,t)):u<=t&&(e.expiredLanes|=l),i&=~l}}function gw(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function yE(){var e=dh;return dh<<=1,!(dh&4194240)&&(dh=64),e}function Oy(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function fp(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Qi(t),e[t]=n}function IL(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-Qi(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function cv(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Qi(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var hn=0;function xE(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var wE,uv,bE,vE,kE,yw=!1,ph=[],Za=null,el=null,tl=null,_f=new Map,Pf=new Map,Ka=[],TL="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 Ek(e,t){switch(e){case"focusin":case"focusout":Za=null;break;case"dragenter":case"dragleave":el=null;break;case"mouseover":case"mouseout":tl=null;break;case"pointerover":case"pointerout":_f.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pf.delete(t.pointerId)}}function Td(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=hp(t),t!==null&&uv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function RL(e,t,n,r,s){switch(t){case"focusin":return Za=Td(Za,e,t,n,r,s),!0;case"dragenter":return el=Td(el,e,t,n,r,s),!0;case"mouseover":return tl=Td(tl,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return _f.set(i,Td(_f.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Pf.set(i,Td(Pf.get(i)||null,e,t,n,r,s)),!0}return!1}function SE(e){var t=Jl(e.target);if(t!==null){var n=vc(t);if(n!==null){if(t=n.tag,t===13){if(t=dE(n),t!==null){e.blockedOn=t,kE(e.priority,function(){bE(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 tm(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xw(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);fw=r,n.target.dispatchEvent(r),fw=null}else return t=hp(n),t!==null&&uv(t),e.blockedOn=n,!1;t.shift()}return!0}function _k(e,t,n){tm(e)&&n.delete(t)}function LL(){yw=!1,Za!==null&&tm(Za)&&(Za=null),el!==null&&tm(el)&&(el=null),tl!==null&&tm(tl)&&(tl=null),_f.forEach(_k),Pf.forEach(_k)}function Rd(e,t){e.blockedOn===t&&(e.blockedOn=null,yw||(yw=!0,ai.unstable_scheduleCallback(ai.unstable_NormalPriority,LL)))}function Af(e){function t(s){return Rd(s,e)}if(0<ph.length){Rd(ph[0],e);for(var n=1;n<ph.length;n++){var r=ph[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Za!==null&&Rd(Za,e),el!==null&&Rd(el,e),tl!==null&&Rd(tl,e),_f.forEach(t),Pf.forEach(t),n=0;n<Ka.length;n++)r=Ka[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Ka.length&&(n=Ka[0],n.blockedOn===null);)SE(n),n.blockedOn===null&&Ka.shift()}var ku=va.ReactCurrentBatchConfig,Pm=!0;function ML(e,t,n,r){var s=hn,i=ku.transition;ku.transition=null;try{hn=1,dv(e,t,n,r)}finally{hn=s,ku.transition=i}}function OL(e,t,n,r){var s=hn,i=ku.transition;ku.transition=null;try{hn=4,dv(e,t,n,r)}finally{hn=s,ku.transition=i}}function dv(e,t,n,r){if(Pm){var s=xw(e,t,n,r);if(s===null)Ky(e,t,r,Am,n),Ek(e,r);else if(RL(s,e,t,n,r))r.stopPropagation();else if(Ek(e,r),t&4&&-1<TL.indexOf(e)){for(;s!==null;){var i=hp(s);if(i!==null&&wE(i),i=xw(e,t,n,r),i===null&&Ky(e,t,r,Am,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Ky(e,t,r,null,n)}}var Am=null;function xw(e,t,n,r){if(Am=null,e=av(r),e=Jl(e),e!==null)if(t=vc(e),t===null)e=null;else if(n=t.tag,n===13){if(e=dE(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 Am=e,null}function NE(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(SL()){case lv:return 1;case mE:return 4;case Em:case NL:return 16;case gE:return 536870912;default:return 16}default:return 16}}var Ga=null,fv=null,nm=null;function jE(){if(nm)return nm;var e,t=fv,n=t.length,r,s="value"in Ga?Ga.value:Ga.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 nm=s.slice(e,1<r?1-r:void 0)}function rm(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 hh(){return!0}function Pk(){return!1}function ui(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)?hh:Pk,this.isPropagationStopped=Pk,this}return Qn(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=hh)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=hh)},persist:function(){},isPersistent:hh}),t}var td={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pv=ui(td),pp=Qn({},td,{view:0,detail:0}),$L=ui(pp),$y,Dy,Ld,Mg=Qn({},pp,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hv,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!==Ld&&(Ld&&e.type==="mousemove"?($y=e.screenX-Ld.screenX,Dy=e.screenY-Ld.screenY):Dy=$y=0,Ld=e),$y)},movementY:function(e){return"movementY"in e?e.movementY:Dy}}),Ak=ui(Mg),DL=Qn({},Mg,{dataTransfer:0}),FL=ui(DL),zL=Qn({},pp,{relatedTarget:0}),Fy=ui(zL),HL=Qn({},td,{animationName:0,elapsedTime:0,pseudoElement:0}),BL=ui(HL),WL=Qn({},td,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),VL=ui(WL),UL=Qn({},td,{data:0}),Ik=ui(UL),KL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qL={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"},YL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function GL(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=YL[e])?!!t[e]:!1}function hv(){return GL}var XL=Qn({},pp,{key:function(e){if(e.key){var t=KL[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=rm(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?qL[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hv,charCode:function(e){return e.type==="keypress"?rm(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?rm(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),JL=ui(XL),QL=Qn({},Mg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Tk=ui(QL),ZL=Qn({},pp,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hv}),eM=ui(ZL),tM=Qn({},td,{propertyName:0,elapsedTime:0,pseudoElement:0}),nM=ui(tM),rM=Qn({},Mg,{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}),sM=ui(rM),iM=[9,13,27,32],mv=ha&&"CompositionEvent"in window,lf=null;ha&&"documentMode"in document&&(lf=document.documentMode);var oM=ha&&"TextEvent"in window&&!lf,CE=ha&&(!mv||lf&&8<lf&&11>=lf),Rk=" ",Lk=!1;function EE(e,t){switch(e){case"keyup":return iM.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _E(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ru=!1;function aM(e,t){switch(e){case"compositionend":return _E(t);case"keypress":return t.which!==32?null:(Lk=!0,Rk);case"textInput":return e=t.data,e===Rk&&Lk?null:e;default:return null}}function lM(e,t){if(ru)return e==="compositionend"||!mv&&EE(e,t)?(e=jE(),nm=fv=Ga=null,ru=!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 CE&&t.locale!=="ko"?null:t.data;default:return null}}var cM={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 Mk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!cM[e.type]:t==="textarea"}function PE(e,t,n,r){oE(r),t=Im(t,"onChange"),0<t.length&&(n=new pv("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var cf=null,If=null;function uM(e){zE(e,0)}function Og(e){var t=ou(e);if(ZC(t))return e}function dM(e,t){if(e==="change")return t}var AE=!1;if(ha){var zy;if(ha){var Hy="oninput"in document;if(!Hy){var Ok=document.createElement("div");Ok.setAttribute("oninput","return;"),Hy=typeof Ok.oninput=="function"}zy=Hy}else zy=!1;AE=zy&&(!document.documentMode||9<document.documentMode)}function $k(){cf&&(cf.detachEvent("onpropertychange",IE),If=cf=null)}function IE(e){if(e.propertyName==="value"&&Og(If)){var t=[];PE(t,If,e,av(e)),uE(uM,t)}}function fM(e,t,n){e==="focusin"?($k(),cf=t,If=n,cf.attachEvent("onpropertychange",IE)):e==="focusout"&&$k()}function pM(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Og(If)}function hM(e,t){if(e==="click")return Og(t)}function mM(e,t){if(e==="input"||e==="change")return Og(t)}function gM(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var eo=typeof Object.is=="function"?Object.is:gM;function Tf(e,t){if(eo(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(!ew.call(t,s)||!eo(e[s],t[s]))return!1}return!0}function Dk(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Fk(e,t){var n=Dk(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=Dk(n)}}function TE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?TE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function RE(){for(var e=window,t=Nm();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nm(e.document)}return t}function gv(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 yM(e){var t=RE(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&TE(n.ownerDocument.documentElement,n)){if(r!==null&&gv(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=Fk(n,i);var a=Fk(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 xM=ha&&"documentMode"in document&&11>=document.documentMode,su=null,ww=null,uf=null,bw=!1;function zk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bw||su==null||su!==Nm(r)||(r=su,"selectionStart"in r&&gv(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}),uf&&Tf(uf,r)||(uf=r,r=Im(ww,"onSelect"),0<r.length&&(t=new pv("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=su)))}function mh(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var iu={animationend:mh("Animation","AnimationEnd"),animationiteration:mh("Animation","AnimationIteration"),animationstart:mh("Animation","AnimationStart"),transitionend:mh("Transition","TransitionEnd")},By={},LE={};ha&&(LE=document.createElement("div").style,"AnimationEvent"in window||(delete iu.animationend.animation,delete iu.animationiteration.animation,delete iu.animationstart.animation),"TransitionEvent"in window||delete iu.transitionend.transition);function $g(e){if(By[e])return By[e];if(!iu[e])return e;var t=iu[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in LE)return By[e]=t[n];return e}var ME=$g("animationend"),OE=$g("animationiteration"),$E=$g("animationstart"),DE=$g("transitionend"),FE=new Map,Hk="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 wl(e,t){FE.set(e,t),bc(t,[e])}for(var Wy=0;Wy<Hk.length;Wy++){var Vy=Hk[Wy],wM=Vy.toLowerCase(),bM=Vy[0].toUpperCase()+Vy.slice(1);wl(wM,"on"+bM)}wl(ME,"onAnimationEnd");wl(OE,"onAnimationIteration");wl($E,"onAnimationStart");wl("dblclick","onDoubleClick");wl("focusin","onFocus");wl("focusout","onBlur");wl(DE,"onTransitionEnd");Iu("onMouseEnter",["mouseout","mouseover"]);Iu("onMouseLeave",["mouseout","mouseover"]);Iu("onPointerEnter",["pointerout","pointerover"]);Iu("onPointerLeave",["pointerout","pointerover"]);bc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));bc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));bc("onBeforeInput",["compositionend","keypress","textInput","paste"]);bc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));bc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));bc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jd="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(" "),vM=new Set("cancel close invalid load scroll toggle".split(" ").concat(Jd));function Bk(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,wL(r,t,void 0,e),e.currentTarget=null}function zE(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],u=l.instance,d=l.currentTarget;if(l=l.listener,u!==i&&s.isPropagationStopped())break e;Bk(s,l,d),i=u}else for(a=0;a<r.length;a++){if(l=r[a],u=l.instance,d=l.currentTarget,l=l.listener,u!==i&&s.isPropagationStopped())break e;Bk(s,l,d),i=u}}}if(Cm)throw e=mw,Cm=!1,mw=null,e}function Mn(e,t){var n=t[jw];n===void 0&&(n=t[jw]=new Set);var r=e+"__bubble";n.has(r)||(HE(t,e,2,!1),n.add(r))}function Uy(e,t,n){var r=0;t&&(r|=4),HE(n,e,r,t)}var gh="_reactListening"+Math.random().toString(36).slice(2);function Rf(e){if(!e[gh]){e[gh]=!0,YC.forEach(function(n){n!=="selectionchange"&&(vM.has(n)||Uy(n,!1,e),Uy(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[gh]||(t[gh]=!0,Uy("selectionchange",!1,t))}}function HE(e,t,n,r){switch(NE(t)){case 1:var s=ML;break;case 4:s=OL;break;default:s=dv}n=s.bind(null,t,n,e),s=void 0,!hw||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 Ky(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 u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===s||u.nodeType===8&&u.parentNode===s))return;a=a.return}for(;l!==null;){if(a=Jl(l),a===null)return;if(u=a.tag,u===5||u===6){r=i=a;continue e}l=l.parentNode}}r=r.return}uE(function(){var d=i,p=av(n),c=[];e:{var f=FE.get(e);if(f!==void 0){var m=pv,y=e;switch(e){case"keypress":if(rm(n)===0)break e;case"keydown":case"keyup":m=JL;break;case"focusin":y="focus",m=Fy;break;case"focusout":y="blur",m=Fy;break;case"beforeblur":case"afterblur":m=Fy;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":m=Ak;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=FL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=eM;break;case ME:case OE:case $E:m=BL;break;case DE:m=nM;break;case"scroll":m=$L;break;case"wheel":m=sM;break;case"copy":case"cut":case"paste":m=VL;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Tk}var v=(t&4)!==0,k=!v&&e==="scroll",g=v?f!==null?f+"Capture":null:f;v=[];for(var b=d,x;b!==null;){x=b;var N=x.stateNode;if(x.tag===5&&N!==null&&(x=N,g!==null&&(N=Ef(b,g),N!=null&&v.push(Lf(b,N,x)))),k)break;b=b.return}0<v.length&&(f=new m(f,y,null,n,p),c.push({event:f,listeners:v}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==fw&&(y=n.relatedTarget||n.fromElement)&&(Jl(y)||y[ma]))break e;if((m||f)&&(f=p.window===p?p:(f=p.ownerDocument)?f.defaultView||f.parentWindow:window,m?(y=n.relatedTarget||n.toElement,m=d,y=y?Jl(y):null,y!==null&&(k=vc(y),y!==k||y.tag!==5&&y.tag!==6)&&(y=null)):(m=null,y=d),m!==y)){if(v=Ak,N="onMouseLeave",g="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(v=Tk,N="onPointerLeave",g="onPointerEnter",b="pointer"),k=m==null?f:ou(m),x=y==null?f:ou(y),f=new v(N,b+"leave",m,n,p),f.target=k,f.relatedTarget=x,N=null,Jl(p)===d&&(v=new v(g,b+"enter",y,n,p),v.target=x,v.relatedTarget=k,N=v),k=N,m&&y)t:{for(v=m,g=y,b=0,x=v;x;x=Vc(x))b++;for(x=0,N=g;N;N=Vc(N))x++;for(;0<b-x;)v=Vc(v),b--;for(;0<x-b;)g=Vc(g),x--;for(;b--;){if(v===g||g!==null&&v===g.alternate)break t;v=Vc(v),g=Vc(g)}v=null}else v=null;m!==null&&Wk(c,f,m,v,!1),y!==null&&k!==null&&Wk(c,k,y,v,!0)}}e:{if(f=d?ou(d):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var _=dM;else if(Mk(f))if(AE)_=mM;else{_=pM;var C=fM}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(_=hM);if(_&&(_=_(e,d))){PE(c,_,n,p);break e}C&&C(e,f,d),e==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&aw(f,"number",f.value)}switch(C=d?ou(d):window,e){case"focusin":(Mk(C)||C.contentEditable==="true")&&(su=C,ww=d,uf=null);break;case"focusout":uf=ww=su=null;break;case"mousedown":bw=!0;break;case"contextmenu":case"mouseup":case"dragend":bw=!1,zk(c,n,p);break;case"selectionchange":if(xM)break;case"keydown":case"keyup":zk(c,n,p)}var T;if(mv)e:{switch(e){case"compositionstart":var H="onCompositionStart";break e;case"compositionend":H="onCompositionEnd";break e;case"compositionupdate":H="onCompositionUpdate";break e}H=void 0}else ru?EE(e,n)&&(H="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(H="onCompositionStart");H&&(CE&&n.locale!=="ko"&&(ru||H!=="onCompositionStart"?H==="onCompositionEnd"&&ru&&(T=jE()):(Ga=p,fv="value"in Ga?Ga.value:Ga.textContent,ru=!0)),C=Im(d,H),0<C.length&&(H=new Ik(H,e,null,n,p),c.push({event:H,listeners:C}),T?H.data=T:(T=_E(n),T!==null&&(H.data=T)))),(T=oM?aM(e,n):lM(e,n))&&(d=Im(d,"onBeforeInput"),0<d.length&&(p=new Ik("onBeforeInput","beforeinput",null,n,p),c.push({event:p,listeners:d}),p.data=T))}zE(c,t)})}function Lf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Im(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Ef(e,n),i!=null&&r.unshift(Lf(e,i,s)),i=Ef(e,t),i!=null&&r.push(Lf(e,i,s))),e=e.return}return r}function Vc(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Wk(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,u=l.alternate,d=l.stateNode;if(u!==null&&u===r)break;l.tag===5&&d!==null&&(l=d,s?(u=Ef(n,i),u!=null&&a.unshift(Lf(n,u,l))):s||(u=Ef(n,i),u!=null&&a.push(Lf(n,u,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var kM=/\r\n?/g,SM=/\u0000|\uFFFD/g;function Vk(e){return(typeof e=="string"?e:""+e).replace(kM,`
|
|
38
|
+
`).replace(SM,"")}function yh(e,t,n){if(t=Vk(t),Vk(e)!==t&&n)throw Error(_e(425))}function Tm(){}var vw=null,kw=null;function Sw(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 Nw=typeof setTimeout=="function"?setTimeout:void 0,NM=typeof clearTimeout=="function"?clearTimeout:void 0,Uk=typeof Promise=="function"?Promise:void 0,jM=typeof queueMicrotask=="function"?queueMicrotask:typeof Uk<"u"?function(e){return Uk.resolve(null).then(e).catch(CM)}:Nw;function CM(e){setTimeout(function(){throw e})}function qy(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),Af(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Af(t)}function nl(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 Kk(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 nd=Math.random().toString(36).slice(2),ko="__reactFiber$"+nd,Mf="__reactProps$"+nd,ma="__reactContainer$"+nd,jw="__reactEvents$"+nd,EM="__reactListeners$"+nd,_M="__reactHandles$"+nd;function Jl(e){var t=e[ko];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ma]||n[ko]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Kk(e);e!==null;){if(n=e[ko])return n;e=Kk(e)}return t}e=n,n=e.parentNode}return null}function hp(e){return e=e[ko]||e[ma],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ou(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(_e(33))}function Dg(e){return e[Mf]||null}var Cw=[],au=-1;function bl(e){return{current:e}}function Dn(e){0>au||(e.current=Cw[au],Cw[au]=null,au--)}function Pn(e,t){au++,Cw[au]=e.current,e.current=t}var fl={},ls=bl(fl),Ds=bl(!1),cc=fl;function Tu(e,t){var n=e.type.contextTypes;if(!n)return fl;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 Fs(e){return e=e.childContextTypes,e!=null}function Rm(){Dn(Ds),Dn(ls)}function qk(e,t,n){if(ls.current!==fl)throw Error(_e(168));Pn(ls,t),Pn(Ds,n)}function BE(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(_e(108,fL(e)||"Unknown",s));return Qn({},n,r)}function Lm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fl,cc=ls.current,Pn(ls,e),Pn(Ds,Ds.current),!0}function Yk(e,t,n){var r=e.stateNode;if(!r)throw Error(_e(169));n?(e=BE(e,t,cc),r.__reactInternalMemoizedMergedChildContext=e,Dn(Ds),Dn(ls),Pn(ls,e)):Dn(Ds),Pn(Ds,n)}var sa=null,Fg=!1,Yy=!1;function WE(e){sa===null?sa=[e]:sa.push(e)}function PM(e){Fg=!0,WE(e)}function vl(){if(!Yy&&sa!==null){Yy=!0;var e=0,t=hn;try{var n=sa;for(hn=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}sa=null,Fg=!1}catch(s){throw sa!==null&&(sa=sa.slice(e+1)),hE(lv,vl),s}finally{hn=t,Yy=!1}}return null}var lu=[],cu=0,Mm=null,Om=0,ji=[],Ci=0,uc=null,aa=1,la="";function Kl(e,t){lu[cu++]=Om,lu[cu++]=Mm,Mm=e,Om=t}function VE(e,t,n){ji[Ci++]=aa,ji[Ci++]=la,ji[Ci++]=uc,uc=e;var r=aa;e=la;var s=32-Qi(r)-1;r&=~(1<<s),n+=1;var i=32-Qi(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,aa=1<<32-Qi(t)+s|n<<s|r,la=i+e}else aa=1<<i|n<<s|r,la=e}function yv(e){e.return!==null&&(Kl(e,1),VE(e,1,0))}function xv(e){for(;e===Mm;)Mm=lu[--cu],lu[cu]=null,Om=lu[--cu],lu[cu]=null;for(;e===uc;)uc=ji[--Ci],ji[Ci]=null,la=ji[--Ci],ji[Ci]=null,aa=ji[--Ci],ji[Ci]=null}var ii=null,ri=null,Wn=!1,qi=null;function UE(e,t){var n=Pi(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 Gk(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,ii=e,ri=nl(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ii=e,ri=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=uc!==null?{id:aa,overflow:la}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Pi(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ii=e,ri=null,!0):!1;default:return!1}}function Ew(e){return(e.mode&1)!==0&&(e.flags&128)===0}function _w(e){if(Wn){var t=ri;if(t){var n=t;if(!Gk(e,t)){if(Ew(e))throw Error(_e(418));t=nl(n.nextSibling);var r=ii;t&&Gk(e,t)?UE(r,n):(e.flags=e.flags&-4097|2,Wn=!1,ii=e)}}else{if(Ew(e))throw Error(_e(418));e.flags=e.flags&-4097|2,Wn=!1,ii=e}}}function Xk(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ii=e}function xh(e){if(e!==ii)return!1;if(!Wn)return Xk(e),Wn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Sw(e.type,e.memoizedProps)),t&&(t=ri)){if(Ew(e))throw KE(),Error(_e(418));for(;t;)UE(e,t),t=nl(t.nextSibling)}if(Xk(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(_e(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ri=nl(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ri=null}}else ri=ii?nl(e.stateNode.nextSibling):null;return!0}function KE(){for(var e=ri;e;)e=nl(e.nextSibling)}function Ru(){ri=ii=null,Wn=!1}function wv(e){qi===null?qi=[e]:qi.push(e)}var AM=va.ReactCurrentBatchConfig;function Md(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(_e(309));var r=n.stateNode}if(!r)throw Error(_e(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(_e(284));if(!n._owner)throw Error(_e(290,e))}return e}function wh(e,t){throw e=Object.prototype.toString.call(t),Error(_e(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Jk(e){var t=e._init;return t(e._payload)}function qE(e){function t(g,b){if(e){var x=g.deletions;x===null?(g.deletions=[b],g.flags|=16):x.push(b)}}function n(g,b){if(!e)return null;for(;b!==null;)t(g,b),b=b.sibling;return null}function r(g,b){for(g=new Map;b!==null;)b.key!==null?g.set(b.key,b):g.set(b.index,b),b=b.sibling;return g}function s(g,b){return g=ol(g,b),g.index=0,g.sibling=null,g}function i(g,b,x){return g.index=x,e?(x=g.alternate,x!==null?(x=x.index,x<b?(g.flags|=2,b):x):(g.flags|=2,b)):(g.flags|=1048576,b)}function a(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,b,x,N){return b===null||b.tag!==6?(b=tx(x,g.mode,N),b.return=g,b):(b=s(b,x),b.return=g,b)}function u(g,b,x,N){var _=x.type;return _===nu?p(g,b,x.props.children,N,x.key):b!==null&&(b.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Wa&&Jk(_)===b.type)?(N=s(b,x.props),N.ref=Md(g,b,x),N.return=g,N):(N=um(x.type,x.key,x.props,null,g.mode,N),N.ref=Md(g,b,x),N.return=g,N)}function d(g,b,x,N){return b===null||b.tag!==4||b.stateNode.containerInfo!==x.containerInfo||b.stateNode.implementation!==x.implementation?(b=nx(x,g.mode,N),b.return=g,b):(b=s(b,x.children||[]),b.return=g,b)}function p(g,b,x,N,_){return b===null||b.tag!==7?(b=rc(x,g.mode,N,_),b.return=g,b):(b=s(b,x),b.return=g,b)}function c(g,b,x){if(typeof b=="string"&&b!==""||typeof b=="number")return b=tx(""+b,g.mode,x),b.return=g,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case lh:return x=um(b.type,b.key,b.props,null,g.mode,x),x.ref=Md(g,null,b),x.return=g,x;case tu:return b=nx(b,g.mode,x),b.return=g,b;case Wa:var N=b._init;return c(g,N(b._payload),x)}if(Gd(b)||Ad(b))return b=rc(b,g.mode,x,null),b.return=g,b;wh(g,b)}return null}function f(g,b,x,N){var _=b!==null?b.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return _!==null?null:l(g,b,""+x,N);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case lh:return x.key===_?u(g,b,x,N):null;case tu:return x.key===_?d(g,b,x,N):null;case Wa:return _=x._init,f(g,b,_(x._payload),N)}if(Gd(x)||Ad(x))return _!==null?null:p(g,b,x,N,null);wh(g,x)}return null}function m(g,b,x,N,_){if(typeof N=="string"&&N!==""||typeof N=="number")return g=g.get(x)||null,l(b,g,""+N,_);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case lh:return g=g.get(N.key===null?x:N.key)||null,u(b,g,N,_);case tu:return g=g.get(N.key===null?x:N.key)||null,d(b,g,N,_);case Wa:var C=N._init;return m(g,b,x,C(N._payload),_)}if(Gd(N)||Ad(N))return g=g.get(x)||null,p(b,g,N,_,null);wh(b,N)}return null}function y(g,b,x,N){for(var _=null,C=null,T=b,H=b=0,L=null;T!==null&&H<x.length;H++){T.index>H?(L=T,T=null):L=T.sibling;var F=f(g,T,x[H],N);if(F===null){T===null&&(T=L);break}e&&T&&F.alternate===null&&t(g,T),b=i(F,b,H),C===null?_=F:C.sibling=F,C=F,T=L}if(H===x.length)return n(g,T),Wn&&Kl(g,H),_;if(T===null){for(;H<x.length;H++)T=c(g,x[H],N),T!==null&&(b=i(T,b,H),C===null?_=T:C.sibling=T,C=T);return Wn&&Kl(g,H),_}for(T=r(g,T);H<x.length;H++)L=m(T,g,H,x[H],N),L!==null&&(e&&L.alternate!==null&&T.delete(L.key===null?H:L.key),b=i(L,b,H),C===null?_=L:C.sibling=L,C=L);return e&&T.forEach(function(O){return t(g,O)}),Wn&&Kl(g,H),_}function v(g,b,x,N){var _=Ad(x);if(typeof _!="function")throw Error(_e(150));if(x=_.call(x),x==null)throw Error(_e(151));for(var C=_=null,T=b,H=b=0,L=null,F=x.next();T!==null&&!F.done;H++,F=x.next()){T.index>H?(L=T,T=null):L=T.sibling;var O=f(g,T,F.value,N);if(O===null){T===null&&(T=L);break}e&&T&&O.alternate===null&&t(g,T),b=i(O,b,H),C===null?_=O:C.sibling=O,C=O,T=L}if(F.done)return n(g,T),Wn&&Kl(g,H),_;if(T===null){for(;!F.done;H++,F=x.next())F=c(g,F.value,N),F!==null&&(b=i(F,b,H),C===null?_=F:C.sibling=F,C=F);return Wn&&Kl(g,H),_}for(T=r(g,T);!F.done;H++,F=x.next())F=m(T,g,H,F.value,N),F!==null&&(e&&F.alternate!==null&&T.delete(F.key===null?H:F.key),b=i(F,b,H),C===null?_=F:C.sibling=F,C=F);return e&&T.forEach(function(D){return t(g,D)}),Wn&&Kl(g,H),_}function k(g,b,x,N){if(typeof x=="object"&&x!==null&&x.type===nu&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case lh:e:{for(var _=x.key,C=b;C!==null;){if(C.key===_){if(_=x.type,_===nu){if(C.tag===7){n(g,C.sibling),b=s(C,x.props.children),b.return=g,g=b;break e}}else if(C.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Wa&&Jk(_)===C.type){n(g,C.sibling),b=s(C,x.props),b.ref=Md(g,C,x),b.return=g,g=b;break e}n(g,C);break}else t(g,C);C=C.sibling}x.type===nu?(b=rc(x.props.children,g.mode,N,x.key),b.return=g,g=b):(N=um(x.type,x.key,x.props,null,g.mode,N),N.ref=Md(g,b,x),N.return=g,g=N)}return a(g);case tu:e:{for(C=x.key;b!==null;){if(b.key===C)if(b.tag===4&&b.stateNode.containerInfo===x.containerInfo&&b.stateNode.implementation===x.implementation){n(g,b.sibling),b=s(b,x.children||[]),b.return=g,g=b;break e}else{n(g,b);break}else t(g,b);b=b.sibling}b=nx(x,g.mode,N),b.return=g,g=b}return a(g);case Wa:return C=x._init,k(g,b,C(x._payload),N)}if(Gd(x))return y(g,b,x,N);if(Ad(x))return v(g,b,x,N);wh(g,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,b!==null&&b.tag===6?(n(g,b.sibling),b=s(b,x),b.return=g,g=b):(n(g,b),b=tx(x,g.mode,N),b.return=g,g=b),a(g)):n(g,b)}return k}var Lu=qE(!0),YE=qE(!1),$m=bl(null),Dm=null,uu=null,bv=null;function vv(){bv=uu=Dm=null}function kv(e){var t=$m.current;Dn($m),e._currentValue=t}function Pw(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 Su(e,t){Dm=e,bv=uu=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Rs=!0),e.firstContext=null)}function Ii(e){var t=e._currentValue;if(bv!==e)if(e={context:e,memoizedValue:t,next:null},uu===null){if(Dm===null)throw Error(_e(308));uu=e,Dm.dependencies={lanes:0,firstContext:e}}else uu=uu.next=e;return t}var Ql=null;function Sv(e){Ql===null?Ql=[e]:Ql.push(e)}function GE(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Sv(t)):(n.next=s.next,s.next=n),t.interleaved=n,ga(e,r)}function ga(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 Va=!1;function Nv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function XE(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 fa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function rl(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Gt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,ga(e,n)}return s=r.interleaved,s===null?(t.next=t,Sv(r)):(t.next=s.next,s.next=t),r.interleaved=t,ga(e,n)}function sm(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,cv(e,n)}}function Qk(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 Fm(e,t,n,r){var s=e.updateQueue;Va=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var u=l,d=u.next;u.next=null,a===null?i=d:a.next=d,a=u;var p=e.alternate;p!==null&&(p=p.updateQueue,l=p.lastBaseUpdate,l!==a&&(l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=u))}if(i!==null){var c=s.baseState;a=0,p=d=u=null,l=i;do{var f=l.lane,m=l.eventTime;if((r&f)===f){p!==null&&(p=p.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,v=l;switch(f=t,m=n,v.tag){case 1:if(y=v.payload,typeof y=="function"){c=y.call(m,c,f);break e}c=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=v.payload,f=typeof y=="function"?y.call(m,c,f):y,f==null)break e;c=Qn({},c,f);break e;case 2:Va=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},p===null?(d=p=m,u=c):p=p.next=m,a|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(p===null&&(u=c),s.baseState=u,s.firstBaseUpdate=d,s.lastBaseUpdate=p,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);fc|=a,e.lanes=a,e.memoizedState=c}}function Zk(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(_e(191,s));s.call(r)}}}var mp={},Eo=bl(mp),Of=bl(mp),$f=bl(mp);function Zl(e){if(e===mp)throw Error(_e(174));return e}function jv(e,t){switch(Pn($f,t),Pn(Of,e),Pn(Eo,mp),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:cw(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=cw(t,e)}Dn(Eo),Pn(Eo,t)}function Mu(){Dn(Eo),Dn(Of),Dn($f)}function JE(e){Zl($f.current);var t=Zl(Eo.current),n=cw(t,e.type);t!==n&&(Pn(Of,e),Pn(Eo,n))}function Cv(e){Of.current===e&&(Dn(Eo),Dn(Of))}var Xn=bl(0);function zm(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 Gy=[];function Ev(){for(var e=0;e<Gy.length;e++)Gy[e]._workInProgressVersionPrimary=null;Gy.length=0}var im=va.ReactCurrentDispatcher,Xy=va.ReactCurrentBatchConfig,dc=0,Jn=null,vr=null,Ir=null,Hm=!1,df=!1,Df=0,IM=0;function ss(){throw Error(_e(321))}function _v(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!eo(e[n],t[n]))return!1;return!0}function Pv(e,t,n,r,s,i){if(dc=i,Jn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,im.current=e===null||e.memoizedState===null?MM:OM,e=n(r,s),df){i=0;do{if(df=!1,Df=0,25<=i)throw Error(_e(301));i+=1,Ir=vr=null,t.updateQueue=null,im.current=$M,e=n(r,s)}while(df)}if(im.current=Bm,t=vr!==null&&vr.next!==null,dc=0,Ir=vr=Jn=null,Hm=!1,t)throw Error(_e(300));return e}function Av(){var e=Df!==0;return Df=0,e}function yo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ir===null?Jn.memoizedState=Ir=e:Ir=Ir.next=e,Ir}function Ti(){if(vr===null){var e=Jn.alternate;e=e!==null?e.memoizedState:null}else e=vr.next;var t=Ir===null?Jn.memoizedState:Ir.next;if(t!==null)Ir=t,vr=e;else{if(e===null)throw Error(_e(310));vr=e,e={memoizedState:vr.memoizedState,baseState:vr.baseState,baseQueue:vr.baseQueue,queue:vr.queue,next:null},Ir===null?Jn.memoizedState=Ir=e:Ir=Ir.next=e}return Ir}function Ff(e,t){return typeof t=="function"?t(e):t}function Jy(e){var t=Ti(),n=t.queue;if(n===null)throw Error(_e(311));n.lastRenderedReducer=e;var r=vr,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,u=null,d=i;do{var p=d.lane;if((dc&p)===p)u!==null&&(u=u.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 c={lane:p,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};u===null?(l=u=c,a=r):u=u.next=c,Jn.lanes|=p,fc|=p}d=d.next}while(d!==null&&d!==i);u===null?a=r:u.next=l,eo(r,t.memoizedState)||(Rs=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Jn.lanes|=i,fc|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Qy(e){var t=Ti(),n=t.queue;if(n===null)throw Error(_e(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);eo(i,t.memoizedState)||(Rs=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function QE(){}function ZE(e,t){var n=Jn,r=Ti(),s=t(),i=!eo(r.memoizedState,s);if(i&&(r.memoizedState=s,Rs=!0),r=r.queue,Iv(n_.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Ir!==null&&Ir.memoizedState.tag&1){if(n.flags|=2048,zf(9,t_.bind(null,n,r,s,t),void 0,null),Rr===null)throw Error(_e(349));dc&30||e_(n,t,s)}return s}function e_(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Jn.updateQueue,t===null?(t={lastEffect:null,stores:null},Jn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function t_(e,t,n,r){t.value=n,t.getSnapshot=r,r_(t)&&s_(e)}function n_(e,t,n){return n(function(){r_(t)&&s_(e)})}function r_(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!eo(e,n)}catch{return!0}}function s_(e){var t=ga(e,1);t!==null&&Zi(t,e,1,-1)}function eS(e){var t=yo();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ff,lastRenderedState:e},t.queue=e,e=e.dispatch=LM.bind(null,Jn,e),[t.memoizedState,e]}function zf(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Jn.updateQueue,t===null?(t={lastEffect:null,stores:null},Jn.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 i_(){return Ti().memoizedState}function om(e,t,n,r){var s=yo();Jn.flags|=e,s.memoizedState=zf(1|t,n,void 0,r===void 0?null:r)}function zg(e,t,n,r){var s=Ti();r=r===void 0?null:r;var i=void 0;if(vr!==null){var a=vr.memoizedState;if(i=a.destroy,r!==null&&_v(r,a.deps)){s.memoizedState=zf(t,n,i,r);return}}Jn.flags|=e,s.memoizedState=zf(1|t,n,i,r)}function tS(e,t){return om(8390656,8,e,t)}function Iv(e,t){return zg(2048,8,e,t)}function o_(e,t){return zg(4,2,e,t)}function a_(e,t){return zg(4,4,e,t)}function l_(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 c_(e,t,n){return n=n!=null?n.concat([e]):null,zg(4,4,l_.bind(null,t,e),n)}function Tv(){}function u_(e,t){var n=Ti();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&_v(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function d_(e,t){var n=Ti();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&_v(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function f_(e,t,n){return dc&21?(eo(n,t)||(n=yE(),Jn.lanes|=n,fc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Rs=!0),e.memoizedState=n)}function TM(e,t){var n=hn;hn=n!==0&&4>n?n:4,e(!0);var r=Xy.transition;Xy.transition={};try{e(!1),t()}finally{hn=n,Xy.transition=r}}function p_(){return Ti().memoizedState}function RM(e,t,n){var r=il(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},h_(e))m_(t,n);else if(n=GE(e,t,n,r),n!==null){var s=ks();Zi(n,e,r,s),g_(n,t,r)}}function LM(e,t,n){var r=il(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(h_(e))m_(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,eo(l,a)){var u=t.interleaved;u===null?(s.next=s,Sv(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=GE(e,t,s,r),n!==null&&(s=ks(),Zi(n,e,r,s),g_(n,t,r))}}function h_(e){var t=e.alternate;return e===Jn||t!==null&&t===Jn}function m_(e,t){df=Hm=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function g_(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cv(e,n)}}var Bm={readContext:Ii,useCallback:ss,useContext:ss,useEffect:ss,useImperativeHandle:ss,useInsertionEffect:ss,useLayoutEffect:ss,useMemo:ss,useReducer:ss,useRef:ss,useState:ss,useDebugValue:ss,useDeferredValue:ss,useTransition:ss,useMutableSource:ss,useSyncExternalStore:ss,useId:ss,unstable_isNewReconciler:!1},MM={readContext:Ii,useCallback:function(e,t){return yo().memoizedState=[e,t===void 0?null:t],e},useContext:Ii,useEffect:tS,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,om(4194308,4,l_.bind(null,t,e),n)},useLayoutEffect:function(e,t){return om(4194308,4,e,t)},useInsertionEffect:function(e,t){return om(4,2,e,t)},useMemo:function(e,t){var n=yo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=yo();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=RM.bind(null,Jn,e),[r.memoizedState,e]},useRef:function(e){var t=yo();return e={current:e},t.memoizedState=e},useState:eS,useDebugValue:Tv,useDeferredValue:function(e){return yo().memoizedState=e},useTransition:function(){var e=eS(!1),t=e[0];return e=TM.bind(null,e[1]),yo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Jn,s=yo();if(Wn){if(n===void 0)throw Error(_e(407));n=n()}else{if(n=t(),Rr===null)throw Error(_e(349));dc&30||e_(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,tS(n_.bind(null,r,i,e),[e]),r.flags|=2048,zf(9,t_.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=yo(),t=Rr.identifierPrefix;if(Wn){var n=la,r=aa;n=(r&~(1<<32-Qi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Df++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=IM++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},OM={readContext:Ii,useCallback:u_,useContext:Ii,useEffect:Iv,useImperativeHandle:c_,useInsertionEffect:o_,useLayoutEffect:a_,useMemo:d_,useReducer:Jy,useRef:i_,useState:function(){return Jy(Ff)},useDebugValue:Tv,useDeferredValue:function(e){var t=Ti();return f_(t,vr.memoizedState,e)},useTransition:function(){var e=Jy(Ff)[0],t=Ti().memoizedState;return[e,t]},useMutableSource:QE,useSyncExternalStore:ZE,useId:p_,unstable_isNewReconciler:!1},$M={readContext:Ii,useCallback:u_,useContext:Ii,useEffect:Iv,useImperativeHandle:c_,useInsertionEffect:o_,useLayoutEffect:a_,useMemo:d_,useReducer:Qy,useRef:i_,useState:function(){return Qy(Ff)},useDebugValue:Tv,useDeferredValue:function(e){var t=Ti();return vr===null?t.memoizedState=e:f_(t,vr.memoizedState,e)},useTransition:function(){var e=Qy(Ff)[0],t=Ti().memoizedState;return[e,t]},useMutableSource:QE,useSyncExternalStore:ZE,useId:p_,unstable_isNewReconciler:!1};function Vi(e,t){if(e&&e.defaultProps){t=Qn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Aw(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Qn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Hg={isMounted:function(e){return(e=e._reactInternals)?vc(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ks(),s=il(e),i=fa(r,s);i.payload=t,n!=null&&(i.callback=n),t=rl(e,i,s),t!==null&&(Zi(t,e,s,r),sm(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ks(),s=il(e),i=fa(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=rl(e,i,s),t!==null&&(Zi(t,e,s,r),sm(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ks(),r=il(e),s=fa(n,r);s.tag=2,t!=null&&(s.callback=t),t=rl(e,s,r),t!==null&&(Zi(t,e,r,n),sm(t,e,r))}};function nS(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?!Tf(n,r)||!Tf(s,i):!0}function y_(e,t,n){var r=!1,s=fl,i=t.contextType;return typeof i=="object"&&i!==null?i=Ii(i):(s=Fs(t)?cc:ls.current,r=t.contextTypes,i=(r=r!=null)?Tu(e,s):fl),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Hg,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function rS(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&&Hg.enqueueReplaceState(t,t.state,null)}function Iw(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Nv(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Ii(i):(i=Fs(t)?cc:ls.current,s.context=Tu(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Aw(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&&Hg.enqueueReplaceState(s,s.state,null),Fm(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Ou(e,t){try{var n="",r=t;do n+=dL(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 Zy(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Tw(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var DM=typeof WeakMap=="function"?WeakMap:Map;function x_(e,t,n){n=fa(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vm||(Vm=!0,Bw=r),Tw(e,t)},n}function w_(e,t,n){n=fa(-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(){Tw(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Tw(e,t),typeof r!="function"&&(sl===null?sl=new Set([this]):sl.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function sS(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new DM;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=QM.bind(null,e,t,n),t.then(e,e))}function iS(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 oS(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=fa(-1,1),t.tag=2,rl(n,t,1))),n.lanes|=1),e)}var FM=va.ReactCurrentOwner,Rs=!1;function bs(e,t,n,r){t.child=e===null?YE(t,null,n,r):Lu(t,e.child,n,r)}function aS(e,t,n,r,s){n=n.render;var i=t.ref;return Su(t,s),r=Pv(e,t,n,r,i,s),n=Av(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ya(e,t,s)):(Wn&&n&&yv(t),t.flags|=1,bs(e,t,r,s),t.child)}function lS(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!zv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,b_(e,t,i,r,s)):(e=um(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:Tf,n(a,r)&&e.ref===t.ref)return ya(e,t,s)}return t.flags|=1,e=ol(i,r),e.ref=t.ref,e.return=t,t.child=e}function b_(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Tf(i,r)&&e.ref===t.ref)if(Rs=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Rs=!0);else return t.lanes=e.lanes,ya(e,t,s)}return Rw(e,t,n,r,s)}function v_(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},Pn(fu,ei),ei|=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,Pn(fu,ei),ei|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Pn(fu,ei),ei|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Pn(fu,ei),ei|=r;return bs(e,t,s,n),t.child}function k_(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Rw(e,t,n,r,s){var i=Fs(n)?cc:ls.current;return i=Tu(t,i),Su(t,s),n=Pv(e,t,n,r,i,s),r=Av(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ya(e,t,s)):(Wn&&r&&yv(t),t.flags|=1,bs(e,t,n,s),t.child)}function cS(e,t,n,r,s){if(Fs(n)){var i=!0;Lm(t)}else i=!1;if(Su(t,s),t.stateNode===null)am(e,t),y_(t,n,r),Iw(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var u=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=Ii(d):(d=Fs(n)?cc:ls.current,d=Tu(t,d));var p=n.getDerivedStateFromProps,c=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function";c||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||u!==d)&&rS(t,a,r,d),Va=!1;var f=t.memoizedState;a.state=f,Fm(t,r,a,s),u=t.memoizedState,l!==r||f!==u||Ds.current||Va?(typeof p=="function"&&(Aw(t,n,p,r),u=t.memoizedState),(l=Va||nS(t,n,l,r,f,u,d))?(c||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=u),a.props=r,a.state=u,a.context=d,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,XE(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:Vi(t.type,l),a.props=d,c=t.pendingProps,f=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=Ii(u):(u=Fs(n)?cc:ls.current,u=Tu(t,u));var m=n.getDerivedStateFromProps;(p=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==c||f!==u)&&rS(t,a,r,u),Va=!1,f=t.memoizedState,a.state=f,Fm(t,r,a,s);var y=t.memoizedState;l!==c||f!==y||Ds.current||Va?(typeof m=="function"&&(Aw(t,n,m,r),y=t.memoizedState),(d=Va||nS(t,n,d,r,f,y,u)||!1)?(p||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,y,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,y,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),a.props=r,a.state=y,a.context=u,r=d):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Lw(e,t,n,r,i,s)}function Lw(e,t,n,r,s,i){k_(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&Yk(t,n,!1),ya(e,t,i);r=t.stateNode,FM.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Lu(t,e.child,null,i),t.child=Lu(t,null,l,i)):bs(e,t,l,i),t.memoizedState=r.state,s&&Yk(t,n,!0),t.child}function S_(e){var t=e.stateNode;t.pendingContext?qk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&qk(e,t.context,!1),jv(e,t.containerInfo)}function uS(e,t,n,r,s){return Ru(),wv(s),t.flags|=256,bs(e,t,n,r),t.child}var Mw={dehydrated:null,treeContext:null,retryLane:0};function Ow(e){return{baseLanes:e,cachePool:null,transitions:null}}function N_(e,t,n){var r=t.pendingProps,s=Xn.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),Pn(Xn,s&1),e===null)return _w(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=Vg(a,r,0,null),e=rc(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ow(n),t.memoizedState=Mw,e):Rv(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return zM(e,t,a,r,l,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,l=s.sibling;var u={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=ol(s,u),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=ol(l,i):(i=rc(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?Ow(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Mw,r}return i=e.child,e=i.sibling,r=ol(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 Rv(e,t){return t=Vg({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function bh(e,t,n,r){return r!==null&&wv(r),Lu(t,e.child,null,n),e=Rv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function zM(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Zy(Error(_e(422))),bh(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Vg({mode:"visible",children:r.children},s,0,null),i=rc(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Lu(t,e.child,null,a),t.child.memoizedState=Ow(a),t.memoizedState=Mw,i);if(!(t.mode&1))return bh(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(_e(419)),r=Zy(i,r,void 0),bh(e,t,a,r)}if(l=(a&e.childLanes)!==0,Rs||l){if(r=Rr,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,ga(e,s),Zi(r,e,s,-1))}return Fv(),r=Zy(Error(_e(421))),bh(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=ZM.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,ri=nl(s.nextSibling),ii=t,Wn=!0,qi=null,e!==null&&(ji[Ci++]=aa,ji[Ci++]=la,ji[Ci++]=uc,aa=e.id,la=e.overflow,uc=t),t=Rv(t,r.children),t.flags|=4096,t)}function dS(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Pw(e.return,t,n)}function ex(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 j_(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(bs(e,t,r.children,n),r=Xn.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&&dS(e,n,t);else if(e.tag===19)dS(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(Pn(Xn,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&&zm(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),ex(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&&zm(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}ex(t,!0,n,null,i);break;case"together":ex(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function am(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ya(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),fc|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(_e(153));if(t.child!==null){for(e=t.child,n=ol(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ol(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function HM(e,t,n){switch(t.tag){case 3:S_(t),Ru();break;case 5:JE(t);break;case 1:Fs(t.type)&&Lm(t);break;case 4:jv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Pn($m,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Pn(Xn,Xn.current&1),t.flags|=128,null):n&t.child.childLanes?N_(e,t,n):(Pn(Xn,Xn.current&1),e=ya(e,t,n),e!==null?e.sibling:null);Pn(Xn,Xn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return j_(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Pn(Xn,Xn.current),r)break;return null;case 22:case 23:return t.lanes=0,v_(e,t,n)}return ya(e,t,n)}var C_,$w,E_,__;C_=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}};$w=function(){};E_=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Zl(Eo.current);var i=null;switch(n){case"input":s=iw(e,s),r=iw(e,r),i=[];break;case"select":s=Qn({},s,{value:void 0}),r=Qn({},r,{value:void 0}),i=[];break;case"textarea":s=lw(e,s),r=lw(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Tm)}uw(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"&&(jf.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var u=r[d];if(l=s!=null?s[d]:void 0,r.hasOwnProperty(d)&&u!==l&&(u!=null||l!=null))if(d==="style")if(l){for(a in l)!l.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&l[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(i||(i=[]),i.push(d,n)),n=u;else d==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,l=l?l.__html:void 0,u!=null&&l!==u&&(i=i||[]).push(d,u)):d==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(d,""+u):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(jf.hasOwnProperty(d)?(u!=null&&d==="onScroll"&&Mn("scroll",e),i||l===u||(i=[])):(i=i||[]).push(d,u))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};__=function(e,t,n,r){n!==r&&(t.flags|=4)};function Od(e,t){if(!Wn)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 is(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 BM(e,t,n){var r=t.pendingProps;switch(xv(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return is(t),null;case 1:return Fs(t.type)&&Rm(),is(t),null;case 3:return r=t.stateNode,Mu(),Dn(Ds),Dn(ls),Ev(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(xh(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,qi!==null&&(Uw(qi),qi=null))),$w(e,t),is(t),null;case 5:Cv(t);var s=Zl($f.current);if(n=t.type,e!==null&&t.stateNode!=null)E_(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(_e(166));return is(t),null}if(e=Zl(Eo.current),xh(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ko]=t,r[Mf]=i,e=(t.mode&1)!==0,n){case"dialog":Mn("cancel",r),Mn("close",r);break;case"iframe":case"object":case"embed":Mn("load",r);break;case"video":case"audio":for(s=0;s<Jd.length;s++)Mn(Jd[s],r);break;case"source":Mn("error",r);break;case"img":case"image":case"link":Mn("error",r),Mn("load",r);break;case"details":Mn("toggle",r);break;case"input":bk(r,i),Mn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Mn("invalid",r);break;case"textarea":kk(r,i),Mn("invalid",r)}uw(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&&yh(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&yh(r.textContent,l,e),s=["children",""+l]):jf.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&Mn("scroll",r)}switch(n){case"input":ch(r),vk(r,i,!0);break;case"textarea":ch(r),Sk(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Tm)}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=nE(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[ko]=t,e[Mf]=r,C_(e,t,!1,!1),t.stateNode=e;e:{switch(a=dw(n,r),n){case"dialog":Mn("cancel",e),Mn("close",e),s=r;break;case"iframe":case"object":case"embed":Mn("load",e),s=r;break;case"video":case"audio":for(s=0;s<Jd.length;s++)Mn(Jd[s],e);s=r;break;case"source":Mn("error",e),s=r;break;case"img":case"image":case"link":Mn("error",e),Mn("load",e),s=r;break;case"details":Mn("toggle",e),s=r;break;case"input":bk(e,r),s=iw(e,r),Mn("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Qn({},r,{value:void 0}),Mn("invalid",e);break;case"textarea":kk(e,r),s=lw(e,r),Mn("invalid",e);break;default:s=r}uw(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var u=l[i];i==="style"?iE(e,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&rE(e,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Cf(e,u):typeof u=="number"&&Cf(e,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(jf.hasOwnProperty(i)?u!=null&&i==="onScroll"&&Mn("scroll",e):u!=null&&rv(e,i,u,a))}switch(n){case"input":ch(e),vk(e,r,!1);break;case"textarea":ch(e),Sk(e);break;case"option":r.value!=null&&e.setAttribute("value",""+dl(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?wu(e,!!r.multiple,i,!1):r.defaultValue!=null&&wu(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Tm)}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 is(t),null;case 6:if(e&&t.stateNode!=null)__(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(_e(166));if(n=Zl($f.current),Zl(Eo.current),xh(t)){if(r=t.stateNode,n=t.memoizedProps,r[ko]=t,(i=r.nodeValue!==n)&&(e=ii,e!==null))switch(e.tag){case 3:yh(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&yh(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ko]=t,t.stateNode=r}return is(t),null;case 13:if(Dn(Xn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Wn&&ri!==null&&t.mode&1&&!(t.flags&128))KE(),Ru(),t.flags|=98560,i=!1;else if(i=xh(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(_e(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(_e(317));i[ko]=t}else Ru(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;is(t),i=!1}else qi!==null&&(Uw(qi),qi=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||Xn.current&1?Sr===0&&(Sr=3):Fv())),t.updateQueue!==null&&(t.flags|=4),is(t),null);case 4:return Mu(),$w(e,t),e===null&&Rf(t.stateNode.containerInfo),is(t),null;case 10:return kv(t.type._context),is(t),null;case 17:return Fs(t.type)&&Rm(),is(t),null;case 19:if(Dn(Xn),i=t.memoizedState,i===null)return is(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Od(i,!1);else{if(Sr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=zm(e),a!==null){for(t.flags|=128,Od(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 Pn(Xn,Xn.current&1|2),t.child}e=e.sibling}i.tail!==null&&lr()>$u&&(t.flags|=128,r=!0,Od(i,!1),t.lanes=4194304)}else{if(!r)if(e=zm(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Od(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Wn)return is(t),null}else 2*lr()-i.renderingStartTime>$u&&n!==1073741824&&(t.flags|=128,r=!0,Od(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=lr(),t.sibling=null,n=Xn.current,Pn(Xn,r?n&1|2:n&1),t):(is(t),null);case 22:case 23:return Dv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ei&1073741824&&(is(t),t.subtreeFlags&6&&(t.flags|=8192)):is(t),null;case 24:return null;case 25:return null}throw Error(_e(156,t.tag))}function WM(e,t){switch(xv(t),t.tag){case 1:return Fs(t.type)&&Rm(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Mu(),Dn(Ds),Dn(ls),Ev(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Cv(t),null;case 13:if(Dn(Xn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(_e(340));Ru()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Dn(Xn),null;case 4:return Mu(),null;case 10:return kv(t.type._context),null;case 22:case 23:return Dv(),null;case 24:return null;default:return null}}var vh=!1,os=!1,VM=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function du(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){nr(e,t,r)}else n.current=null}function Dw(e,t,n){try{n()}catch(r){nr(e,t,r)}}var fS=!1;function UM(e,t){if(vw=Pm,e=RE(),gv(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,u=-1,d=0,p=0,c=e,f=null;t:for(;;){for(var m;c!==n||s!==0&&c.nodeType!==3||(l=a+s),c!==i||r!==0&&c.nodeType!==3||(u=a+r),c.nodeType===3&&(a+=c.nodeValue.length),(m=c.firstChild)!==null;)f=c,c=m;for(;;){if(c===e)break t;if(f===n&&++d===s&&(l=a),f===i&&++p===r&&(u=a),(m=c.nextSibling)!==null)break;c=f,f=c.parentNode}c=m}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(kw={focusedElem:e,selectionRange:n},Pm=!1,Ke=t;Ke!==null;)if(t=Ke,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ke=e;else for(;Ke!==null;){t=Ke;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 v=y.memoizedProps,k=y.memoizedState,g=t.stateNode,b=g.getSnapshotBeforeUpdate(t.elementType===t.type?v:Vi(t.type,v),k);g.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(_e(163))}}catch(N){nr(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,Ke=e;break}Ke=t.return}return y=fS,fS=!1,y}function ff(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&&Dw(t,n,i)}s=s.next}while(s!==r)}}function Bg(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 Fw(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 P_(e){var t=e.alternate;t!==null&&(e.alternate=null,P_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ko],delete t[Mf],delete t[jw],delete t[EM],delete t[_M])),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 A_(e){return e.tag===5||e.tag===3||e.tag===4}function pS(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||A_(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 zw(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=Tm));else if(r!==4&&(e=e.child,e!==null))for(zw(e,t,n),e=e.sibling;e!==null;)zw(e,t,n),e=e.sibling}function Hw(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(Hw(e,t,n),e=e.sibling;e!==null;)Hw(e,t,n),e=e.sibling}var Br=null,Ui=!1;function $a(e,t,n){for(n=n.child;n!==null;)I_(e,t,n),n=n.sibling}function I_(e,t,n){if(Co&&typeof Co.onCommitFiberUnmount=="function")try{Co.onCommitFiberUnmount(Lg,n)}catch{}switch(n.tag){case 5:os||du(n,t);case 6:var r=Br,s=Ui;Br=null,$a(e,t,n),Br=r,Ui=s,Br!==null&&(Ui?(e=Br,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Br.removeChild(n.stateNode));break;case 18:Br!==null&&(Ui?(e=Br,n=n.stateNode,e.nodeType===8?qy(e.parentNode,n):e.nodeType===1&&qy(e,n),Af(e)):qy(Br,n.stateNode));break;case 4:r=Br,s=Ui,Br=n.stateNode.containerInfo,Ui=!0,$a(e,t,n),Br=r,Ui=s;break;case 0:case 11:case 14:case 15:if(!os&&(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)&&Dw(n,t,a),s=s.next}while(s!==r)}$a(e,t,n);break;case 1:if(!os&&(du(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){nr(n,t,l)}$a(e,t,n);break;case 21:$a(e,t,n);break;case 22:n.mode&1?(os=(r=os)||n.memoizedState!==null,$a(e,t,n),os=r):$a(e,t,n);break;default:$a(e,t,n)}}function hS(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new VM),t.forEach(function(r){var s=eO.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function zi(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:Br=l.stateNode,Ui=!1;break e;case 3:Br=l.stateNode.containerInfo,Ui=!0;break e;case 4:Br=l.stateNode.containerInfo,Ui=!0;break e}l=l.return}if(Br===null)throw Error(_e(160));I_(i,a,s),Br=null,Ui=!1;var u=s.alternate;u!==null&&(u.return=null),s.return=null}catch(d){nr(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)T_(t,e),t=t.sibling}function T_(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(zi(t,e),mo(e),r&4){try{ff(3,e,e.return),Bg(3,e)}catch(v){nr(e,e.return,v)}try{ff(5,e,e.return)}catch(v){nr(e,e.return,v)}}break;case 1:zi(t,e),mo(e),r&512&&n!==null&&du(n,n.return);break;case 5:if(zi(t,e),mo(e),r&512&&n!==null&&du(n,n.return),e.flags&32){var s=e.stateNode;try{Cf(s,"")}catch(v){nr(e,e.return,v)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,l=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&eE(s,i),dw(l,a);var d=dw(l,i);for(a=0;a<u.length;a+=2){var p=u[a],c=u[a+1];p==="style"?iE(s,c):p==="dangerouslySetInnerHTML"?rE(s,c):p==="children"?Cf(s,c):rv(s,p,c,d)}switch(l){case"input":ow(s,i);break;case"textarea":tE(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?wu(s,!!i.multiple,m,!1):f!==!!i.multiple&&(i.defaultValue!=null?wu(s,!!i.multiple,i.defaultValue,!0):wu(s,!!i.multiple,i.multiple?[]:"",!1))}s[Mf]=i}catch(v){nr(e,e.return,v)}}break;case 6:if(zi(t,e),mo(e),r&4){if(e.stateNode===null)throw Error(_e(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(v){nr(e,e.return,v)}}break;case 3:if(zi(t,e),mo(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Af(t.containerInfo)}catch(v){nr(e,e.return,v)}break;case 4:zi(t,e),mo(e);break;case 13:zi(t,e),mo(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Ov=lr())),r&4&&hS(e);break;case 22:if(p=n!==null&&n.memoizedState!==null,e.mode&1?(os=(d=os)||p,zi(t,e),os=d):zi(t,e),mo(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!p&&e.mode&1)for(Ke=e,p=e.child;p!==null;){for(c=Ke=p;Ke!==null;){switch(f=Ke,m=f.child,f.tag){case 0:case 11:case 14:case 15:ff(4,f,f.return);break;case 1:du(f,f.return);var y=f.stateNode;if(typeof y.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(v){nr(r,n,v)}}break;case 5:du(f,f.return);break;case 22:if(f.memoizedState!==null){gS(c);continue}}m!==null?(m.return=f,Ke=m):gS(c)}p=p.sibling}e:for(p=null,c=e;;){if(c.tag===5){if(p===null){p=c;try{s=c.stateNode,d?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=c.stateNode,u=c.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,l.style.display=sE("display",a))}catch(v){nr(e,e.return,v)}}}else if(c.tag===6){if(p===null)try{c.stateNode.nodeValue=d?"":c.memoizedProps}catch(v){nr(e,e.return,v)}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===e)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===e)break e;for(;c.sibling===null;){if(c.return===null||c.return===e)break e;p===c&&(p=null),c=c.return}p===c&&(p=null),c.sibling.return=c.return,c=c.sibling}}break;case 19:zi(t,e),mo(e),r&4&&hS(e);break;case 21:break;default:zi(t,e),mo(e)}}function mo(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(A_(n)){var r=n;break e}n=n.return}throw Error(_e(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Cf(s,""),r.flags&=-33);var i=pS(e);Hw(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=pS(e);zw(e,l,a);break;default:throw Error(_e(161))}}catch(u){nr(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function KM(e,t,n){Ke=e,R_(e)}function R_(e,t,n){for(var r=(e.mode&1)!==0;Ke!==null;){var s=Ke,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||vh;if(!a){var l=s.alternate,u=l!==null&&l.memoizedState!==null||os;l=vh;var d=os;if(vh=a,(os=u)&&!d)for(Ke=s;Ke!==null;)a=Ke,u=a.child,a.tag===22&&a.memoizedState!==null?yS(s):u!==null?(u.return=a,Ke=u):yS(s);for(;i!==null;)Ke=i,R_(i),i=i.sibling;Ke=s,vh=l,os=d}mS(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Ke=i):mS(e)}}function mS(e){for(;Ke!==null;){var t=Ke;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:os||Bg(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!os)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Vi(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Zk(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}Zk(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.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 p=d.memoizedState;if(p!==null){var c=p.dehydrated;c!==null&&Af(c)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(_e(163))}os||t.flags&512&&Fw(t)}catch(f){nr(t,t.return,f)}}if(t===e){Ke=null;break}if(n=t.sibling,n!==null){n.return=t.return,Ke=n;break}Ke=t.return}}function gS(e){for(;Ke!==null;){var t=Ke;if(t===e){Ke=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Ke=n;break}Ke=t.return}}function yS(e){for(;Ke!==null;){var t=Ke;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Bg(4,t)}catch(u){nr(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(u){nr(t,s,u)}}var i=t.return;try{Fw(t)}catch(u){nr(t,i,u)}break;case 5:var a=t.return;try{Fw(t)}catch(u){nr(t,a,u)}}}catch(u){nr(t,t.return,u)}if(t===e){Ke=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Ke=l;break}Ke=t.return}}var qM=Math.ceil,Wm=va.ReactCurrentDispatcher,Lv=va.ReactCurrentOwner,Ai=va.ReactCurrentBatchConfig,Gt=0,Rr=null,hr=null,Vr=0,ei=0,fu=bl(0),Sr=0,Hf=null,fc=0,Wg=0,Mv=0,pf=null,Ts=null,Ov=0,$u=1/0,ra=null,Vm=!1,Bw=null,sl=null,kh=!1,Xa=null,Um=0,hf=0,Ww=null,lm=-1,cm=0;function ks(){return Gt&6?lr():lm!==-1?lm:lm=lr()}function il(e){return e.mode&1?Gt&2&&Vr!==0?Vr&-Vr:AM.transition!==null?(cm===0&&(cm=yE()),cm):(e=hn,e!==0||(e=window.event,e=e===void 0?16:NE(e.type)),e):1}function Zi(e,t,n,r){if(50<hf)throw hf=0,Ww=null,Error(_e(185));fp(e,n,r),(!(Gt&2)||e!==Rr)&&(e===Rr&&(!(Gt&2)&&(Wg|=n),Sr===4&&qa(e,Vr)),zs(e,r),n===1&&Gt===0&&!(t.mode&1)&&($u=lr()+500,Fg&&vl()))}function zs(e,t){var n=e.callbackNode;AL(e,t);var r=_m(e,e===Rr?Vr:0);if(r===0)n!==null&&Ck(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ck(n),t===1)e.tag===0?PM(xS.bind(null,e)):WE(xS.bind(null,e)),jM(function(){!(Gt&6)&&vl()}),n=null;else{switch(xE(r)){case 1:n=lv;break;case 4:n=mE;break;case 16:n=Em;break;case 536870912:n=gE;break;default:n=Em}n=H_(n,L_.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function L_(e,t){if(lm=-1,cm=0,Gt&6)throw Error(_e(327));var n=e.callbackNode;if(Nu()&&e.callbackNode!==n)return null;var r=_m(e,e===Rr?Vr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Km(e,r);else{t=r;var s=Gt;Gt|=2;var i=O_();(Rr!==e||Vr!==t)&&(ra=null,$u=lr()+500,nc(e,t));do try{XM();break}catch(l){M_(e,l)}while(!0);vv(),Wm.current=i,Gt=s,hr!==null?t=0:(Rr=null,Vr=0,t=Sr)}if(t!==0){if(t===2&&(s=gw(e),s!==0&&(r=s,t=Vw(e,s))),t===1)throw n=Hf,nc(e,0),qa(e,r),zs(e,lr()),n;if(t===6)qa(e,r);else{if(s=e.current.alternate,!(r&30)&&!YM(s)&&(t=Km(e,r),t===2&&(i=gw(e),i!==0&&(r=i,t=Vw(e,i))),t===1))throw n=Hf,nc(e,0),qa(e,r),zs(e,lr()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(_e(345));case 2:ql(e,Ts,ra);break;case 3:if(qa(e,r),(r&130023424)===r&&(t=Ov+500-lr(),10<t)){if(_m(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){ks(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Nw(ql.bind(null,e,Ts,ra),t);break}ql(e,Ts,ra);break;case 4:if(qa(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Qi(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=lr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*qM(r/1960))-r,10<r){e.timeoutHandle=Nw(ql.bind(null,e,Ts,ra),r);break}ql(e,Ts,ra);break;case 5:ql(e,Ts,ra);break;default:throw Error(_e(329))}}}return zs(e,lr()),e.callbackNode===n?L_.bind(null,e):null}function Vw(e,t){var n=pf;return e.current.memoizedState.isDehydrated&&(nc(e,t).flags|=256),e=Km(e,t),e!==2&&(t=Ts,Ts=n,t!==null&&Uw(t)),e}function Uw(e){Ts===null?Ts=e:Ts.push.apply(Ts,e)}function YM(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(!eo(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 qa(e,t){for(t&=~Mv,t&=~Wg,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Qi(t),r=1<<n;e[n]=-1,t&=~r}}function xS(e){if(Gt&6)throw Error(_e(327));Nu();var t=_m(e,0);if(!(t&1))return zs(e,lr()),null;var n=Km(e,t);if(e.tag!==0&&n===2){var r=gw(e);r!==0&&(t=r,n=Vw(e,r))}if(n===1)throw n=Hf,nc(e,0),qa(e,t),zs(e,lr()),n;if(n===6)throw Error(_e(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ql(e,Ts,ra),zs(e,lr()),null}function $v(e,t){var n=Gt;Gt|=1;try{return e(t)}finally{Gt=n,Gt===0&&($u=lr()+500,Fg&&vl())}}function pc(e){Xa!==null&&Xa.tag===0&&!(Gt&6)&&Nu();var t=Gt;Gt|=1;var n=Ai.transition,r=hn;try{if(Ai.transition=null,hn=1,e)return e()}finally{hn=r,Ai.transition=n,Gt=t,!(Gt&6)&&vl()}}function Dv(){ei=fu.current,Dn(fu)}function nc(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,NM(n)),hr!==null)for(n=hr.return;n!==null;){var r=n;switch(xv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Rm();break;case 3:Mu(),Dn(Ds),Dn(ls),Ev();break;case 5:Cv(r);break;case 4:Mu();break;case 13:Dn(Xn);break;case 19:Dn(Xn);break;case 10:kv(r.type._context);break;case 22:case 23:Dv()}n=n.return}if(Rr=e,hr=e=ol(e.current,null),Vr=ei=t,Sr=0,Hf=null,Mv=Wg=fc=0,Ts=pf=null,Ql!==null){for(t=0;t<Ql.length;t++)if(n=Ql[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}Ql=null}return e}function M_(e,t){do{var n=hr;try{if(vv(),im.current=Bm,Hm){for(var r=Jn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Hm=!1}if(dc=0,Ir=vr=Jn=null,df=!1,Df=0,Lv.current=null,n===null||n.return===null){Sr=1,Hf=t,hr=null;break}e:{var i=e,a=n.return,l=n,u=t;if(t=Vr,l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var d=u,p=l,c=p.tag;if(!(p.mode&1)&&(c===0||c===11||c===15)){var f=p.alternate;f?(p.updateQueue=f.updateQueue,p.memoizedState=f.memoizedState,p.lanes=f.lanes):(p.updateQueue=null,p.memoizedState=null)}var m=iS(a);if(m!==null){m.flags&=-257,oS(m,a,l,i,t),m.mode&1&&sS(i,d,t),t=m,u=d;var y=t.updateQueue;if(y===null){var v=new Set;v.add(u),t.updateQueue=v}else y.add(u);break e}else{if(!(t&1)){sS(i,d,t),Fv();break e}u=Error(_e(426))}}else if(Wn&&l.mode&1){var k=iS(a);if(k!==null){!(k.flags&65536)&&(k.flags|=256),oS(k,a,l,i,t),wv(Ou(u,l));break e}}i=u=Ou(u,l),Sr!==4&&(Sr=2),pf===null?pf=[i]:pf.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=x_(i,u,t);Qk(i,g);break e;case 1:l=u;var b=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(sl===null||!sl.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=w_(i,l,t);Qk(i,N);break e}}i=i.return}while(i!==null)}D_(n)}catch(_){t=_,hr===n&&n!==null&&(hr=n=n.return);continue}break}while(!0)}function O_(){var e=Wm.current;return Wm.current=Bm,e===null?Bm:e}function Fv(){(Sr===0||Sr===3||Sr===2)&&(Sr=4),Rr===null||!(fc&268435455)&&!(Wg&268435455)||qa(Rr,Vr)}function Km(e,t){var n=Gt;Gt|=2;var r=O_();(Rr!==e||Vr!==t)&&(ra=null,nc(e,t));do try{GM();break}catch(s){M_(e,s)}while(!0);if(vv(),Gt=n,Wm.current=r,hr!==null)throw Error(_e(261));return Rr=null,Vr=0,Sr}function GM(){for(;hr!==null;)$_(hr)}function XM(){for(;hr!==null&&!vL();)$_(hr)}function $_(e){var t=z_(e.alternate,e,ei);e.memoizedProps=e.pendingProps,t===null?D_(e):hr=t,Lv.current=null}function D_(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=WM(n,t),n!==null){n.flags&=32767,hr=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Sr=6,hr=null;return}}else if(n=BM(n,t,ei),n!==null){hr=n;return}if(t=t.sibling,t!==null){hr=t;return}hr=t=e}while(t!==null);Sr===0&&(Sr=5)}function ql(e,t,n){var r=hn,s=Ai.transition;try{Ai.transition=null,hn=1,JM(e,t,n,r)}finally{Ai.transition=s,hn=r}return null}function JM(e,t,n,r){do Nu();while(Xa!==null);if(Gt&6)throw Error(_e(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(_e(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(IL(e,i),e===Rr&&(hr=Rr=null,Vr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||kh||(kh=!0,H_(Em,function(){return Nu(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Ai.transition,Ai.transition=null;var a=hn;hn=1;var l=Gt;Gt|=4,Lv.current=null,UM(e,n),T_(n,e),yM(kw),Pm=!!vw,kw=vw=null,e.current=n,KM(n),kL(),Gt=l,hn=a,Ai.transition=i}else e.current=n;if(kh&&(kh=!1,Xa=e,Um=s),i=e.pendingLanes,i===0&&(sl=null),jL(n.stateNode),zs(e,lr()),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(Vm)throw Vm=!1,e=Bw,Bw=null,e;return Um&1&&e.tag!==0&&Nu(),i=e.pendingLanes,i&1?e===Ww?hf++:(hf=0,Ww=e):hf=0,vl(),null}function Nu(){if(Xa!==null){var e=xE(Um),t=Ai.transition,n=hn;try{if(Ai.transition=null,hn=16>e?16:e,Xa===null)var r=!1;else{if(e=Xa,Xa=null,Um=0,Gt&6)throw Error(_e(331));var s=Gt;for(Gt|=4,Ke=e.current;Ke!==null;){var i=Ke,a=i.child;if(Ke.flags&16){var l=i.deletions;if(l!==null){for(var u=0;u<l.length;u++){var d=l[u];for(Ke=d;Ke!==null;){var p=Ke;switch(p.tag){case 0:case 11:case 15:ff(8,p,i)}var c=p.child;if(c!==null)c.return=p,Ke=c;else for(;Ke!==null;){p=Ke;var f=p.sibling,m=p.return;if(P_(p),p===d){Ke=null;break}if(f!==null){f.return=m,Ke=f;break}Ke=m}}}var y=i.alternate;if(y!==null){var v=y.child;if(v!==null){y.child=null;do{var k=v.sibling;v.sibling=null,v=k}while(v!==null)}}Ke=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,Ke=a;else e:for(;Ke!==null;){if(i=Ke,i.flags&2048)switch(i.tag){case 0:case 11:case 15:ff(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Ke=g;break e}Ke=i.return}}var b=e.current;for(Ke=b;Ke!==null;){a=Ke;var x=a.child;if(a.subtreeFlags&2064&&x!==null)x.return=a,Ke=x;else e:for(a=b;Ke!==null;){if(l=Ke,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Bg(9,l)}}catch(_){nr(l,l.return,_)}if(l===a){Ke=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,Ke=N;break e}Ke=l.return}}if(Gt=s,vl(),Co&&typeof Co.onPostCommitFiberRoot=="function")try{Co.onPostCommitFiberRoot(Lg,e)}catch{}r=!0}return r}finally{hn=n,Ai.transition=t}}return!1}function wS(e,t,n){t=Ou(n,t),t=x_(e,t,1),e=rl(e,t,1),t=ks(),e!==null&&(fp(e,1,t),zs(e,t))}function nr(e,t,n){if(e.tag===3)wS(e,e,n);else for(;t!==null;){if(t.tag===3){wS(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(sl===null||!sl.has(r))){e=Ou(n,e),e=w_(t,e,1),t=rl(t,e,1),e=ks(),t!==null&&(fp(t,1,e),zs(t,e));break}}t=t.return}}function QM(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ks(),e.pingedLanes|=e.suspendedLanes&n,Rr===e&&(Vr&n)===n&&(Sr===4||Sr===3&&(Vr&130023424)===Vr&&500>lr()-Ov?nc(e,0):Mv|=n),zs(e,t)}function F_(e,t){t===0&&(e.mode&1?(t=fh,fh<<=1,!(fh&130023424)&&(fh=4194304)):t=1);var n=ks();e=ga(e,t),e!==null&&(fp(e,t,n),zs(e,n))}function ZM(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),F_(e,n)}function eO(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(_e(314))}r!==null&&r.delete(t),F_(e,n)}var z_;z_=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ds.current)Rs=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Rs=!1,HM(e,t,n);Rs=!!(e.flags&131072)}else Rs=!1,Wn&&t.flags&1048576&&VE(t,Om,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;am(e,t),e=t.pendingProps;var s=Tu(t,ls.current);Su(t,n),s=Pv(null,t,r,e,s,n);var i=Av();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,Fs(r)?(i=!0,Lm(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Nv(t),s.updater=Hg,t.stateNode=s,s._reactInternals=t,Iw(t,r,e,n),t=Lw(null,t,r,!0,i,n)):(t.tag=0,Wn&&i&&yv(t),bs(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(am(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=nO(r),e=Vi(r,e),s){case 0:t=Rw(null,t,r,e,n);break e;case 1:t=cS(null,t,r,e,n);break e;case 11:t=aS(null,t,r,e,n);break e;case 14:t=lS(null,t,r,Vi(r.type,e),n);break e}throw Error(_e(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Vi(r,s),Rw(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Vi(r,s),cS(e,t,r,s,n);case 3:e:{if(S_(t),e===null)throw Error(_e(387));r=t.pendingProps,i=t.memoizedState,s=i.element,XE(e,t),Fm(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=Ou(Error(_e(423)),t),t=uS(e,t,r,n,s);break e}else if(r!==s){s=Ou(Error(_e(424)),t),t=uS(e,t,r,n,s);break e}else for(ri=nl(t.stateNode.containerInfo.firstChild),ii=t,Wn=!0,qi=null,n=YE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ru(),r===s){t=ya(e,t,n);break e}bs(e,t,r,n)}t=t.child}return t;case 5:return JE(t),e===null&&_w(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,Sw(r,s)?a=null:i!==null&&Sw(r,i)&&(t.flags|=32),k_(e,t),bs(e,t,a,n),t.child;case 6:return e===null&&_w(t),null;case 13:return N_(e,t,n);case 4:return jv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Lu(t,null,r,n):bs(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Vi(r,s),aS(e,t,r,s,n);case 7:return bs(e,t,t.pendingProps,n),t.child;case 8:return bs(e,t,t.pendingProps.children,n),t.child;case 12:return bs(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,Pn($m,r._currentValue),r._currentValue=a,i!==null)if(eo(i.value,a)){if(i.children===s.children&&!Ds.current){t=ya(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 u=l.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=fa(-1,n&-n),u.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var p=d.pending;p===null?u.next=u:(u.next=p.next,p.next=u),d.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Pw(i.return,n,t),l.lanes|=n;break}u=u.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(_e(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Pw(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}bs(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Su(t,n),s=Ii(s),r=r(s),t.flags|=1,bs(e,t,r,n),t.child;case 14:return r=t.type,s=Vi(r,t.pendingProps),s=Vi(r.type,s),lS(e,t,r,s,n);case 15:return b_(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Vi(r,s),am(e,t),t.tag=1,Fs(r)?(e=!0,Lm(t)):e=!1,Su(t,n),y_(t,r,s),Iw(t,r,s,n),Lw(null,t,r,!0,e,n);case 19:return j_(e,t,n);case 22:return v_(e,t,n)}throw Error(_e(156,t.tag))};function H_(e,t){return hE(e,t)}function tO(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 Pi(e,t,n,r){return new tO(e,t,n,r)}function zv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nO(e){if(typeof e=="function")return zv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===iv)return 11;if(e===ov)return 14}return 2}function ol(e,t){var n=e.alternate;return n===null?(n=Pi(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 um(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")zv(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case nu:return rc(n.children,s,i,t);case sv:a=8,s|=8;break;case tw:return e=Pi(12,n,t,s|2),e.elementType=tw,e.lanes=i,e;case nw:return e=Pi(13,n,t,s),e.elementType=nw,e.lanes=i,e;case rw:return e=Pi(19,n,t,s),e.elementType=rw,e.lanes=i,e;case JC:return Vg(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case GC:a=10;break e;case XC:a=9;break e;case iv:a=11;break e;case ov:a=14;break e;case Wa:a=16,r=null;break e}throw Error(_e(130,e==null?e:typeof e,""))}return t=Pi(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function rc(e,t,n,r){return e=Pi(7,e,r,t),e.lanes=n,e}function Vg(e,t,n,r){return e=Pi(22,e,r,t),e.elementType=JC,e.lanes=n,e.stateNode={isHidden:!1},e}function tx(e,t,n){return e=Pi(6,e,null,t),e.lanes=n,e}function nx(e,t,n){return t=Pi(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function rO(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=Oy(0),this.expirationTimes=Oy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Oy(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Hv(e,t,n,r,s,i,a,l,u){return e=new rO(e,t,n,l,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Pi(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Nv(i),e}function sO(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:tu,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function B_(e){if(!e)return fl;e=e._reactInternals;e:{if(vc(e)!==e||e.tag!==1)throw Error(_e(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Fs(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(_e(171))}if(e.tag===1){var n=e.type;if(Fs(n))return BE(e,n,t)}return t}function W_(e,t,n,r,s,i,a,l,u){return e=Hv(n,r,!0,e,s,i,a,l,u),e.context=B_(null),n=e.current,r=ks(),s=il(n),i=fa(r,s),i.callback=t??null,rl(n,i,s),e.current.lanes=s,fp(e,s,r),zs(e,r),e}function Ug(e,t,n,r){var s=t.current,i=ks(),a=il(s);return n=B_(n),t.context===null?t.context=n:t.pendingContext=n,t=fa(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=rl(s,t,a),e!==null&&(Zi(e,s,a,i),sm(e,s,a)),a}function qm(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 bS(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Bv(e,t){bS(e,t),(e=e.alternate)&&bS(e,t)}function iO(){return null}var V_=typeof reportError=="function"?reportError:function(e){console.error(e)};function Wv(e){this._internalRoot=e}Kg.prototype.render=Wv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(_e(409));Ug(e,t,null,null)};Kg.prototype.unmount=Wv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;pc(function(){Ug(null,e,null,null)}),t[ma]=null}};function Kg(e){this._internalRoot=e}Kg.prototype.unstable_scheduleHydration=function(e){if(e){var t=vE();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ka.length&&t!==0&&t<Ka[n].priority;n++);Ka.splice(n,0,e),n===0&&SE(e)}};function Vv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function qg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function vS(){}function oO(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var d=qm(a);i.call(d)}}var a=W_(t,r,e,0,null,!1,!1,"",vS);return e._reactRootContainer=a,e[ma]=a.current,Rf(e.nodeType===8?e.parentNode:e),pc(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=qm(u);l.call(d)}}var u=Hv(e,0,!1,null,null,!1,!1,"",vS);return e._reactRootContainer=u,e[ma]=u.current,Rf(e.nodeType===8?e.parentNode:e),pc(function(){Ug(t,u,n,r)}),u}function Yg(e,t,n,r,s){var i=n._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var l=s;s=function(){var u=qm(a);l.call(u)}}Ug(t,a,e,s)}else a=oO(n,t,e,s,r);return qm(a)}wE=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Xd(t.pendingLanes);n!==0&&(cv(t,n|1),zs(t,lr()),!(Gt&6)&&($u=lr()+500,vl()))}break;case 13:pc(function(){var r=ga(e,1);if(r!==null){var s=ks();Zi(r,e,1,s)}}),Bv(e,1)}};uv=function(e){if(e.tag===13){var t=ga(e,134217728);if(t!==null){var n=ks();Zi(t,e,134217728,n)}Bv(e,134217728)}};bE=function(e){if(e.tag===13){var t=il(e),n=ga(e,t);if(n!==null){var r=ks();Zi(n,e,t,r)}Bv(e,t)}};vE=function(){return hn};kE=function(e,t){var n=hn;try{return hn=e,t()}finally{hn=n}};pw=function(e,t,n){switch(t){case"input":if(ow(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=Dg(r);if(!s)throw Error(_e(90));ZC(r),ow(r,s)}}}break;case"textarea":tE(e,n);break;case"select":t=n.value,t!=null&&wu(e,!!n.multiple,t,!1)}};lE=$v;cE=pc;var aO={usingClientEntryPoint:!1,Events:[hp,ou,Dg,oE,aE,$v]},$d={findFiberByHostInstance:Jl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},lO={bundleType:$d.bundleType,version:$d.version,rendererPackageName:$d.rendererPackageName,rendererConfig:$d.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:va.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=fE(e),e===null?null:e.stateNode},findFiberByHostInstance:$d.findFiberByHostInstance||iO,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 Sh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sh.isDisabled&&Sh.supportsFiber)try{Lg=Sh.inject(lO),Co=Sh}catch{}}ci.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=aO;ci.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Vv(t))throw Error(_e(200));return sO(e,t,null,n)};ci.createRoot=function(e,t){if(!Vv(e))throw Error(_e(299));var n=!1,r="",s=V_;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Hv(e,1,!1,null,null,n,!1,r,s),e[ma]=t.current,Rf(e.nodeType===8?e.parentNode:e),new Wv(t)};ci.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(_e(188)):(e=Object.keys(e).join(","),Error(_e(268,e)));return e=fE(t),e=e===null?null:e.stateNode,e};ci.flushSync=function(e){return pc(e)};ci.hydrate=function(e,t,n){if(!qg(t))throw Error(_e(200));return Yg(null,e,t,!0,n)};ci.hydrateRoot=function(e,t,n){if(!Vv(e))throw Error(_e(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=V_;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=W_(t,null,e,1,n??null,s,!1,i,a),e[ma]=t.current,Rf(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 Kg(t)};ci.render=function(e,t,n){if(!qg(t))throw Error(_e(200));return Yg(null,e,t,!1,n)};ci.unmountComponentAtNode=function(e){if(!qg(e))throw Error(_e(40));return e._reactRootContainer?(pc(function(){Yg(null,null,e,!1,function(){e._reactRootContainer=null,e[ma]=null})}),!0):!1};ci.unstable_batchedUpdates=$v;ci.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!qg(n))throw Error(_e(200));if(e==null||e._reactInternals===void 0)throw Error(_e(38));return Yg(e,t,n,!1,r)};ci.version="18.3.1-next-f1338f8080-20240426";function U_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U_)}catch(e){console.error(e)}}U_(),UC.exports=ci;var Wr=UC.exports,kS=Wr;Zx.createRoot=kS.createRoot,Zx.hydrateRoot=kS.hydrateRoot;const K_=h.createContext(null);function Kw(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function cO(){const e=Kw(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function uO({children:e}){const[t,n]=h.useState(cO);h.useEffect(()=>{const i=()=>n(Kw(window.location.pathname));return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=h.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 u=Kw(l.pathname),d=l.search||"";window.history.pushState({},"",u+d),n(u)},[]),s=h.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(K_.Provider,{value:s,children:e})}function Lo(){const e=h.useContext(K_);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function dO(){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 SS={};function qw(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&SS[t[0]]||(typeof t[0]=="string"&&(SS[t[0]]=new Date),dO(...t))}const q_=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function NS(e,t,n){e.loadNamespaces(t,q_(e,n))}function jS(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,q_(e,r))}function fO(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,u)=>{const d=t.services.backendConnector.state[`${l}|${u}`];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 pO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(qw("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}}):fO(e,t,n)}const hO=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,mO={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},gO=e=>mO[e],yO=e=>e.replace(hO,gO);let Yw={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:yO};function xO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yw={...Yw,...e}}function wO(){return Yw}let Y_;function bO(e){Y_=e}function vO(){return Y_}const kO={type:"3rdParty",init(e){xO(e.options.react),bO(e)}},SO=h.createContext();class NO{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const jO=(e,t)=>{const n=h.useRef();return h.useEffect(()=>{n.current=e},[e,t]),n.current};function In(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=h.useContext(SO)||{},i=n||r||vO();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new NO),!i){qw("You will need to pass in an i18next instance by using initReactI18next");const x=(_,C)=>typeof C=="string"?C:C&&typeof C=="object"&&typeof C.defaultValue=="string"?C.defaultValue:Array.isArray(_)?_[_.length-1]:_,N=[x,{},!1];return N.t=x,N.i18n={},N.ready=!1,N}i.options.react&&i.options.react.wait!==void 0&&qw("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...wO(),...i.options.react,...t},{useSuspense:l,keyPrefix:u}=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 p=(i.isInitialized||i.initializedStoreOnce)&&d.every(x=>pO(x,i,a));function c(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?d:d[0],u)}const[f,m]=h.useState(c);let y=d.join();t.lng&&(y=`${t.lng}${y}`);const v=jO(y),k=h.useRef(!0);h.useEffect(()=>{const{bindI18n:x,bindI18nStore:N}=a;k.current=!0,!p&&!l&&(t.lng?jS(i,t.lng,d,()=>{k.current&&m(c)}):NS(i,d,()=>{k.current&&m(c)})),p&&v&&v!==y&&k.current&&m(c);function _(){k.current&&m(c)}return x&&i&&i.on(x,_),N&&i&&i.store.on(N,_),()=>{k.current=!1,x&&i&&x.split(" ").forEach(C=>i.off(C,_)),N&&i&&N.split(" ").forEach(C=>i.store.off(C,_))}},[i,y]);const g=h.useRef(!0);h.useEffect(()=>{k.current&&!g.current&&m(c),g.current=!1},[i,u]);const b=[f,i,p];if(b.t=f,b.i18n=i,b.ready=p,p||!p&&!l)return b;throw new Promise(x=>{t.lng?jS(i,t.lng,d,()=>x()):NS(i,d,()=>x())})}const G_="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",CO=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/nodes",labelKey:"common:nav.nodes",icon:"account_tree"},{to:"/my-nodes",labelKey:"common:nav.myNodes",icon:"deployed_code"},{to:"/my-flows",labelKey:"common:nav.myFlows",icon:"schema"},{to:"/skills",labelKey:"common:nav.skills",icon:"extension"},{to:"/mcps",labelKey:"common:nav.mcps",icon:"hub"},{to:"/feedback",labelKey:"common:nav.feedback",icon:"rate_review"},{to:"/settings",labelKey:"common:nav.settings",icon:"settings"}],EO=[{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 _O(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function PO({authUser:e,onLogout:t}){const{path:n,navigate:r}=Lo(),{t:s}=In(),[i,a]=h.useState(!1);return h.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(u=>u.json()).then(u=>{l||a(!!u.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:G_,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:CO.map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(_O(n,l.to)?" af-nav-link--active":""),onClick:()=>r(l.to),children:[o.jsx("span",{className:"material-symbols-outlined",children:l.icon}),o.jsx("span",{children:s(l.labelKey)})]},l.to))}),o.jsxs("div",{className:"af-sidebar-footer",children:[o.jsxs("div",{className:"af-sidebar-user",title:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||"",children:[o.jsx("span",{className:"material-symbols-outlined",children:"person"}),o.jsx("span",{children:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||""}),e!=null&&e.isAdmin?o.jsx("span",{className:"af-sidebar-admin-badge",children:"Admin"}):null,o.jsx("button",{type:"button",className:"af-sidebar-logout",onClick:t,"aria-label":"Logout",title:"Logout",children:o.jsx("span",{className:"material-symbols-outlined",children:"logout"})})]}),!i&&EO.map(l=>{const u=s(l.labelKey);return o.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":u,title:u,children:o.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const X_="agentflow.pipelineRecent",AO=50,IO=15;function TO(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function J_(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(X_);return e?TO(e).filter(t=>t&&typeof t.flowId=="string"&&(t.flowSource==="user"||t.flowSource==="builtin"||t.flowSource==="admin"||t.flowSource==="workspace")&&t.kind==="opened"&&typeof t.at=="number"):[]}function Nh(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=J_(),i=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(a=>!(a.flowId===e&&a.flowSource===t))].slice(0,AO);try{localStorage.setItem(X_,JSON.stringify(i))}catch{}}function RO(e,t){const n=e.filter(r=>r.id===t);return n.length===0||n.some(r=>(r.source??"user")==="user")?"user":n.some(r=>r.source==="workspace")?"workspace":n.some(r=>r.source==="admin")?"admin":n.some(r=>r.source==="builtin")?"builtin":n[0].source??"user"}function Gw(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),u=new Date,d=new Date(u);if(d.setDate(d.getDate()-1),l.toDateString()===d.toDateString())return t("flow:time.yesterday");const p=Math.floor(a/24);return p<7?t("flow:time.daysAgo",{n:p}):`${l.getMonth()+1}/${l.getDate()}`}function LO(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 MO(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:RO(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,IO)}var ti=Uint8Array,pu=Uint16Array,OO=Int32Array,Q_=new ti([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]),Z_=new ti([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]),$O=new ti([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),eP=function(e,t){for(var n=new pu(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new OO(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}},tP=eP(Q_,2),nP=tP.b,DO=tP.r;nP[28]=258,DO[258]=28;var FO=eP(Z_,0),zO=FO.b,Xw=new pu(32768);for(var $n=0;$n<32768;++$n){var Da=($n&43690)>>1|($n&21845)<<1;Da=(Da&52428)>>2|(Da&13107)<<2,Da=(Da&61680)>>4|(Da&3855)<<4,Xw[$n]=((Da&65280)>>8|(Da&255)<<8)>>1}var mf=function(e,t,n){for(var r=e.length,s=0,i=new pu(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new pu(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new pu(1<<t);var u=15-t;for(s=0;s<r;++s)if(e[s])for(var d=s<<4|e[s],p=t-e[s],c=a[e[s]-1]++<<p,f=c|(1<<p)-1;c<=f;++c)l[Xw[c]>>u]=d}else for(l=new pu(r),s=0;s<r;++s)e[s]&&(l[s]=Xw[a[e[s]-1]++]>>15-e[s]);return l},gp=new ti(288);for(var $n=0;$n<144;++$n)gp[$n]=8;for(var $n=144;$n<256;++$n)gp[$n]=9;for(var $n=256;$n<280;++$n)gp[$n]=7;for(var $n=280;$n<288;++$n)gp[$n]=8;var rP=new ti(32);for(var $n=0;$n<32;++$n)rP[$n]=5;var HO=mf(gp,9,1),BO=mf(rP,5,1),rx=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Hi=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},sx=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},WO=function(e){return(e+7)/8|0},Uv=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ti(e.subarray(t,n))},VO=["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"],Ni=function(e,t,n){var r=new Error(t||VO[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ni),!n)throw r;return r},UO=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new ti(0);var a=!n,l=a||t.i!=2,u=t.i;a&&(n=new ti(s*3));var d=function(oe){var ye=n.length;if(oe>ye){var ke=new ti(Math.max(ye*2,oe));ke.set(n),n=ke}},p=t.f||0,c=t.p||0,f=t.b||0,m=t.l,y=t.d,v=t.m,k=t.n,g=s*8;do{if(!m){p=Hi(e,c,1);var b=Hi(e,c+1,3);if(c+=3,b)if(b==1)m=HO,y=BO,v=9,k=5;else if(b==2){var C=Hi(e,c,31)+257,T=Hi(e,c+10,15)+4,H=C+Hi(e,c+5,31)+1;c+=14;for(var L=new ti(H),F=new ti(19),O=0;O<T;++O)F[$O[O]]=Hi(e,c+O*3,7);c+=T*3;for(var D=rx(F),W=(1<<D)-1,$=mf(F,D,1),O=0;O<H;){var M=$[Hi(e,c,W)];c+=M&15;var x=M>>4;if(x<16)L[O++]=x;else{var I=0,z=0;for(x==16?(z=3+Hi(e,c,3),c+=2,I=L[O-1]):x==17?(z=3+Hi(e,c,7),c+=3):x==18&&(z=11+Hi(e,c,127),c+=7);z--;)L[O++]=I}}var P=L.subarray(0,C),R=L.subarray(C);v=rx(P),k=rx(R),m=mf(P,v,1),y=mf(R,k,1)}else Ni(1);else{var x=WO(c)+4,N=e[x-4]|e[x-3]<<8,_=x+N;if(_>s){u&&Ni(0);break}l&&d(f+N),n.set(e.subarray(x,_),f),t.b=f+=N,t.p=c=_*8,t.f=p;continue}if(c>g){u&&Ni(0);break}}l&&d(f+131072);for(var E=(1<<v)-1,J=(1<<k)-1,Z=c;;Z=c){var I=m[sx(e,c)&E],U=I>>4;if(c+=I&15,c>g){u&&Ni(0);break}if(I||Ni(2),U<256)n[f++]=U;else if(U==256){Z=c,m=null;break}else{var se=U-254;if(U>264){var O=U-257,pe=Q_[O];se=Hi(e,c,(1<<pe)-1)+nP[O],c+=pe}var he=y[sx(e,c)&J],xe=he>>4;he||Ni(3),c+=he&15;var R=zO[xe];if(xe>3){var pe=Z_[xe];R+=sx(e,c)&(1<<pe)-1,c+=pe}if(c>g){u&&Ni(0);break}l&&d(f+131072);var le=f+se;if(f<R){var Se=i-R,ie=Math.min(R,le);for(Se+f<0&&Ni(3);f<ie;++f)n[f]=r[Se+f]}for(;f<le;++f)n[f]=n[f-R]}}t.l=m,t.p=Z,t.b=f,t.f=p,m&&(p=1,t.m=v,t.d=y,t.n=k)}while(!p);return f!=n.length&&a?Uv(n,0,f):n.subarray(0,f)},KO=new ti(0),So=function(e,t){return e[t]|e[t+1]<<8},Yi=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},ix=function(e,t){return Yi(e,t)+Yi(e,t+4)*4294967296};function qO(e,t){return UO(e,{i:2},t&&t.out,t&&t.dictionary)}var Jw=typeof TextDecoder<"u"&&new TextDecoder,YO=0;try{Jw.decode(KO,{stream:!0}),YO=1}catch{}var GO=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:Uv(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 XO(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(Jw)return Jw.decode(e);var s=GO(e),i=s.s,n=s.r;return n.length&&Ni(8),i}}var JO=function(e,t){return t+30+So(e,t+26)+So(e,t+28)},QO=function(e,t,n){var r=So(e,t+28),s=XO(e.subarray(t+46,t+46+r),!(So(e,t+8)&2048)),i=t+46+r,a=Yi(e,t+20),l=n&&a==4294967295?ZO(e,i):[a,Yi(e,t+24),Yi(e,t+42)],u=l[0],d=l[1],p=l[2];return[So(e,t+10),u,d,s,i+So(e,t+30)+So(e,t+32),p]},ZO=function(e,t){for(;So(e,t)!=1;t+=4+So(e,t+2));return[ix(e,t+12),ix(e,t+4),ix(e,t+20)]};function e$(e,t){for(var n={},r=e.length-22;Yi(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Ni(13);var s=So(e,r+8);if(!s)return{};var i=Yi(e,r+16),a=i==4294967295||s==65535;if(a){var l=Yi(e,r-12);a=Yi(e,l)==101075792,a&&(s=Yi(e,l+32),i=Yi(e,l+48))}for(var u=0;u<s;++u){var d=QO(e,i,a),p=d[0],c=d[1],f=d[2],m=d[3],y=d[4],v=d[5],k=JO(e,v);i=y,p?p==8?n[m]=qO(e.subarray(k,k+c),{out:new ti(f)}):Ni(14,"unknown compression type "+p):n[m]=Uv(e,k,k+c)}return n}const t$=8*1024*1024,n$=500;function r$(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 s$(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function i$(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 o$=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function a$(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=e$(t),r=new Map;let s=0,i=0;for(const[u,d]of Object.entries(n)){if(u.endsWith("/"))continue;const p=r$(u);if(!p||s$(p))continue;const c=(d==null?void 0:d.length)??0;if(s+=c,s>t$||(i+=1,i>n$))return null;r.set(p,c)}if(r.size===0)return null;const a=new Set;for(const u of r.keys()){const d=i$(u);d!==null&&a.add(d)}if(a.size!==1)return null;const[l]=[...a];if(l==="")return null;for(const u of r.keys())if(!(u===l||u.startsWith(`${l}/`)))return null;return o$.test(l)?l:null}catch{return null}}const ox=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function l$({file:e,onClose:t,onImported:n}){const{t:r}=In(),s=h.useId(),i=h.useRef(null),a=h.useRef(null),[l,u]=h.useState(""),[d,p]=h.useState("user"),[c,f]=h.useState(!1),[m,y]=h.useState(""),[v,k]=h.useState(null),g=v??e;h.useEffect(()=>{const _=requestAnimationFrame(()=>{var C;return(C=i.current)==null?void 0:C.focus()});return()=>cancelAnimationFrame(_)},[]),h.useEffect(()=>{let _=!1;return(async()=>{const C=g.name||"",T=C.toLowerCase();let H="";if(T.endsWith(".zip")){if(H=await a$(g)||"",!H){const L=C.replace(/\.zip$/i,"");ox.test(L)&&(H=L)}}else if(T.endsWith(".yaml")||T.endsWith(".yml")){const L=C.replace(/\.ya?ml$/i,"");ox.test(L)&&(H=L)}_||u(H)})(),()=>{_=!0}},[g]);const b=l.trim(),x=b.length>0&&ox.test(b);async function N(_){if(_.preventDefault(),!(!x||c)){f(!0),y("");try{const C=new FormData;C.set("flowId",b),C.set("targetSpace",d),C.set("file",g,g.name);const T=await fetch("/api/flows/import",{method:"POST",body:C}),H=await T.json().catch(()=>({}));if(!T.ok){y(typeof H.error=="string"?H.error:r("project:importModal.importFailed"));return}n({id:H.flowId,source:H.flowSource??"user"})}catch(C){y(String((C==null?void 0:C.message)||C))}finally{f(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:_=>{_.target===_.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:_=>_.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:N,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename: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:_=>{var T;const C=(T=_.target.files)==null?void 0:T[0];C&&k(C),_.target.value=""}}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:importModal.nameLabel")}),o.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"importFlowId",autoComplete:"off",spellCheck:!1,placeholder:r("project:importModal.namePlaceholder"),value:l,onChange:_=>u(_.target.value),"aria-invalid":b.length>0&&!x}),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 _;return(_=a.current)==null?void 0:_.click()},children:r("project:importModal.changeFile")})}),m?o.jsx("p",{className:"af-err af-new-pipeline-err",children:m}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:c,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!x||c,children:r(c?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const c$=/^[a-zA-Z][a-zA-Z0-9_-]*$/,CS="af:newPipelineGuide";function u$({open:e,onClose:t,onCreated:n}){const{t:r}=In(),s=h.useId(),i=h.useRef(null),[a,l]=h.useState(""),[u,d]=h.useState(""),[p,c]=h.useState("user"),[f,m]=h.useState(!1),[y,v]=h.useState(""),[k,g]=h.useState(!1);h.useEffect(()=>{if(!e)return;l(""),d(""),c("user"),v(""),m(!1),localStorage.getItem(CS)==="true"&&g(!0);const T=requestAnimationFrame(()=>{var H;return(H=i.current)==null?void 0:H.focus()});return()=>cancelAnimationFrame(T)},[e]);const b=()=>{localStorage.removeItem(CS),g(!1)};if(!e)return null;const x=a.trim(),N=x.length>0&&c$.test(x);async function _(C){if(C.preventDefault(),!(!N||f)){m(!0),v(""),b();try{const T=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:x,description:u.trim(),targetSpace:p})}),H=await T.json().catch(()=>({}));if(!T.ok){v(typeof H.error=="string"?H.error:r("project:newPipelineModal.createFailed"));return}n({id:H.flowId,source:H.flowSource??"user"})}catch(T){v(String((T==null?void 0:T.message)||T))}finally{m(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&(b(),t())},children:o.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:C=>C.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{b(),t()},"aria-label":r("project:newPipelineModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),k?o.jsx("div",{className:"af-new-pipeline-guide",children:o.jsxs("div",{className:"af-new-pipeline-guide-content",children:[o.jsx("span",{className:"material-symbols-outlined af-new-pipeline-guide-icon",children:"lightbulb"}),o.jsxs("div",{className:"af-new-pipeline-guide-text",children:[o.jsx("p",{children:o.jsx("strong",{children:r("onboarding:newPipeline.guideTitle")})}),o.jsx("p",{children:r("onboarding:newPipeline.guideDesc")})]}),o.jsx("button",{type:"button",className:"af-new-pipeline-guide-close",onClick:b,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:_,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:C=>l(C.target.value),"aria-invalid":x.length>0&&!N}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(k?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-new-pipeline-textarea",name:"pipelineDescription",rows:3,placeholder:r(k?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:u,onChange:C=>d(C.target.value)}),k?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:()=>{b(),t()},disabled:f,children:r("project:newPipelineModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!N||f,children:r(f?"project:newPipelineModal.creating":k?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const sP="agentflow.pipelineViewPreference";function iP(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function oP(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(sP)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function d$(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(sP,JSON.stringify(e))}catch{}}function Ym(e){return e==="display"?"display":e==="pipeline"?"pipeline":"workspace"}function f$(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function aP(e,t,n,r=!1){if(!e)return;const s=oP();s[iP(e,t,r)]={view:Ym(n),at:Date.now()},d$(s)}function p$(e,t="workspace"){if(!(e!=null&&e.id))return Ym(t);const r=oP()[iP(e.id,e.source??"user",!!e.archived)],s=Ym((r==null?void 0:r.view)||t);return s==="pipeline"&&!f$(e)?"workspace":s}function Bf(e,t="workspace"){const n=Ym(t);if(!(e!=null&&e.id))return n==="pipeline"?"/flow":n==="display"?"/workspace?view=display":"/workspace";const r=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&r.set(n==="pipeline"?"flowArchived":"archived","1"),n==="display"&&r.set("view","display"),`/${n==="pipeline"?"flow":"workspace"}?${r.toString()}`}function jh(e,t="workspace"){return Bf(e,p$(e,t))}function h$(e,t){const n=String(e||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),r=String(t||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),s=Math.max(n.length,r.length);for(let i=0;i<s;i+=1){const a=Number.isFinite(n[i])?n[i]:0,l=Number.isFinite(r[i])?r[i]:0;if(a!==l)return a>l?1:-1}return 0}function Qw(e){return String((e==null?void 0:e.version)||"").trim()}function m$(e){const t=Qw(e),n=[(e==null?void 0:e.agent)||"codex",(e==null?void 0:e.kind)||"skill"];return t&&n.push(`v${t}`),n.join(" · ")}function g$({onChanged:e}){const[t,n]=h.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[r,s]=h.useState([]),[i,a]=h.useState(""),[l,u]=h.useState("keyword"),[d,p]=h.useState([]),[c,f]=h.useState({}),[m,y]=h.useState(""),[v,k]=h.useState(""),[g,b]=h.useState(""),x=h.useCallback(async()=>{k("");try{const[L,F]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),O=await L.json().catch(()=>({}));L.ok&&n({available:!!O.available,version:typeof O.version=="string"?O.version:"",loggedIn:!!O.loggedIn,user:typeof O.user=="string"?O.user:"",error:typeof O.error=="string"?O.error:""});const D=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof D.error=="string"?D.error:"HTTP "+F.status);s(Array.isArray(D.skills)?D.skills:[]),f({})}catch(L){k(String(L.message||L))}},[]);h.useEffect(()=>{x()},[x]);const N=h.useCallback(async()=>{const L=i.trim();if(L){y("search"),k(""),b("");try{const F=await fetch(`/api/skillhub/search?q=${encodeURIComponent(L)}&mode=${encodeURIComponent(l)}`),O=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof O.error=="string"?O.error:"HTTP "+F.status);p(Array.isArray(O.items)?O.items:[])}catch(F){k(String(F.message||F))}finally{y("")}}},[i,l]),_=h.useCallback(async(L,F=!1)=>{const O=L&&typeof L=="object"?L:null,D=String(O?O.slug||O.name||O.collection||O.skillId||O.id:L||"").trim();if(D){y(`install:${D}`),k(""),b("");try{const W=O?{slug:O.slug||"",skillId:O.skillId||"",collection:O.collection||"",collectionName:O.collection&&O.name||"",target:"global",agent:"codex",force:F}:{slug:D,target:"global",agent:"codex",force:F},$=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}),M=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof M.error=="string"?M.error:"HTTP "+$.status);b(F?`已更新 ${D}`:`已安装 ${D}`),await x(),typeof e=="function"&&await e()}catch(W){k(String(W.message||W))}finally{y("")}}},[x,e]),C=h.useCallback(async()=>{if(r.length!==0){y("check-updates"),k(""),b("");try{const L=await Promise.all(r.map(async D=>{const W=String(D.name||"").trim();if(!W)return null;try{const $=await fetch(`/api/skillhub/search?q=${encodeURIComponent(W)}&mode=keyword`),M=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof M.error=="string"?M.error:"HTTP "+$.status);const I=Array.isArray(M.items)?M.items:[],z=I.find(J=>J.slug===W||J.name===W||J.id===W)||I[0],P=Qw(D),R=String((z==null?void 0:z.version)||"").trim();let E="unknown";return z?P&&R?E=h$(P,R)<0?"update":"current":R&&(E="remote-only"):E="missing",[W,{state:E,latestVersion:R,installedVersion:P,summary:(z==null?void 0:z.summary)||""}]}catch($){return[W,{state:"error",error:String($.message||$),installedVersion:Qw(D)}]}})),F={};for(const D of L)D&&(F[D[0]]=D[1]);f(F);const O=Object.values(F).filter(D=>D.state==="update").length;b(O>0?`发现 ${O} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{y("")}}},[r]),T=h.useCallback(async L=>{const F=String(L||"").trim();if(F){y(`uninstall:${F}`),k(""),b("");try{const O=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:F,target:"global",agent:"codex"})}),D=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof D.error=="string"?D.error:"HTTP "+O.status);b(`已卸载 ${F}`),await x(),typeof e=="function"&&await e()}catch(O){k(String(O.message||O))}finally{y("")}}},[x,e]),H=h.useCallback(async()=>{y("update-cli"),k(""),b("");try{const L=await fetch("/api/skillhub/update",{method:"POST"}),F=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof F.error=="string"?F.error:"HTTP "+L.status);b("SkillHub CLI 已更新"),await x()}catch(L){k(String(L.message||L))}finally{y("")}},[x]);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:x,disabled:!!m,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:C,disabled:!!m||r.length===0,children:m==="check-updates"?"检查中…":"检查更新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:H,disabled:!!m,children:m==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),o.jsxs("div",{className:"af-set-skillhub-search",children:[o.jsxs("select",{className:"af-set-input af-set-input--sm af-set-skillhub-search-mode",value:l,onChange:L=>{u(L.target.value),p([])},children:[o.jsx("option",{value:"keyword",children:"关键词"}),o.jsx("option",{value:"skillId",children:"Skill ID"}),o.jsx("option",{value:"collectionId",children:"Collection ID"})]}),o.jsx("input",{className:"af-set-input af-set-input--sm",value:i,onChange:L=>a(L.target.value),onKeyDown:L=>{L.key==="Enter"&&N()},placeholder:l==="collectionId"?"输入 collection id,例如 1":l==="skillId"?"输入 skill id":"搜索 skill slug / 关键词,例如 android、issue-tracker"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>N(),disabled:!i.trim()||m==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),m==="search"?"搜索中…":"搜索"]})]}),v?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:v}):null,g?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:g}):null,o.jsxs("div",{className:"af-set-skillhub-grid",children:[o.jsxs("div",{className:"af-set-skillhub-pane",children:[o.jsxs("div",{className:"af-set-skillhub-pane-head",children:[o.jsx("h3",{children:"已安装"}),o.jsx("span",{children:r.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:r.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 Codex 全局 skills"}):r.map(L=>{const F=c[L.name],O=!F||F.state==="update"||F.state==="remote-only"||F.state==="unknown"||F.state==="error",D=m===`install:${L.name}`?"更新中…":(F==null?void 0:F.state)==="current"?"已最新":(F==null?void 0:F.state)==="update"&&F.latestVersion?`更新到 v${F.latestVersion}`:(F==null?void 0:F.state)==="remote-only"&&F.latestVersion?`安装 v${F.latestVersion}`:"重装";return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:L.displayName||L.name}),o.jsx("div",{className:"af-set-skillhub-meta",children:m$(L)}),o.jsx("div",{className:"af-set-skillhub-version-row",children:F?F.state==="update"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",F.installedVersion?`v${F.installedVersion} -> `:"","v",F.latestVersion]}):F.state==="current"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",F.latestVersion||F.installedVersion]}):F.state==="remote-only"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",F.latestVersion,",本地版本未知"]}):F.state==="missing"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):F.state==="error"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--err",children:"检查失败"}):o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"状态未知"}):o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未检查远端版本"})})]}),o.jsxs("div",{className:"af-set-skillhub-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>_(L.name,!0),disabled:!!m||!O,children:D}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>T(L.name),disabled:!!m,children:"卸载"})]})]},`${L.agent}:${L.path}:${L.name}`)})})]}),o.jsxs("div",{className:"af-set-skillhub-pane",children:[o.jsxs("div",{className:"af-set-skillhub-pane-head",children:[o.jsx("h3",{children:"搜索结果"}),o.jsx("span",{children:d.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:d.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):d.map(L=>{const F=L.slug||L.name,O=L.kind==="collection"||L.collection,D=!O&&r.some(W=>W.name===F||W.name===L.name);return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:L.name||F}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[O?`collection:${L.collection}`:F,L.skillId?` · id:${L.skillId}`:"",L.version?` · ${L.version}`:""]}),L.summary?o.jsx("p",{className:"af-set-skillhub-summary",children:L.summary}):null]}),o.jsx("button",{type:"button",className:D?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>_(L,D),disabled:!!m,children:D?"更新":O?"安装合集":"安装"})]},L.id||F)})})]})]})]})}function al(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 y$(e){return{version:1,collections:al({collections:e})}}function pl(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 lP(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 cP(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function uP(e,t,n){const r=pl(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 x$(e,t,n){const r=String(e||"").trim().toLowerCase(),s=al({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return pl(s,t)}function dP(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(d=>d.key).filter(Boolean),i=String(t||"").trim().toLowerCase(),a=al({collections:r}),l=x$(t,n,r),u=l.length>0?l:s;if(!e)return u;try{const d=localStorage.getItem(e);if(d!==null){const p=JSON.parse(d);if(Array.isArray(p)){const c=new Set(s),f=p.map(String).filter(g=>c.has(g));if(s.length>0&&f.length===s.length)return u;const m=new Set(f),y=new Set(l),v=l.length>0&&l.every(g=>m.has(g)),k=a.some(g=>{if(!g.builtin||g.id===i||g.name.toLowerCase()===i)return!1;const b=pl(g,n);return b.length>0&&b.every(x=>m.has(x))});return l.length>0&&k&&!v?u:f}}}catch{}return u}function Dd(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 w$(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 Zw(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="admin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function fP(e){const t=e.source??"user";return t==="builtin"?`builtin/pipelines / ${e.id}`:t==="admin"?`admin builtin / ${e.ownerUserId||"-"} / ${e.id}`:t==="workspace"?e.archived?`.workspace/agentflow/pipelines/_archived / ${e.id}`:`.workspace/agentflow/pipelines / ${e.id}`:e.archived?`~/agentflow/pipelines/_archived / ${e.id}`:`~/agentflow/pipelines / ${e.id}`}const b$="project:defaultCardDesc";function pP(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(b$)}function v$(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ar({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(`(${v$(r)})`,"gi"),a=s.split(i);return o.jsx("span",{className:t,children:a.map((l,u)=>u%2===1?o.jsx("mark",{className:"af-search-hit",children:l},u):o.jsx("span",{children:l},u))})}function k$(e,t,n){const r=[String(e.id),pP(e,n),fP(e),Zw(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
+
`).toLowerCase()}function S$(e,t,n){return t?k$(e,t,n).includes(t):!0}function N$(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 ax(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
+
`).toLowerCase().includes(n):!0}function ES(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 _S(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const j$=["all","agent","control","provide","marketplace"],C$=["all","agent","control","provide"],hP="agentflow.projects.activityPanelOpen",eb="agentflow.projects.activitySelected";function E$(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(hP);return e!=="0"}function PS(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function _$(){return typeof localStorage>"u"?"":localStorage.getItem(eb)||""}function Ch(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Bn(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 Fa(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function mP(e){var n;const t=(n=e==null?void 0:e.snippet)==null?void 0:n.instances;return Array.isArray(t)?t.filter(r=>r&&typeof r=="object"):t&&typeof t=="object"?Object.entries(t).map(([r,s])=>({...s&&typeof s=="object"?s:{},instanceId:(s==null?void 0:s.instanceId)||r})):[]}function gP(e){var n;const t=(n=e==null?void 0:e.snippet)==null?void 0:n.edges;return Array.isArray(t)?t.filter(r=>r&&typeof r=="object"):[]}function tb(e,t){return String((e==null?void 0:e.instanceId)||(e==null?void 0:e.id)||(e==null?void 0:e.nodeId)||`node_${t+1}`)}function AS(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||tb(e,t))}function P$(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function IS(e,t){return String(t==="source"?(e==null?void 0:e.source)||(e==null?void 0:e.from)||(e==null?void 0:e.sourceId)||(e==null?void 0:e.fromNode)||(e==null?void 0:e.fromInstanceId)||"":(e==null?void 0:e.target)||(e==null?void 0:e.to)||(e==null?void 0:e.targetId)||(e==null?void 0:e.toNode)||(e==null?void 0:e.toInstanceId)||"")}function A$(e){const t=(e==null?void 0:e.sourceHandle)||(e==null?void 0:e.fromHandle)||(e==null?void 0:e.output)||(e==null?void 0:e.outputName),n=(e==null?void 0:e.targetHandle)||(e==null?void 0:e.toHandle)||(e==null?void 0:e.input)||(e==null?void 0:e.inputName);return t&&n?`${t} -> ${n}`:String(t||n||"")}function lx(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function I$(e){const t=Number(e==null?void 0:e.x),n=Number(e==null?void 0:e.y);return!Number.isFinite(t)||!Number.isFinite(n)?null:{x:t,y:n}}function T$(e,t){const n=e.map(p=>p.id),r=new Set(n),s=new Map(n.map(p=>[p,0])),i=new Map(n.map(p=>[p,[]]));t.forEach(p=>{var c;!r.has(p.sourceId)||!r.has(p.targetId)||(s.set(p.targetId,(s.get(p.targetId)||0)+1),(c=i.get(p.sourceId))==null||c.push(p.targetId))});const a=new Map,l=n.filter(p=>(s.get(p)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(p=>a.set(p,0));for(let p=0;p<l.length;p+=1){const c=l[p],f=(a.get(c)||0)+1;for(const m of i.get(c)||[])(!a.has(m)||f>a.get(m))&&(a.set(m,f),l.push(m))}n.forEach((p,c)=>{a.has(p)||a.set(p,c%3)});const u=new Map,d=new Map;return n.forEach(p=>{const c=a.get(p)||0,f=u.get(c)||0;u.set(c,f+1),d.set(p,{x:c*190,y:f*86})}),d}function R$(e){var v,k,g,b;const t=mP(e),n=gP(e),r=new Map(t.map((x,N)=>[tb(x,N),AS(x,N)])),s=t.map((x,N)=>({id:tb(x,N),title:AS(x,N),meta:P$(x)})),i=n.map((x,N)=>{const _=IS(x,"source"),C=IS(x,"target");return{key:(x==null?void 0:x.id)||`${_}-${C}-${N}`,sourceId:_,targetId:C,source:r.get(_)||_||"?",target:r.get(C)||C||"?",label:A$(x)}}),a=(k=(v=e==null?void 0:e.snippet)==null?void 0:v.ui)!=null&&k.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(b=(g=e==null?void 0:e.snippet)==null?void 0:g.ui)!=null&&b.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},u=T$(s,i),d=s.map(x=>{const N=I$(a[x.id])||u.get(x.id)||{x:0,y:0},_=l[x.id]&&typeof l[x.id]=="object"?l[x.id]:{},C=Number(_.width),T=Number(_.height),H=Math.max(132,Math.min(210,Number.isFinite(C)?C*.62:150)),L=Math.max(48,Math.min(76,Number.isFinite(T)?T*.46:54));return{...x,x:N.x,y:N.y,width:H,height:L}}),p=new Map(d.map(x=>[x.id,x])),c=i.map(x=>{const N=p.get(x.sourceId),_=p.get(x.targetId);if(!N||!_)return null;const C=N.x+N.width,T=N.y+N.height/2,H=_.x,L=_.y+_.height/2,F=Math.max(48,Math.abs(H-C)*.45);return{...x,path:`M ${C} ${T} C ${C+F} ${T}, ${H-F} ${L}, ${H} ${L}`,labelX:(C+H)/2,labelY:(T+L)/2}}).filter(Boolean),f=d.reduce((x,N)=>({minX:Math.min(x.minX,N.x),minY:Math.min(x.minY,N.y),maxX:Math.max(x.maxX,N.x+N.width),maxY:Math.max(x.maxY,N.y+N.height)}),{minX:0,minY:0,maxX:420,maxY:220}),m=36,y=`${f.minX-m} ${f.minY-m} ${Math.max(360,f.maxX-f.minX+m*2)} ${Math.max(180,f.maxY-f.minY+m*2)}`;return{nodes:s,edges:i,diagram:{nodes:d,edges:c,viewBox:y}}}function Uc({resourceKind:e="",authUser:t=null}){var Ys,Ri,sr,Gr,Or,Ho;const{t:n}=In(),{navigate:r,path:s}=Lo(),i=!!(t!=null&&t.isAdmin),[a,l]=h.useState(e||"all"),[u,d]=h.useState([]),[p,c]=h.useState([]),[f,m]=h.useState([]),[y,v]=h.useState([]),[k,g]=h.useState([]),[b,x]=h.useState(""),[N,_]=h.useState(!1),[C,T]=h.useState([]),[H,L]=h.useState(""),[F,O]=h.useState(""),[D,W]=h.useState(!1),[$,M]=h.useState(!1),[I,z]=h.useState(!1),[P,R]=h.useState(null),[E,J]=h.useState(!1),[Z,U]=h.useState(""),[se,pe]=h.useState(E$),[he,xe]=h.useState(_$),[le,Se]=h.useState("all"),[ie,oe]=h.useState(""),[ye,ke]=h.useState("overview"),[Ve,Je]=h.useState({}),[We,ot]=h.useState(""),[ze,mt]=h.useState({}),[ln,zn]=h.useState(""),[Bt,en]=h.useState(""),[cn,un]=h.useState({}),[ue,Ne]=h.useState(""),[He,nt]=h.useState(""),[et,_t]=h.useState(""),[st,dn]=h.useState(""),[on,Un]=h.useState(""),[fn,Tn]=h.useState(!1),[Kn,Nr]=h.useState(""),[we,Me]=h.useState({hiddenBuiltins:[],promoted:[]}),ct=h.useRef(0),vt=h.useRef(0),ae=h.useRef(0),Le=h.useCallback(async()=>{var me,De;const K=++vt.current;L("");try{const Ie=await fetch("/api/flows");if(K!==vt.current)return;if(!Ie.ok)throw new Error("HTTP "+Ie.status);const Ze=await Ie.json();if(K!==vt.current)return;d(Array.isArray(Ze)?Ze:[])}catch(Ie){if(K!==vt.current)return;d([]),L(String(Ie.message||Ie))}try{const Ie=await fetch("/api/pipeline-recent-runs");if(K!==vt.current)return;if(Ie.ok){const Ze=await Ie.json();if(K!==vt.current)return;T(Array.isArray(Ze.runs)?Ze.runs:[])}else T([])}catch{if(K!==vt.current)return;T([])}if(t!=null&&t.isAdmin)try{const Ie=await fetch("/api/admin/builtin-flows");if(K!==vt.current)return;const Ze=await Ie.json().catch(()=>({}));Ie.ok&&Me({hiddenBuiltins:Array.isArray((me=Ze==null?void 0:Ze.config)==null?void 0:me.hiddenBuiltins)?Ze.config.hiddenBuiltins:[],promoted:Array.isArray((De=Ze==null?void 0:Ze.config)==null?void 0:De.promoted)?Ze.config.promoted:[]})}catch{if(K!==vt.current)return;Me({hiddenBuiltins:[],promoted:[]})}else Me({hiddenBuiltins:[],promoted:[]});W(!0)},[t==null?void 0:t.isAdmin]),rt=h.useCallback(async(K,me)=>{if(!(t!=null&&t.isAdmin)||!(K!=null&&K.id))return;const De=`${me}:${K.source}:${K.id}`;Nr(De),L("");try{const Ie=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:me,flowId:K.id,ownerUserId:K.ownerUserId||t.userId})}),Ze=await Ie.json().catch(()=>({}));if(!Ie.ok)throw new Error(Ze.error||"更新内置配置失败");await Le()}catch(Ie){L(String(Ie.message||Ie))}finally{Nr("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,Le]),Tt=h.useCallback(async()=>{const K=++ae.current;O(""),M(!1);const me=e==="my-nodes"?"/api/nodes?scope=owned":"/api/nodes",De=e==="my-flows"?"/api/marketplace/flow-snippets?scope=owned":"/api/marketplace/flow-snippets";c([]),v([]),oe("");try{const[Ie,Ze,Yt,Ct]=await Promise.all([fetch(me),fetch("/api/skills"),fetch("/api/skill-collections"),fetch(De)]),ir=await Ie.json().catch(()=>({})),Xr=await Ze.json().catch(()=>({})),di=await Yt.json().catch(()=>({})),mn=await Ct.json().catch(()=>({}));if(!Ie.ok)throw new Error(ir.error||"Nodes HTTP "+Ie.status);if(!Ze.ok)throw new Error(Xr.error||"Skills HTTP "+Ze.status);if(!Yt.ok)throw new Error(di.error||"Collections HTTP "+Yt.status);if(!Ct.ok)throw new Error(mn.error||"Flow snippets HTTP "+Ct.status);if(K!==ae.current)return;c(Array.isArray(ir.nodes)?ir.nodes:Array.isArray(ir)?ir:[]),m(Array.isArray(Xr.skills)?Xr.skills:[]),g(al(di)),v(Array.isArray(mn.snippets)?mn.snippets:[])}catch(Ie){if(K!==ae.current)return;c([]),m([]),v([]),g([]),O(String(Ie.message||Ie))}finally{if(K!==ae.current)return;M(!0)}},[e]);h.useEffect(()=>{W(!1),Le(),Tt()},[Le,Tt]),h.useEffect(()=>{try{localStorage.setItem(hP,se?"1":"0")}catch{}},[se]),h.useEffect(()=>{try{he?localStorage.setItem(eb,he):localStorage.removeItem(eb)}catch{}},[he]),h.useEffect(()=>{let K=!1;return fetch("/api/ui-context").then(me=>me.json()).then(me=>{K||Tn(!!me.hideCommunityLinks)}).catch(()=>{}),()=>{K=!0}},[]);const Wt=h.useCallback(async K=>{if(!i)return;const me=al({collections:K});_(!0),O("");try{const De=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(y$(me))}),Ie=await De.json().catch(()=>({}));if(!De.ok)throw new Error(Ie.error||"Collections HTTP "+De.status);g(al(Ie))}catch(De){O(String(De.message||De))}finally{_(!1)}},[i]),Zn=h.useCallback(()=>{if(!i)return;const K=b.trim();if(!K)return;const me=K.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",De=new Set(k.map(Ct=>Ct.id));let Ie=me,Ze=2;for(;De.has(Ie);)Ie=`${me}-${Ze++}`;const Yt=Date.now();Wt([...k,{id:Ie,name:K,skillKeys:[],createdAt:Yt,updatedAt:Yt}]),x(""),Se(`collection:${Ie}`)},[i,b,Wt,k]),ds=h.useCallback(K=>{if(!i)return;const me=k.find(Ie=>Ie.id===K);if(me!=null&&me.builtin)return;const De=k.filter(Ie=>Ie.id!==K);le===`collection:${K}`&&Se("all"),Wt(De)},[i,le,Wt,k]),Us=h.useCallback((K,me,De)=>{if(!i)return;const Ie=String(me||"").trim();if(!Ie)return;const Ze=Date.now(),Yt=k.map(Ct=>{if(Ct.id!==K)return Ct;const ir=new Set(Ct.skillKeys||[]);return De?ir.add(Ie):ir.delete(Ie),{...Ct,skillKeys:Array.from(ir),updatedAt:Ze}});Wt(Yt)},[i,Wt,k]),Yr=h.useCallback(async K=>{const me=K==null?void 0:K.packageId,De=K==null?void 0:K.version;if(!me||!De||!window.confirm(n("project:deleteMyNodeConfirm",{id:me,version:De})))return;const Ie=Bn(K);nt(Ie),_t(""),O("");try{const Ze=new URLSearchParams({id:me,version:De}),Yt=await fetch(`/api/marketplace/node?${Ze.toString()}`,{method:"DELETE"}),Ct=await Yt.json().catch(()=>({}));if(!Yt.ok||(Ct==null?void 0:Ct.ok)===!1){const ir=Array.isArray(Ct==null?void 0:Ct.usage)&&Ct.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:Ct.usage.length})}`:"";throw new Error(((Ct==null?void 0:Ct.error)||"Delete failed")+ir)}_t(n("project:deleteMyNodeSuccess",{id:me,version:De})),mt(ir=>{const Xr={...ir};return delete Xr[Ie],Xr}),un(ir=>{const Xr={};for(const[di,mn]of Object.entries(ir))di.startsWith(`${Ie}:`)||(Xr[di]=mn);return Xr}),oe(""),await Tt()}catch(Ze){_t(String(Ze.message||Ze))}finally{nt("")}},[Tt,n]),fs=h.useCallback(async K=>{const me=K==null?void 0:K.id,De=(K==null?void 0:K.version)||"1.0.0";if(!me||!De||!window.confirm(n("project:deleteMyFlowConfirm",{id:me,version:De})))return;const Ie=Fa(K);dn(Ie),Un(""),O("");try{const Ze=new URLSearchParams({id:me,version:De}),Yt=await fetch(`/api/marketplace/flow-snippet?${Ze.toString()}`,{method:"DELETE"}),Ct=await Yt.json().catch(()=>({}));if(!Yt.ok||(Ct==null?void 0:Ct.ok)===!1)throw new Error((Ct==null?void 0:Ct.error)||"Delete failed");Un(n("project:deleteMyFlowSuccess",{id:me,version:De})),oe(""),await Tt()}catch(Ze){Un(String(Ze.message||Ze))}finally{dn("")}},[Tt,n]);h.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){l(e),Se("all"),oe(""),ke("overview");return}l(K=>K==="archived"?"archived":"all")},[e]),h.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const K=new URLSearchParams(window.location.search);let me=!1;if(K.get("tab")==="nodes"){r("/nodes");return}if(K.get("tab")==="my-nodes"){r("/my-nodes");return}if(K.get("tab")==="my-flows"){r("/my-flows");return}if(K.get("tab")==="skills"){r("/skills");return}if(K.get("tab")==="archived"&&(l("archived"),K.delete("tab"),me=!0),K.get("new")==="1"&&(z(!0),K.delete("new"),me=!0),me){const De=K.toString();window.history.replaceState({},"",De?`/projects?${De}`:"/projects")}},[s,r]);const qn=h.useMemo(()=>MO(C,J_(),u),[C,u,s]),cr=h.useMemo(()=>qn.filter(K=>N$(Z,K)),[qn,Z]),Ks=Z.trim().toLowerCase(),ft=h.useMemo(()=>a==="archived"?u.filter(K=>K.archived):u.filter(K=>!K.archived),[u,a]),Lr=h.useMemo(()=>ft.filter(K=>S$(K,Ks,n)),[ft,Ks,n]),$o=h.useMemo(()=>new Set((we.promoted||[]).map(K=>String((K==null?void 0:K.id)||"").trim()).filter(Boolean)),[we.promoted]),Fe=h.useMemo(()=>(we.hiddenBuiltins||[]).map(K=>String(K||"").trim()).filter(Boolean),[we.hiddenBuiltins]),Mt=a==="nodes"||a==="my-nodes",ur=a==="my-nodes",lt=a==="my-flows",Mr=h.useMemo(()=>p.filter(K=>ur&&K.source!=="marketplace"?!1:(le==="all"||(le==="marketplace"?K.source==="marketplace":K.type===le))&&ax(Z,[K.id,K.label,K.displayName,K.description,K.type,K.source,K.packageId,K.version])),[p,ur,Z,le]),jr=h.useMemo(()=>{const K=new Map;for(const me of k)K.set(me.id,new Set(me.skillKeys||[]));return K},[k]),Te=h.useMemo(()=>[{id:"all",label:"全部"},...k.map(K=>({id:`collection:${K.id}`,label:K.name,count:K.skillKeys.length,collection:K})),{id:"ungrouped",label:"未分组"}],[k]),ps=h.useMemo(()=>f.filter(K=>{var Ie;const me=Bn(K);let De=le==="all";if(le.startsWith("collection:")){const Ze=le.slice(11);De=!!((Ie=jr.get(Ze))!=null&&Ie.has(me))}else le==="ungrouped"&&(De=!Array.from(jr.values()).some(Ze=>Ze.has(me)));return De&&ax(Z,[K.name,K.id,K.description,K.sourceLabel,K.source,K.path])}),[f,Z,le,jr]),Yn=h.useMemo(()=>y.filter(K=>ax(Z,[K.id,K.name,K.displayName,K.description,K.version,K.packageDir,Array.isArray(K.tags)?K.tags.join(" "):""])),[y,Z]),qs=Mt||lt||a==="skills",ut=h.useMemo(()=>Mr.find(K=>Bn(K)===ie)||Mr[0]||null,[Mr,ie]),Xt=h.useMemo(()=>ps.find(K=>Bn(K)===ie)||ps[0]||null,[ps,ie]),Jt=h.useMemo(()=>Yn.find(K=>Fa(K)===ie)||Yn[0]||null,[Yn,ie]),Cr=Xt?Ve[Bn(Xt)]:null,tt=ut?ze[Bn(ut)]:null,hs=ut&&Bt?cn[`${Bn(ut)}:${Bt}`]:null,Do=n(Mt?"project:searchNodes":lt?"project:searchFlows":a==="skills"?"project:searchSkills":"project:searchPipelines");h.useEffect(()=>{if(a!=="skills"||!Xt)return;const K=Bn(Xt);if(Ve[K])return;let me=!1;return ot(K),fetch(`/api/skills/detail?key=${encodeURIComponent(K)}`).then(De=>De.json().then(Ie=>({ok:De.ok,json:Ie}))).then(({ok:De,json:Ie})=>{me||De&&Ie.skill&&Je(Ze=>({...Ze,[K]:Ie.skill}))}).catch(()=>{}).finally(()=>{me||ot("")}),()=>{me=!0}},[a,Xt,Ve]),h.useEffect(()=>{if(!Mt||!ut)return;const K=Bn(ut);if(ze[K])return;let me=!1;return zn(K),fetch(`/api/nodes/detail?id=${encodeURIComponent(ut.id)}`).then(De=>De.json().then(Ie=>({ok:De.ok,json:Ie}))).then(({ok:De,json:Ie})=>{me||De&&mt(Ze=>({...Ze,[K]:Ie}))}).catch(()=>{}).finally(()=>{me||zn("")}),()=>{me=!0}},[Mt,ut,ze]),h.useEffect(()=>{if(!Mt)return;const K=Array.isArray(tt==null?void 0:tt.files)?tt.files:[];en(me=>{var De;return me&&K.some(Ie=>Ie.path===me)?me:((De=K[0])==null?void 0:De.path)||""})},[Mt,tt]),h.useEffect(()=>{if(!Mt||!ut||!Bt)return;const K=`${Bn(ut)}:${Bt}`;if(cn[K])return;let me=!1;return Ne(K),fetch(`/api/nodes/file?id=${encodeURIComponent(ut.id)}&path=${encodeURIComponent(Bt)}`).then(De=>De.json().then(Ie=>({ok:De.ok,json:Ie}))).then(({ok:De,json:Ie})=>{me||De&&un(Ze=>({...Ze,[K]:Ie}))}).catch(()=>{}).finally(()=>{me||Ne("")}),()=>{me=!0}},[Mt,ut,Bt,cn]),h.useEffect(()=>{_t("")},[ie,a]);const js=K=>{r(jh(K,"workspace"))},Fo=K=>{xe(PS(K)),r(jh({id:K.flowId,source:K.flowSource,archived:!!K.archived},"workspace"))},ms=h.useCallback(K=>{var me,De;K.preventDefault(),K.stopPropagation(),(De=(me=K.dataTransfer)==null?void 0:me.types)!=null&&De.includes("Files")&&(ct.current+=1,J(!0))},[]),zo=h.useCallback(K=>{K.preventDefault(),K.stopPropagation(),ct.current-=1,ct.current<=0&&(ct.current=0,J(!1))},[]),dr=h.useCallback(K=>{K.preventDefault(),K.stopPropagation()},[]),jn=h.useCallback(K=>{var Ie,Ze;K.preventDefault(),K.stopPropagation(),ct.current=0,J(!1);const me=(Ze=(Ie=K.dataTransfer)==null?void 0:Ie.files)==null?void 0:Ze[0];if(!me)return;const De=me.name.toLowerCase();!De.endsWith(".yaml")&&!De.endsWith(".yml")&&!De.endsWith(".zip")||R(me)},[]);return o.jsxs("div",{className:"af-projects"+(E?" af-projects--drop-target":""),onDragEnter:ms,onDragLeave:zo,onDragOver:dr,onDrop:jn,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:a==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>l("all"),children:n("project:all")}),o.jsx("button",{type:"button",className:a==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>l("archived"),children:n("project:archived")})]}),o.jsxs("div",{className:"af-projects-top-right",children:[o.jsxs("div",{className:"af-search-wrap",children:[o.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),o.jsx("input",{className:"af-search"+(Z.trim()?" af-search--has-clear":""),type:"search",placeholder:Do,"aria-label":Do,autoComplete:"off",value:Z,onChange:K=>U(K.target.value),onKeyDown:K=>{K.key==="Escape"&&(U(""),K.currentTarget.blur())}}),Z.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>U(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),qs?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Tt(),children:n("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(se?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":se,"aria-controls":"af-recent-activity-panel",onClick:()=>pe(K=>!K),children:o.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>z(!0),children:n("project:createNew")})]})]})]}),o.jsxs("div",{className:"af-projects-body",children:[o.jsxs("section",{className:"af-projects-main",children:[o.jsxs("header",{className:"af-projects-section-head",children:[o.jsx("h2",{className:"af-projects-h2",children:n(a==="my-nodes"?"project:myNodes":a==="my-flows"?"project:myFlows":a==="nodes"?"project:globalNodes":a==="skills"?"project:globalSkills":a==="archived"?"project:archivedPipelines":"project:activeProjects")}),o.jsx("p",{className:"af-projects-sub",children:Ks?n("project:filterResult",{count:a==="nodes"||a==="my-nodes"?Mr.length:a==="my-flows"?Yn.length:a==="skills"?ps.length:Lr.length}):a==="my-nodes"?n("project:myNodesHint",{count:Mr.length}):a==="my-flows"?n("project:myFlowsHint",{count:Yn.length}):a==="nodes"?n("project:nodesHint",{count:p.length}):a==="skills"?n("project:skillsHint",{count:f.length}):n(a==="archived"?"project:archivedHint":"project:activeHint")}),H?o.jsx("p",{className:"af-err af-projects-api-hint",children:H}):null,F&&qs?o.jsx("p",{className:"af-err af-projects-api-hint",children:F}):null]}),qs?o.jsxs("div",{className:"af-resource-toolbar",children:[a==="skills"?o.jsx(g$,{onChanged:Tt}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:lt?"schema":Mt?ur?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:n(lt?"project:myFlowsPurposeTitle":ur?"project:myNodesPurposeTitle":Mt?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:n(lt?"project:myFlowsPurposeDesc":ur?"project:myNodesPurposeDesc":Mt?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),lt?null:o.jsx("div",{className:"af-resource-filter-row",children:(Mt?(ur?C$:j$).map(K=>({id:K,label:n(`project:resourceFilter.${K}`)})):Te).map(K=>K.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(le===K.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{Se(K.id),oe("")},children:[K.label,o.jsx("em",{children:K.count}),K.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),i&&!K.collection.builtin?o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:N,"aria-label":`删除 ${K.collection.name}`,onClick:()=>ds(K.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})}):null]},K.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(le===K.id?" af-resource-filter--active":""),onClick:()=>{Se(K.id),oe("")},children:K.label},K.id))}),a==="skills"&&i?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:K=>x(K.target.value),onKeyDown:K=>{K.key==="Enter"&&Zn()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!b.trim()||N,onClick:()=>Zn(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Mt?o.jsx("div",{className:"af-resource-grid",children:Mr.length>0?Mr.map(K=>o.jsxs("button",{type:"button",className:"af-resource-card"+(ut&&Bn(K)===Bn(ut)?" af-resource-card--active":""),onClick:()=>oe(Bn(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Dd(K.type==="control"?"secondary":K.type==="provide"?"primary":"muted"),children:o.jsx(ar,{query:Z,children:K.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(ar,{query:Z,children:ES(K.source,n)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(ar,{query:Z,children:K.label||K.displayName||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(ar,{query:Z,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(ar,{query:Z,children:K.id})}),o.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(K.inputs||{}).length,outputs:Object.keys(K.outputs||{}).length})})]}),K.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(ar,{query:Z,children:`${K.packageId}${K.version?` / ${K.version}`:""}`})})]}):null]},`${K.id}:${K.source||""}:${K.packageId||""}`)):$?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Ks?n("project:noNodeMatch",{query:Z.trim()}):n(ur?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):lt?o.jsx("div",{className:"af-resource-grid",children:Yn.length>0?Yn.map(K=>{const me=mP(K),De=gP(K),Ie=Number.isFinite(Number(K.nodeCount))?Number(K.nodeCount):me.length,Ze=Number.isFinite(Number(K.edgeCount))?Number(K.edgeCount):De.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(Jt&&Fa(K)===Fa(Jt)?" af-resource-card--active":""),onClick:()=>oe(Fa(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Dd("primary"),children:o.jsx(ar,{query:Z,children:K.version?`v${K.version}`:"flow"})}),o.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(ar,{query:Z,children:K.displayName||K.name||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(ar,{query:Z,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:n("project:flowSnippetNodes",{nodes:Ie,edges:Ze})}),o.jsx("span",{children:o.jsx(ar,{query:Z,children:K.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(ar,{query:Z,children:_S(K)})})]})]},Fa(K))}):$?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Ks?n("project:noFlowSnippetMatch",{query:Z.trim()}):n("project:noMyFlows")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):a==="skills"?o.jsx("div",{className:"af-resource-grid",children:ps.length>0?ps.map(K=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Xt&&Bn(K)===Bn(Xt)?" af-resource-card--active":""),onClick:()=>oe(Bn(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Dd(K.source==="builtin"?"muted":"primary"),children:o.jsx(ar,{query:Z,children:K.sourceLabel||K.source||"skill"})}),o.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(ar,{query:Z,children:K.name||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(ar,{query:Z,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),o.jsx("span",{className:"af-path-text",children:o.jsx(ar,{query:Z,children:K.path||K.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[k.filter(me=>me.skillKeys.includes(Bn(K))).slice(0,3).map(me=>o.jsx("span",{children:me.name},me.id)),k.filter(me=>me.skillKeys.includes(Bn(K))).length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},K.key||`${K.source}:${K.name}`)):$?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Ks?n("project:noSkillMatch",{query:Z.trim()}):n("project:noSkills")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):o.jsxs(o.Fragment,{children:[t!=null&&t.isAdmin&&a==="all"&&Fe.length>0?o.jsxs("div",{className:"af-project-admin-panel",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"已隐藏内置"}),o.jsx("span",{children:"这些包内置流水线不会出现在普通项目列表中。"})]}),o.jsx("div",{className:"af-project-admin-hidden-list",children:Fe.map(K=>{const me=Kn===`show-builtin:builtin:${K}`;return o.jsxs("button",{type:"button",disabled:me,onClick:()=>rt({id:K,source:"builtin"},"show-builtin"),children:[o.jsx("span",{children:K}),o.jsx("em",{children:me?"恢复中":"恢复"})]},K)})})]}):null,o.jsxs("div",{className:"af-project-grid",children:[Lr.length>0?Lr.map(K=>{const me=(t==null?void 0:t.isAdmin)&&K.source==="user"&&!K.archived&&!$o.has(K.id),De=(t==null?void 0:t.isAdmin)&&K.source==="admin",Ie=(t==null?void 0:t.isAdmin)&&K.source==="builtin",Ze=Kn.endsWith(`:${K.source}:${K.id}`);return o.jsx("div",{className:"af-project-card",role:"button",tabIndex:0,onClick:()=>js(K),onKeyDown:Yt=>{(Yt.key==="Enter"||Yt.key===" ")&&(Yt.preventDefault(),js(K))},children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:Dd(Zw(K.source,n).tone),children:o.jsx(ar,{query:Z,children:Zw(K.source,n).label})}),K.archived?o.jsx("span",{className:Dd("muted"),children:o.jsx(ar,{query:Z,children:n("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(ar,{query:Z,children:K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(ar,{query:Z,children:pP(K,n)})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),o.jsx("span",{className:"af-path-text",children:o.jsx(ar,{query:Z,children:fP(K)})})]}),t!=null&&t.isAdmin?o.jsxs("div",{className:"af-project-admin-actions",onClick:Yt=>Yt.stopPropagation(),onKeyDown:Yt=>Yt.stopPropagation(),children:[me?o.jsx("button",{type:"button",disabled:Ze,onClick:()=>rt(K,"promote"),children:"设为内置"}):null,De?o.jsx("button",{type:"button",disabled:Ze,onClick:()=>rt(K,"unpromote"),children:"取消内置"}):null,Ie?o.jsx("button",{type:"button",disabled:Ze,onClick:()=>rt(K,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${K.id}:${K.source??"user"}:${K.archived?"a":""}`)}):D?ft.length===0?o.jsxs("div",{className:"af-projects-empty-block",children:[o.jsx("p",{className:"af-projects-empty",children:a==="archived"?n("project:noArchived"):u.length>0?n("project:noActive"):n(H?"project:loadFailed":"project:noPipelines")}),!H&&u.length===0&&a==="all"?o.jsx("p",{className:"af-projects-empty-hint",children:n("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:noMatch",{query:Z.trim()})})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingPipelines")})}),o.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>z(!0),children:[o.jsx("span",{className:"material-symbols-outlined af-project-add-icon",children:"add_circle"}),o.jsx("span",{className:"af-project-add-label",children:n("project:newPipeline")})]}),fn?null:o.jsxs("a",{className:"af-hub-card",href:"https://agentflow-hub.com",target:"_blank",rel:"noopener noreferrer",children:[o.jsx("div",{className:"af-hub-card__glow","aria-hidden":!0}),o.jsxs("span",{className:"af-hub-card__eyebrow",children:[o.jsx("span",{className:"material-symbols-outlined af-hub-card__eyebrow-icon",children:"hub"}),n("project:hubCard.eyebrow")]}),o.jsx("h3",{className:"af-hub-card__title",children:n("project:hubCard.title")}),o.jsx("p",{className:"af-hub-card__desc",children:n("project:hubCard.desc")}),o.jsxs("span",{className:"af-hub-card__cta",children:[n("project:hubCard.cta"),o.jsx("span",{className:"material-symbols-outlined af-hub-card__cta-icon",children:"arrow_outward"})]}),o.jsx("code",{className:"af-hub-card__cli",children:n("project:hubCard.cliHint")})]})]})]})]}),qs?o.jsx("aside",{className:"af-resource-detail","aria-label":n(Mt?"project:nodeDetail":lt?"project:flowDetail":"project:skillDetail"),children:Mt&&ut?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:ut.label||ut.displayName||ut.id}),o.jsx("p",{children:ut.id})]})]}),o.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(K=>o.jsx("button",{type:"button",className:"af-resource-detail-tab"+(ye===K?" af-resource-detail-tab--active":""),onClick:()=>ke(K),children:n(`project:nodeDetailTabs.${K}`)},K))}),ln===Bn(ut)?o.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):ye==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:ut.description||((Ys=tt==null?void 0:tt.node)==null?void 0:Ys.description)||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailType")}),o.jsx("dd",{children:ut.type||((Ri=tt==null?void 0:tt.node)==null?void 0:Ri.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:ES(ut.source,n)})]}),ut.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPackage")}),o.jsx("dd",{children:ut.packageId})]}):null,ut.version?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:ut.version})]}):null,ut.packageDir||tt!=null&&tt.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:ut.packageDir||(tt==null?void 0:tt.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailEditable")}),o.jsx("dd",{children:(tt==null?void 0:tt.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),ur&&ut.source==="marketplace"?o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myNodeManagement")}),o.jsx("p",{children:n("project:deleteMyNodeHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:He===Bn(ut),onClick:()=>Yr(ut),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),He===Bn(ut)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),et?o.jsx("p",{className:"af-resource-action-message",children:et}):null]}):null,o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:nodesMeaning")})]})]}):ye==="schema"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeSchema")}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeInputs")}),Ch(((sr=tt==null?void 0:tt.node)==null?void 0:sr.inputs)||ut.inputs).length>0?Ch(((Gr=tt==null?void 0:tt.node)==null?void 0:Gr.inputs)||ut.inputs).map(K=>o.jsxs("code",{children:[K.name||K.key,K.type?`: ${K.type}`:""]},K.key)):o.jsx("em",{children:n("project:noSlots")})]}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeOutputs")}),Ch(((Or=tt==null?void 0:tt.node)==null?void 0:Or.outputs)||ut.outputs).length>0?Ch(((Ho=tt==null?void 0:tt.node)==null?void 0:Ho.outputs)||ut.outputs).map(K=>o.jsxs("code",{children:[K.name||K.key,K.type?`: ${K.type}`:""]},K.key)):o.jsx("em",{children:n("project:noSlots")})]})]}):ye==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeRuntime")}),tt!=null&&tt.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(tt.runtime,null,2)}):o.jsx("p",{children:n("project:noRuntimeManifest")}),tt!=null&&tt.body?o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"af-resource-detail-subtitle",children:n("project:nodeBody")}),o.jsx("pre",{className:"af-resource-skill-preview",children:tt.body})]}):o.jsx("p",{children:n("project:noNodeBody")})]}):ye==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(tt==null?void 0:tt.files)&&tt.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:tt.files.map(K=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(Bt===K.path?" af-node-file-item--active":""),onClick:()=>en(K.path),children:[o.jsx("span",{className:"material-symbols-outlined",children:"description"}),o.jsx("span",{children:K.path})]},K.path))}),o.jsxs("pre",{className:"af-resource-skill-preview",children:[ue===`${Bn(ut)}:${Bt}`?n("project:loadingResources"):hs!=null&&hs.binary?n("project:binaryFile"):(hs==null?void 0:hs.content)||n("project:selectNodeFile"),hs!=null&&hs.truncated?`
|
|
43
|
+
|
|
44
|
+
${n("project:fileTruncated")}`:""]})]}):o.jsx("p",{children:n("project:noNodeFiles")})]}):o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeUsage")}),Array.isArray(tt==null?void 0:tt.usage)&&tt.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:tt.usage.map(K=>o.jsxs("div",{className:"af-node-usage-item",children:[o.jsx("strong",{children:K.flowId}),o.jsxs("span",{children:[K.flowSource,K.archived?` · ${n("project:archived")}`:""]}),o.jsx("em",{children:K.instances.map(me=>me.label||me.instanceId).join(", ")})]},`${K.flowSource}:${K.flowId}:${K.archived?"a":""}`))}):o.jsx("p",{children:n("project:noNodeUsage")})]})]}):lt&&Jt?(()=>{const K=R$(Jt);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"schema"}),o.jsxs("div",{children:[o.jsx("h3",{children:Jt.displayName||Jt.name||Jt.id}),o.jsx("p",{children:Jt.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Jt.description||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:Jt.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:_S(Jt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:flowSnippetScale")}),o.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(Jt.nodeCount))?Number(Jt.nodeCount):K.nodes.length,edges:Number.isFinite(Number(Jt.edgeCount))?Number(Jt.edgeCount):K.edges.length})})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:myFlowsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myFlowManagement")}),o.jsx("p",{children:n("project:deleteMyFlowHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:st===Fa(Jt),onClick:()=>fs(Jt),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),st===Fa(Jt)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),on?o.jsx("p",{className:"af-resource-action-message",children:on}):null]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:flowSnippetPreview")}),K.diagram.nodes.length>0?o.jsx("div",{className:"af-flow-snippet-map",children:o.jsxs("svg",{viewBox:K.diagram.viewBox,role:"img","aria-label":n("project:flowSnippetPreview"),children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-flow-snippet-arrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:o.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})}),o.jsx("g",{className:"af-flow-snippet-map__edges",children:K.diagram.edges.map(me=>o.jsxs("g",{children:[o.jsx("path",{d:me.path}),me.label?o.jsx("text",{x:me.labelX,y:me.labelY-5,textAnchor:"middle",children:lx(me.label,18)}):null]},me.key))}),o.jsx("g",{className:"af-flow-snippet-map__nodes",children:K.diagram.nodes.map((me,De)=>o.jsxs("g",{transform:`translate(${me.x} ${me.y})`,children:[o.jsx("rect",{width:me.width,height:me.height,rx:"10"}),o.jsx("circle",{cx:"19",cy:me.height/2,r:"12"}),o.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:me.height/2+4,textAnchor:"middle",children:De+1}),o.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:me.height/2-3,children:lx(me.title)}),o.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:me.height/2+16,children:lx(me.meta||me.id,20)})]},me.id))})]})}):o.jsx("p",{className:"af-resource-detail-desc",children:n("project:noFlowSnippetPreview")}),o.jsxs("details",{className:"af-flow-snippet-json",children:[o.jsx("summary",{children:n("project:flowSnippetJson")}),o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Jt.snippet||{},null,2)})]})]})]})})():a==="skills"&&Xt?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:Xt.name||Xt.id}),o.jsx("p",{children:Xt.sourceLabel||Xt.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Xt.description||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:Xt.sourceLabel||Xt.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:Xt.path||Xt.key})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:"Collections"}),k.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:k.map(K=>{const me=Bn(Xt),De=K.skillKeys.includes(me);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:De,disabled:N||!i,onChange:Ie=>Us(K.id,me,Ie.target.checked)}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:K.name}),o.jsxs("span",{className:"af-composer-skill-option-desc",children:[K.skillKeys.length," skills"]})]})]},K.id)})})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:skillsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:skillPreview")}),o.jsx("pre",{className:"af-resource-skill-preview",children:We===Bn(Xt)?n("project:loadingResources"):(Cr==null?void 0:Cr.body)||(Cr==null?void 0:Cr.content)||n("project:skillPreviewEmpty")})]})]}):o.jsx("p",{className:"af-activity-empty",children:n("project:selectResource")})}):o.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(se?"":" af-activity--hidden"),"aria-hidden":!se,"aria-label":n("project:recentActivity"),children:[o.jsxs("h2",{className:"af-activity-title",children:[o.jsx("span",{className:"af-activity-bullet"}),n("project:recentActivity")]}),o.jsx("div",{className:"af-activity-list",children:cr.length===0?o.jsx("p",{className:"af-activity-empty",children:qn.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):cr.map(K=>{const me=he===PS(K);return o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(me?" af-activity-row--active":""),"aria-current":me?"page":void 0,onClick:()=>Fo(K),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(ar,{query:Z,children:K.flowId})}),o.jsx("span",{className:"af-activity-time",children:Gw(K.at,n)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:w$(K.kind),children:K.kind==="executed"?"play_arrow":"visibility"}),o.jsxs("p",{className:"af-activity-text",children:[K.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",Gw(K.at,n)]})]})]},`${K.kind}-${K.flowId}-${K.flowSource}-${K.at}`)})})]})]}),o.jsx(u$,{open:I,onClose:()=>z(!1),onCreated:async K=>{z(!1),await Le();const me=K.source??"user";r(jh({id:K.id,source:me},"workspace"))}}),P?o.jsx(l$,{file:P,onClose:()=>R(null),onImported:async K=>{R(null),await Le();const me=K.source??"user";r(jh({id:K.id,source:me},"workspace"))}},`${P.name}-${P.size}-${P.lastModified}`):null]})}function gr(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=gr(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var L$={value:()=>{}};function Gg(){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 dm(n)}function dm(e){this._=e}function M$(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}})}dm.prototype=Gg.prototype={constructor:dm,on:function(e,t){var n=this._,r=M$(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=O$(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]=TS(n[s],e.name,t);else if(t==null)for(s in n)n[s]=TS(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 dm(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 O$(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function TS(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=L$,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var nb="http://www.w3.org/1999/xhtml";const RS={svg:"http://www.w3.org/2000/svg",xhtml:nb,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xg(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),RS.hasOwnProperty(t)?{space:RS[t],local:e}:e}function $$(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===nb&&t.documentElement.namespaceURI===nb?t.createElement(e):t.createElementNS(n,e)}}function D$(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function yP(e){var t=Xg(e);return(t.local?D$:$$)(t)}function F$(){}function Kv(e){return e==null?F$:function(){return this.querySelector(e)}}function z$(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),u,d,p=0;p<a;++p)(u=i[p])&&(d=e.call(u,u.__data__,p,i))&&("__data__"in u&&(d.__data__=u.__data__),l[p]=d);return new li(r,this._parents)}function H$(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function B$(){return[]}function xP(e){return e==null?B$:function(){return this.querySelectorAll(e)}}function W$(e){return function(){return H$(e.apply(this,arguments))}}function V$(e){typeof e=="function"?e=W$(e):e=xP(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var a=t[i],l=a.length,u,d=0;d<l;++d)(u=a[d])&&(r.push(e.call(u,u.__data__,d,a)),s.push(u));return new li(r,s)}function wP(e){return function(){return this.matches(e)}}function bP(e){return function(t){return t.matches(e)}}var U$=Array.prototype.find;function K$(e){return function(){return U$.call(this.children,e)}}function q$(){return this.firstElementChild}function Y$(e){return this.select(e==null?q$:K$(typeof e=="function"?e:bP(e)))}var G$=Array.prototype.filter;function X$(){return Array.from(this.children)}function J$(e){return function(){return G$.call(this.children,e)}}function Q$(e){return this.selectAll(e==null?X$:J$(typeof e=="function"?e:bP(e)))}function Z$(e){typeof e!="function"&&(e=wP(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]=[],u,d=0;d<a;++d)(u=i[d])&&e.call(u,u.__data__,d,i)&&l.push(u);return new li(r,this._parents)}function vP(e){return new Array(e.length)}function eD(){return new li(this._enter||this._groups.map(vP),this._parents)}function Gm(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Gm.prototype={constructor:Gm,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 tD(e){return function(){return e}}function nD(e,t,n,r,s,i){for(var a=0,l,u=t.length,d=i.length;a<d;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Gm(e,i[a]);for(;a<u;++a)(l=t[a])&&(s[a]=l)}function rD(e,t,n,r,s,i,a){var l,u,d=new Map,p=t.length,c=i.length,f=new Array(p),m;for(l=0;l<p;++l)(u=t[l])&&(f[l]=m=a.call(u,u.__data__,l,t)+"",d.has(m)?s[l]=u:d.set(m,u));for(l=0;l<c;++l)m=a.call(e,i[l],l,i)+"",(u=d.get(m))?(r[l]=u,u.__data__=i[l],d.delete(m)):n[l]=new Gm(e,i[l]);for(l=0;l<p;++l)(u=t[l])&&d.get(f[l])===u&&(s[l]=u)}function sD(e){return e.__data__}function iD(e,t){if(!arguments.length)return Array.from(this,sD);var n=t?rD:nD,r=this._parents,s=this._groups;typeof e!="function"&&(e=tD(e));for(var i=s.length,a=new Array(i),l=new Array(i),u=new Array(i),d=0;d<i;++d){var p=r[d],c=s[d],f=c.length,m=oD(e.call(p,p&&p.__data__,d,r)),y=m.length,v=l[d]=new Array(y),k=a[d]=new Array(y),g=u[d]=new Array(f);n(p,c,v,k,g,m,t);for(var b=0,x=0,N,_;b<y;++b)if(N=v[b]){for(b>=x&&(x=b+1);!(_=k[x])&&++x<y;);N._next=_||null}}return a=new li(a,r),a._enter=l,a._exit=u,a}function oD(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function aD(){return new li(this._exit||this._groups.map(vP),this._parents)}function lD(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 cD(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),u=0;u<a;++u)for(var d=n[u],p=r[u],c=d.length,f=l[u]=new Array(c),m,y=0;y<c;++y)(m=d[y]||p[y])&&(f[y]=m);for(;u<s;++u)l[u]=n[u];return new li(l,this._parents)}function uD(){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 dD(e){e||(e=fD);function t(c,f){return c&&f?e(c.__data__,f.__data__):!c-!f}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,u=s[i]=new Array(l),d,p=0;p<l;++p)(d=a[p])&&(u[p]=d);u.sort(t)}return new li(s,this._parents).order()}function fD(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pD(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hD(){return Array.from(this)}function mD(){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 gD(){let e=0;for(const t of this)++e;return e}function yD(){return!this.node()}function xD(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 wD(e){return function(){this.removeAttribute(e)}}function bD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vD(e,t){return function(){this.setAttribute(e,t)}}function kD(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function SD(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ND(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 jD(e,t){var n=Xg(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?bD:wD:typeof t=="function"?n.local?ND:SD:n.local?kD:vD)(n,t))}function kP(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function CD(e){return function(){this.style.removeProperty(e)}}function ED(e,t,n){return function(){this.style.setProperty(e,t,n)}}function _D(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function PD(e,t,n){return arguments.length>1?this.each((t==null?CD:typeof t=="function"?_D:ED)(e,t,n??"")):Du(this.node(),e)}function Du(e,t){return e.style.getPropertyValue(t)||kP(e).getComputedStyle(e,null).getPropertyValue(t)}function AD(e){return function(){delete this[e]}}function ID(e,t){return function(){this[e]=t}}function TD(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function RD(e,t){return arguments.length>1?this.each((t==null?AD:typeof t=="function"?TD:ID)(e,t)):this.node()[e]}function SP(e){return e.trim().split(/^|\s+/)}function qv(e){return e.classList||new NP(e)}function NP(e){this._node=e,this._names=SP(e.getAttribute("class")||"")}NP.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 jP(e,t){for(var n=qv(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function CP(e,t){for(var n=qv(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function LD(e){return function(){jP(this,e)}}function MD(e){return function(){CP(this,e)}}function OD(e,t){return function(){(t.apply(this,arguments)?jP:CP)(this,e)}}function $D(e,t){var n=SP(e+"");if(arguments.length<2){for(var r=qv(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?OD:t?LD:MD)(n,t))}function DD(){this.textContent=""}function FD(e){return function(){this.textContent=e}}function zD(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function HD(e){return arguments.length?this.each(e==null?DD:(typeof e=="function"?zD:FD)(e)):this.node().textContent}function BD(){this.innerHTML=""}function WD(e){return function(){this.innerHTML=e}}function VD(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function UD(e){return arguments.length?this.each(e==null?BD:(typeof e=="function"?VD:WD)(e)):this.node().innerHTML}function KD(){this.nextSibling&&this.parentNode.appendChild(this)}function qD(){return this.each(KD)}function YD(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function GD(){return this.each(YD)}function XD(e){var t=typeof e=="function"?e:yP(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function JD(){return null}function QD(e,t){var n=typeof e=="function"?e:yP(e),r=t==null?JD:typeof t=="function"?t:Kv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function ZD(){var e=this.parentNode;e&&e.removeChild(this)}function eF(){return this.each(ZD)}function tF(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nF(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rF(e){return this.select(e?nF:tF)}function sF(e){return arguments.length?this.property("__data__",e):this.node().__data__}function iF(e){return function(t){e.call(this,t,this.__data__)}}function oF(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 aF(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 lF(e,t,n){return function(){var r=this.__on,s,i=iF(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 cF(e,t,n){var r=oF(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,d=l.length,p;u<d;++u)for(s=0,p=l[u];s<i;++s)if((a=r[s]).type===p.type&&a.name===p.name)return p.value}return}for(l=t?lF:aF,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function EP(e,t,n){var r=kP(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 uF(e,t){return function(){return EP(this,e,t)}}function dF(e,t){return function(){return EP(this,e,t.apply(this,arguments))}}function fF(e,t){return this.each((typeof t=="function"?dF:uF)(e,t))}function*pF(){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 _P=[null];function li(e,t){this._groups=e,this._parents=t}function yp(){return new li([[document.documentElement]],_P)}function hF(){return this}li.prototype=yp.prototype={constructor:li,select:z$,selectAll:V$,selectChild:Y$,selectChildren:Q$,filter:Z$,data:iD,enter:eD,exit:aD,join:lD,merge:cD,selection:hF,order:uD,sort:dD,call:pD,nodes:hD,node:mD,size:gD,empty:yD,each:xD,attr:jD,style:PD,property:RD,classed:$D,text:HD,html:UD,raise:qD,lower:GD,append:XD,insert:QD,remove:eF,clone:rF,datum:sF,on:cF,dispatch:fF,[Symbol.iterator]:pF};function ni(e){return typeof e=="string"?new li([[document.querySelector(e)]],[document.documentElement]):new li([[e]],_P)}function mF(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ki(e,t){if(e=mF(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 gF={passive:!1},Wf={capture:!0,passive:!1};function cx(e){e.stopImmediatePropagation()}function ju(e){e.preventDefault(),e.stopImmediatePropagation()}function PP(e){var t=e.document.documentElement,n=ni(e).on("dragstart.drag",ju,Wf);"onselectstart"in t?n.on("selectstart.drag",ju,Wf):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function AP(e,t){var n=e.document.documentElement,r=ni(e).on("dragstart.drag",null);t&&(r.on("click.drag",ju,Wf),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 Eh=e=>()=>e;function rb(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:u,dy:d,dispatch:p}){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:u,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:p}})}rb.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yF(e){return!e.ctrlKey&&!e.button}function xF(){return this.parentNode}function wF(e,t){return t??{x:e.x,y:e.y}}function bF(){return navigator.maxTouchPoints||"ontouchstart"in this}function IP(){var e=yF,t=xF,n=wF,r=bF,s={},i=Gg("start","drag","end"),a=0,l,u,d,p,c=0;function f(N){N.on("mousedown.drag",m).filter(r).on("touchstart.drag",k).on("touchmove.drag",g,gF).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(N,_){if(!(p||!e.call(this,N,_))){var C=x(this,t.call(this,N,_),N,_,"mouse");C&&(ni(N.view).on("mousemove.drag",y,Wf).on("mouseup.drag",v,Wf),PP(N.view),cx(N),d=!1,l=N.clientX,u=N.clientY,C("start",N))}}function y(N){if(ju(N),!d){var _=N.clientX-l,C=N.clientY-u;d=_*_+C*C>c}s.mouse("drag",N)}function v(N){ni(N.view).on("mousemove.drag mouseup.drag",null),AP(N.view,d),ju(N),s.mouse("end",N)}function k(N,_){if(e.call(this,N,_)){var C=N.changedTouches,T=t.call(this,N,_),H=C.length,L,F;for(L=0;L<H;++L)(F=x(this,T,N,_,C[L].identifier,C[L]))&&(cx(N),F("start",N,C[L]))}}function g(N){var _=N.changedTouches,C=_.length,T,H;for(T=0;T<C;++T)(H=s[_[T].identifier])&&(ju(N),H("drag",N,_[T]))}function b(N){var _=N.changedTouches,C=_.length,T,H;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),T=0;T<C;++T)(H=s[_[T].identifier])&&(cx(N),H("end",N,_[T]))}function x(N,_,C,T,H,L){var F=i.copy(),O=Ki(L||C,_),D,W,$;if(($=n.call(N,new rb("beforestart",{sourceEvent:C,target:f,identifier:H,active:a,x:O[0],y:O[1],dx:0,dy:0,dispatch:F}),T))!=null)return D=$.x-O[0]||0,W=$.y-O[1]||0,function M(I,z,P){var R=O,E;switch(I){case"start":s[H]=M,E=a++;break;case"end":delete s[H],--a;case"drag":O=Ki(P||z,_),E=a;break}F.call(I,N,new rb(I,{sourceEvent:z,subject:$,target:f,identifier:H,active:E,x:O[0]+D,y:O[1]+W,dx:O[0]-R[0],dy:O[1]-R[1],dispatch:F}),T)}}return f.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Eh(!!N),f):e},f.container=function(N){return arguments.length?(t=typeof N=="function"?N:Eh(N),f):t},f.subject=function(N){return arguments.length?(n=typeof N=="function"?N:Eh(N),f):n},f.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:Eh(!!N),f):r},f.on=function(){var N=i.on.apply(i,arguments);return N===i?f:N},f.clickDistance=function(N){return arguments.length?(c=(N=+N)*N,f):Math.sqrt(c)},f}function Yv(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function TP(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function xp(){}var Vf=.7,Xm=1/Vf,Cu="\\s*([+-]?\\d+)\\s*",Uf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vF=/^#([0-9a-f]{3,8})$/,kF=new RegExp(`^rgb\\(${Cu},${Cu},${Cu}\\)$`),SF=new RegExp(`^rgb\\(${_o},${_o},${_o}\\)$`),NF=new RegExp(`^rgba\\(${Cu},${Cu},${Cu},${Uf}\\)$`),jF=new RegExp(`^rgba\\(${_o},${_o},${_o},${Uf}\\)$`),CF=new RegExp(`^hsl\\(${Uf},${_o},${_o}\\)$`),EF=new RegExp(`^hsla\\(${Uf},${_o},${_o},${Uf}\\)$`),LS={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};Yv(xp,hc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:MS,formatHex:MS,formatHex8:_F,formatHsl:PF,formatRgb:OS,toString:OS});function MS(){return this.rgb().formatHex()}function _F(){return this.rgb().formatHex8()}function PF(){return RP(this).formatHsl()}function OS(){return this.rgb().formatRgb()}function hc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=vF.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?$S(t):n===3?new Ls(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?_h(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?_h(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=kF.exec(e))?new Ls(t[1],t[2],t[3],1):(t=SF.exec(e))?new Ls(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=NF.exec(e))?_h(t[1],t[2],t[3],t[4]):(t=jF.exec(e))?_h(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=CF.exec(e))?zS(t[1],t[2]/100,t[3]/100,1):(t=EF.exec(e))?zS(t[1],t[2]/100,t[3]/100,t[4]):LS.hasOwnProperty(e)?$S(LS[e]):e==="transparent"?new Ls(NaN,NaN,NaN,0):null}function $S(e){return new Ls(e>>16&255,e>>8&255,e&255,1)}function _h(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ls(e,t,n,r)}function AF(e){return e instanceof xp||(e=hc(e)),e?(e=e.rgb(),new Ls(e.r,e.g,e.b,e.opacity)):new Ls}function sb(e,t,n,r){return arguments.length===1?AF(e):new Ls(e,t,n,r??1)}function Ls(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Yv(Ls,sb,TP(xp,{brighter(e){return e=e==null?Xm:Math.pow(Xm,e),new Ls(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Vf:Math.pow(Vf,e),new Ls(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ls(sc(this.r),sc(this.g),sc(this.b),Jm(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:DS,formatHex:DS,formatHex8:IF,formatRgb:FS,toString:FS}));function DS(){return`#${ec(this.r)}${ec(this.g)}${ec(this.b)}`}function IF(){return`#${ec(this.r)}${ec(this.g)}${ec(this.b)}${ec((isNaN(this.opacity)?1:this.opacity)*255)}`}function FS(){const e=Jm(this.opacity);return`${e===1?"rgb(":"rgba("}${sc(this.r)}, ${sc(this.g)}, ${sc(this.b)}${e===1?")":`, ${e})`}`}function Jm(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function sc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ec(e){return e=sc(e),(e<16?"0":"")+e.toString(16)}function zS(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Gi(e,t,n,r)}function RP(e){if(e instanceof Gi)return new Gi(e.h,e.s,e.l,e.opacity);if(e instanceof xp||(e=hc(e)),!e)return new Gi;if(e instanceof Gi)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,u=(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/=u<.5?i+s:2-i-s,a*=60):l=u>0&&u<1?0:a,new Gi(a,l,u,e.opacity)}function TF(e,t,n,r){return arguments.length===1?RP(e):new Gi(e,t,n,r??1)}function Gi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Yv(Gi,TF,TP(xp,{brighter(e){return e=e==null?Xm:Math.pow(Xm,e),new Gi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vf:Math.pow(Vf,e),new Gi(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 Ls(ux(e>=240?e-240:e+120,s,r),ux(e,s,r),ux(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Gi(HS(this.h),Ph(this.s),Ph(this.l),Jm(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=Jm(this.opacity);return`${e===1?"hsl(":"hsla("}${HS(this.h)}, ${Ph(this.s)*100}%, ${Ph(this.l)*100}%${e===1?")":`, ${e})`}`}}));function HS(e){return e=(e||0)%360,e<0?e+360:e}function Ph(e){return Math.max(0,Math.min(1,e||0))}function ux(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 Gv=e=>()=>e;function RF(e,t){return function(n){return e+n*t}}function LF(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 MF(e){return(e=+e)==1?LP:function(t,n){return n-t?LF(t,n,e):Gv(isNaN(t)?n:t)}}function LP(e,t){var n=t-e;return n?RF(e,n):Gv(isNaN(e)?t:e)}const Qm=function e(t){var n=MF(t);function r(s,i){var a=n((s=sb(s)).r,(i=sb(i)).r),l=n(s.g,i.g),u=n(s.b,i.b),d=LP(s.opacity,i.opacity);return function(p){return s.r=a(p),s.g=l(p),s.b=u(p),s.opacity=d(p),s+""}}return r.gamma=e,r}(1);function OF(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 $F(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function DF(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]=gf(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 FF(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function bo(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function zF(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]=gf(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var ib=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,dx=new RegExp(ib.source,"g");function HF(e){return function(){return e}}function BF(e){return function(t){return e(t)+""}}function MP(e,t){var n=ib.lastIndex=dx.lastIndex=0,r,s,i,a=-1,l=[],u=[];for(e=e+"",t=t+"";(r=ib.exec(e))&&(s=dx.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,u.push({i:a,x:bo(r,s)})),n=dx.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?u[0]?BF(u[0].x):HF(t):(t=u.length,function(d){for(var p=0,c;p<t;++p)l[(c=u[p]).i]=c.x(d);return l.join("")})}function gf(e,t){var n=typeof t,r;return t==null||n==="boolean"?Gv(t):(n==="number"?bo:n==="string"?(r=hc(t))?(t=r,Qm):MP:t instanceof hc?Qm:t instanceof Date?FF:$F(t)?OF:Array.isArray(t)?DF:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?zF:bo)(e,t)}var BS=180/Math.PI,ob={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function OP(e,t,n,r,s,i){var a,l,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*r)&&(n-=e*u,r-=t*u),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,u/=l),e*r<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*BS,skewX:Math.atan(u)*BS,scaleX:a,scaleY:l}}var Ah;function WF(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ob:OP(t.a,t.b,t.c,t.d,t.e,t.f)}function VF(e){return e==null||(Ah||(Ah=document.createElementNS("http://www.w3.org/2000/svg","g")),Ah.setAttribute("transform",e),!(e=Ah.transform.baseVal.consolidate()))?ob:(e=e.matrix,OP(e.a,e.b,e.c,e.d,e.e,e.f))}function $P(e,t,n,r){function s(d){return d.length?d.pop()+" ":""}function i(d,p,c,f,m,y){if(d!==c||p!==f){var v=m.push("translate(",null,t,null,n);y.push({i:v-4,x:bo(d,c)},{i:v-2,x:bo(p,f)})}else(c||f)&&m.push("translate("+c+t+f+n)}function a(d,p,c,f){d!==p?(d-p>180?p+=360:p-d>180&&(d+=360),f.push({i:c.push(s(c)+"rotate(",null,r)-2,x:bo(d,p)})):p&&c.push(s(c)+"rotate("+p+r)}function l(d,p,c,f){d!==p?f.push({i:c.push(s(c)+"skewX(",null,r)-2,x:bo(d,p)}):p&&c.push(s(c)+"skewX("+p+r)}function u(d,p,c,f,m,y){if(d!==c||p!==f){var v=m.push(s(m)+"scale(",null,",",null,")");y.push({i:v-4,x:bo(d,c)},{i:v-2,x:bo(p,f)})}else(c!==1||f!==1)&&m.push(s(m)+"scale("+c+","+f+")")}return function(d,p){var c=[],f=[];return d=e(d),p=e(p),i(d.translateX,d.translateY,p.translateX,p.translateY,c,f),a(d.rotate,p.rotate,c,f),l(d.skewX,p.skewX,c,f),u(d.scaleX,d.scaleY,p.scaleX,p.scaleY,c,f),d=p=null,function(m){for(var y=-1,v=f.length,k;++y<v;)c[(k=f[y]).i]=k.x(m);return c.join("")}}}var UF=$P(WF,"px, ","px)","deg)"),KF=$P(VF,", ",")",")"),qF=1e-12;function WS(e){return((e=Math.exp(e))+1/e)/2}function YF(e){return((e=Math.exp(e))-1/e)/2}function GF(e){return((e=Math.exp(2*e))-1)/(e+1)}const fm=function e(t,n,r){function s(i,a){var l=i[0],u=i[1],d=i[2],p=a[0],c=a[1],f=a[2],m=p-l,y=c-u,v=m*m+y*y,k,g;if(v<qF)g=Math.log(f/d)/t,k=function(T){return[l+T*m,u+T*y,d*Math.exp(t*T*g)]};else{var b=Math.sqrt(v),x=(f*f-d*d+r*v)/(2*d*n*b),N=(f*f-d*d-r*v)/(2*f*n*b),_=Math.log(Math.sqrt(x*x+1)-x),C=Math.log(Math.sqrt(N*N+1)-N);g=(C-_)/t,k=function(T){var H=T*g,L=WS(_),F=d/(n*b)*(L*GF(t*H+_)-YF(_));return[l+F*m,u+F*y,d*L/WS(t*H+_)]}}return k.duration=g*1e3*t/Math.SQRT2,k}return s.rho=function(i){var a=Math.max(.001,+i),l=a*a,u=l*l;return e(a,l,u)},s}(Math.SQRT2,2,4);var Fu=0,Qd=0,Fd=0,DP=1e3,Zm,Zd,eg=0,mc=0,Jg=0,Kf=typeof performance=="object"&&performance.now?performance:Date,FP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xv(){return mc||(FP(XF),mc=Kf.now()+Jg)}function XF(){mc=0}function tg(){this._call=this._time=this._next=null}tg.prototype=zP.prototype={constructor:tg,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xv():+n)+(t==null?0:+t),!this._next&&Zd!==this&&(Zd?Zd._next=this:Zm=this,Zd=this),this._call=e,this._time=n,ab()},stop:function(){this._call&&(this._call=null,this._time=1/0,ab())}};function zP(e,t,n){var r=new tg;return r.restart(e,t,n),r}function JF(){Xv(),++Fu;for(var e=Zm,t;e;)(t=mc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fu}function VS(){mc=(eg=Kf.now())+Jg,Fu=Qd=0;try{JF()}finally{Fu=0,ZF(),mc=0}}function QF(){var e=Kf.now(),t=e-eg;t>DP&&(Jg-=t,eg=e)}function ZF(){for(var e,t=Zm,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:Zm=n);Zd=e,ab(r)}function ab(e){if(!Fu){Qd&&(Qd=clearTimeout(Qd));var t=e-mc;t>24?(e<1/0&&(Qd=setTimeout(VS,e-Kf.now()-Jg)),Fd&&(Fd=clearInterval(Fd))):(Fd||(eg=Kf.now(),Fd=setInterval(QF,DP)),Fu=1,FP(VS))}}function US(e,t,n){var r=new tg;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var ez=Gg("start","end","cancel","interrupt"),tz=[],HP=0,KS=1,lb=2,pm=3,qS=4,cb=5,hm=6;function Qg(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;nz(e,n,{name:t,index:r,group:s,on:ez,tween:tz,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:HP})}function Jv(e,t){var n=ro(e,t);if(n.state>HP)throw new Error("too late; already scheduled");return n}function Mo(e,t){var n=ro(e,t);if(n.state>pm)throw new Error("too late; already running");return n}function ro(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function nz(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=zP(i,0,n.time);function i(d){n.state=KS,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var p,c,f,m;if(n.state!==KS)return u();for(p in r)if(m=r[p],m.name===n.name){if(m.state===pm)return US(a);m.state===qS?(m.state=hm,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[p]):+p<t&&(m.state=hm,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete r[p])}if(US(function(){n.state===pm&&(n.state=qS,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=lb,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lb){for(n.state=pm,s=new Array(f=n.tween.length),p=0,c=-1;p<f;++p)(m=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(s[++c]=m);s.length=c+1}}function l(d){for(var p=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(u),n.state=cb,1),c=-1,f=s.length;++c<f;)s[c].call(e,p);n.state===cb&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=hm,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function mm(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>lb&&r.state<cb,r.state=hm,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function rz(e){return this.each(function(){mm(this,e)})}function sz(e,t){var n,r;return function(){var s=Mo(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 iz(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Mo(this,e),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:t,value:n},u=0,d=s.length;u<d;++u)if(s[u].name===t){s[u]=l;break}u===d&&s.push(l)}i.tween=s}}function oz(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ro(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?sz:iz)(n,e,t))}function Qv(e,t,n){var r=e._id;return e.each(function(){var s=Mo(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return ro(s,r).value[t]}}function BP(e,t){var n;return(typeof t=="number"?bo:t instanceof hc?Qm:(n=hc(t))?(t=n,Qm):MP)(e,t)}function az(e){return function(){this.removeAttribute(e)}}function lz(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cz(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 uz(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 dz(e,t,n){var r,s,i;return function(){var a,l=n(this),u;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=l+"",a===u?null:a===r&&u===s?i:(s=u,i=t(r=a,l)))}}function fz(e,t,n){var r,s,i;return function(){var a,l=n(this),u;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=l+"",a===u?null:a===r&&u===s?i:(s=u,i=t(r=a,l)))}}function pz(e,t){var n=Xg(e),r=n==="transform"?KF:BP;return this.attrTween(e,typeof t=="function"?(n.local?fz:dz)(n,r,Qv(this,"attr."+e,t)):t==null?(n.local?lz:az)(n):(n.local?uz:cz)(n,r,t))}function hz(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function mz(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function gz(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&mz(e,i)),n}return s._value=t,s}function yz(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&hz(e,i)),n}return s._value=t,s}function xz(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=Xg(e);return this.tween(n,(r.local?gz:yz)(r,t))}function wz(e,t){return function(){Jv(this,e).delay=+t.apply(this,arguments)}}function bz(e,t){return t=+t,function(){Jv(this,e).delay=t}}function vz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wz:bz)(t,e)):ro(this.node(),t).delay}function kz(e,t){return function(){Mo(this,e).duration=+t.apply(this,arguments)}}function Sz(e,t){return t=+t,function(){Mo(this,e).duration=t}}function Nz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kz:Sz)(t,e)):ro(this.node(),t).duration}function jz(e,t){if(typeof t!="function")throw new Error;return function(){Mo(this,e).ease=t}}function Cz(e){var t=this._id;return arguments.length?this.each(jz(t,e)):ro(this.node(),t).ease}function Ez(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Mo(this,e).ease=n}}function _z(e){if(typeof e!="function")throw new Error;return this.each(Ez(this._id,e))}function Pz(e){typeof e!="function"&&(e=wP(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]=[],u,d=0;d<a;++d)(u=i[d])&&e.call(u,u.__data__,d,i)&&l.push(u);return new xa(r,this._parents,this._name,this._id)}function Az(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 u=t[l],d=n[l],p=u.length,c=a[l]=new Array(p),f,m=0;m<p;++m)(f=u[m]||d[m])&&(c[m]=f);for(;l<r;++l)a[l]=t[l];return new xa(a,this._parents,this._name,this._id)}function Iz(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 Tz(e,t,n){var r,s,i=Iz(t)?Jv:Mo;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function Rz(e,t){var n=this._id;return arguments.length<2?ro(this.node(),n).on.on(e):this.each(Tz(n,e,t))}function Lz(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Mz(){return this.on("end.remove",Lz(this._id))}function Oz(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],u=l.length,d=i[a]=new Array(u),p,c,f=0;f<u;++f)(p=l[f])&&(c=e.call(p,p.__data__,f,l))&&("__data__"in p&&(c.__data__=p.__data__),d[f]=c,Qg(d[f],t,n,f,d,ro(p,n)));return new xa(i,this._parents,t,n)}function $z(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xP(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var u=r[l],d=u.length,p,c=0;c<d;++c)if(p=u[c]){for(var f=e.call(p,p.__data__,c,u),m,y=ro(p,n),v=0,k=f.length;v<k;++v)(m=f[v])&&Qg(m,t,n,v,f,y);i.push(f),a.push(p)}return new xa(i,a,t,n)}var Dz=yp.prototype.constructor;function Fz(){return new Dz(this._groups,this._parents)}function zz(e,t){var n,r,s;return function(){var i=Du(this,e),a=(this.style.removeProperty(e),Du(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function WP(e){return function(){this.style.removeProperty(e)}}function Hz(e,t,n){var r,s=n+"",i;return function(){var a=Du(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function Bz(e,t,n){var r,s,i;return function(){var a=Du(this,e),l=n(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(e),Du(this,e))),a===u?null:a===r&&u===s?i:(s=u,i=t(r=a,l))}}function Wz(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var u=Mo(this,e),d=u.on,p=u.value[i]==null?l||(l=WP(t)):void 0;(d!==n||s!==p)&&(r=(n=d).copy()).on(a,s=p),u.on=r}}function Vz(e,t,n){var r=(e+="")=="transform"?UF:BP;return t==null?this.styleTween(e,zz(e,r)).on("end.style."+e,WP(e)):typeof t=="function"?this.styleTween(e,Bz(e,r,Qv(this,"style."+e,t))).each(Wz(this._id,e)):this.styleTween(e,Hz(e,r,t),n).on("end.style."+e,null)}function Uz(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Kz(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&Uz(e,a,n)),r}return i._value=t,i}function qz(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,Kz(e,t,n??""))}function Yz(e){return function(){this.textContent=e}}function Gz(e){return function(){var t=e(this);this.textContent=t??""}}function Xz(e){return this.tween("text",typeof e=="function"?Gz(Qv(this,"text",e)):Yz(e==null?"":e+""))}function Jz(e){return function(t){this.textContent=e.call(this,t)}}function Qz(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&Jz(s)),t}return r._value=e,r}function Zz(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,Qz(e))}function e3(){for(var e=this._name,t=this._id,n=VP(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,u,d=0;d<l;++d)if(u=a[d]){var p=ro(u,t);Qg(u,e,n,d,a,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new xa(r,this._parents,e,n)}function t3(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,a){var l={value:a},u={value:function(){--s===0&&i()}};n.each(function(){var d=Mo(this,r),p=d.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(u)),d.on=t}),s===0&&i()})}var n3=0;function xa(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function VP(){return++n3}var ta=yp.prototype;xa.prototype={constructor:xa,select:Oz,selectAll:$z,selectChild:ta.selectChild,selectChildren:ta.selectChildren,filter:Pz,merge:Az,selection:Fz,transition:e3,call:ta.call,nodes:ta.nodes,node:ta.node,size:ta.size,empty:ta.empty,each:ta.each,on:Rz,attr:pz,attrTween:xz,style:Vz,styleTween:qz,text:Xz,textTween:Zz,remove:Mz,tween:oz,delay:vz,duration:Nz,ease:Cz,easeVarying:_z,end:t3,[Symbol.iterator]:ta[Symbol.iterator]};function r3(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var s3={time:null,delay:0,duration:250,ease:r3};function i3(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 o3(e){var t,n;e instanceof xa?(t=e._id,e=e._name):(t=VP(),(n=s3).time=Xv(),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,u,d=0;d<l;++d)(u=a[d])&&Qg(u,e,t,d,a,n||i3(u,t));return new xa(r,this._parents,e,t)}yp.prototype.interrupt=rz;yp.prototype.transition=o3;const Ih=e=>()=>e;function a3(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 ca(e,t,n){this.k=e,this.x=t,this.y=n}ca.prototype={constructor:ca,scale:function(e){return e===1?this:new ca(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ca(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 Zg=new ca(1,0,0);UP.prototype=ca.prototype;function UP(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Zg;return e.__zoom}function fx(e){e.stopImmediatePropagation()}function zd(e){e.preventDefault(),e.stopImmediatePropagation()}function l3(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function c3(){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 YS(){return this.__zoom||Zg}function u3(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function d3(){return navigator.maxTouchPoints||"ontouchstart"in this}function f3(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 KP(){var e=l3,t=c3,n=f3,r=u3,s=d3,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,u=fm,d=Gg("start","zoom","end"),p,c,f,m=500,y=150,v=0,k=10;function g($){$.property("__zoom",YS).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",F).filter(s).on("touchstart.zoom",O).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function($,M,I,z){var P=$.selection?$.selection():$;P.property("__zoom",YS),$!==P?_($,M,I,z):P.interrupt().each(function(){C(this,arguments).event(z).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},g.scaleBy=function($,M,I,z){g.scaleTo($,function(){var P=this.__zoom.k,R=typeof M=="function"?M.apply(this,arguments):M;return P*R},I,z)},g.scaleTo=function($,M,I,z){g.transform($,function(){var P=t.apply(this,arguments),R=this.__zoom,E=I==null?N(P):typeof I=="function"?I.apply(this,arguments):I,J=R.invert(E),Z=typeof M=="function"?M.apply(this,arguments):M;return n(x(b(R,Z),E,J),P,a)},I,z)},g.translateBy=function($,M,I,z){g.transform($,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),a)},null,z)},g.translateTo=function($,M,I,z,P){g.transform($,function(){var R=t.apply(this,arguments),E=this.__zoom,J=z==null?N(R):typeof z=="function"?z.apply(this,arguments):z;return n(Zg.translate(J[0],J[1]).scale(E.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof I=="function"?-I.apply(this,arguments):-I),R,a)},z,P)};function b($,M){return M=Math.max(i[0],Math.min(i[1],M)),M===$.k?$:new ca(M,$.x,$.y)}function x($,M,I){var z=M[0]-I[0]*$.k,P=M[1]-I[1]*$.k;return z===$.x&&P===$.y?$:new ca($.k,z,P)}function N($){return[(+$[0][0]+ +$[1][0])/2,(+$[0][1]+ +$[1][1])/2]}function _($,M,I,z){$.on("start.zoom",function(){C(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(z).end()}).tween("zoom",function(){var P=this,R=arguments,E=C(P,R).event(z),J=t.apply(P,R),Z=I==null?N(J):typeof I=="function"?I.apply(P,R):I,U=Math.max(J[1][0]-J[0][0],J[1][1]-J[0][1]),se=P.__zoom,pe=typeof M=="function"?M.apply(P,R):M,he=u(se.invert(Z).concat(U/se.k),pe.invert(Z).concat(U/pe.k));return function(xe){if(xe===1)xe=pe;else{var le=he(xe),Se=U/le[2];xe=new ca(Se,Z[0]-le[0]*Se,Z[1]-le[1]*Se)}E.zoom(null,xe)}})}function C($,M,I){return!I&&$.__zooming||new T($,M)}function T($,M){this.that=$,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply($,M),this.taps=0}T.prototype={event:function($){return $&&(this.sourceEvent=$),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function($,M){return this.mouse&&$!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&$!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&$!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function($){var M=ni(this.that).datum();d.call($,this.that,new a3($,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),M)}};function H($,...M){if(!e.apply(this,arguments))return;var I=C(this,M).event($),z=this.__zoom,P=Math.max(i[0],Math.min(i[1],z.k*Math.pow(2,r.apply(this,arguments)))),R=Ki($);if(I.wheel)(I.mouse[0][0]!==R[0]||I.mouse[0][1]!==R[1])&&(I.mouse[1]=z.invert(I.mouse[0]=R)),clearTimeout(I.wheel);else{if(z.k===P)return;I.mouse=[R,z.invert(R)],mm(this),I.start()}zd($),I.wheel=setTimeout(E,y),I.zoom("mouse",n(x(b(z,P),I.mouse[0],I.mouse[1]),I.extent,a));function E(){I.wheel=null,I.end()}}function L($,...M){if(f||!e.apply(this,arguments))return;var I=$.currentTarget,z=C(this,M,!0).event($),P=ni($.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",U,!0),R=Ki($,I),E=$.clientX,J=$.clientY;PP($.view),fx($),z.mouse=[R,this.__zoom.invert(R)],mm(this),z.start();function Z(se){if(zd(se),!z.moved){var pe=se.clientX-E,he=se.clientY-J;z.moved=pe*pe+he*he>v}z.event(se).zoom("mouse",n(x(z.that.__zoom,z.mouse[0]=Ki(se,I),z.mouse[1]),z.extent,a))}function U(se){P.on("mousemove.zoom mouseup.zoom",null),AP(se.view,z.moved),zd(se),z.event(se).end()}}function F($,...M){if(e.apply(this,arguments)){var I=this.__zoom,z=Ki($.changedTouches?$.changedTouches[0]:$,this),P=I.invert(z),R=I.k*($.shiftKey?.5:2),E=n(x(b(I,R),z,P),t.apply(this,M),a);zd($),l>0?ni(this).transition().duration(l).call(_,E,z,$):ni(this).call(g.transform,E,z,$)}}function O($,...M){if(e.apply(this,arguments)){var I=$.touches,z=I.length,P=C(this,M,$.changedTouches.length===z).event($),R,E,J,Z;for(fx($),E=0;E<z;++E)J=I[E],Z=Ki(J,this),Z=[Z,this.__zoom.invert(Z),J.identifier],P.touch0?!P.touch1&&P.touch0[2]!==Z[2]&&(P.touch1=Z,P.taps=0):(P.touch0=Z,R=!0,P.taps=1+!!p);p&&(p=clearTimeout(p)),R&&(P.taps<2&&(c=Z[0],p=setTimeout(function(){p=null},m)),mm(this),P.start())}}function D($,...M){if(this.__zooming){var I=C(this,M).event($),z=$.changedTouches,P=z.length,R,E,J,Z;for(zd($),R=0;R<P;++R)E=z[R],J=Ki(E,this),I.touch0&&I.touch0[2]===E.identifier?I.touch0[0]=J:I.touch1&&I.touch1[2]===E.identifier&&(I.touch1[0]=J);if(E=I.that.__zoom,I.touch1){var U=I.touch0[0],se=I.touch0[1],pe=I.touch1[0],he=I.touch1[1],xe=(xe=pe[0]-U[0])*xe+(xe=pe[1]-U[1])*xe,le=(le=he[0]-se[0])*le+(le=he[1]-se[1])*le;E=b(E,Math.sqrt(xe/le)),J=[(U[0]+pe[0])/2,(U[1]+pe[1])/2],Z=[(se[0]+he[0])/2,(se[1]+he[1])/2]}else if(I.touch0)J=I.touch0[0],Z=I.touch0[1];else return;I.zoom("touch",n(x(E,J,Z),I.extent,a))}}function W($,...M){if(this.__zooming){var I=C(this,M).event($),z=$.changedTouches,P=z.length,R,E;for(fx($),f&&clearTimeout(f),f=setTimeout(function(){f=null},m),R=0;R<P;++R)E=z[R],I.touch0&&I.touch0[2]===E.identifier?delete I.touch0:I.touch1&&I.touch1[2]===E.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(E=Ki(E,this),Math.hypot(c[0]-E[0],c[1]-E[1])<k)){var J=ni(this).on("dblclick.zoom");J&&J.apply(this,arguments)}}}return g.wheelDelta=function($){return arguments.length?(r=typeof $=="function"?$:Ih(+$),g):r},g.filter=function($){return arguments.length?(e=typeof $=="function"?$:Ih(!!$),g):e},g.touchable=function($){return arguments.length?(s=typeof $=="function"?$:Ih(!!$),g):s},g.extent=function($){return arguments.length?(t=typeof $=="function"?$:Ih([[+$[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?(u=$,g):u},g.on=function(){var $=d.on.apply(d,arguments);return $===d?g:$},g.clickDistance=function($){return arguments.length?(v=($=+$)*$,g):Math.sqrt(v)},g.tapDistance=function($){return arguments.length?(k=+$,g):k},g}const To={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."},qf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],qP=["Enter"," ","Escape"],YP={"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 zu;(function(e){e.Strict="strict",e.Loose="loose"})(zu||(zu={}));var ic;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ic||(ic={}));var Yf;(function(e){e.Partial="partial",e.Full="full"})(Yf||(Yf={}));const GP={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ya;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ya||(Ya={}));var Hs;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Hs||(Hs={}));var Xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Xe||(Xe={}));const GS={[Xe.Left]:Xe.Right,[Xe.Right]:Xe.Left,[Xe.Top]:Xe.Bottom,[Xe.Bottom]:Xe.Top};function XP(e){return e===null?null:e?"valid":"invalid"}const JP=e=>"id"in e&&"source"in e&&"target"in e,p3=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Zv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),wp=(e,t=[0,0])=>{const{width:n,height:r}=ka(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},h3=(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):Zv(s)?s:t.nodeLookup.get(s.id));const l=a?ng(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ey(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ty(n)},bp=(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=ey(n,ng(s)),r=!0)}),r?ty(n):{x:0,y:0,width:0,height:0}},e0=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...kp(t,[n,r,s]),width:t.width/s,height:t.height/s},u=[];for(const d of e.values()){const{measured:p,selectable:c=!0,hidden:f=!1}=d;if(a&&!c||f)continue;const m=p.width??d.width??d.initialWidth??null,y=p.height??d.height??d.initialHeight??null,v=Gf(l,Bu(d)),k=(m??0)*(y??0),g=i&&v>0;(!d.internals.handleBounds||g||v>=k||d.dragging)&&u.push(d)}return u},m3=(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 g3(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 y3({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=g3(e,a),u=bp(l),d=t0(u,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 QP({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:u,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},p=a.origin??r;let c=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",To.error005());else{const m=l.measured.width,y=l.measured.height;m&&y&&(c=[[u,d],[u+m,d+y]])}else l&&Wu(a.extent)&&(c=[[a.extent[0][0]+u,a.extent[0][1]+d],[a.extent[1][0]+u,a.extent[1][1]+d]]);const f=Wu(c)?gc(t,c,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",To.error015())),{position:{x:f.x-u+(a.measured.width??0)*p[0],y:f.y-d+(a.measured.height??0)*p[1]},positionAbsolute:f}}async function x3({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(f=>f.id)),a=[];for(const f of n){if(f.deletable===!1)continue;const m=i.has(f.id),y=!m&&f.parentId&&a.find(v=>v.id===f.parentId);(m||y)&&a.push(f)}const l=new Set(t.map(f=>f.id)),u=r.filter(f=>f.deletable!==!1),p=m3(a,u);for(const f of u)l.has(f.id)&&!p.find(y=>y.id===f.id)&&p.push(f);if(!s)return{edges:p,nodes:a};const c=await s({nodes:a,edges:p});return typeof c=="boolean"?c?{edges:p,nodes:a}:{edges:[],nodes:[]}:c}const Hu=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),gc=(e={x:0,y:0},t,n)=>({x:Hu(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Hu(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ZP(e,t,n){const{width:r,height:s}=ka(n),{x:i,y:a}=n.internals.positionAbsolute;return gc(e,[[i,a],[i+r,a+s]],t)}const XS=(e,t,n)=>e<t?Hu(Math.abs(e-t),1,t)/t:e>n?-Hu(Math.abs(e-n),1,t)/t:0,eA=(e,t,n=15,r=40)=>{const s=XS(e.x,r,t.width-r)*n,i=XS(e.y,r,t.height-r)*n;return[s,i]},ey=(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)}),ub=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),ty=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Bu=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Zv(e)?e.internals.positionAbsolute:wp(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}},ng=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Zv(e)?e.internals.positionAbsolute:wp(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)}},tA=(e,t)=>ty(ey(ub(e),ub(t))),Gf=(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)},JS=e=>Xi(e.width)&&Xi(e.height)&&Xi(e.x)&&Xi(e.y),Xi=e=>!isNaN(e)&&isFinite(e),w3=(e,t)=>{},vp=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),kp=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?vp(l,a):l},rg=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Kc(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 b3(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Kc(e,n),s=Kc(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Kc(e.top??e.y??0,n),s=Kc(e.bottom??e.y??0,n),i=Kc(e.left??e.x??0,t),a=Kc(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 v3(e,t,n,r,s,i){const{x:a,y:l}=rg(e,[t,n,r]),{x:u,y:d}=rg({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=s-u,c=i-d;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(c)}}const t0=(e,t,n,r,s,i)=>{const a=b3(i,t,n),l=(t-a.x)/e.width,u=(n-a.y)/e.height,d=Math.min(l,u),p=Hu(d,r,s),c=e.x+e.width/2,f=e.y+e.height/2,m=t/2-c*p,y=n/2-f*p,v=v3(e,m,y,p,t,n),k={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:m-k.left+k.right,y:y-k.top+k.bottom,zoom:p}},Xf=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Wu(e){return e!=null&&e!=="parent"}function ka(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 nA(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 rA(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 QS(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function k3(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function S3(e){return{...YP,...e||{}}}function yf(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=Ji(e),l=kp({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:u,y:d}=n?vp(l,t):l;return{xSnapped:u,ySnapped:d,...l}}const n0=e=>({width:e.offsetWidth,height:e.offsetHeight}),sA=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},N3=["INPUT","SELECT","TEXTAREA"];function iA(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:N3.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const oA=e=>"clientX"in e,Ji=(e,t)=>{var i,a;const n=oA(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)}},ZS=(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,...n0(a)}})};function aA({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:l}){const u=e*.125+s*.375+a*.375+n*.125,d=t*.125+i*.375+l*.375+r*.125,p=Math.abs(u-e),c=Math.abs(d-t);return[u,d,p,c]}function Th(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function eN({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Xe.Left:return[t-Th(t-r,i),n];case Xe.Right:return[t+Th(r-t,i),n];case Xe.Top:return[t,n-Th(n-s,i)];case Xe.Bottom:return[t,n+Th(s-n,i)]}}function lA({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:r,targetY:s,targetPosition:i=Xe.Top,curvature:a=.25}){const[l,u]=eN({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[d,p]=eN({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[c,f,m,y]=aA({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:p});return[`M${e},${t} C${l},${u} ${d},${p} ${r},${s}`,c,f,m,y]}function cA({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 j3({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 C3({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=ey(ng(e),ng(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 Gf(a,ty(i))>0}const E3=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,_3=(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)),Jf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||E3;let s;return JP(e)?s={...e}:s={...e,id:r(e)},_3(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function uA({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=cA({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const tN={[Xe.Left]:{x:-1,y:0},[Xe.Right]:{x:1,y:0},[Xe.Top]:{x:0,y:-1},[Xe.Bottom]:{x:0,y:1}},P3=({source:e,sourcePosition:t=Xe.Bottom,target:n})=>t===Xe.Left||t===Xe.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},nN=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function A3({source:e,sourcePosition:t=Xe.Bottom,target:n,targetPosition:r=Xe.Top,center:s,offset:i,stepPosition:a}){const l=tN[t],u=tN[r],d={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+u.x*i,y:n.y+u.y*i},c=P3({source:d,sourcePosition:t,target:p}),f=c.x!==0?"x":"y",m=c[f];let y=[],v,k;const g={x:0,y:0},b={x:0,y:0},[,,x,N]=cA({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*u[f]===-1){f==="x"?(v=s.x??d.x+(p.x-d.x)*a,k=s.y??(d.y+p.y)/2):(v=s.x??(d.x+p.x)/2,k=s.y??d.y+(p.y-d.y)*a);const H=[{x:v,y:d.y},{x:v,y:p.y}],L=[{x:d.x,y:k},{x:p.x,y:k}];l[f]===m?y=f==="x"?H:L:y=f==="x"?L:H}else{const H=[{x:d.x,y:p.y}],L=[{x:p.x,y:d.y}];if(f==="x"?y=l.x===m?L:H:y=l.y===m?H:L,t===r){const $=Math.abs(e[f]-n[f]);if($<=i){const M=Math.min(i-1,i-$);l[f]===m?g[f]=(d[f]>e[f]?-1:1)*M:b[f]=(p[f]>n[f]?-1:1)*M}}if(t!==r){const $=f==="x"?"y":"x",M=l[f]===u[$],I=d[$]>p[$],z=d[$]<p[$];(l[f]===1&&(!M&&I||M&&z)||l[f]!==1&&(!M&&z||M&&I))&&(y=f==="x"?H:L)}const F={x:d.x+g.x,y:d.y+g.y},O={x:p.x+b.x,y:p.y+b.y},D=Math.max(Math.abs(F.x-y[0].x),Math.abs(O.x-y[0].x)),W=Math.max(Math.abs(F.y-y[0].y),Math.abs(O.y-y[0].y));D>=W?(v=(F.x+O.x)/2,k=y[0].y):(v=y[0].x,k=(F.y+O.y)/2)}const _={x:d.x+g.x,y:d.y+g.y},C={x:p.x+b.x,y:p.y+b.y};return[[e,..._.x!==y[0].x||_.y!==y[0].y?[_]:[],...y,...C.x!==y[y.length-1].x||C.y!==y[y.length-1].y?[C]:[],n],v,k,x,N]}function I3(e,t,n,r){const s=Math.min(nN(e,t)/2,nN(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,p=e.y<n.y?1:-1;return`L ${i+s*d},${a}Q ${i},${a} ${i},${a+s*p}`}const l=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${i},${a+s*u}Q ${i},${a} ${i+s*l},${a}`}function db({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:r,targetY:s,targetPosition:i=Xe.Top,borderRadius:a=5,centerX:l,centerY:u,offset:d=20,stepPosition:p=.5}){const[c,f,m,y,v]=A3({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:u},offset:d,stepPosition:p});let k=`M${c[0].x} ${c[0].y}`;for(let g=1;g<c.length-1;g++)k+=I3(c[g-1],c[g],c[g+1],a);return k+=`L${c[c.length-1].x} ${c[c.length-1].y}`,[k,f,m,y,v]}function rN(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function T3(e){var c;const{sourceNode:t,targetNode:n}=e;if(!rN(t)||!rN(n))return null;const r=t.internals.handleBounds||sN(t.handles),s=n.internals.handleBounds||sN(n.handles),i=iN((r==null?void 0:r.source)??[],e.sourceHandle),a=iN(e.connectionMode===zu.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(c=e.onError)==null||c.call(e,"008",To.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Xe.Bottom,u=(a==null?void 0:a.position)||Xe.Top,d=yc(t,i,l),p=yc(n,a,u);return{sourceX:d.x,sourceY:d.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:u}}function sN(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 yc(e,t,n=Xe.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??ka(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Xe.Top:return{x:s+a/2,y:i};case Xe.Right:return{x:s+a,y:i+l/2};case Xe.Bottom:return{x:s+a/2,y:i+l};case Xe.Left:return{x:s,y:i+l/2}}}function iN(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function fb(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function R3(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(u=>{if(u&&typeof u=="object"){const d=fb(u,t);i.has(d)||(a.push({id:d,color:u.color||n,...u}),i.add(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const dA=1e3,L3=10,r0={nodeOrigin:[0,0],nodeExtent:qf,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},M3={...r0,checkEquality:!0};function s0(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function O3(e,t,n){const r=s0(r0,n);for(const s of e.values())if(s.parentId)o0(s,e,t,r);else{const i=wp(s,r.nodeOrigin),a=Wu(s.extent)?s.extent:r.nodeExtent,l=gc(i,a,ka(s));s.internals.positionAbsolute=l}}function $3(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 i0(e){return e==="manual"}function pb(e,t,n,r={}){var p,c;const s=s0(M3,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!i0(s.zIndexMode)?dA:0;let u=e.length>0,d=!1;t.clear(),n.clear();for(const f of e){let m=a.get(f.id);if(s.checkEquality&&f===(m==null?void 0:m.internals.userNode))t.set(f.id,m);else{const y=wp(f,s.nodeOrigin),v=Wu(f.extent)?f.extent:s.nodeExtent,k=gc(y,v,ka(f));m={...s.defaults,...f,measured:{width:(p=f.measured)==null?void 0:p.width,height:(c=f.measured)==null?void 0:c.height},internals:{positionAbsolute:k,handleBounds:$3(f,m),z:fA(f,l,s.zIndexMode),userNode:f}},t.set(f.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(u=!1),f.parentId&&o0(m,t,n,r,i),d||(d=f.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:d}}function D3(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function o0(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:u}=s0(r0,r),d=e.parentId,p=t.get(d);if(!p){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}D3(e,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&u==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*L3),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const c=i&&!i0(u)?dA:0,{x:f,y:m,z:y}=F3(e,p,a,l,c,u),{positionAbsolute:v}=e.internals,k=f!==v.x||m!==v.y;(k||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:f,y:m}:v,z:y}})}function fA(e,t,n){const r=Xi(e.zIndex)?e.zIndex:0;return i0(n)?r:r+(e.selected?t:0)}function F3(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,u=ka(e),d=wp(e,n),p=Wu(e.extent)?gc(d,e.extent,u):d;let c=gc({x:a+p.x,y:l+p.y},r,u);e.extent==="parent"&&(c=ZP(c,u,t));const f=fA(e,s,i),m=t.internals.z??0;return{x:c.x,y:c.y,z:m>=f?m+1:f}}function a0(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const l of e){const u=t.get(l.parentId);if(!u)continue;const d=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??Bu(u),p=tA(d,l.rect);i.set(l.parentId,{expandedRect:p,parent:u})}return i.size>0&&i.forEach(({expandedRect:l,parent:u},d)=>{var x;const p=u.internals.positionAbsolute,c=ka(u),f=u.origin??r,m=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,y=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,v=Math.max(c.width,Math.round(l.width)),k=Math.max(c.height,Math.round(l.height)),g=(v-c.width)*f[0],b=(k-c.height)*f[1];(m>0||y>0||g||b)&&(s.push({id:d,type:"position",position:{x:u.position.x-m+g,y:u.position.y-y+b}}),(x=n.get(d))==null||x.forEach(N=>{e.some(_=>_.id===N.id)||s.push({id:N.id,type:"position",position:{x:N.position.x+m,y:N.position.y+y}})})),(c.width<l.width||c.height<l.height||m||y)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:v+(m?f[0]*m-g:0),height:k+(y?f[1]*y-b:0)}})}),s}function z3(e,t,n,r,s,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let u=!1;if(!l)return{changes:[],updatedInternals:u};const d=[],p=window.getComputedStyle(l),{m22:c}=new window.DOMMatrixReadOnly(p.transform),f=[];for(const m of e.values()){const y=t.get(m.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),u=!0;continue}const v=n0(m.nodeElement),k=y.measured.width!==v.width||y.measured.height!==v.height;if(!!(v.width&&v.height&&(k||!y.internals.handleBounds||m.force))){const b=m.nodeElement.getBoundingClientRect(),x=Wu(y.extent)?y.extent:i;let{positionAbsolute:N}=y.internals;y.parentId&&y.extent==="parent"?N=ZP(N,v,t.get(y.parentId)):x&&(N=gc(N,x,v));const _={...y,measured:v,internals:{...y.internals,positionAbsolute:N,handleBounds:{source:ZS("source",m.nodeElement,b,c,y.id),target:ZS("target",m.nodeElement,b,c,y.id)}}};t.set(y.id,_),y.parentId&&o0(_,t,n,{nodeOrigin:s,zIndexMode:a}),u=!0,k&&(d.push({id:y.id,type:"dimensions",dimensions:v}),y.expandParent&&y.parentId&&f.push({id:y.id,parentId:y.parentId,rect:Bu(_,s)}))}}if(f.length>0){const m=a0(f,t,n,s);d.push(...m)}return{changes:d,updatedInternals:u}}async function H3({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r),l=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(l)}function oN(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 u=r.get(a)||new Map;if(r.set(a,u.set(n,t)),i){a=`${s}-${e}-${i}`;const d=r.get(a)||new Map;r.set(a,d.set(n,t))}}function pA(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:l=null}=r,u={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:l},d=`${s}-${a}--${i}-${l}`,p=`${i}-${l}--${s}-${a}`;oN("source",u,p,e,s,a),oN("target",u,d,e,i,l),t.set(r.id,r)}}function hA(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:hA(n,t):!1}function aN(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 B3(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!hA(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 px({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,u;const s=[];for(const[d,p]of t){const c=(a=n.get(d))==null?void 0:a.internals.userNode;c&&s.push({...c,position:p.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:((u=t.get(e))==null?void 0:u.position)||i.position,dragging:r}:s[0],s]}function W3({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=vp(i,t);return{x:a.x-i.x,y:a.y-i.y}}function V3({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,l=new Map,u=!1,d={x:0,y:0},p=null,c=!1,f=null,m=!1,y=!1,v=null;function k({noDragClassName:b,handleSelector:x,domNode:N,isSelectable:_,nodeId:C,nodeClickDistance:T=0}){f=ni(N);function H({x:D,y:W}){const{nodeLookup:$,nodeExtent:M,snapGrid:I,snapToGrid:z,nodeOrigin:P,onNodeDrag:R,onSelectionDrag:E,onError:J,updateNodePositions:Z}=t();i={x:D,y:W};let U=!1;const se=l.size>1,pe=se&&M?ub(bp(l)):null,he=se&&z?W3({dragItems:l,snapGrid:I,x:D,y:W}):null;for(const[xe,le]of l){if(!$.has(xe))continue;let Se={x:D-le.distance.x,y:W-le.distance.y};z&&(Se=he?{x:Math.round(Se.x+he.x),y:Math.round(Se.y+he.y)}:vp(Se,I));let ie=null;if(se&&M&&!le.extent&&pe){const{positionAbsolute:ke}=le.internals,Ve=ke.x-pe.x+M[0][0],Je=ke.x+le.measured.width-pe.x2+M[1][0],We=ke.y-pe.y+M[0][1],ot=ke.y+le.measured.height-pe.y2+M[1][1];ie=[[Ve,We],[Je,ot]]}const{position:oe,positionAbsolute:ye}=QP({nodeId:xe,nextPosition:Se,nodeLookup:$,nodeExtent:ie||M,nodeOrigin:P,onError:J});U=U||le.position.x!==oe.x||le.position.y!==oe.y,le.position=oe,le.internals.positionAbsolute=ye}if(y=y||U,!!U&&(Z(l,!0),v&&(r||R||!C&&E))){const[xe,le]=px({nodeId:C,dragItems:l,nodeLookup:$});r==null||r(v,l,xe,le),R==null||R(v,xe,le),C||E==null||E(v,le)}}async function L(){if(!p)return;const{transform:D,panBy:W,autoPanSpeed:$,autoPanOnNodeDrag:M}=t();if(!M){u=!1,cancelAnimationFrame(a);return}const[I,z]=eA(d,p,$);(I!==0||z!==0)&&(i.x=(i.x??0)-I/D[2],i.y=(i.y??0)-z/D[2],await W({x:I,y:z})&&H(i)),a=requestAnimationFrame(L)}function F(D){var se;const{nodeLookup:W,multiSelectionActive:$,nodesDraggable:M,transform:I,snapGrid:z,snapToGrid:P,selectNodesOnDrag:R,onNodeDragStart:E,onSelectionDragStart:J,unselectNodesAndEdges:Z}=t();c=!0,(!R||!_)&&!$&&C&&((se=W.get(C))!=null&&se.selected||Z()),_&&R&&C&&(e==null||e(C));const U=yf(D.sourceEvent,{transform:I,snapGrid:z,snapToGrid:P,containerBounds:p});if(i=U,l=B3(W,M,U,C),l.size>0&&(n||E||!C&&J)){const[pe,he]=px({nodeId:C,dragItems:l,nodeLookup:W});n==null||n(D.sourceEvent,l,pe,he),E==null||E(D.sourceEvent,pe,he),C||J==null||J(D.sourceEvent,he)}}const O=IP().clickDistance(T).on("start",D=>{const{domNode:W,nodeDragThreshold:$,transform:M,snapGrid:I,snapToGrid:z}=t();p=(W==null?void 0:W.getBoundingClientRect())||null,m=!1,y=!1,v=D.sourceEvent,$===0&&F(D),i=yf(D.sourceEvent,{transform:M,snapGrid:I,snapToGrid:z,containerBounds:p}),d=Ji(D.sourceEvent,p)}).on("drag",D=>{const{autoPanOnNodeDrag:W,transform:$,snapGrid:M,snapToGrid:I,nodeDragThreshold:z,nodeLookup:P}=t(),R=yf(D.sourceEvent,{transform:$,snapGrid:M,snapToGrid:I,containerBounds:p});if(v=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||C&&!P.has(C))&&(m=!0),!m){if(!u&&W&&c&&(u=!0,L()),!c){const E=Ji(D.sourceEvent,p),J=E.x-d.x,Z=E.y-d.y;Math.sqrt(J*J+Z*Z)>z&&F(D)}(i.x!==R.xSnapped||i.y!==R.ySnapped)&&l&&c&&(d=Ji(D.sourceEvent,p),H(R))}}).on("end",D=>{if(!(!c||m)&&(u=!1,c=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:W,updateNodePositions:$,onNodeDragStop:M,onSelectionDragStop:I}=t();if(y&&($(l,!1),y=!1),s||M||!C&&I){const[z,P]=px({nodeId:C,dragItems:l,nodeLookup:W,dragging:!1});s==null||s(D.sourceEvent,l,z,P),M==null||M(D.sourceEvent,z,P),C||I==null||I(D.sourceEvent,P)}}}).filter(D=>{const W=D.target;return!D.button&&(!b||!aN(W,`.${b}`,N))&&(!x||aN(W,x,N))});f.call(O)}function g(){f==null||f.on(".drag",null)}return{update:k,destroy:g}}function U3(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())Gf(s,Bu(i))>0&&r.push(i);return r}const K3=250;function q3(e,t,n,r){var l,u;let s=[],i=1/0;const a=U3(e,n,t+K3);for(const d of a){const p=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((u=d.internals.handleBounds)==null?void 0:u.target)??[]];for(const c of p){if(r.nodeId===c.nodeId&&r.type===c.type&&r.id===c.id)continue;const{x:f,y:m}=yc(d,c,c.position,!0),y=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(m-e.y,2));y>t||(y<i?(s=[{...c,x:f,y:m}],i=y):y===i&&s.push({...c,x:f,y:m}))}}if(!s.length)return null;if(s.length>1){const d=r.type==="source"?"target":"source";return s.find(p=>p.type===d)??s[0]}return s[0]}function mA(e,t,n,r,s,i=!1){var d,p,c;const a=r.get(e);if(!a)return null;const l=s==="strict"?(d=a.internals.handleBounds)==null?void 0:d[t]:[...((p=a.internals.handleBounds)==null?void 0:p.source)??[],...((c=a.internals.handleBounds)==null?void 0:c.target)??[]],u=(n?l==null?void 0:l.find(f=>f.id===n):l==null?void 0:l[0])??null;return u&&i?{...u,...yc(a,u,u.position,!0)}:u}function gA(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Y3(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const yA=()=>!0;function G3(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:u,lib:d,autoPanOnConnect:p,flowId:c,panBy:f,cancelConnection:m,onConnectStart:y,onConnect:v,onConnectEnd:k,isValidConnection:g=yA,onReconnectEnd:b,updateConnection:x,getTransform:N,getFromHandle:_,autoPanSpeed:C,dragThreshold:T=1,handleDomNode:H}){const L=sA(e.target);let F=0,O;const{x:D,y:W}=Ji(e),$=gA(i,H),M=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!M||!$)return;const z=mA(s,$,r,u,t);if(!z)return;let P=Ji(e,M),R=!1,E=null,J=!1,Z=null;function U(){if(!p||!M)return;const[oe,ye]=eA(P,M,C);f({x:oe,y:ye}),F=requestAnimationFrame(U)}const se={...z,nodeId:s,type:$,position:z.position},pe=u.get(s);let xe={inProgress:!0,isValid:null,from:yc(pe,se,Xe.Left,!0),fromHandle:se,fromPosition:se.position,fromNode:pe,to:P,toHandle:null,toPosition:GS[se.position],toNode:null,pointer:P};function le(){I=!0,x(xe),y==null||y(e,{nodeId:s,handleId:r,handleType:$})}T===0&&le();function Se(oe){if(!I){const{x:ot,y:ze}=Ji(oe),mt=ot-D,ln=ze-W;if(!(mt*mt+ln*ln>T*T))return;le()}if(!_()||!se){ie(oe);return}const ye=N();P=Ji(oe,M),O=q3(kp(P,ye,!1,[1,1]),n,u,se),R||(U(),R=!0);const ke=xA(oe,{handle:O,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:L,lib:d,flowId:c,nodeLookup:u});Z=ke.handleDomNode,E=ke.connection,J=Y3(!!O,ke.isValid);const Ve=u.get(s),Je=Ve?yc(Ve,se,Xe.Left,!0):xe.from,We={...xe,from:Je,isValid:J,to:ke.toHandle&&J?rg({x:ke.toHandle.x,y:ke.toHandle.y},ye):P,toHandle:ke.toHandle,toPosition:J&&ke.toHandle?ke.toHandle.position:GS[se.position],toNode:ke.toHandle?u.get(ke.toHandle.nodeId):null,pointer:P};x(We),xe=We}function ie(oe){if(!("touches"in oe&&oe.touches.length>0)){if(I){(O||Z)&&E&&J&&(v==null||v(E));const{inProgress:ye,...ke}=xe,Ve={...ke,toPosition:xe.toHandle?xe.toPosition:null};k==null||k(oe,Ve),i&&(b==null||b(oe,Ve))}m(),cancelAnimationFrame(F),R=!1,J=!1,E=null,Z=null,L.removeEventListener("mousemove",Se),L.removeEventListener("mouseup",ie),L.removeEventListener("touchmove",Se),L.removeEventListener("touchend",ie)}}L.addEventListener("mousemove",Se),L.addEventListener("mouseup",ie),L.addEventListener("touchmove",Se),L.addEventListener("touchend",ie)}function xA(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:u,isValidConnection:d=yA,nodeLookup:p}){const c=i==="target",f=t?a.querySelector(`.${l}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y}=Ji(e),v=a.elementFromPoint(m,y),k=v!=null&&v.classList.contains(`${l}-flow__handle`)?v:f,g={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const b=gA(void 0,k),x=k.getAttribute("data-nodeid"),N=k.getAttribute("data-handleid"),_=k.classList.contains("connectable"),C=k.classList.contains("connectableend");if(!x||!b)return g;const T={source:c?x:r,sourceHandle:c?N:s,target:c?r:x,targetHandle:c?s:N};g.connection=T;const L=_&&C&&(n===zu.Strict?c&&b==="source"||!c&&b==="target":x!==r||N!==s);g.isValid=L&&d(T),g.toHandle=mA(x,b,N,p,n,!0)}return g}const hb={onPointerDown:G3,isValid:xA};function X3({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=ni(e);function i({translateExtent:l,width:u,height:d,zoomStep:p=1,pannable:c=!0,zoomable:f=!0,inversePan:m=!1}){const y=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const N=n(),_=x.sourceEvent.ctrlKey&&Xf()?10:1,C=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*p,T=N[2]*Math.pow(2,C*_);t.scaleTo(T)};let v=[0,0];const k=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(v=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},g=x=>{const N=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const _=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],C=[_[0]-v[0],_[1]-v[1]];v=_;const T=r()*Math.max(N[2],Math.log(N[2]))*(m?-1:1),H={x:N[0]-C[0]*T,y:N[1]-C[1]*T},L=[[0,0],[u,d]];t.setViewportConstrained({x:H.x,y:H.y,zoom:N[2]},L,l)},b=KP().on("start",k).on("zoom",c?g:null).on("zoom.wheel",f?y:null);s.call(b,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:Ki}}const ny=e=>({x:e.x,y:e.y,zoom:e.k}),hx=({x:e,y:t,zoom:n})=>Zg.translate(e,t).scale(n),hu=(e,t)=>e.target.closest(`.${t}`),wA=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),J3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,mx=(e,t=0,n=J3,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},bA=e=>{const t=e.ctrlKey&&Xf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Q3({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:d}){return p=>{if(hu(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(p.ctrlKey&&a){const k=Ki(p),g=bA(p),b=c*Math.pow(2,g);r.scaleTo(n,b,k,p);return}const f=p.deltaMode===1?20:1;let m=s===ic.Vertical?0:p.deltaX*f,y=s===ic.Horizontal?0:p.deltaY*f;!Xf()&&p.shiftKey&&s!==ic.Vertical&&(m=p.deltaY*f,y=0),r.translateBy(n,-(m/c)*i,-(y/c)*i,{internal:!0});const v=ny(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(p,v),e.panScrollTimeout=setTimeout(()=>{d==null||d(p,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,v))}}function Z3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=hu(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function e5({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=ny(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 t5({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&wA(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,ny(i.transform)))}}function n5({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&&wA(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const u=ny(a.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,u)},n?150:0)}}}function r5({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:u,lib:d,connectionInProgress:p}){return c=>{var k;const f=e||t,m=n&&c.ctrlKey,y=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(hu(c,`${d}-flow__node`)||hu(c,`${d}-flow__edge`)))return!0;if(!r&&!f&&!s&&!i&&!n||a||p&&!y||hu(c,l)&&y||hu(c,u)&&(!y||s&&y&&!e)||!n&&c.ctrlKey&&y)return!1;if(!n&&c.type==="touchstart"&&((k=c.touches)==null?void 0:k.length)>1)return c.preventDefault(),!1;if(!f&&!s&&!m&&y||!r&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(r)&&!r.includes(c.button)&&c.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||y)&&v}}function s5({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:u}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),c=KP().scaleExtent([t,n]).translateExtent(r),f=ni(e).call(c);b({x:s.x,y:s.y,zoom:Hu(s.zoom,t,n)},[[0,0],[p.width,p.height]],r);const m=f.on("wheel.zoom"),y=f.on("dblclick.zoom");c.wheelDelta(bA);function v(O,D){return f?new Promise(W=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?gf:fm).transform(mx(f,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>W(!0)),O)}):Promise.resolve(!1)}function k({noWheelClassName:O,noPanClassName:D,onPaneContextMenu:W,userSelectionActive:$,panOnScroll:M,panOnDrag:I,panOnScrollMode:z,panOnScrollSpeed:P,preventScrolling:R,zoomOnPinch:E,zoomOnScroll:J,zoomOnDoubleClick:Z,zoomActivationKeyPressed:U,lib:se,onTransformChange:pe,connectionInProgress:he,paneClickDistance:xe,selectionOnDrag:le}){$&&!d.isZoomingOrPanning&&g();const Se=M&&!U&&!$;c.clickDistance(le?1/0:!Xi(xe)||xe<0?0:xe);const ie=Se?Q3({zoomPanValues:d,noWheelClassName:O,d3Selection:f,d3Zoom:c,panOnScrollMode:z,panOnScrollSpeed:P,zoomOnPinch:E,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):Z3({noWheelClassName:O,preventScrolling:R,d3ZoomHandler:m});if(f.on("wheel.zoom",ie,{passive:!1}),!$){const ye=e5({zoomPanValues:d,onDraggingChange:u,onPanZoomStart:a});c.on("start",ye);const ke=t5({zoomPanValues:d,panOnDrag:I,onPaneContextMenu:!!W,onPanZoom:i,onTransformChange:pe});c.on("zoom",ke);const Ve=n5({zoomPanValues:d,panOnDrag:I,panOnScroll:M,onPaneContextMenu:W,onPanZoomEnd:l,onDraggingChange:u});c.on("end",Ve)}const oe=r5({zoomActivationKeyPressed:U,panOnDrag:I,zoomOnScroll:J,panOnScroll:M,zoomOnDoubleClick:Z,zoomOnPinch:E,userSelectionActive:$,noPanClassName:D,noWheelClassName:O,lib:se,connectionInProgress:he});c.filter(oe),Z?f.on("dblclick.zoom",y):f.on("dblclick.zoom",null)}function g(){c.on("zoom",null)}async function b(O,D,W){const $=hx(O),M=c==null?void 0:c.constrain()($,D,W);return M&&await v(M),new Promise(I=>I(M))}async function x(O,D){const W=hx(O);return await v(W,D),new Promise($=>$(W))}function N(O){if(f){const D=hx(O),W=f.property("__zoom");(W.k!==O.zoom||W.x!==O.x||W.y!==O.y)&&(c==null||c.transform(f,D,null,{sync:!0}))}}function _(){const O=f?UP(f.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}function C(O,D){return f?new Promise(W=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?gf:fm).scaleTo(mx(f,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>W(!0)),O)}):Promise.resolve(!1)}function T(O,D){return f?new Promise(W=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?gf:fm).scaleBy(mx(f,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>W(!0)),O)}):Promise.resolve(!1)}function H(O){c==null||c.scaleExtent(O)}function L(O){c==null||c.translateExtent(O)}function F(O){const D=!Xi(O)||O<0?0:O;c==null||c.clickDistance(D)}return{update:k,destroy:g,setViewport:x,setViewportConstrained:b,getViewport:_,scaleTo:C,scaleBy:T,setScaleExtent:H,setTranslateExtent:L,syncViewport:N,setClickDistance:F}}var Vu;(function(e){e.Line="line",e.Handle="handle"})(Vu||(Vu={}));function i5({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,l=n-r,u=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&s&&(u[0]=u[0]*-1),l&&i&&(u[1]=u[1]*-1),u}function lN(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 za(e,t){return Math.max(0,t-e)}function Ha(e,t){return Math.max(0,e-t)}function Rh(e,t,n){return Math.max(0,t-e,e-n)}function cN(e,t){return e?!t:t}function o5(e,t,n,r,s,i,a,l){let{affectsX:u,affectsY:d}=t;const{isHorizontal:p,isVertical:c}=t,f=p&&c,{xSnapped:m,ySnapped:y}=n,{minWidth:v,maxWidth:k,minHeight:g,maxHeight:b}=r,{x,y:N,width:_,height:C,aspectRatio:T}=e;let H=Math.floor(p?m-e.pointerX:0),L=Math.floor(c?y-e.pointerY:0);const F=_+(u?-H:H),O=C+(d?-L:L),D=-i[0]*_,W=-i[1]*C;let $=Rh(F,v,k),M=Rh(O,g,b);if(a){let P=0,R=0;u&&H<0?P=za(x+H+D,a[0][0]):!u&&H>0&&(P=Ha(x+F+D,a[1][0])),d&&L<0?R=za(N+L+W,a[0][1]):!d&&L>0&&(R=Ha(N+O+W,a[1][1])),$=Math.max($,P),M=Math.max(M,R)}if(l){let P=0,R=0;u&&H>0?P=Ha(x+H,l[0][0]):!u&&H<0&&(P=za(x+F,l[1][0])),d&&L>0?R=Ha(N+L,l[0][1]):!d&&L<0&&(R=za(N+O,l[1][1])),$=Math.max($,P),M=Math.max(M,R)}if(s){if(p){const P=Rh(F/T,g,b)*T;if($=Math.max($,P),a){let R=0;!u&&!d||u&&!d&&f?R=Ha(N+W+F/T,a[1][1])*T:R=za(N+W+(u?H:-H)/T,a[0][1])*T,$=Math.max($,R)}if(l){let R=0;!u&&!d||u&&!d&&f?R=za(N+F/T,l[1][1])*T:R=Ha(N+(u?H:-H)/T,l[0][1])*T,$=Math.max($,R)}}if(c){const P=Rh(O*T,v,k)/T;if(M=Math.max(M,P),a){let R=0;!u&&!d||d&&!u&&f?R=Ha(x+O*T+D,a[1][0])/T:R=za(x+(d?L:-L)*T+D,a[0][0])/T,M=Math.max(M,R)}if(l){let R=0;!u&&!d||d&&!u&&f?R=za(x+O*T,l[1][0])/T:R=Ha(x+(d?L:-L)*T,l[0][0])/T,M=Math.max(M,R)}}}L=L+(L<0?M:-M),H=H+(H<0?$:-$),s&&(f?F>O*T?L=(cN(u,d)?-H:H)/T:H=(cN(u,d)?-L:L)*T:p?(L=H/T,d=u):(H=L*T,u=d));const I=u?x+H:x,z=d?N+L:N;return{width:_+(u?-H:H),height:C+(d?-L:L),x:i[0]*H*(u?-1:1)+I,y:i[1]*L*(d?-1:1)+z}}const vA={width:0,height:0,x:0,y:0},a5={...vA,pointerX:0,pointerY:0,aspectRatio:1};function l5(e){return[[0,0],[e.measured.width,e.measured.height]]}function c5(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,u=n[1]*a;return[[r-l,s-u],[r+i-l,s+a-u]]}function u5({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=ni(e);let a={controlDirection:lN("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:p,keepAspectRatio:c,resizeDirection:f,onResizeStart:m,onResize:y,onResizeEnd:v,shouldResize:k}){let g={...vA},b={...a5};a={boundaries:p,resizeDirection:f,keepAspectRatio:c,controlDirection:lN(d)};let x,N=null,_=[],C,T,H,L=!1;const F=IP().on("start",O=>{const{nodeLookup:D,transform:W,snapGrid:$,snapToGrid:M,nodeOrigin:I,paneDomNode:z}=n();if(x=D.get(t),!x)return;N=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:R}=yf(O.sourceEvent,{transform:W,snapGrid:$,snapToGrid:M,containerBounds:N});g={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},b={...g,pointerX:P,pointerY:R,aspectRatio:g.width/g.height},C=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(C=D.get(x.parentId),T=C&&x.extent==="parent"?l5(C):void 0),_=[],H=void 0;for(const[E,J]of D)if(J.parentId===t&&(_.push({id:E,position:{...J.position},extent:J.extent}),J.extent==="parent"||J.expandParent)){const Z=c5(J,x,J.origin??I);H?H=[[Math.min(Z[0][0],H[0][0]),Math.min(Z[0][1],H[0][1])],[Math.max(Z[1][0],H[1][0]),Math.max(Z[1][1],H[1][1])]]:H=Z}m==null||m(O,{...g})}).on("drag",O=>{const{transform:D,snapGrid:W,snapToGrid:$,nodeOrigin:M}=n(),I=yf(O.sourceEvent,{transform:D,snapGrid:W,snapToGrid:$,containerBounds:N}),z=[];if(!x)return;const{x:P,y:R,width:E,height:J}=g,Z={},U=x.origin??M,{width:se,height:pe,x:he,y:xe}=o5(b,a.controlDirection,I,a.boundaries,a.keepAspectRatio,U,T,H),le=se!==E,Se=pe!==J,ie=he!==P&&le,oe=xe!==R&&Se;if(!ie&&!oe&&!le&&!Se)return;if((ie||oe||U[0]===1||U[1]===1)&&(Z.x=ie?he:g.x,Z.y=oe?xe:g.y,g.x=Z.x,g.y=Z.y,_.length>0)){const Je=he-P,We=xe-R;for(const ot of _)ot.position={x:ot.position.x-Je+U[0]*(se-E),y:ot.position.y-We+U[1]*(pe-J)},z.push(ot)}if((le||Se)&&(Z.width=le&&(!a.resizeDirection||a.resizeDirection==="horizontal")?se:g.width,Z.height=Se&&(!a.resizeDirection||a.resizeDirection==="vertical")?pe:g.height,g.width=Z.width,g.height=Z.height),C&&x.expandParent){const Je=U[0]*(Z.width??0);Z.x&&Z.x<Je&&(g.x=Je,b.x=b.x-(Z.x-Je));const We=U[1]*(Z.height??0);Z.y&&Z.y<We&&(g.y=We,b.y=b.y-(Z.y-We))}const ye=i5({width:g.width,prevWidth:E,height:g.height,prevHeight:J,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),ke={...g,direction:ye};(k==null?void 0:k(O,ke))!==!1&&(L=!0,y==null||y(O,ke),r(Z,z))}).on("end",O=>{L&&(v==null||v(O,{...g}),s==null||s({...g}),L=!1)});i.call(F)}function u(){i.on(".drag",null)}return{update:l,destroy:u}}var kA={exports:{}},SA={},NA={exports:{}},jA={};/**
|
|
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 Uu=h;function d5(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var f5=typeof Object.is=="function"?Object.is:d5,p5=Uu.useState,h5=Uu.useEffect,m5=Uu.useLayoutEffect,g5=Uu.useDebugValue;function y5(e,t){var n=t(),r=p5({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return m5(function(){s.value=n,s.getSnapshot=t,gx(s)&&i({inst:s})},[e,n,t]),h5(function(){return gx(s)&&i({inst:s}),e(function(){gx(s)&&i({inst:s})})},[e]),g5(n),n}function gx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!f5(e,n)}catch{return!0}}function x5(e,t){return t()}var w5=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?x5:y5;jA.useSyncExternalStore=Uu.useSyncExternalStore!==void 0?Uu.useSyncExternalStore:w5;NA.exports=jA;var CA=NA.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 ry=h,b5=CA;function v5(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var k5=typeof Object.is=="function"?Object.is:v5,S5=b5.useSyncExternalStore,N5=ry.useRef,j5=ry.useEffect,C5=ry.useMemo,E5=ry.useDebugValue;SA.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=N5(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=C5(function(){function u(m){if(!d){if(d=!0,p=m,m=r(m),s!==void 0&&a.hasValue){var y=a.value;if(s(y,m))return c=y}return c=m}if(y=c,k5(p,m))return y;var v=r(m);return s!==void 0&&s(y,v)?(p=m,y):(p=m,c=v)}var d=!1,p,c,f=n===void 0?null:n;return[function(){return u(t())},f===null?void 0:function(){return u(f())}]},[t,n,r,s]);var l=S5(e,i[0],i[1]);return j5(function(){a.hasValue=!0,a.value=l},[l]),E5(l),l};kA.exports=SA;var _5=kA.exports;const P5=xl(_5),A5={},uN=e=>{let t;const n=new Set,r=(p,c)=>{const f=typeof p=="function"?p(t):p;if(!Object.is(f,t)){const m=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(y=>y(t,m))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>d,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(A5?"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,u);return u},I5=e=>e?uN(e):uN,{useDebugValue:T5}=at,{useSyncExternalStoreWithSelector:R5}=P5,L5=e=>e;function EA(e,t=L5,n){const r=R5(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return T5(r),r}const dN=(e,t)=>{const n=I5(e),r=(s,i=t)=>EA(n,s,i);return Object.assign(r,n),r},M5=(e,t)=>e?dN(e,t):dN;function Vn(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 sy=h.createContext(null),O5=sy.Provider,_A=To.error001();function qt(e,t){const n=h.useContext(sy);if(n===null)throw new Error(_A);return EA(n,e,t)}function Fn(){const e=h.useContext(sy);if(e===null)throw new Error(_A);return h.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const fN={display:"none"},$5={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},PA="react-flow__node-desc",AA="react-flow__edge-desc",D5="react-flow__aria-live",F5=e=>e.ariaLiveMessage,z5=e=>e.ariaLabelConfig;function H5({rfId:e}){const t=qt(F5);return o.jsx("div",{id:`${D5}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:$5,children:t})}function B5({rfId:e,disableKeyboardA11y:t}){const n=qt(z5);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${PA}-${e}`,style:fN,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${AA}-${e}`,style:fN,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(H5,{rfId:e})]})}const Ku=h.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:gr(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});Ku.displayName="Panel";function W5({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Ku,{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 V5=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}},Lh=e=>e.id;function U5(e,t){return Vn(e.selectedNodes.map(Lh),t.selectedNodes.map(Lh))&&Vn(e.selectedEdges.map(Lh),t.selectedEdges.map(Lh))}function K5({onSelectionChange:e}){const t=Fn(),{selectedNodes:n,selectedEdges:r}=qt(V5,U5);return h.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const q5=e=>!!e.onSelectionChangeHandlers;function Y5({onSelectionChange:e}){const t=qt(q5);return e||t?o.jsx(K5,{onSelectionChange:e}):null}const mb=typeof window<"u"?h.useLayoutEffect:h.useEffect,IA=[0,0],G5={x:0,y:0,zoom:1},X5=["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"],pN=[...X5,"rfId"],J5=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}),hN={translateExtent:qf,nodeOrigin:IA,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Q5(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:u}=qt(J5,Vn),d=Fn();mb(()=>(u(e.defaultNodes,e.defaultEdges),()=>{p.current=hN,l()}),[]);const p=h.useRef(hN);return mb(()=>{for(const c of pN){const f=e[c],m=p.current[c];f!==m&&(typeof e[c]>"u"||(c==="nodes"?t(f):c==="edges"?n(f):c==="minZoom"?r(f):c==="maxZoom"?s(f):c==="translateExtent"?i(f):c==="nodeExtent"?a(f):c==="ariaLabelConfig"?d.setState({ariaLabelConfig:S3(f)}):c==="fitView"?d.setState({fitViewQueued:f}):c==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[c]:f})))}p.current=e},pN.map(c=>e[c])),null}function mN(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Z5(e){var r;const[t,n]=h.useState(e==="system"?null:e);return h.useEffect(()=>{if(e!=="system"){n(e);return}const s=mN(),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=mN())!=null&&r.matches?"dark":"light"}const gN=typeof document<"u"?document:null;function Qf(e=null,t={target:gN,actInsideInputWithModifier:!0}){const[n,r]=h.useState(!1),s=h.useRef(!1),i=h.useRef(new Set([])),[a,l]=h.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
|
|
61
|
+
`).replace(`
|
|
62
|
+
|
|
63
|
+
`,`
|
|
64
|
+
+`).split(`
|
|
65
|
+
`)),p=d.reduce((c,f)=>c.concat(...f),[]);return[d,p]}return[[],[]]},[e]);return h.useEffect(()=>{const u=(t==null?void 0:t.target)??gN,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=m=>{var k,g;if(s.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!s.current||s.current&&!d)&&iA(m))return!1;const v=xN(m.code,l);if(i.current.add(m[v]),yN(a,i.current,!1)){const b=((g=(k=m.composedPath)==null?void 0:k.call(m))==null?void 0:g[0])||m.target,x=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(s.current||!x)&&m.preventDefault(),r(!0)}},c=m=>{const y=xN(m.code,l);yN(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[y]),m.key==="Meta"&&i.current.clear(),s.current=!1},f=()=>{i.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",p),u==null||u.addEventListener("keyup",c),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{u==null||u.removeEventListener("keydown",p),u==null||u.removeEventListener("keyup",c),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function yN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function xN(e,t){return t.includes(e)?"code":"key"}const eH=()=>{const e=Fn();return h.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(),u=t0(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(u,{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:u}=a.getBoundingClientRect(),d={x:t.x-l,y:t.y-u},p=n.snapGrid??s,c=n.snapToGrid??i;return kp(d,r,c,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=rg(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function TA(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 u of a)tH(u,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 tH(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 sg(e,t){return TA(e,t)}function l0(e,t){return TA(e,t)}function Yl(e,t){return{id:e,type:"select",selected:t}}function mu(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(Yl(i.id,a)))}return r}function wN({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),u=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;u!==void 0&&u!==a&&n.push({id:a.id,item:a,type:"replace"}),u===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 bN(e){return{id:e.id,type:"remove"}}const vN=e=>p3(e),nH=e=>JP(e);function RA(e){return h.forwardRef(e)}function kN(e){const[t,n]=h.useState(BigInt(0)),[r]=h.useState(()=>rH(()=>n(s=>s+BigInt(1))));return mb(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function rH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const LA=h.createContext(null);function sH({children:e}){const t=Fn(),n=h.useCallback(l=>{const{nodes:u=[],setNodes:d,hasDefaultNodes:p,onNodesChange:c,nodeLookup:f,fitViewQueued:m,onNodesChangeMiddlewareMap:y}=t.getState();let v=u;for(const g of l)v=typeof g=="function"?g(v):g;let k=wN({items:v,lookup:f});for(const g of y.values())k=g(k);p&&d(v),k.length>0?c==null||c(k):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:b,setNodes:x}=t.getState();g&&x(b)})},[]),r=kN(n),s=h.useCallback(l=>{const{edges:u=[],setEdges:d,hasDefaultEdges:p,onEdgesChange:c,edgeLookup:f}=t.getState();let m=u;for(const y of l)m=typeof y=="function"?y(m):y;p?d(m):c&&c(wN({items:m,lookup:f}))},[]),i=kN(s),a=h.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(LA.Provider,{value:a,children:e})}function iH(){const e=h.useContext(LA);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const oH=e=>!!e.panZoom;function kc(){const e=eH(),t=Fn(),n=iH(),r=qt(oH),s=h.useMemo(()=>{const i=c=>t.getState().nodeLookup.get(c),a=c=>{n.nodeQueue.push(c)},l=c=>{n.edgeQueue.push(c)},u=c=>{var g,b;const{nodeLookup:f,nodeOrigin:m}=t.getState(),y=vN(c)?c:f.get(c.id),v=y.parentId?rA(y.position,y.measured,y.parentId,f,m):y.position,k={...y,position:v,width:((g=y.measured)==null?void 0:g.width)??y.width,height:((b=y.measured)==null?void 0:b.height)??y.height};return Bu(k)},d=(c,f,m={replace:!1})=>{a(y=>y.map(v=>{if(v.id===c){const k=typeof f=="function"?f(v):f;return m.replace&&vN(k)?k:{...v,...k}}return v}))},p=(c,f,m={replace:!1})=>{l(y=>y.map(v=>{if(v.id===c){const k=typeof f=="function"?f(v):f;return m.replace&&nH(k)?k:{...v,...k}}return v}))};return{getNodes:()=>t.getState().nodes.map(c=>({...c})),getNode:c=>{var f;return(f=i(c))==null?void 0:f.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:c=[]}=t.getState();return c.map(f=>({...f}))},getEdge:c=>t.getState().edgeLookup.get(c),setNodes:a,setEdges:l,addNodes:c=>{const f=Array.isArray(c)?c:[c];n.nodeQueue.push(m=>[...m,...f])},addEdges:c=>{const f=Array.isArray(c)?c:[c];n.edgeQueue.push(m=>[...m,...f])},toObject:()=>{const{nodes:c=[],edges:f=[],transform:m}=t.getState(),[y,v,k]=m;return{nodes:c.map(g=>({...g})),edges:f.map(g=>({...g})),viewport:{x:y,y:v,zoom:k}}},deleteElements:async({nodes:c=[],edges:f=[]})=>{const{nodes:m,edges:y,onNodesDelete:v,onEdgesDelete:k,triggerNodeChanges:g,triggerEdgeChanges:b,onDelete:x,onBeforeDelete:N}=t.getState(),{nodes:_,edges:C}=await x3({nodesToRemove:c,edgesToRemove:f,nodes:m,edges:y,onBeforeDelete:N}),T=C.length>0,H=_.length>0;if(T){const L=C.map(bN);k==null||k(C),b(L)}if(H){const L=_.map(bN);v==null||v(_),g(L)}return(H||T)&&(x==null||x({nodes:_,edges:C})),{deletedNodes:_,deletedEdges:C}},getIntersectingNodes:(c,f=!0,m)=>{const y=JS(c),v=y?c:u(c),k=m!==void 0;return v?(m||t.getState().nodes).filter(g=>{const b=t.getState().nodeLookup.get(g.id);if(b&&!y&&(g.id===c.id||!b.internals.positionAbsolute))return!1;const x=Bu(k?g:b),N=Gf(x,v);return f&&N>0||N>=x.width*x.height||N>=v.width*v.height}):[]},isNodeIntersecting:(c,f,m=!0)=>{const v=JS(c)?c:u(c);if(!v)return!1;const k=Gf(v,f);return m&&k>0||k>=f.width*f.height||k>=v.width*v.height},updateNode:d,updateNodeData:(c,f,m={replace:!1})=>{d(c,y=>{const v=typeof f=="function"?f(y):f;return m.replace?{...y,data:v}:{...y,data:{...y.data,...v}}},m)},updateEdge:p,updateEdgeData:(c,f,m={replace:!1})=>{p(c,y=>{const v=typeof f=="function"?f(y):f;return m.replace?{...y,data:v}:{...y,data:{...y.data,...v}}},m)},getNodesBounds:c=>{const{nodeLookup:f,nodeOrigin:m}=t.getState();return h3(c,{nodeLookup:f,nodeOrigin:m})},getHandleConnections:({type:c,id:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}-${c}${f?`-${f}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:c,handleId:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}${c?f?`-${c}-${f}`:`-${c}`:""}`))==null?void 0:y.values())??[])},fitView:async c=>{const f=t.getState().fitViewResolver??k3();return t.setState({fitViewQueued:!0,fitViewOptions:c,fitViewResolver:f}),n.nodeQueue.push(m=>[...m]),f.promise}}},[]);return h.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const SN=e=>e.selected,aH=typeof window<"u"?window:void 0;function lH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Fn(),{deleteElements:r}=kc(),s=Qf(e,{actInsideInputWithModifier:!1}),i=Qf(t,{target:aH});h.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(SN),edges:a.filter(SN)}),n.setState({nodesSelectionActive:!1})}},[s]),h.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function cH(e){const t=Fn();h.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=n0(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",To.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 iy={position:"absolute",width:"100%",height:"100%",top:0,left:0},uH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function dH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=ic.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:d,minZoom:p,maxZoom:c,zoomActivationKeyCode:f,preventScrolling:m=!0,children:y,noWheelClassName:v,noPanClassName:k,onViewportChange:g,isControlledViewport:b,paneClickDistance:x,selectionOnDrag:N}){const _=Fn(),C=h.useRef(null),{userSelectionActive:T,lib:H,connectionInProgress:L}=qt(uH,Vn),F=Qf(f),O=h.useRef();cH(C);const D=h.useCallback(W=>{g==null||g({x:W[0],y:W[1],zoom:W[2]}),b||_.setState({transform:W})},[g,b]);return h.useEffect(()=>{if(C.current){O.current=s5({domNode:C.current,minZoom:p,maxZoom:c,translateExtent:d,viewport:u,onDraggingChange:I=>_.setState(z=>z.paneDragging===I?z:{paneDragging:I}),onPanZoomStart:(I,z)=>{const{onViewportChangeStart:P,onMoveStart:R}=_.getState();R==null||R(I,z),P==null||P(z)},onPanZoom:(I,z)=>{const{onViewportChange:P,onMove:R}=_.getState();R==null||R(I,z),P==null||P(z)},onPanZoomEnd:(I,z)=>{const{onViewportChangeEnd:P,onMoveEnd:R}=_.getState();R==null||R(I,z),P==null||P(z)}});const{x:W,y:$,zoom:M}=O.current.getViewport();return _.setState({panZoom:O.current,transform:[W,$,M],domNode:C.current.closest(".react-flow")}),()=>{var I;(I=O.current)==null||I.destroy()}}},[]),h.useEffect(()=>{var W;(W=O.current)==null||W.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:F,preventScrolling:m,noPanClassName:k,userSelectionActive:T,noWheelClassName:v,lib:H,onTransformChange:D,connectionInProgress:L,selectionOnDrag:N,paneClickDistance:x})},[e,t,n,r,s,i,a,l,F,m,k,T,v,H,D,L,N,x]),o.jsx("div",{className:"react-flow__renderer",ref:C,style:iy,children:y})}const fH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function pH(){const{userSelectionActive:e,userSelectionRect:t}=qt(fH,Vn);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 yx=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},hH=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function mH({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Yf.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:p,onPaneMouseEnter:c,onPaneMouseMove:f,onPaneMouseLeave:m,children:y}){const v=Fn(),{userSelectionActive:k,elementsSelectable:g,dragging:b,connectionInProgress:x}=qt(hH,Vn),N=g&&(e||k),_=h.useRef(null),C=h.useRef(),T=h.useRef(new Set),H=h.useRef(new Set),L=h.useRef(!1),F=P=>{if(L.current||x){L.current=!1;return}u==null||u(P),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},O=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}d==null||d(P)},D=p?P=>p(P):void 0,W=P=>{L.current&&(P.stopPropagation(),L.current=!1)},$=P=>{var pe,he;const{domNode:R}=v.getState();if(C.current=R==null?void 0:R.getBoundingClientRect(),!C.current)return;const E=P.target===_.current;if(!E&&!!P.target.closest(".nokey")||!e||!(i&&E||t)||P.button!==0||!P.isPrimary)return;(he=(pe=P.target)==null?void 0:pe.setPointerCapture)==null||he.call(pe,P.pointerId),L.current=!1;const{x:U,y:se}=Ji(P.nativeEvent,C.current);v.setState({userSelectionRect:{width:0,height:0,startX:U,startY:se,x:U,y:se}}),E||(P.stopPropagation(),P.preventDefault())},M=P=>{const{userSelectionRect:R,transform:E,nodeLookup:J,edgeLookup:Z,connectionLookup:U,triggerNodeChanges:se,triggerEdgeChanges:pe,defaultEdgeOptions:he,resetSelectedElements:xe}=v.getState();if(!C.current||!R)return;const{x:le,y:Se}=Ji(P.nativeEvent,C.current),{startX:ie,startY:oe}=R;if(!L.current){const We=t?0:s;if(Math.hypot(le-ie,Se-oe)<=We)return;xe(),a==null||a(P)}L.current=!0;const ye={startX:ie,startY:oe,x:le<ie?le:ie,y:Se<oe?Se:oe,width:Math.abs(le-ie),height:Math.abs(Se-oe)},ke=T.current,Ve=H.current;T.current=new Set(e0(J,ye,E,n===Yf.Partial,!0).map(We=>We.id)),H.current=new Set;const Je=(he==null?void 0:he.selectable)??!0;for(const We of T.current){const ot=U.get(We);if(ot)for(const{edgeId:ze}of ot.values()){const mt=Z.get(ze);mt&&(mt.selectable??Je)&&H.current.add(ze)}}if(!QS(ke,T.current)){const We=mu(J,T.current,!0);se(We)}if(!QS(Ve,H.current)){const We=mu(Z,H.current);pe(We)}v.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},I=P=>{var R,E;P.button===0&&((E=(R=P.target)==null?void 0:R.releasePointerCapture)==null||E.call(R,P.pointerId),!k&&P.target===_.current&&v.getState().userSelectionRect&&(F==null||F(P)),v.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(l==null||l(P),v.setState({nodesSelectionActive:T.current.size>0})))},z=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:gr(["react-flow__pane",{draggable:z,dragging:b,selection:e}]),onClick:N?void 0:yx(F,_),onContextMenu:yx(O,_),onWheel:yx(D,_),onPointerEnter:N?void 0:c,onPointerMove:N?M:f,onPointerUp:N?I:void 0,onPointerDownCapture:N?$:void 0,onClickCapture:N?W:void 0,onPointerLeave:m,ref:_,style:iy,children:[y,o.jsx(pH,{})]})}function gb({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:u}=t.getState(),d=l.get(e);if(!d){u==null||u("012",To.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):s([e])}function MA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=Fn(),[u,d]=h.useState(!1),p=h.useRef();return h.useEffect(()=>{p.current=V3({getStoreItems:()=>l.getState(),onNodeMouseDown:c=>{gb({id:c,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),h.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var c;(c=p.current)==null||c.destroy()}},[n,r,t,i,e,s,a]),u}const gH=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function OA(){const e=Fn();return h.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:u,nodeLookup:d,nodeOrigin:p}=e.getState(),c=new Map,f=gH(a),m=s?i[0]:5,y=s?i[1]:5,v=n.direction.x*m*n.factor,k=n.direction.y*y*n.factor;for(const[,g]of d){if(!f(g))continue;let b={x:g.internals.positionAbsolute.x+v,y:g.internals.positionAbsolute.y+k};s&&(b=vp(b,i));const{position:x,positionAbsolute:N}=QP({nodeId:g.id,nextPosition:b,nodeLookup:d,nodeExtent:r,nodeOrigin:p,onError:l});g.position=x,g.internals.positionAbsolute=N,c.set(g.id,g)}u(c)},[])}const c0=h.createContext(null),yH=c0.Provider;c0.Consumer;const $A=()=>h.useContext(c0),xH=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),wH=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:u,isValid:d}=a,p=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.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:p,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===zu.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:p&&d}};function bH({type:e="source",position:t=Xe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:u,className:d,onMouseDown:p,onTouchStart:c,...f},m){var M,I;const y=a||null,v=e==="target",k=Fn(),g=$A(),{connectOnClick:b,noPanClassName:x,rfId:N}=qt(xH,Vn),{connectingFrom:_,connectingTo:C,clickConnecting:T,isPossibleEndHandle:H,connectionInProcess:L,clickConnectionInProcess:F,valid:O}=qt(wH(g,y,e),Vn);g||(I=(M=k.getState()).onError)==null||I.call(M,"010",To.error010());const D=z=>{const{defaultEdgeOptions:P,onConnect:R,hasDefaultEdges:E}=k.getState(),J={...P,...z};if(E){const{edges:Z,setEdges:U}=k.getState();U(Jf(J,Z))}R==null||R(J),l==null||l(J)},W=z=>{if(!g)return;const P=oA(z.nativeEvent);if(s&&(P&&z.button===0||!P)){const R=k.getState();hb.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:R.autoPanOnConnect,connectionMode:R.connectionMode,connectionRadius:R.connectionRadius,domNode:R.domNode,nodeLookup:R.nodeLookup,lib:R.lib,isTarget:v,handleId:y,nodeId:g,flowId:R.rfId,panBy:R.panBy,cancelConnection:R.cancelConnection,onConnectStart:R.onConnectStart,onConnectEnd:(...E)=>{var J,Z;return(Z=(J=k.getState()).onConnectEnd)==null?void 0:Z.call(J,...E)},updateConnection:R.updateConnection,onConnect:D,isValidConnection:n||((...E)=>{var J,Z;return((Z=(J=k.getState()).isValidConnection)==null?void 0:Z.call(J,...E))??!0}),getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,autoPanSpeed:R.autoPanSpeed,dragThreshold:R.connectionDragThreshold})}P?p==null||p(z):c==null||c(z)},$=z=>{const{onClickConnectStart:P,onClickConnectEnd:R,connectionClickStartHandle:E,connectionMode:J,isValidConnection:Z,lib:U,rfId:se,nodeLookup:pe,connection:he}=k.getState();if(!g||!E&&!s)return;if(!E){P==null||P(z.nativeEvent,{nodeId:g,handleId:y,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:g,type:e,id:y}});return}const xe=sA(z.target),le=n||Z,{connection:Se,isValid:ie}=hb.isValid(z.nativeEvent,{handle:{nodeId:g,id:y,type:e},connectionMode:J,fromNodeId:E.nodeId,fromHandleId:E.id||null,fromType:E.type,isValidConnection:le,flowId:se,doc:xe,lib:U,nodeLookup:pe});ie&&Se&&D(Se);const oe=structuredClone(he);delete oe.inProgress,oe.toPosition=oe.toHandle?oe.toHandle.position:null,R==null||R(z,oe),k.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":y,"data-nodeid":g,"data-handlepos":t,"data-id":`${N}-${g}-${y}-${e}`,className:gr(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,d,{source:!v,target:v,connectable:r,connectablestart:s,connectableend:i,clickconnecting:T,connectingfrom:_,connectingto:C,valid:O,connectionindicator:r&&(!L||H)&&(L||F?i:s)}]),onMouseDown:W,onTouchStart:W,onClick:b?$:void 0,ref:m,...f,children:u})}const Ws=h.memo(RA(bH));function vH({data:e,isConnectable:t,sourcePosition:n=Xe.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Ws,{type:"source",position:n,isConnectable:t})]})}function kH({data:e,isConnectable:t,targetPosition:n=Xe.Top,sourcePosition:r=Xe.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Ws,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Ws,{type:"source",position:r,isConnectable:t})]})}function SH(){return null}function NH({data:e,isConnectable:t,targetPosition:n=Xe.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Ws,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const ig={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},NN={input:vH,default:kH,output:NH,group:SH};function jH(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 CH=e=>{const{width:t,height:n,x:r,y:s}=bp(e.nodeLookup,{filter:i=>!!i.selected});return{width:Xi(t)?t:null,height:Xi(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 EH({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Fn(),{width:s,height:i,transformString:a,userSelectionActive:l}=qt(CH,Vn),u=OA(),d=h.useRef(null);h.useEffect(()=>{var m;n||(m=d.current)==null||m.focus({preventScroll:!0})},[n]);const p=!l&&s!==null&&i!==null;if(MA({nodeRef:d,disabled:!p}),!p)return null;const c=e?m=>{const y=r.getState().nodes.filter(v=>v.selected);e(m,y)}:void 0,f=m=>{Object.prototype.hasOwnProperty.call(ig,m.key)&&(m.preventDefault(),u({direction:ig[m.key],factor:m.shiftKey?4:1}))};return o.jsx("div",{className:gr(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:s,height:i}})})}const jN=typeof window<"u"?window:void 0,_H=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function DA({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:p,selectionMode:c,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:y,panActivationKeyCode:v,zoomActivationKeyCode:k,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:N,panOnScrollSpeed:_,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:H,defaultViewport:L,translateExtent:F,minZoom:O,maxZoom:D,preventScrolling:W,onSelectionContextMenu:$,noWheelClassName:M,noPanClassName:I,disableKeyboardA11y:z,onViewportChange:P,isControlledViewport:R}){const{nodesSelectionActive:E,userSelectionActive:J}=qt(_H,Vn),Z=Qf(d,{target:jN}),U=Qf(v,{target:jN}),se=U||H,pe=U||N,he=p&&se!==!0,xe=Z||J||he;return lH({deleteKeyCode:u,multiSelectionKeyCode:y}),o.jsx(dH,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:pe,panOnScrollSpeed:_,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:!Z&&se,defaultViewport:L,translateExtent:F,minZoom:O,maxZoom:D,zoomActivationKeyCode:k,preventScrolling:W,noWheelClassName:M,noPanClassName:I,onViewportChange:P,isControlledViewport:R,paneClickDistance:l,selectionOnDrag:he,children:o.jsxs(mH,{onSelectionStart:f,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:se,isSelecting:!!xe,selectionMode:c,selectionKeyPressed:Z,paneClickDistance:l,selectionOnDrag:he,children:[e,E&&o.jsx(EH,{onSelectionContextMenu:$,noPanClassName:I,disableKeyboardA11y:z})]})})}DA.displayName="FlowRenderer";const PH=h.memo(DA),AH=e=>t=>e?e0(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 IH(e){return qt(h.useCallback(AH(e),[e]),Vn)}const TH=e=>e.updateNodeInternals;function RH(){const e=qt(TH),[t]=h.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 h.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function LH({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Fn(),i=h.useRef(null),a=h.useRef(null),l=h.useRef(e.sourcePosition),u=h.useRef(e.targetPosition),d=h.useRef(t),p=n&&!!e.internals.handleBounds;return h.useEffect(()=>{i.current&&!e.hidden&&(!p||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[p,e.hidden]),h.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),h.useEffect(()=>{if(i.current){const c=d.current!==t,f=l.current!==e.sourcePosition,m=u.current!==e.targetPosition;(c||f||m)&&(d.current=t,l.current=e.sourcePosition,u.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 MH({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:u,nodesConnectable:d,nodesFocusable:p,resizeObserver:c,noDragClassName:f,noPanClassName:m,disableKeyboardA11y:y,rfId:v,nodeTypes:k,nodeClickDistance:g,onError:b}){const{node:x,internals:N,isParent:_}=qt(le=>{const Se=le.nodeLookup.get(e),ie=le.parentLookup.has(e);return{node:Se,internals:Se.internals,isParent:ie}},Vn);let C=x.type||"default",T=(k==null?void 0:k[C])||NN[C];T===void 0&&(b==null||b("003",To.error003(C)),C="default",T=(k==null?void 0:k.default)||NN.default);const H=!!(x.draggable||l&&typeof x.draggable>"u"),L=!!(x.selectable||u&&typeof x.selectable>"u"),F=!!(x.connectable||d&&typeof x.connectable>"u"),O=!!(x.focusable||p&&typeof x.focusable>"u"),D=Fn(),W=nA(x),$=LH({node:x,nodeType:C,hasDimensions:W,resizeObserver:c}),M=MA({nodeRef:$,disabled:x.hidden||!H,noDragClassName:f,handleSelector:x.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:g}),I=OA();if(x.hidden)return null;const z=ka(x),P=jH(x),R=L||H||t||n||r||s,E=n?le=>n(le,{...N.userNode}):void 0,J=r?le=>r(le,{...N.userNode}):void 0,Z=s?le=>s(le,{...N.userNode}):void 0,U=i?le=>i(le,{...N.userNode}):void 0,se=a?le=>a(le,{...N.userNode}):void 0,pe=le=>{const{selectNodesOnDrag:Se,nodeDragThreshold:ie}=D.getState();L&&(!Se||!H||ie>0)&&gb({id:e,store:D,nodeRef:$}),t&&t(le,{...N.userNode})},he=le=>{if(!(iA(le.nativeEvent)||y)){if(qP.includes(le.key)&&L){const Se=le.key==="Escape";gb({id:e,store:D,unselect:Se,nodeRef:$})}else if(H&&x.selected&&Object.prototype.hasOwnProperty.call(ig,le.key)){le.preventDefault();const{ariaLabelConfig:Se}=D.getState();D.setState({ariaLiveMessage:Se["node.a11yDescription.ariaLiveMessage"]({direction:le.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),I({direction:ig[le.key],factor:le.shiftKey?4:1})}}},xe=()=>{var Ve;if(y||!((Ve=$.current)!=null&&Ve.matches(":focus-visible")))return;const{transform:le,width:Se,height:ie,autoPanOnNodeFocus:oe,setCenter:ye}=D.getState();if(!oe)return;e0(new Map([[e,x]]),{x:0,y:0,width:Se,height:ie},le,!0).length>0||ye(x.position.x+z.width/2,x.position.y+z.height/2,{zoom:le[2]})};return o.jsx("div",{className:gr(["react-flow__node",`react-flow__node-${C}`,{[m]:H},x.className,{selected:x.selected,selectable:L,parent:_,draggable:H,dragging:M}]),ref:$,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:R?"all":"none",visibility:W?"visible":"hidden",...x.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:E,onMouseMove:J,onMouseLeave:Z,onContextMenu:U,onClick:pe,onDoubleClick:se,onKeyDown:O?he:void 0,tabIndex:O?0:void 0,onFocus:O?xe:void 0,role:x.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${PA}-${v}`,"aria-label":x.ariaLabel,...x.domAttributes,children:o.jsx(yH,{value:e,children:o.jsx(T,{id:e,data:x.data,type:C,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:x.selected??!1,selectable:L,draggable:H,deletable:x.deletable??!0,isConnectable:F,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:M,dragHandle:x.dragHandle,zIndex:N.z,parentId:x.parentId,...z})})})}var OH=h.memo(MH);const $H=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function FA(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=qt($H,Vn),a=IH(e.onlyRenderVisibleElements),l=RH();return o.jsx("div",{className:"react-flow__nodes",style:iy,children:a.map(u=>o.jsx(OH,{id:u,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},u))})}FA.displayName="NodeRenderer";const DH=h.memo(FA);function FH(e){return qt(h.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&&C3({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),Vn)}const zH=({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"})},HH=({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"})},CN={[Hs.Arrow]:zH,[Hs.ArrowClosed]:HH};function BH(e){const t=Fn();return h.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(CN,e)?CN[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",To.error009(e)),null)},[e])}const WH=({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 u=BH(t);return u?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(u,{color:n,strokeWidth:a})}):null},zA=({defaultColor:e,rfId:t})=>{const n=qt(i=>i.edges),r=qt(i=>i.defaultEdgeOptions),s=h.useMemo(()=>R3(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(WH,{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};zA.displayName="MarkerDefinitions";var VH=h.memo(zA);function HA({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:u,className:d,...p}){const[c,f]=h.useState({x:1,y:0,width:0,height:0}),m=gr(["react-flow__edge-textwrapper",d]),y=h.useRef(null);return h.useEffect(()=>{if(y.current){const v=y.current.getBBox();f({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:m,visibility:c.width?"visible":"hidden",...p,children:[s&&o.jsx("rect",{width:c.width+2*a[0],x:-a[0],y:-a[1],height:c.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:y,style:r,children:n}),u]}):null}HA.displayName="EdgeText";const UH=h.memo(HA);function oy({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:d=20,...p}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...p,d:e,fill:"none",className:gr(["react-flow__edge-path",p.className])}),d?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&Xi(t)&&Xi(n)?o.jsx(UH,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function EN({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Xe.Left||e===Xe.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function BA({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:r,targetY:s,targetPosition:i=Xe.Top}){const[a,l]=EN({pos:n,x1:e,y1:t,x2:r,y2:s}),[u,d]=EN({pos:i,x1:r,y1:s,x2:e,y2:t}),[p,c,f,m]=aA({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${l} ${u},${d} ${r},${s}`,p,c,f,m]}function WA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:k,interactionWidth:g})=>{const[b,x,N]=BA({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),_=e.isInternal?void 0:t;return o.jsx(oy,{id:_,path:b,labelX:x,labelY:N,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:k,interactionWidth:g})})}const KH=WA({isInternal:!1}),VA=WA({isInternal:!0});KH.displayName="SimpleBezierEdge";VA.displayName="SimpleBezierEdgeInternal";function UA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:c,style:f,sourcePosition:m=Xe.Bottom,targetPosition:y=Xe.Top,markerEnd:v,markerStart:k,pathOptions:g,interactionWidth:b})=>{const[x,N,_]=db({sourceX:n,sourceY:r,sourcePosition:m,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}),C=e.isInternal?void 0:t;return o.jsx(oy,{id:C,path:x,labelX:N,labelY:_,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:c,style:f,markerEnd:v,markerStart:k,interactionWidth:b})})}const KA=UA({isInternal:!1}),qA=UA({isInternal:!0});KA.displayName="SmoothStepEdge";qA.displayName="SmoothStepEdgeInternal";function YA(e){return h.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(KA,{...n,id:r,pathOptions:h.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const qH=YA({isInternal:!1}),GA=YA({isInternal:!0});qH.displayName="StepEdge";GA.displayName="StepEdgeInternal";function XA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:c,style:f,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[k,g,b]=uA({sourceX:n,sourceY:r,targetX:s,targetY:i}),x=e.isInternal?void 0:t;return o.jsx(oy,{id:x,path:k,labelX:g,labelY:b,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:c,style:f,markerEnd:m,markerStart:y,interactionWidth:v})})}const YH=XA({isInternal:!1}),JA=XA({isInternal:!0});YH.displayName="StraightEdge";JA.displayName="StraightEdgeInternal";function QA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Xe.Bottom,targetPosition:l=Xe.Top,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:k,pathOptions:g,interactionWidth:b})=>{const[x,N,_]=lA({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:g==null?void 0:g.curvature}),C=e.isInternal?void 0:t;return o.jsx(oy,{id:C,path:x,labelX:N,labelY:_,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:k,interactionWidth:b})})}const GH=QA({isInternal:!1}),ZA=QA({isInternal:!0});GH.displayName="BezierEdge";ZA.displayName="BezierEdgeInternal";const _N={default:ZA,straight:JA,step:GA,smoothstep:qA,simplebezier:VA},PN={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},XH=(e,t,n)=>n===Xe.Left?e-t:n===Xe.Right?e+t:e,JH=(e,t,n)=>n===Xe.Top?e-t:n===Xe.Bottom?e+t:e,AN="react-flow__edgeupdater";function IN({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:gr([AN,`${AN}-${l}`]),cx:XH(t,r,e),cy:JH(n,r,e),r,stroke:"transparent",fill:"transparent"})}function QH({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:u,onReconnect:d,onReconnectStart:p,onReconnectEnd:c,setReconnecting:f,setUpdateHover:m}){const y=Fn(),v=(N,_)=>{if(N.button!==0)return;const{autoPanOnConnect:C,domNode:T,connectionMode:H,connectionRadius:L,lib:F,onConnectStart:O,cancelConnection:D,nodeLookup:W,rfId:$,panBy:M,updateConnection:I}=y.getState(),z=_.type==="target",P=(J,Z)=>{f(!1),c==null||c(J,n,_.type,Z)},R=J=>d==null?void 0:d(n,J),E=(J,Z)=>{f(!0),p==null||p(N,n,_.type),O==null||O(J,Z)};hb.onPointerDown(N.nativeEvent,{autoPanOnConnect:C,connectionMode:H,connectionRadius:L,domNode:T,handleId:_.id,nodeId:_.nodeId,nodeLookup:W,isTarget:z,edgeUpdaterType:_.type,lib:F,flowId:$,cancelConnection:D,panBy:M,isValidConnection:(...J)=>{var Z,U;return((U=(Z=y.getState()).isValidConnection)==null?void 0:U.call(Z,...J))??!0},onConnect:R,onConnectStart:E,onConnectEnd:(...J)=>{var Z,U;return(U=(Z=y.getState()).onConnectEnd)==null?void 0:U.call(Z,...J)},onReconnectEnd:P,updateConnection:I,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},k=N=>v(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=N=>v(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>m(!0),x=()=>m(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(IN,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:k,onMouseEnter:b,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&o.jsx(IN,{position:u,centerX:i,centerY:a,radius:t,onMouseDown:g,onMouseEnter:b,onMouseOut:x,type:"target"})]})}function ZH({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,reconnectRadius:p,onReconnect:c,onReconnectStart:f,onReconnectEnd:m,rfId:y,edgeTypes:v,noPanClassName:k,onError:g,disableKeyboardA11y:b}){let x=qt(ye=>ye.edgeLookup.get(e));const N=qt(ye=>ye.defaultEdgeOptions);x=N?{...N,...x}:x;let _=x.type||"default",C=(v==null?void 0:v[_])||_N[_];C===void 0&&(g==null||g("011",To.error011(_)),_="default",C=(v==null?void 0:v.default)||_N.default);const T=!!(x.focusable||t&&typeof x.focusable>"u"),H=typeof c<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),L=!!(x.selectable||r&&typeof x.selectable>"u"),F=h.useRef(null),[O,D]=h.useState(!1),[W,$]=h.useState(!1),M=Fn(),{zIndex:I,sourceX:z,sourceY:P,targetX:R,targetY:E,sourcePosition:J,targetPosition:Z}=qt(h.useCallback(ye=>{const ke=ye.nodeLookup.get(x.source),Ve=ye.nodeLookup.get(x.target);if(!ke||!Ve)return{zIndex:x.zIndex,...PN};const Je=T3({id:e,sourceNode:ke,targetNode:Ve,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:ye.connectionMode,onError:g});return{zIndex:j3({selected:x.selected,zIndex:x.zIndex,sourceNode:ke,targetNode:Ve,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Je||PN}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),Vn),U=h.useMemo(()=>x.markerStart?`url('#${fb(x.markerStart,y)}')`:void 0,[x.markerStart,y]),se=h.useMemo(()=>x.markerEnd?`url('#${fb(x.markerEnd,y)}')`:void 0,[x.markerEnd,y]);if(x.hidden||z===null||P===null||R===null||E===null)return null;const pe=ye=>{var We;const{addSelectedEdges:ke,unselectNodesAndEdges:Ve,multiSelectionActive:Je}=M.getState();L&&(M.setState({nodesSelectionActive:!1}),x.selected&&Je?(Ve({nodes:[],edges:[x]}),(We=F.current)==null||We.blur()):ke([e])),s&&s(ye,x)},he=i?ye=>{i(ye,{...x})}:void 0,xe=a?ye=>{a(ye,{...x})}:void 0,le=l?ye=>{l(ye,{...x})}:void 0,Se=u?ye=>{u(ye,{...x})}:void 0,ie=d?ye=>{d(ye,{...x})}:void 0,oe=ye=>{var ke;if(!b&&qP.includes(ye.key)&&L){const{unselectNodesAndEdges:Ve,addSelectedEdges:Je}=M.getState();ye.key==="Escape"?((ke=F.current)==null||ke.blur(),Ve({edges:[x]})):Je([e])}};return o.jsx("svg",{style:{zIndex:I},children:o.jsxs("g",{className:gr(["react-flow__edge",`react-flow__edge-${_}`,x.className,k,{selected:x.selected,animated:x.animated,inactive:!L&&!s,updating:O,selectable:L}]),onClick:pe,onDoubleClick:he,onContextMenu:xe,onMouseEnter:le,onMouseMove:Se,onMouseLeave:ie,onKeyDown:T?oe:void 0,tabIndex:T?0:void 0,role:x.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":T?`${AA}-${y}`:void 0,ref:F,...x.domAttributes,children:[!W&&o.jsx(C,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:L,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:z,sourceY:P,targetX:R,targetY:E,sourcePosition:J,targetPosition:Z,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:U,markerEnd:se,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),H&&o.jsx(QH,{edge:x,isReconnectable:H,reconnectRadius:p,onReconnect:c,onReconnectStart:f,onReconnectEnd:m,sourceX:z,sourceY:P,targetX:R,targetY:E,sourcePosition:J,targetPosition:Z,setUpdateHover:D,setReconnecting:$})]})})}var eB=h.memo(ZH);const tB=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function eI({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:p,reconnectRadius:c,onEdgeDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,disableKeyboardA11y:v}){const{edgesFocusable:k,edgesReconnectable:g,elementsSelectable:b,onError:x}=qt(tB,Vn),N=FH(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(VH,{defaultColor:e,rfId:n}),N.map(_=>o.jsx(eB,{id:_,edgesFocusable:k,edgesReconnectable:g,elementsSelectable:b,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,onClick:p,reconnectRadius:c,onDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:v},_))]})}eI.displayName="EdgeRenderer";const nB=h.memo(eI),rB=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function sB({children:e}){const t=qt(rB);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function iB(e){const t=kc(),n=h.useRef(!1);h.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const oB=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function aB(e){const t=qt(oB),n=Fn();return h.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function lB(e){return e.connection.inProgress?{...e.connection,to:kp(e.connection.to,e.transform)}:{...e.connection}}function cB(e){return lB}function uB(e){const t=cB();return qt(t,Vn)}const dB=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function fB({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:u}=qt(dB,Vn);return!(i&&s&&u)?null:o.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:gr(["react-flow__connection",XP(l)]),children:o.jsx(tI,{style:t,type:n,CustomComponent:r,isValid:l})})})}const tI=({style:e,type:t=Ya.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:u,to:d,toNode:p,toHandle:c,toPosition:f,pointer:m}=uB();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:u,toPosition:f,connectionStatus:XP(r),toNode:p,toHandle:c,pointer:m});let y="";const v={sourceX:i.x,sourceY:i.y,sourcePosition:u,targetX:d.x,targetY:d.y,targetPosition:f};switch(t){case Ya.Bezier:[y]=lA(v);break;case Ya.SimpleBezier:[y]=BA(v);break;case Ya.Step:[y]=db({...v,borderRadius:0});break;case Ya.SmoothStep:[y]=db(v);break;default:[y]=uA(v)}return o.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};tI.displayName="ConnectionLine";const pB={};function TN(e=pB){h.useRef(e),Fn(),h.useEffect(()=>{},[e])}function hB(){Fn(),h.useRef(!1),h.useEffect(()=>{},[])}function nI({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,onSelectionContextMenu:c,onSelectionStart:f,onSelectionEnd:m,connectionLineType:y,connectionLineStyle:v,connectionLineComponent:k,connectionLineContainerStyle:g,selectionKeyCode:b,selectionOnDrag:x,selectionMode:N,multiSelectionKeyCode:_,panActivationKeyCode:C,zoomActivationKeyCode:T,deleteKeyCode:H,onlyRenderVisibleElements:L,elementsSelectable:F,defaultViewport:O,translateExtent:D,minZoom:W,maxZoom:$,preventScrolling:M,defaultMarkerColor:I,zoomOnScroll:z,zoomOnPinch:P,panOnScroll:R,panOnScrollSpeed:E,panOnScrollMode:J,zoomOnDoubleClick:Z,panOnDrag:U,onPaneClick:se,onPaneMouseEnter:pe,onPaneMouseMove:he,onPaneMouseLeave:xe,onPaneScroll:le,onPaneContextMenu:Se,paneClickDistance:ie,nodeClickDistance:oe,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ve,onEdgeMouseLeave:Je,reconnectRadius:We,onReconnect:ot,onReconnectStart:ze,onReconnectEnd:mt,noDragClassName:ln,noWheelClassName:zn,noPanClassName:Bt,disableKeyboardA11y:en,nodeExtent:cn,rfId:un,viewport:ue,onViewportChange:Ne}){return TN(e),TN(t),hB(),iB(n),aB(ue),o.jsx(PH,{onPaneClick:se,onPaneMouseEnter:pe,onPaneMouseMove:he,onPaneMouseLeave:xe,onPaneContextMenu:Se,onPaneScroll:le,paneClickDistance:ie,deleteKeyCode:H,selectionKeyCode:b,selectionOnDrag:x,selectionMode:N,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:C,zoomActivationKeyCode:T,elementsSelectable:F,zoomOnScroll:z,zoomOnPinch:P,zoomOnDoubleClick:Z,panOnScroll:R,panOnScrollSpeed:E,panOnScrollMode:J,panOnDrag:U,defaultViewport:O,translateExtent:D,minZoom:W,maxZoom:$,onSelectionContextMenu:c,preventScrolling:M,noDragClassName:ln,noWheelClassName:zn,noPanClassName:Bt,disableKeyboardA11y:en,onViewportChange:Ne,isControlledViewport:!!ue,children:o.jsxs(sB,{children:[o.jsx(nB,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:ot,onReconnectStart:ze,onReconnectEnd:mt,onlyRenderVisibleElements:L,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ve,onEdgeMouseLeave:Je,reconnectRadius:We,defaultMarkerColor:I,noPanClassName:Bt,disableKeyboardA11y:en,rfId:un}),o.jsx(fB,{style:v,type:y,component:k,containerStyle:g}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(DH,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,nodeClickDistance:oe,onlyRenderVisibleElements:L,noPanClassName:Bt,noDragClassName:ln,disableKeyboardA11y:en,nodeExtent:cn,rfId:un}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}nI.displayName="GraphView";const mB=h.memo(nI),RN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:u=.5,maxZoom:d=2,nodeOrigin:p,nodeExtent:c,zIndexMode:f="basic"}={})=>{const m=new Map,y=new Map,v=new Map,k=new Map,g=r??t??[],b=n??e??[],x=p??[0,0],N=c??qf;pA(v,k,g);const{nodesInitialized:_}=pb(b,m,y,{nodeOrigin:x,nodeExtent:N,zIndexMode:f});let C=[0,0,1];if(a&&s&&i){const T=bp(m,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:H,y:L,zoom:F}=t0(T,s,i,u,d,(l==null?void 0:l.padding)??.1);C=[H,L,F]}return{rfId:"1",width:s??0,height:i??0,transform:C,nodes:b,nodesInitialized:_,nodeLookup:m,parentLookup:y,edges:g,edgeLookup:k,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:d,translateExtent:qf,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:zu.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,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:{...GP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:w3,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:YP,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},gB=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:p,nodeExtent:c,zIndexMode:f})=>M5((m,y)=>{async function v(){const{nodeLookup:k,panZoom:g,fitViewOptions:b,fitViewResolver:x,width:N,height:_,minZoom:C,maxZoom:T}=y();g&&(await y3({nodes:k,width:N,height:_,panZoom:g,minZoom:C,maxZoom:T},b),x==null||x.resolve(!0),m({fitViewResolver:null}))}return{...RN({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:p,nodeExtent:c,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:k=>{const{nodeLookup:g,parentLookup:b,nodeOrigin:x,elevateNodesOnSelect:N,fitViewQueued:_,zIndexMode:C,nodesSelectionActive:T}=y(),{nodesInitialized:H,hasSelectedNodes:L}=pb(k,g,b,{nodeOrigin:x,nodeExtent:c,elevateNodesOnSelect:N,checkEquality:!0,zIndexMode:C}),F=T&&L;_&&H?(v(),m({nodes:k,nodesInitialized:H,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:F})):m({nodes:k,nodesInitialized:H,nodesSelectionActive:F})},setEdges:k=>{const{connectionLookup:g,edgeLookup:b}=y();pA(g,b,k),m({edges:k})},setDefaultNodesAndEdges:(k,g)=>{if(k){const{setNodes:b}=y();b(k),m({hasDefaultNodes:!0})}if(g){const{setEdges:b}=y();b(g),m({hasDefaultEdges:!0})}},updateNodeInternals:k=>{const{triggerNodeChanges:g,nodeLookup:b,parentLookup:x,domNode:N,nodeOrigin:_,nodeExtent:C,debug:T,fitViewQueued:H,zIndexMode:L}=y(),{changes:F,updatedInternals:O}=z3(k,b,x,N,_,C,L);O&&(O3(b,x,{nodeOrigin:_,nodeExtent:C,zIndexMode:L}),H?(v(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(F==null?void 0:F.length)>0&&(T&&console.log("React Flow: trigger node changes",F),g==null||g(F)))},updateNodePositions:(k,g=!1)=>{const b=[];let x=[];const{nodeLookup:N,triggerNodeChanges:_,connection:C,updateConnection:T,onNodesChangeMiddlewareMap:H}=y();for(const[L,F]of k){const O=N.get(L),D=!!(O!=null&&O.expandParent&&(O!=null&&O.parentId)&&(F!=null&&F.position)),W={id:L,type:"position",position:D?{x:Math.max(0,F.position.x),y:Math.max(0,F.position.y)}:F.position,dragging:g};if(O&&C.inProgress&&C.fromNode.id===O.id){const $=yc(O,C.fromHandle,Xe.Left,!0);T({...C,from:$})}D&&O.parentId&&b.push({id:L,parentId:O.parentId,rect:{...F.internals.positionAbsolute,width:F.measured.width??0,height:F.measured.height??0}}),x.push(W)}if(b.length>0){const{parentLookup:L,nodeOrigin:F}=y(),O=a0(b,N,L,F);x.push(...O)}for(const L of H.values())x=L(x);_(x)},triggerNodeChanges:k=>{const{onNodesChange:g,setNodes:b,nodes:x,hasDefaultNodes:N,debug:_}=y();if(k!=null&&k.length){if(N){const C=sg(k,x);b(C)}_&&console.log("React Flow: trigger node changes",k),g==null||g(k)}},triggerEdgeChanges:k=>{const{onEdgesChange:g,setEdges:b,edges:x,hasDefaultEdges:N,debug:_}=y();if(k!=null&&k.length){if(N){const C=l0(k,x);b(C)}_&&console.log("React Flow: trigger edge changes",k),g==null||g(k)}},addSelectedNodes:k=>{const{multiSelectionActive:g,edgeLookup:b,nodeLookup:x,triggerNodeChanges:N,triggerEdgeChanges:_}=y();if(g){const C=k.map(T=>Yl(T,!0));N(C);return}N(mu(x,new Set([...k]),!0)),_(mu(b))},addSelectedEdges:k=>{const{multiSelectionActive:g,edgeLookup:b,nodeLookup:x,triggerNodeChanges:N,triggerEdgeChanges:_}=y();if(g){const C=k.map(T=>Yl(T,!0));_(C);return}_(mu(b,new Set([...k]))),N(mu(x,new Set,!0))},unselectNodesAndEdges:({nodes:k,edges:g}={})=>{const{edges:b,nodes:x,nodeLookup:N,triggerNodeChanges:_,triggerEdgeChanges:C}=y(),T=k||x,H=g||b,L=[];for(const O of T){if(!O.selected)continue;const D=N.get(O.id);D&&(D.selected=!1),L.push(Yl(O.id,!1))}const F=[];for(const O of H)O.selected&&F.push(Yl(O.id,!1));_(L),C(F)},setMinZoom:k=>{const{panZoom:g,maxZoom:b}=y();g==null||g.setScaleExtent([k,b]),m({minZoom:k})},setMaxZoom:k=>{const{panZoom:g,minZoom:b}=y();g==null||g.setScaleExtent([b,k]),m({maxZoom:k})},setTranslateExtent:k=>{var g;(g=y().panZoom)==null||g.setTranslateExtent(k),m({translateExtent:k})},resetSelectedElements:()=>{const{edges:k,nodes:g,triggerNodeChanges:b,triggerEdgeChanges:x,elementsSelectable:N}=y();if(!N)return;const _=g.reduce((T,H)=>H.selected?[...T,Yl(H.id,!1)]:T,[]),C=k.reduce((T,H)=>H.selected?[...T,Yl(H.id,!1)]:T,[]);b(_),x(C)},setNodeExtent:k=>{const{nodes:g,nodeLookup:b,parentLookup:x,nodeOrigin:N,elevateNodesOnSelect:_,nodeExtent:C,zIndexMode:T}=y();k[0][0]===C[0][0]&&k[0][1]===C[0][1]&&k[1][0]===C[1][0]&&k[1][1]===C[1][1]||(pb(g,b,x,{nodeOrigin:N,nodeExtent:k,elevateNodesOnSelect:_,checkEquality:!1,zIndexMode:T}),m({nodeExtent:k}))},panBy:k=>{const{transform:g,width:b,height:x,panZoom:N,translateExtent:_}=y();return H3({delta:k,panZoom:N,transform:g,translateExtent:_,width:b,height:x})},setCenter:async(k,g,b)=>{const{width:x,height:N,maxZoom:_,panZoom:C}=y();if(!C)return Promise.resolve(!1);const T=typeof(b==null?void 0:b.zoom)<"u"?b.zoom:_;return await C.setViewport({x:x/2-k*T,y:N/2-g*T,zoom:T},{duration:b==null?void 0:b.duration,ease:b==null?void 0:b.ease,interpolate:b==null?void 0:b.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{m({connection:{...GP}})},updateConnection:k=>{m({connection:k})},reset:()=>m({...RN()})}},Object.is);function ay({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:u,fitView:d,nodeOrigin:p,nodeExtent:c,zIndexMode:f,children:m}){const[y]=h.useState(()=>gB({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:d,minZoom:a,maxZoom:l,fitViewOptions:u,nodeOrigin:p,nodeExtent:c,zIndexMode:f}));return o.jsx(O5,{value:y,children:o.jsx(sH,{children:m})})}function yB({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:p,nodeOrigin:c,nodeExtent:f,zIndexMode:m}){return h.useContext(sy)?o.jsx(o.Fragment,{children:e}):o.jsx(ay,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:p,nodeOrigin:c,nodeExtent:f,zIndexMode:m,children:e})}const xB={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function wB({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:u,onInit:d,onMove:p,onMoveStart:c,onMoveEnd:f,onConnect:m,onConnectStart:y,onConnectEnd:v,onClickConnectStart:k,onClickConnectEnd:g,onNodeMouseEnter:b,onNodeMouseMove:x,onNodeMouseLeave:N,onNodeContextMenu:_,onNodeDoubleClick:C,onNodeDragStart:T,onNodeDrag:H,onNodeDragStop:L,onNodesDelete:F,onEdgesDelete:O,onDelete:D,onSelectionChange:W,onSelectionDragStart:$,onSelectionDrag:M,onSelectionDragStop:I,onSelectionContextMenu:z,onSelectionStart:P,onSelectionEnd:R,onBeforeDelete:E,connectionMode:J,connectionLineType:Z=Ya.Bezier,connectionLineStyle:U,connectionLineComponent:se,connectionLineContainerStyle:pe,deleteKeyCode:he="Backspace",selectionKeyCode:xe="Shift",selectionOnDrag:le=!1,selectionMode:Se=Yf.Full,panActivationKeyCode:ie="Space",multiSelectionKeyCode:oe=Xf()?"Meta":"Control",zoomActivationKeyCode:ye=Xf()?"Meta":"Control",snapToGrid:ke,snapGrid:Ve,onlyRenderVisibleElements:Je=!1,selectNodesOnDrag:We,nodesDraggable:ot,autoPanOnNodeFocus:ze,nodesConnectable:mt,nodesFocusable:ln,nodeOrigin:zn=IA,edgesFocusable:Bt,edgesReconnectable:en,elementsSelectable:cn=!0,defaultViewport:un=G5,minZoom:ue=.5,maxZoom:Ne=2,translateExtent:He=qf,preventScrolling:nt=!0,nodeExtent:et,defaultMarkerColor:_t="#b1b1b7",zoomOnScroll:st=!0,zoomOnPinch:dn=!0,panOnScroll:on=!1,panOnScrollSpeed:Un=.5,panOnScrollMode:fn=ic.Free,zoomOnDoubleClick:Tn=!0,panOnDrag:Kn=!0,onPaneClick:Nr,onPaneMouseEnter:we,onPaneMouseMove:Me,onPaneMouseLeave:ct,onPaneScroll:vt,onPaneContextMenu:ae,paneClickDistance:Le=1,nodeClickDistance:rt=0,children:Tt,onReconnect:Wt,onReconnectStart:Zn,onReconnectEnd:ds,onEdgeContextMenu:Us,onEdgeDoubleClick:Yr,onEdgeMouseEnter:fs,onEdgeMouseMove:qn,onEdgeMouseLeave:cr,reconnectRadius:Ks=10,onNodesChange:ft,onEdgesChange:Lr,noDragClassName:$o="nodrag",noWheelClassName:Fe="nowheel",noPanClassName:Mt="nopan",fitView:ur,fitViewOptions:lt,connectOnClick:Mr,attributionPosition:jr,proOptions:Te,defaultEdgeOptions:ps,elevateNodesOnSelect:Yn=!0,elevateEdgesOnSelect:qs=!1,disableKeyboardA11y:ut=!1,autoPanOnConnect:Xt,autoPanOnNodeDrag:Jt,autoPanSpeed:Cr,connectionRadius:tt,isValidConnection:hs,onError:Do,style:js,id:Fo,nodeDragThreshold:ms,connectionDragThreshold:zo,viewport:dr,onViewportChange:jn,width:Ys,height:Ri,colorMode:sr="light",debug:Gr,onScroll:Or,ariaLabelConfig:Ho,zIndexMode:K="basic",...me},De){const Ie=Fo||"1",Ze=Z5(sr),Yt=h.useCallback(Ct=>{Ct.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Or==null||Or(Ct)},[Or]);return o.jsx("div",{"data-testid":"rf__wrapper",...me,onScroll:Yt,style:{...js,...xB},ref:De,className:gr(["react-flow",s,Ze]),id:Fo,role:"application",children:o.jsxs(yB,{nodes:e,edges:t,width:Ys,height:Ri,fitView:ur,fitViewOptions:lt,minZoom:ue,maxZoom:Ne,nodeOrigin:zn,nodeExtent:et,zIndexMode:K,children:[o.jsx(Q5,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:y,onConnectEnd:v,onClickConnectStart:k,onClickConnectEnd:g,nodesDraggable:ot,autoPanOnNodeFocus:ze,nodesConnectable:mt,nodesFocusable:ln,edgesFocusable:Bt,edgesReconnectable:en,elementsSelectable:cn,elevateNodesOnSelect:Yn,elevateEdgesOnSelect:qs,minZoom:ue,maxZoom:Ne,nodeExtent:et,onNodesChange:ft,onEdgesChange:Lr,snapToGrid:ke,snapGrid:Ve,connectionMode:J,translateExtent:He,connectOnClick:Mr,defaultEdgeOptions:ps,fitView:ur,fitViewOptions:lt,onNodesDelete:F,onEdgesDelete:O,onDelete:D,onNodeDragStart:T,onNodeDrag:H,onNodeDragStop:L,onSelectionDrag:M,onSelectionDragStart:$,onSelectionDragStop:I,onMove:p,onMoveStart:c,onMoveEnd:f,noPanClassName:Mt,nodeOrigin:zn,rfId:Ie,autoPanOnConnect:Xt,autoPanOnNodeDrag:Jt,autoPanSpeed:Cr,onError:Do,connectionRadius:tt,isValidConnection:hs,selectNodesOnDrag:We,nodeDragThreshold:ms,connectionDragThreshold:zo,onBeforeDelete:E,debug:Gr,ariaLabelConfig:Ho,zIndexMode:K}),o.jsx(mB,{onInit:d,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:b,onNodeMouseMove:x,onNodeMouseLeave:N,onNodeContextMenu:_,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:a,connectionLineType:Z,connectionLineStyle:U,connectionLineComponent:se,connectionLineContainerStyle:pe,selectionKeyCode:xe,selectionOnDrag:le,selectionMode:Se,deleteKeyCode:he,multiSelectionKeyCode:oe,panActivationKeyCode:ie,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Je,defaultViewport:un,translateExtent:He,minZoom:ue,maxZoom:Ne,preventScrolling:nt,zoomOnScroll:st,zoomOnPinch:dn,zoomOnDoubleClick:Tn,panOnScroll:on,panOnScrollSpeed:Un,panOnScrollMode:fn,panOnDrag:Kn,onPaneClick:Nr,onPaneMouseEnter:we,onPaneMouseMove:Me,onPaneMouseLeave:ct,onPaneScroll:vt,onPaneContextMenu:ae,paneClickDistance:Le,nodeClickDistance:rt,onSelectionContextMenu:z,onSelectionStart:P,onSelectionEnd:R,onReconnect:Wt,onReconnectStart:Zn,onReconnectEnd:ds,onEdgeContextMenu:Us,onEdgeDoubleClick:Yr,onEdgeMouseEnter:fs,onEdgeMouseMove:qn,onEdgeMouseLeave:cr,reconnectRadius:Ks,defaultMarkerColor:_t,noDragClassName:$o,noWheelClassName:Fe,noPanClassName:Mt,rfId:Ie,disableKeyboardA11y:ut,nodeExtent:et,viewport:dr,onViewportChange:jn}),o.jsx(Y5,{onSelectionChange:W}),Tt,o.jsx(W5,{proOptions:Te,position:jr}),o.jsx(B5,{rfId:Ie,disableKeyboardA11y:ut})]})})}var u0=RA(wB);function d0(){const e=Fn();return h.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 rI(e){const[t,n]=h.useState(e),r=h.useCallback(s=>n(i=>sg(s,i)),[]);return[t,n,r]}function sI(e){const[t,n]=h.useState(e),r=h.useCallback(s=>n(i=>l0(s,i)),[]);return[t,n,r]}function bB({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:gr(["react-flow__background-pattern",n,r])})}function vB({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:gr(["react-flow__background-pattern","dots",t])})}var ll;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ll||(ll={}));const kB={[ll.Dots]:1,[ll.Lines]:1,[ll.Cross]:6},SB=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function iI({id:e,variant:t=ll.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:u,className:d,patternClassName:p}){const c=h.useRef(null),{transform:f,patternId:m}=qt(SB,Vn),y=r||kB[t],v=t===ll.Dots,k=t===ll.Cross,g=Array.isArray(n)?n:[n,n],b=[g[0]*f[2]||1,g[1]*f[2]||1],x=y*f[2],N=Array.isArray(i)?i:[i,i],_=k?[x,x]:b,C=[N[0]*f[2]||1+_[0]/2,N[1]*f[2]||1+_[1]/2],T=`${m}${e||""}`;return o.jsxs("svg",{className:gr(["react-flow__background",d]),style:{...u,...iy,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:c,"data-testid":"rf__background",children:[o.jsx("pattern",{id:T,x:f[0]%b[0],y:f[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:v?o.jsx(vB,{radius:x/2,className:p}):o.jsx(bB,{dimensions:_,lineWidth:s,variant:t,className:p})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}iI.displayName="Background";const f0=h.memo(iI);function NB(){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 jB(){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 CB(){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 EB(){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 _B(){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 Mh({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:gr(["react-flow__controls-button",t]),...n,children:e})}const PB=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function oI({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:u,className:d,children:p,position:c="bottom-left",orientation:f="vertical","aria-label":m}){const y=Fn(),{isInteractive:v,minZoomReached:k,maxZoomReached:g,ariaLabelConfig:b}=qt(PB,Vn),{zoomIn:x,zoomOut:N,fitView:_}=kc(),C=()=>{x(),i==null||i()},T=()=>{N(),a==null||a()},H=()=>{_(s),l==null||l()},L=()=>{y.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),u==null||u(!v)},F=f==="horizontal"?"horizontal":"vertical";return o.jsxs(Ku,{className:gr(["react-flow__controls",F,d]),position:c,style:e,"data-testid":"rf__controls","aria-label":m??b["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(Mh,{onClick:C,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:g,children:o.jsx(NB,{})}),o.jsx(Mh,{onClick:T,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:k,children:o.jsx(jB,{})})]}),n&&o.jsx(Mh,{className:"react-flow__controls-fitview",onClick:H,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:o.jsx(CB,{})}),r&&o.jsx(Mh,{className:"react-flow__controls-interactive",onClick:L,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:v?o.jsx(_B,{}):o.jsx(EB,{})}),p]})}oI.displayName="Controls";const AB=h.memo(oI);function IB({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:u,className:d,borderRadius:p,shapeRendering:c,selected:f,onClick:m}){const{background:y,backgroundColor:v}=i||{},k=a||y||v;return o.jsx("rect",{className:gr(["react-flow__minimap-node",{selected:f},d]),x:t,y:n,rx:p,ry:p,width:r,height:s,style:{fill:k,stroke:l,strokeWidth:u},shapeRendering:c,onClick:m?g=>m(g,e):void 0})}const TB=h.memo(IB),RB=e=>e.nodes.map(t=>t.id),xx=e=>e instanceof Function?e:()=>e;function LB({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=TB,onClick:a}){const l=qt(RB,Vn),u=xx(t),d=xx(e),p=xx(n),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(f=>o.jsx(OB,{id:f,nodeColorFunc:u,nodeStrokeColorFunc:d,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:c},f))})}function MB({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:u}){const{node:d,x:p,y:c,width:f,height:m}=qt(y=>{const v=y.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const k=v.internals.userNode,{x:g,y:b}=v.internals.positionAbsolute,{width:x,height:N}=ka(k);return{node:k,x:g,y:b,width:x,height:N}},Vn);return!d||d.hidden||!nA(d)?null:o.jsx(l,{x:p,y:c,width:f,height:m,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:s,strokeColor:n(d),strokeWidth:i,shapeRendering:a,onClick:u,id:d.id})}const OB=h.memo(MB);var $B=h.memo(LB);const DB=200,FB=150,zB=e=>!e.hidden,HB=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?tA(bp(e.nodeLookup,{filter:zB}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},BB="react-flow__minimap-desc";function aI({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:u,maskColor:d,maskStrokeColor:p,maskStrokeWidth:c,position:f="bottom-right",onClick:m,onNodeClick:y,pannable:v=!1,zoomable:k=!1,ariaLabel:g,inversePan:b,zoomStep:x=1,offsetScale:N=5}){const _=Fn(),C=h.useRef(null),{boundingRect:T,viewBB:H,rfId:L,panZoom:F,translateExtent:O,flowWidth:D,flowHeight:W,ariaLabelConfig:$}=qt(HB,Vn),M=(e==null?void 0:e.width)??DB,I=(e==null?void 0:e.height)??FB,z=T.width/M,P=T.height/I,R=Math.max(z,P),E=R*M,J=R*I,Z=N*R,U=T.x-(E-T.width)/2-Z,se=T.y-(J-T.height)/2-Z,pe=E+Z*2,he=J+Z*2,xe=`${BB}-${L}`,le=h.useRef(0),Se=h.useRef();le.current=R,h.useEffect(()=>{if(C.current&&F)return Se.current=X3({domNode:C.current,panZoom:F,getTransform:()=>_.getState().transform,getViewScale:()=>le.current}),()=>{var ke;(ke=Se.current)==null||ke.destroy()}},[F]),h.useEffect(()=>{var ke;(ke=Se.current)==null||ke.update({translateExtent:O,width:D,height:W,inversePan:b,pannable:v,zoomStep:x,zoomable:k})},[v,k,b,x,O,D,W]);const ie=m?ke=>{var We;const[Ve,Je]=((We=Se.current)==null?void 0:We.pointer(ke))||[0,0];m(ke,{x:Ve,y:Je})}:void 0,oe=y?h.useCallback((ke,Ve)=>{const Je=_.getState().nodeLookup.get(Ve).internals.userNode;y(ke,Je)},[]):void 0,ye=g??$["minimap.ariaLabel"];return o.jsx(Ku,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*R: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:gr(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:M,height:I,viewBox:`${U} ${se} ${pe} ${he}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":xe,ref:C,onClick:ie,children:[ye&&o.jsx("title",{id:xe,children:ye}),o.jsx($B,{onClick:oe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-Z},${se-Z}h${pe+Z*2}v${he+Z*2}h${-pe-Z*2}z
|
|
66
|
+
M${H.x},${H.y}h${H.width}v${H.height}h${-H.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}aI.displayName="MiniMap";const WB=h.memo(aI),VB=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,UB={[Vu.Line]:"right",[Vu.Handle]:"bottom-right"};function KB({nodeId:e,position:t,variant:n=Vu.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:f,autoScale:m=!0,shouldResize:y,onResizeStart:v,onResize:k,onResizeEnd:g}){const b=$A(),x=typeof e=="string"?e:b,N=Fn(),_=h.useRef(null),C=n===Vu.Handle,T=qt(h.useCallback(VB(C&&m),[C,m]),Vn),H=h.useRef(null),L=t??UB[n];h.useEffect(()=>{if(!(!_.current||!x))return H.current||(H.current=u5({domNode:_.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:O,transform:D,snapGrid:W,snapToGrid:$,nodeOrigin:M,domNode:I}=N.getState();return{nodeLookup:O,transform:D,snapGrid:W,snapToGrid:$,nodeOrigin:M,paneDomNode:I}},onChange:(O,D)=>{const{triggerNodeChanges:W,nodeLookup:$,parentLookup:M,nodeOrigin:I}=N.getState(),z=[],P={x:O.x,y:O.y},R=$.get(x);if(R&&R.expandParent&&R.parentId){const E=R.origin??I,J=O.width??R.measured.width??0,Z=O.height??R.measured.height??0,U={id:R.id,parentId:R.parentId,rect:{width:J,height:Z,...rA({x:O.x??R.position.x,y:O.y??R.position.y},{width:J,height:Z},R.parentId,$,E)}},se=a0([U],$,M,I);z.push(...se),P.x=O.x?Math.max(E[0]*J,O.x):void 0,P.y=O.y?Math.max(E[1]*Z,O.y):void 0}if(P.x!==void 0&&P.y!==void 0){const E={id:x,type:"position",position:{...P}};z.push(E)}if(O.width!==void 0&&O.height!==void 0){const J={id:x,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};z.push(J)}for(const E of D){const J={...E,type:"position"};z.push(J)}W(z)},onEnd:({width:O,height:D})=>{const W={id:x,type:"dimensions",resizing:!1,dimensions:{width:O,height:D}};N.getState().triggerNodeChanges([W])}})),H.current.update({controlPosition:L,boundaries:{minWidth:l,minHeight:u,maxWidth:d,maxHeight:p},keepAspectRatio:c,resizeDirection:f,onResizeStart:v,onResize:k,onResizeEnd:g,shouldResize:y}),()=>{var O;(O=H.current)==null||O.destroy()}},[L,l,u,d,p,c,v,k,g,y]);const F=L.split("-");return o.jsx("div",{className:gr(["react-flow__resize-control","nodrag",...F,n,r]),ref:_,style:{...s,scale:T,...a&&{[C?"backgroundColor":"borderColor"]:a}},children:i})}const lI=h.memo(KB);function qB(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const YB=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GB=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XB={};function LN(e,t){return(XB.jsx?GB:YB).test(e)}const JB=/[ \t\n\f\r]/g;function QB(e){return typeof e=="object"?e.type==="text"?MN(e.value):!1:MN(e)}function MN(e){return e.replace(JB,"")===""}let Sp=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Sp.prototype.normal={};Sp.prototype.property={};Sp.prototype.space=void 0;function cI(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Sp(n,r,t)}function yb(e){return e.toLowerCase()}class Vs{constructor(t,n){this.attribute=n,this.property=t}}Vs.prototype.attribute="";Vs.prototype.booleanish=!1;Vs.prototype.boolean=!1;Vs.prototype.commaOrSpaceSeparated=!1;Vs.prototype.commaSeparated=!1;Vs.prototype.defined=!1;Vs.prototype.mustUseProperty=!1;Vs.prototype.number=!1;Vs.prototype.overloadedBoolean=!1;Vs.prototype.property="";Vs.prototype.spaceSeparated=!1;Vs.prototype.space=void 0;let ZB=0;const Rt=Sc(),pr=Sc(),xb=Sc(),Ae=Sc(),_n=Sc(),Eu=Sc(),Zs=Sc();function Sc(){return 2**++ZB}const wb=Object.freeze(Object.defineProperty({__proto__:null,boolean:Rt,booleanish:pr,commaOrSpaceSeparated:Zs,commaSeparated:Eu,number:Ae,overloadedBoolean:xb,spaceSeparated:_n},Symbol.toStringTag,{value:"Module"})),wx=Object.keys(wb);class p0 extends Vs{constructor(t,n,r,s){let i=-1;if(super(t,n),ON(this,"space",s),typeof r=="number")for(;++i<wx.length;){const a=wx[i];ON(this,wx[i],(r&wb[a])===wb[a])}}}p0.prototype.defined=!0;function ON(e,t,n){n&&(e[t]=n)}function rd(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new p0(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[yb(r)]=r,n[yb(i.attribute)]=r}return new Sp(t,n,e.space)}const uI=rd({properties:{ariaActiveDescendant:null,ariaAtomic:pr,ariaAutoComplete:null,ariaBusy:pr,ariaChecked:pr,ariaColCount:Ae,ariaColIndex:Ae,ariaColSpan:Ae,ariaControls:_n,ariaCurrent:null,ariaDescribedBy:_n,ariaDetails:null,ariaDisabled:pr,ariaDropEffect:_n,ariaErrorMessage:null,ariaExpanded:pr,ariaFlowTo:_n,ariaGrabbed:pr,ariaHasPopup:null,ariaHidden:pr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_n,ariaLevel:Ae,ariaLive:null,ariaModal:pr,ariaMultiLine:pr,ariaMultiSelectable:pr,ariaOrientation:null,ariaOwns:_n,ariaPlaceholder:null,ariaPosInSet:Ae,ariaPressed:pr,ariaReadOnly:pr,ariaRelevant:null,ariaRequired:pr,ariaRoleDescription:_n,ariaRowCount:Ae,ariaRowIndex:Ae,ariaRowSpan:Ae,ariaSelected:pr,ariaSetSize:Ae,ariaSort:null,ariaValueMax:Ae,ariaValueMin:Ae,ariaValueNow:Ae,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function dI(e,t){return t in e?e[t]:t}function fI(e,t){return dI(e,t.toLowerCase())}const e4=rd({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Eu,acceptCharset:_n,accessKey:_n,action:null,allow:null,allowFullScreen:Rt,allowPaymentRequest:Rt,allowUserMedia:Rt,alt:null,as:null,async:Rt,autoCapitalize:null,autoComplete:_n,autoFocus:Rt,autoPlay:Rt,blocking:_n,capture:null,charSet:null,checked:Rt,cite:null,className:_n,cols:Ae,colSpan:null,content:null,contentEditable:pr,controls:Rt,controlsList:_n,coords:Ae|Eu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Rt,defer:Rt,dir:null,dirName:null,disabled:Rt,download:xb,draggable:pr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Rt,formTarget:null,headers:_n,height:Ae,hidden:xb,high:Ae,href:null,hrefLang:null,htmlFor:_n,httpEquiv:_n,id:null,imageSizes:null,imageSrcSet:null,inert:Rt,inputMode:null,integrity:null,is:null,isMap:Rt,itemId:null,itemProp:_n,itemRef:_n,itemScope:Rt,itemType:_n,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Rt,low:Ae,manifest:null,max:null,maxLength:Ae,media:null,method:null,min:null,minLength:Ae,multiple:Rt,muted:Rt,name:null,nonce:null,noModule:Rt,noValidate:Rt,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:Rt,optimum:Ae,pattern:null,ping:_n,placeholder:null,playsInline:Rt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Rt,referrerPolicy:null,rel:_n,required:Rt,reversed:Rt,rows:Ae,rowSpan:Ae,sandbox:_n,scope:null,scoped:Rt,seamless:Rt,selected:Rt,shadowRootClonable:Rt,shadowRootDelegatesFocus:Rt,shadowRootMode:null,shape:null,size:Ae,sizes:null,slot:null,span:Ae,spellCheck:pr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ae,step:null,style:null,tabIndex:Ae,target:null,title:null,translate:null,type:null,typeMustMatch:Rt,useMap:null,value:pr,width:Ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_n,axis:null,background:null,bgColor:null,border:Ae,borderColor:null,bottomMargin:Ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Rt,declare:Rt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ae,leftMargin:Ae,link:null,longDesc:null,lowSrc:null,marginHeight:Ae,marginWidth:Ae,noResize:Rt,noHref:Rt,noShade:Rt,noWrap:Rt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ae,rules:null,scheme:null,scrolling:pr,standby:null,summary:null,text:null,topMargin:Ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ae,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Rt,disableRemotePlayback:Rt,prefix:null,property:null,results:Ae,security:null,unselectable:null},space:"html",transform:fI}),t4=rd({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:Zs,accentHeight:Ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ae,amplitude:Ae,arabicForm:null,ascent:Ae,attributeName:null,attributeType:null,azimuth:Ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ae,by:null,calcMode:null,capHeight:Ae,className:_n,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:Ae,diffuseConstant:Ae,direction:null,display:null,dur:null,divisor:Ae,dominantBaseline:null,download:Rt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ae,enableBackground:null,end:null,event:null,exponent:Ae,externalResourcesRequired:null,fill:null,fillOpacity:Ae,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:Eu,g2:Eu,glyphName:Eu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ae,horizOriginX:Ae,horizOriginY:Ae,id:null,ideographic:Ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ae,k:Ae,k1:Ae,k2:Ae,k3:Ae,k4:Ae,kernelMatrix:Zs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ae,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:Ae,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:Ae,overlineThickness:Ae,paintOrder:null,panose1:null,path:null,pathLength:Ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_n,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ae,pointsAtY:Ae,pointsAtZ:Ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Zs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Zs,rev:Zs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Zs,requiredFeatures:Zs,requiredFonts:Zs,requiredFormats:Zs,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:Ae,specularExponent:Ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ae,strikethroughThickness:Ae,string:null,stroke:null,strokeDashArray:Zs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ae,strokeOpacity:Ae,strokeWidth:null,style:null,surfaceScale:Ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zs,tabIndex:Ae,tableValues:null,target:null,targetX:Ae,targetY:Ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Zs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ae,underlineThickness:Ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ae,values:null,vAlphabetic:Ae,vMathematical:Ae,vectorEffect:null,vHanging:Ae,vIdeographic:Ae,version:null,vertAdvY:Ae,vertOriginX:Ae,vertOriginY:Ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:dI}),pI=rd({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()}}),hI=rd({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:fI}),mI=rd({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),n4={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"},r4=/[A-Z]/g,$N=/-[a-z]/g,s4=/^data[-\w.:]+$/i;function i4(e,t){const n=yb(t);let r=t,s=Vs;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&s4.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace($N,a4);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!$N.test(i)){let a=i.replace(r4,o4);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=p0}return new s(r,t)}function o4(e){return"-"+e.toLowerCase()}function a4(e){return e.charAt(1).toUpperCase()}const l4=cI([uI,e4,pI,hI,mI],"html"),h0=cI([uI,t4,pI,hI,mI],"svg");function c4(e){return e.join(" ").trim()}var m0={},DN=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,u4=/\n/g,d4=/^\s*/,f4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,p4=/^:\s*/,h4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,m4=/^[;\s]*/,g4=/^\s+|\s+$/g,y4=`
|
|
67
|
+
`,FN="/",zN="*",Xl="",x4="comment",w4="declaration";function b4(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 v=y.match(u4);v&&(n+=v.length);var k=y.lastIndexOf(y4);r=~k?y.length-k:r+y.length}function i(){var y={line:n,column:r};return function(v){return v.position=new a(y),d(),v}}function a(y){this.start=y,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(y){var v=new Error(t.source+":"+n+":"+r+": "+y);if(v.reason=y,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function u(y){var v=y.exec(e);if(v){var k=v[0];return s(k),e=e.slice(k.length),v}}function d(){u(d4)}function p(y){var v;for(y=y||[];v=c();)v!==!1&&y.push(v);return y}function c(){var y=i();if(!(FN!=e.charAt(0)||zN!=e.charAt(1))){for(var v=2;Xl!=e.charAt(v)&&(zN!=e.charAt(v)||FN!=e.charAt(v+1));)++v;if(v+=2,Xl===e.charAt(v-1))return l("End of comment missing");var k=e.slice(2,v-2);return r+=2,s(k),e=e.slice(v),r+=2,y({type:x4,comment:k})}}function f(){var y=i(),v=u(f4);if(v){if(c(),!u(p4))return l("property missing ':'");var k=u(h4),g=y({type:w4,property:HN(v[0].replace(DN,Xl)),value:k?HN(k[0].replace(DN,Xl)):Xl});return u(m4),g}}function m(){var y=[];p(y);for(var v;v=f();)v!==!1&&(y.push(v),p(y));return y}return d(),m()}function HN(e){return e?e.replace(g4,Xl):Xl}var v4=b4,k4=Nf&&Nf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m0,"__esModule",{value:!0});m0.default=N4;const S4=k4(v4);function N4(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,S4.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 ly={};Object.defineProperty(ly,"__esModule",{value:!0});ly.camelCase=void 0;var j4=/^--[a-zA-Z0-9_-]+$/,C4=/-([a-z])/g,E4=/^[^-]+$/,_4=/^-(webkit|moz|ms|o|khtml)-/,P4=/^-(ms)-/,A4=function(e){return!e||E4.test(e)||j4.test(e)},I4=function(e,t){return t.toUpperCase()},BN=function(e,t){return"".concat(t,"-")},T4=function(e,t){return t===void 0&&(t={}),A4(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(P4,BN):e=e.replace(_4,BN),e.replace(C4,I4))};ly.camelCase=T4;var R4=Nf&&Nf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},L4=R4(m0),M4=ly;function bb(e,t){var n={};return!e||typeof e!="string"||(0,L4.default)(e,function(r,s){r&&s&&(n[(0,M4.camelCase)(r,t)]=s)}),n}bb.default=bb;var O4=bb;const $4=xl(O4),gI=yI("end"),g0=yI("start");function yI(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 D4(e){const t=g0(e),n=gI(e);if(t&&n)return{start:t,end:n}}function xf(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?WN(e.position):"start"in e||"end"in e?WN(e):"line"in e||"column"in e?vb(e):""}function vb(e){return VN(e&&e.line)+":"+VN(e&&e.column)}function WN(e){return vb(e&&e.start)+"-"+vb(e&&e.end)}function VN(e){return e&&typeof e=="number"?e:1}class cs 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 u=r.indexOf(":");u===-1?i.ruleId=r:(i.source=r.slice(0,u),i.ruleId=r.slice(u+1))}if(!i.place&&i.ancestors&&i.ancestors){const u=i.ancestors[i.ancestors.length-1];u&&(i.place=u.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=xf(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}}cs.prototype.file="";cs.prototype.name="";cs.prototype.reason="";cs.prototype.message="";cs.prototype.stack="";cs.prototype.column=void 0;cs.prototype.line=void 0;cs.prototype.ancestors=void 0;cs.prototype.cause=void 0;cs.prototype.fatal=void 0;cs.prototype.place=void 0;cs.prototype.ruleId=void 0;cs.prototype.source=void 0;const y0={}.hasOwnProperty,F4=new Map,z4=/[A-Z]/g,H4=new Set(["table","tbody","thead","tfoot","tr"]),B4=new Set(["td","th"]),xI="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function W4(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=J4(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=X4(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"?h0:l4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=wI(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function wI(e,t,n){if(t.type==="element")return V4(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return U4(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return q4(e,t,n);if(t.type==="mdxjsEsm")return K4(e,t);if(t.type==="root")return Y4(e,t,n);if(t.type==="text")return G4(e,t)}function V4(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=h0,e.schema=s),e.ancestors.push(t);const i=vI(e,t.tagName,!1),a=Q4(e,t);let l=w0(e,t);return H4.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!QB(u):!0})),bI(e,a,i,t),x0(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function U4(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)}Zf(e,t.position)}function K4(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zf(e,t.position)}function q4(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=h0,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:vI(e,t.name,!0),a=Z4(e,t),l=w0(e,t);return bI(e,a,i,t),x0(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function Y4(e,t,n){const r={};return x0(r,w0(e,t)),e.create(t,e.Fragment,r,n)}function G4(e,t){return t.value}function bI(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function x0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function X4(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 J4(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),u=g0(r);return t(s,i,a,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Q4(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&y0.call(t.properties,s)){const i=e6(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&B4.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 Z4(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 Zf(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 Zf(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function w0(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:F4;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const u=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(u){const d=s.get(u)||0;a=u+"-"+d,s.set(u,d+1)}}const l=wI(e,i,a);l!==void 0&&n.push(l)}return n}function e6(e,t,n){const r=i4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?qB(n):c4(n)),r.property==="style"){let s=typeof n=="object"?n:t6(e,String(n));return e.stylePropertyNameCase==="css"&&(s=n6(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?n4[r.property]||r.property:r.attribute,n]}}function t6(e,t){try{return $4(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new cs("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=xI+"#cannot-parse-style-attribute",s}}function vI(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=LN(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=LN(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return y0.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zf(e)}function Zf(e,t){const n=new cs("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=xI+"#cannot-handle-mdx-estrees-without-createevaluater",n}function n6(e){const t={};let n;for(n in e)y0.call(e,n)&&(t[r6(n)]=e[n]);return t}function r6(e){let t=e.replace(z4,s6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function s6(e){return"-"+e.toLowerCase()}const bx={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"]},i6={};function o6(e,t){const n=i6,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return kI(e,r,s)}function kI(e,t,n){if(a6(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 UN(e.children,t,n)}return Array.isArray(e)?UN(e,t,n):""}function UN(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=kI(e[s],t,n);return r.join("")}function a6(e){return!!(e&&typeof e=="object")}const KN=document.createElement("i");function b0(e){const t="&"+e+";";KN.innerHTML=t;const n=KN.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ro(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 Ei(e,t){return e.length>0?(Ro(e,e.length,0,t),e):t}const qN={}.hasOwnProperty;function l6(e){const t={};let n=-1;for(;++n<e.length;)c6(t,e[n]);return t}function c6(e,t){let n;for(n in t){const s=(qN.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){qN.call(s,a)||(s[a]=[]);const l=i[a];u6(s[a],Array.isArray(l)?l:l?[l]:[])}}}function u6(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ro(e,0,0,r)}function SI(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 _u(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const No=kl(/[A-Za-z]/),si=kl(/[\dA-Za-z]/),d6=kl(/[#-'*+\--9=?A-Z^-~]/);function kb(e){return e!==null&&(e<32||e===127)}const Sb=kl(/\d/),f6=kl(/[\dA-Fa-f]/),p6=kl(/[!-/:-@[-`{-~]/);function wt(e){return e!==null&&e<-2}function Bs(e){return e!==null&&(e<0||e===32)}function sn(e){return e===-2||e===-1||e===32}const h6=kl(new RegExp("\\p{P}|\\p{S}","u")),m6=kl(/\s/);function kl(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function sd(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&si(e.charCodeAt(n+1))&&si(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 An(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(u){return sn(u)?(e.enter(n),l(u)):t(u)}function l(u){return sn(u)&&i++<s?(e.consume(u),l):(e.exit(n),t(u))}}const g6={tokenize:y6};function y6(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"),An(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return wt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const x6={tokenize:w6},YN={tokenize:b6};function w6(e){const t=this,n=[];let r=0,s,i,a;return l;function l(x){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,u,d)(x)}return d(x)}function u(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&b();const N=t.events.length;let _=N,C;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){C=t.events[_][1].end;break}g(r);let T=N;for(;T<t.events.length;)t.events[T][1].end={...C},T++;return Ro(t.events,_+1,0,t.events.slice(N)),t.events.length=T,d(x)}return l(x)}function d(x){if(r===n.length){if(!s)return f(x);if(s.currentConstruct&&s.currentConstruct.concrete)return y(x);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(YN,p,c)(x)}function p(x){return s&&b(),g(r),f(x)}function c(x){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,y(x)}function f(x){return t.containerState={},e.attempt(YN,m,y)(x)}function m(x){return r++,n.push([t.currentConstruct,t.containerState]),f(x)}function y(x){if(x===null){s&&b(),g(0),e.consume(x);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),v(x)}function v(x){if(x===null){k(e.exit("chunkFlow"),!0),g(0),e.consume(x);return}return wt(x)?(e.consume(x),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(x),v)}function k(x,N){const _=t.sliceStream(x);if(N&&_.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(_),t.parser.lazy[x.start.line]){let C=s.events.length;for(;C--;)if(s.events[C][1].start.offset<a&&(!s.events[C][1].end||s.events[C][1].end.offset>a))return;const T=t.events.length;let H=T,L,F;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(L){F=t.events[H][1].end;break}L=!0}for(g(r),C=T;C<t.events.length;)t.events[C][1].end={...F},C++;Ro(t.events,H+1,0,t.events.slice(T)),t.events.length=C}}function g(x){let N=n.length;for(;N-- >x;){const _=n[N];t.containerState=_[1],_[0].exit.call(t,e)}n.length=x}function b(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function b6(e,t,n){return An(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function GN(e){if(e===null||Bs(e)||m6(e))return 1;if(h6(e))return 2}function v0(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 Nb={name:"attention",resolveAll:v6,tokenize:k6};function v6(e,t){let n=-1,r,s,i,a,l,u,d,p;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;u=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 c={...e[r][1].end},f={...e[n][1].start};XN(c,-u),XN(f,u),a={type:u>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:u>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=Ei(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Ei(d,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),d=Ei(d,v0(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Ei(d,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,d=Ei(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Ro(e,r-1,n-r+3,d),n=r+d.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function k6(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=GN(r);let i;return a;function a(u){return i=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===i)return e.consume(u),l;const d=e.exit("attentionSequence"),p=GN(u),c=!p||p===2&&s||n.includes(u),f=!s||s===2&&p||n.includes(r);return d._open=!!(i===42?c:c&&(s||!f)),d._close=!!(i===42?f:f&&(p||!c)),t(u)}}function XN(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const S6={name:"autolink",tokenize:N6};function N6(e,t,n){let r=0;return s;function s(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return No(m)?(e.consume(m),a):m===64?n(m):d(m)}function a(m){return m===43||m===45||m===46||si(m)?(r=1,l(m)):d(m)}function l(m){return m===58?(e.consume(m),r=0,u):(m===43||m===45||m===46||si(m))&&r++<32?(e.consume(m),l):(r=0,d(m))}function u(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||kb(m)?n(m):(e.consume(m),u)}function d(m){return m===64?(e.consume(m),p):d6(m)?(e.consume(m),d):n(m)}function p(m){return si(m)?c(m):n(m)}function c(m){return m===46?(e.consume(m),r=0,p):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):f(m)}function f(m){if((m===45||si(m))&&r++<63){const y=m===45?f:c;return e.consume(m),y}return n(m)}}const cy={partial:!0,tokenize:j6};function j6(e,t,n){return r;function r(i){return sn(i)?An(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||wt(i)?t(i):n(i)}}const NI={continuation:{tokenize:E6},exit:_6,name:"blockQuote",tokenize:C6};function C6(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 sn(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function E6(e,t,n){const r=this;return s;function s(a){return sn(a)?An(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(NI,t,n)(a)}}function _6(e){e.exit("blockQuote")}const jI={name:"characterEscape",tokenize:P6};function P6(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 p6(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const CI={name:"characterReference",tokenize:A6};function A6(e,t,n){const r=this;let s=0,i,a;return l;function l(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),u}function u(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,a=si,p(c))}function d(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=f6,p):(e.enter("characterReferenceValue"),i=7,a=Sb,p(c))}function p(c){if(c===59&&s){const f=e.exit("characterReferenceValue");return a===si&&!b0(r.sliceSerialize(f))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(c)&&s++<i?(e.consume(c),p):n(c)}}const JN={partial:!0,tokenize:T6},QN={concrete:!0,name:"codeFenced",tokenize:I6};function I6(e,t,n){const r=this,s={partial:!0,tokenize:_};let i=0,a=0,l;return u;function u(C){return d(C)}function d(C){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,l=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(C)}function p(C){return C===l?(a++,e.consume(C),p):a<3?n(C):(e.exit("codeFencedFenceSequence"),sn(C)?An(e,c,"whitespace")(C):c(C))}function c(C){return C===null||wt(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(JN,v,N)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||wt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(C)):sn(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),An(e,m,"whitespace")(C)):C===96&&C===l?n(C):(e.consume(C),f)}function m(C){return C===null||wt(C)?c(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||wt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(C)):C===96&&C===l?n(C):(e.consume(C),y)}function v(C){return e.attempt(s,N,k)(C)}function k(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),g}function g(C){return i>0&&sn(C)?An(e,b,"linePrefix",i+1)(C):b(C)}function b(C){return C===null||wt(C)?e.check(JN,v,N)(C):(e.enter("codeFlowValue"),x(C))}function x(C){return C===null||wt(C)?(e.exit("codeFlowValue"),b(C)):(e.consume(C),x)}function N(C){return e.exit("codeFenced"),t(C)}function _(C,T,H){let L=0;return F;function F(M){return C.enter("lineEnding"),C.consume(M),C.exit("lineEnding"),O}function O(M){return C.enter("codeFencedFence"),sn(M)?An(C,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):D(M)}function D(M){return M===l?(C.enter("codeFencedFenceSequence"),W(M)):H(M)}function W(M){return M===l?(L++,C.consume(M),W):L>=a?(C.exit("codeFencedFenceSequence"),sn(M)?An(C,$,"whitespace")(M):$(M)):H(M)}function $(M){return M===null||wt(M)?(C.exit("codeFencedFence"),T(M)):H(M)}}}function T6(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 vx={name:"codeIndented",tokenize:L6},R6={partial:!0,tokenize:M6};function L6(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),An(e,i,"linePrefix",5)(d)}function i(d){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?u(d):wt(d)?e.attempt(R6,a,u)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||wt(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),l)}function u(d){return e.exit("codeIndented"),t(d)}}function M6(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):wt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):An(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):wt(a)?s(a):n(a)}}const O6={name:"codeText",previous:D6,resolve:$6,tokenize:F6};function $6(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 D6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function F6(e,t,n){let r=0,s,i;return a;function a(c){return e.enter("codeText"),e.enter("codeTextSequence"),l(c)}function l(c){return c===96?(e.consume(c),r++,l):(e.exit("codeTextSequence"),u(c))}function u(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),u):c===96?(i=e.enter("codeTextSequence"),s=0,p(c)):wt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):(e.enter("codeTextData"),d(c))}function d(c){return c===null||c===32||c===96||wt(c)?(e.exit("codeTextData"),u(c)):(e.consume(c),d)}function p(c){return c===96?(e.consume(c),s++,p):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(i.type="codeTextData",d(c))}}class z6{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&&Hd(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),Hd(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Hd(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);Hd(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Hd(this.left,n.reverse())}}}function Hd(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 EI(e){const t={};let n=-1,r,s,i,a,l,u,d;const p=new z6(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,i=0,i<u.length&&u[i][1].type==="lineEndingBlank"&&(i+=2),i<u.length&&u[i][1].type==="content"))for(;++i<u.length&&u[i][1].type!=="content";)u[i][1].type==="chunkText"&&(u[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,H6(p,n)),n=t[n],d=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=p.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(p.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={...p.get(s)[1].start},l=p.slice(s,n),l.unshift(r),p.splice(s,n-s+1,l))}}return Ro(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!d}function H6(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,u=[],d={};let p,c,f=-1,m=n,y=0,v=0;const k=[v];for(;m;){for(;e.get(++s)[1]!==m;);i.push(s),m._tokenizer||(p=r.sliceStream(m),m.next||p.push(null),c&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),c=m,m=m.next}for(m=n;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(v=f+1,k.push(v),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):k.pop(),f=k.length;f--;){const g=l.slice(k[f],k[f+1]),b=i.pop();u.push([b,b+g.length-1]),e.splice(b,2,g)}for(u.reverse(),f=-1;++f<u.length;)d[y+u[f][0]]=y+u[f][1],y+=u[f][1]-u[f][0]-1;return d}const B6={resolve:V6,tokenize:U6},W6={partial:!0,tokenize:K6};function V6(e){return EI(e),e}function U6(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):wt(l)?e.check(W6,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 K6(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),An(e,i,"linePrefix")}function i(a){if(a===null||wt(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 _I(e,t,n,r,s,i,a,l,u){const d=u||Number.POSITIVE_INFINITY;let p=0;return c;function c(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),f):g===null||g===32||g===41||kb(g)?n(g):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(g))}function f(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"}),m(g))}function m(g){return g===62?(e.exit("chunkString"),e.exit(l),f(g)):g===null||g===60||wt(g)?n(g):(e.consume(g),g===92?y:m)}function y(g){return g===60||g===62||g===92?(e.consume(g),m):m(g)}function v(g){return!p&&(g===null||g===41||Bs(g))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(g)):p<d&&g===40?(e.consume(g),p++,v):g===41?(e.consume(g),p--,v):g===null||g===32||g===40||kb(g)?n(g):(e.consume(g),g===92?k:v)}function k(g){return g===40||g===41||g===92?(e.consume(g),v):v(g)}}function PI(e,t,n,r,s,i){const a=this;let l=0,u;return d;function d(m){return e.enter(r),e.enter(s),e.consume(m),e.exit(s),e.enter(i),p}function p(m){return l>999||m===null||m===91||m===93&&!u||m===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(m):m===93?(e.exit(i),e.enter(s),e.consume(m),e.exit(s),e.exit(r),t):wt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),c(m))}function c(m){return m===null||m===91||m===93||wt(m)||l++>999?(e.exit("chunkString"),p(m)):(e.consume(m),u||(u=!sn(m)),m===92?f:c)}function f(m){return m===91||m===92||m===93?(e.consume(m),l++,c):c(m)}}function AI(e,t,n,r,s,i){let a;return l;function l(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),a=f===40?41:f,u):n(f)}function u(f){return f===a?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),d(f))}function d(f){return f===a?(e.exit(i),u(a)):f===null?n(f):wt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),An(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===a||f===null||wt(f)?(e.exit("chunkString"),d(f)):(e.consume(f),f===92?c:p)}function c(f){return f===a||f===92?(e.consume(f),p):p(f)}}function wf(e,t){let n;return r;function r(s){return wt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):sn(s)?An(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const q6={name:"definition",tokenize:G6},Y6={partial:!0,tokenize:X6};function G6(e,t,n){const r=this;let s;return i;function i(m){return e.enter("definition"),a(m)}function a(m){return PI.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return s=_u(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),u):n(m)}function u(m){return Bs(m)?wf(e,d)(m):d(m)}function d(m){return _I(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function p(m){return e.attempt(Y6,c,c)(m)}function c(m){return sn(m)?An(e,f,"whitespace")(m):f(m)}function f(m){return m===null||wt(m)?(e.exit("definition"),r.parser.defined.push(s),t(m)):n(m)}}function X6(e,t,n){return r;function r(l){return Bs(l)?wf(e,s)(l):n(l)}function s(l){return AI(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return sn(l)?An(e,a,"whitespace")(l):a(l)}function a(l){return l===null||wt(l)?t(l):n(l)}}const J6={name:"hardBreakEscape",tokenize:Q6};function Q6(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return wt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Z6={name:"headingAtx",resolve:e8,tokenize:t8};function e8(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"},Ro(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function t8(e,t,n){let r=0;return s;function s(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||Bs(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||wt(p)?(e.exit("atxHeading"),t(p)):sn(p)?An(e,l,"whitespace")(p):(e.enter("atxHeadingText"),d(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),l(p))}function d(p){return p===null||p===35||Bs(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),d)}}const n8=["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"],ZN=["pre","script","style","textarea"],r8={concrete:!0,name:"htmlFlow",resolveTo:o8,tokenize:a8},s8={partial:!0,tokenize:c8},i8={partial:!0,tokenize:l8};function o8(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 a8(e,t,n){const r=this;let s,i,a,l,u;return d;function d(U){return p(U)}function p(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),c}function c(U){return U===33?(e.consume(U),f):U===47?(e.consume(U),i=!0,v):U===63?(e.consume(U),s=3,r.interrupt?t:E):No(U)?(e.consume(U),a=String.fromCharCode(U),k):n(U)}function f(U){return U===45?(e.consume(U),s=2,m):U===91?(e.consume(U),s=5,l=0,y):No(U)?(e.consume(U),s=4,r.interrupt?t:E):n(U)}function m(U){return U===45?(e.consume(U),r.interrupt?t:E):n(U)}function y(U){const se="CDATA[";return U===se.charCodeAt(l++)?(e.consume(U),l===se.length?r.interrupt?t:D:y):n(U)}function v(U){return No(U)?(e.consume(U),a=String.fromCharCode(U),k):n(U)}function k(U){if(U===null||U===47||U===62||Bs(U)){const se=U===47,pe=a.toLowerCase();return!se&&!i&&ZN.includes(pe)?(s=1,r.interrupt?t(U):D(U)):n8.includes(a.toLowerCase())?(s=6,se?(e.consume(U),g):r.interrupt?t(U):D(U)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(U):i?b(U):x(U))}return U===45||si(U)?(e.consume(U),a+=String.fromCharCode(U),k):n(U)}function g(U){return U===62?(e.consume(U),r.interrupt?t:D):n(U)}function b(U){return sn(U)?(e.consume(U),b):F(U)}function x(U){return U===47?(e.consume(U),F):U===58||U===95||No(U)?(e.consume(U),N):sn(U)?(e.consume(U),x):F(U)}function N(U){return U===45||U===46||U===58||U===95||si(U)?(e.consume(U),N):_(U)}function _(U){return U===61?(e.consume(U),C):sn(U)?(e.consume(U),_):x(U)}function C(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),u=U,T):sn(U)?(e.consume(U),C):H(U)}function T(U){return U===u?(e.consume(U),u=null,L):U===null||wt(U)?n(U):(e.consume(U),T)}function H(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||Bs(U)?_(U):(e.consume(U),H)}function L(U){return U===47||U===62||sn(U)?x(U):n(U)}function F(U){return U===62?(e.consume(U),O):n(U)}function O(U){return U===null||wt(U)?D(U):sn(U)?(e.consume(U),O):n(U)}function D(U){return U===45&&s===2?(e.consume(U),I):U===60&&s===1?(e.consume(U),z):U===62&&s===4?(e.consume(U),J):U===63&&s===3?(e.consume(U),E):U===93&&s===5?(e.consume(U),R):wt(U)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(s8,Z,W)(U)):U===null||wt(U)?(e.exit("htmlFlowData"),W(U)):(e.consume(U),D)}function W(U){return e.check(i8,$,Z)(U)}function $(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),M}function M(U){return U===null||wt(U)?W(U):(e.enter("htmlFlowData"),D(U))}function I(U){return U===45?(e.consume(U),E):D(U)}function z(U){return U===47?(e.consume(U),a="",P):D(U)}function P(U){if(U===62){const se=a.toLowerCase();return ZN.includes(se)?(e.consume(U),J):D(U)}return No(U)&&a.length<8?(e.consume(U),a+=String.fromCharCode(U),P):D(U)}function R(U){return U===93?(e.consume(U),E):D(U)}function E(U){return U===62?(e.consume(U),J):U===45&&s===2?(e.consume(U),E):D(U)}function J(U){return U===null||wt(U)?(e.exit("htmlFlowData"),Z(U)):(e.consume(U),J)}function Z(U){return e.exit("htmlFlow"),t(U)}}function l8(e,t,n){const r=this;return s;function s(a){return wt(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 c8(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(cy,t,n)}}const u8={name:"htmlText",tokenize:d8};function d8(e,t,n){const r=this;let s,i,a;return l;function l(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),u}function u(E){return E===33?(e.consume(E),d):E===47?(e.consume(E),_):E===63?(e.consume(E),x):No(E)?(e.consume(E),H):n(E)}function d(E){return E===45?(e.consume(E),p):E===91?(e.consume(E),i=0,y):No(E)?(e.consume(E),b):n(E)}function p(E){return E===45?(e.consume(E),m):n(E)}function c(E){return E===null?n(E):E===45?(e.consume(E),f):wt(E)?(a=c,z(E)):(e.consume(E),c)}function f(E){return E===45?(e.consume(E),m):c(E)}function m(E){return E===62?I(E):E===45?f(E):c(E)}function y(E){const J="CDATA[";return E===J.charCodeAt(i++)?(e.consume(E),i===J.length?v:y):n(E)}function v(E){return E===null?n(E):E===93?(e.consume(E),k):wt(E)?(a=v,z(E)):(e.consume(E),v)}function k(E){return E===93?(e.consume(E),g):v(E)}function g(E){return E===62?I(E):E===93?(e.consume(E),g):v(E)}function b(E){return E===null||E===62?I(E):wt(E)?(a=b,z(E)):(e.consume(E),b)}function x(E){return E===null?n(E):E===63?(e.consume(E),N):wt(E)?(a=x,z(E)):(e.consume(E),x)}function N(E){return E===62?I(E):x(E)}function _(E){return No(E)?(e.consume(E),C):n(E)}function C(E){return E===45||si(E)?(e.consume(E),C):T(E)}function T(E){return wt(E)?(a=T,z(E)):sn(E)?(e.consume(E),T):I(E)}function H(E){return E===45||si(E)?(e.consume(E),H):E===47||E===62||Bs(E)?L(E):n(E)}function L(E){return E===47?(e.consume(E),I):E===58||E===95||No(E)?(e.consume(E),F):wt(E)?(a=L,z(E)):sn(E)?(e.consume(E),L):I(E)}function F(E){return E===45||E===46||E===58||E===95||si(E)?(e.consume(E),F):O(E)}function O(E){return E===61?(e.consume(E),D):wt(E)?(a=O,z(E)):sn(E)?(e.consume(E),O):L(E)}function D(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),s=E,W):wt(E)?(a=D,z(E)):sn(E)?(e.consume(E),D):(e.consume(E),$)}function W(E){return E===s?(e.consume(E),s=void 0,M):E===null?n(E):wt(E)?(a=W,z(E)):(e.consume(E),W)}function $(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Bs(E)?L(E):(e.consume(E),$)}function M(E){return E===47||E===62||Bs(E)?L(E):n(E)}function I(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function z(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),P}function P(E){return sn(E)?An(e,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):R(E)}function R(E){return e.enter("htmlTextData"),a(E)}}const k0={name:"labelEnd",resolveAll:m8,resolveTo:g8,tokenize:y8},f8={tokenize:x8},p8={tokenize:w8},h8={tokenize:b8};function m8(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&&Ro(e,0,e.length,n),e}function g8(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 u={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}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",u,t],["enter",d,t]],l=Ei(l,e.slice(i+1,i+r+3)),l=Ei(l,[["enter",p,t]]),l=Ei(l,v0(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Ei(l,[["exit",p,t],e[a-2],e[a-1],["exit",d,t]]),l=Ei(l,e.slice(a+1)),l=Ei(l,[["exit",u,t]]),Ro(e,i,e.length,l),e}function y8(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(f){return i?i._inactive?c(f):(a=r.parser.defined.includes(_u(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),u):n(f)}function u(f){return f===40?e.attempt(f8,p,a?p:c)(f):f===91?e.attempt(p8,p,a?d:c)(f):a?p(f):c(f)}function d(f){return e.attempt(h8,p,c)(f)}function p(f){return t(f)}function c(f){return i._balanced=!0,n(f)}}function x8(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),s}function s(c){return Bs(c)?wf(e,i)(c):i(c)}function i(c){return c===41?p(c):_I(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function a(c){return Bs(c)?wf(e,u)(c):p(c)}function l(c){return n(c)}function u(c){return c===34||c===39||c===40?AI(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):p(c)}function d(c){return Bs(c)?wf(e,p)(c):p(c)}function p(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function w8(e,t,n){const r=this;return s;function s(l){return PI.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(_u(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function b8(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 v8={name:"labelStartImage",resolveAll:k0.resolveAll,tokenize:k8};function k8(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 S8={name:"labelStartLink",resolveAll:k0.resolveAll,tokenize:N8};function N8(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 kx={name:"lineEnding",tokenize:j8};function j8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),An(e,t,"linePrefix")}}const gm={name:"thematicBreak",tokenize:C8};function C8(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"),u(d)):r>=3&&(d===null||wt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function u(d){return d===s?(e.consume(d),r++,u):(e.exit("thematicBreakSequence"),sn(d)?An(e,l,"whitespace")(d):l(d))}}const Is={continuation:{tokenize:A8},exit:T8,name:"list",tokenize:P8},E8={partial:!0,tokenize:R8},_8={partial:!0,tokenize:I8};function P8(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(m){const y=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Sb(m)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(gm,n,d)(m):d(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(m)}return n(m)}function u(m){return Sb(m)&&++a<10?(e.consume(m),u):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),d(m)):n(m)}function d(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(cy,r.interrupt?n:p,e.attempt(E8,f,c))}function p(m){return r.containerState.initialBlankLine=!0,i++,f(m)}function c(m){return sn(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function A8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(cy,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,An(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!sn(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(_8,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,An(e,e.attempt(Is,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function I8(e,t,n){const r=this;return An(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 T8(e){e.exit(this.containerState.type)}function R8(e,t,n){const r=this;return An(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!sn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const ej={name:"setextUnderline",resolveTo:L8,tokenize:M8};function L8(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function M8(e,t,n){const r=this;let s;return i;function i(d){let p=r.events.length,c;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){c=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(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"),sn(d)?An(e,u,"lineSuffix")(d):u(d))}function u(d){return d===null||wt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const O8={tokenize:$8};function $8(e){const t=this,n=e.attempt(cy,r,e.attempt(this.parser.constructs.flowInitial,s,An(e,e.attempt(this.parser.constructs.flow,s,e.attempt(B6,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 D8={resolveAll:TI()},F8=II("string"),z8=II("text");function II(e){return{resolveAll:TI(e==="text"?H8: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(p){return d(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),u}function u(p){return d(p)?(n.exit("data"),i(p)):(n.consume(p),u)}function d(p){if(p===null)return!0;const c=s[p];let f=-1;if(c)for(;++f<c.length;){const m=c[f];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function TI(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 H8(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,u;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)u=!0,l++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||u||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 B8={42:Is,43:Is,45:Is,48:Is,49:Is,50:Is,51:Is,52:Is,53:Is,54:Is,55:Is,56:Is,57:Is,62:NI},W8={91:q6},V8={[-2]:vx,[-1]:vx,32:vx},U8={35:Z6,42:gm,45:[ej,gm],60:r8,61:ej,95:gm,96:QN,126:QN},K8={38:CI,92:jI},q8={[-5]:kx,[-4]:kx,[-3]:kx,33:v8,38:CI,42:Nb,60:[S6,u8],91:S8,92:[J6,jI],93:k0,95:Nb,96:O6},Y8={null:[Nb,D8]},G8={null:[42,95]},X8={null:[]},J8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:G8,contentInitial:W8,disable:X8,document:B8,flow:U8,flowInitial:V8,insideSpan:Y8,string:K8,text:q8},Symbol.toStringTag,{value:"Module"}));function Q8(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 u={attempt:T(_),check:T(C),consume:b,enter:x,exit:N,interrupt:T(C,{interrupt:!0})},d={code:null,containerState:{},defineSkip:v,events:[],now:y,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:c};let p=t.tokenize.call(d,u);return t.resolveAll&&i.push(t),d;function c(O){return a=Ei(a,O),k(),a[a.length-1]!==null?[]:(H(t,0),d.events=v0(i,d.events,d),d.events)}function f(O,D){return eW(m(O),D)}function m(O){return Z8(a,O)}function y(){const{_bufferIndex:O,_index:D,line:W,column:$,offset:M}=r;return{_bufferIndex:O,_index:D,line:W,column:$,offset:M}}function v(O){s[O.line]=O.column,F()}function k(){let O;for(;r._index<a.length;){const D=a[r._index];if(typeof D=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<D.length;)g(D.charCodeAt(r._bufferIndex));else g(D)}}function g(O){p=p(O)}function b(O){wt(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,F()):O!==-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=O}function x(O,D){const W=D||{};return W.type=O,W.start=y(),d.events.push(["enter",W,d]),l.push(W),W}function N(O){const D=l.pop();return D.end=y(),d.events.push(["exit",D,d]),D}function _(O,D){H(O,D.from)}function C(O,D){D.restore()}function T(O,D){return W;function W($,M,I){let z,P,R,E;return Array.isArray($)?Z($):"tokenize"in $?Z([$]):J($);function J(he){return xe;function xe(le){const Se=le!==null&&he[le],ie=le!==null&&he.null,oe=[...Array.isArray(Se)?Se:Se?[Se]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return Z(oe)(le)}}function Z(he){return z=he,P=0,he.length===0?I:U(he[P])}function U(he){return xe;function xe(le){return E=L(),R=he,he.partial||(d.currentConstruct=he),he.name&&d.parser.constructs.disable.null.includes(he.name)?pe():he.tokenize.call(D?Object.assign(Object.create(d),D):d,u,se,pe)(le)}}function se(he){return O(R,E),M}function pe(he){return E.restore(),++P<z.length?U(z[P]):I}}}function H(O,D){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&Ro(d.events,D,d.events.length-D,O.resolve(d.events.slice(D),d)),O.resolveTo&&(d.events=O.resolveTo(d.events,d))}function L(){const O=y(),D=d.previous,W=d.currentConstruct,$=d.events.length,M=Array.from(l);return{from:$,restore:I};function I(){r=O,d.previous=D,d.currentConstruct=W,d.events.length=$,l=M,F()}}function F(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function Z8(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 eW(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 tW(e){const r={constructs:l6([J8,...(e||{}).extensions||[]]),content:s(g6),defined:[],document:s(x6),flow:s(O8),lazy:{},string:s(F8),text:s(z8)};return r;function s(i){return a;function a(l){return Q8(r,i,l)}}}function nW(e){for(;!EI(e););return e}const tj=/[\0\t\n\r]/g;function rW(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const u=[];let d,p,c,f,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),c=0,t="",n&&(i.charCodeAt(0)===65279&&c++,n=void 0);c<i.length;){if(tj.lastIndex=c,d=tj.exec(i),f=d&&d.index!==void 0?d.index:i.length,m=i.charCodeAt(f),!d){t=i.slice(c);break}if(m===10&&c===f&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),c<f&&(u.push(i.slice(c,f)),e+=f-c),m){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}c=f+1}return l&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const sW=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function iW(e){return e.replace(sW,oW)}function oW(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return SI(n.slice(i?2:1),i?16:10)}return b0(n)||e}const RI={}.hasOwnProperty;function aW(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),lW(n)(nW(tW(n).document().write(rW()(e,t,!0))))}function lW(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(mt),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(Je),blockQuote:i(ie),characterEscape:L,characterReference:L,codeFenced:i(oe),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(oe,a),codeText:i(ye,a),codeTextData:L,data:L,codeFlowValue:L,definition:i(ke),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Ve),hardBreakEscape:i(We),hardBreakTrailing:i(We),htmlFlow:i(ot,a),htmlFlowData:L,htmlText:i(ot,a),htmlTextData:L,image:i(ze),label:a,link:i(mt),listItem:i(zn),listItemValue:f,listOrdered:i(ln,c),listUnordered:i(ln),paragraph:i(Bt),reference:U,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Je),strong:i(en),thematicBreak:i(un)},exit:{atxHeading:u(),atxHeadingSequence:_,autolink:u(),autolinkEmail:Se,autolinkProtocol:le,blockQuote:u(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:he,characterReference:xe,codeFenced:u(k),codeFencedFence:v,codeFencedFenceInfo:m,codeFencedFenceMeta:y,codeFlowValue:F,codeIndented:u(g),codeText:u(M),codeTextData:F,data:F,definition:u(),definitionDestinationString:N,definitionLabelString:b,definitionTitleString:x,emphasis:u(),hardBreakEscape:u(D),hardBreakTrailing:u(D),htmlFlow:u(W),htmlFlowData:F,htmlText:u($),htmlTextData:F,image:u(z),label:R,labelText:P,lineEnding:O,link:u(I),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:se,resourceDestinationString:E,resourceTitleString:J,resource:Z,setextHeading:u(H),setextHeadingLineSequence:T,setextHeadingText:C,strong:u(),thematicBreak:u()}};LI(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let Ne={type:"root",children:[]};const He={stack:[Ne],tokenStack:[],config:t,enter:l,exit:d,buffer:a,resume:p,data:n},nt=[];let et=-1;for(;++et<ue.length;)if(ue[et][1].type==="listOrdered"||ue[et][1].type==="listUnordered")if(ue[et][0]==="enter")nt.push(et);else{const _t=nt.pop();et=s(ue,_t,et)}for(et=-1;++et<ue.length;){const _t=t[ue[et][0]];RI.call(_t,ue[et][1].type)&&_t[ue[et][1].type].call(Object.assign({sliceSerialize:ue[et][2].sliceSerialize},He),ue[et][1])}if(He.tokenStack.length>0){const _t=He.tokenStack[He.tokenStack.length-1];(_t[1]||nj).call(He,void 0,_t[0])}for(Ne.position={start:Ba(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Ba(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},et=-1;++et<t.transforms.length;)Ne=t.transforms[et](Ne)||Ne;return Ne}function s(ue,Ne,He){let nt=Ne-1,et=-1,_t=!1,st,dn,on,Un;for(;++nt<=He;){const fn=ue[nt];switch(fn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fn[0]==="enter"?et++:et--,Un=void 0;break}case"lineEndingBlank":{fn[0]==="enter"&&(st&&!Un&&!et&&!on&&(on=nt),Un=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Un=void 0}if(!et&&fn[0]==="enter"&&fn[1].type==="listItemPrefix"||et===-1&&fn[0]==="exit"&&(fn[1].type==="listUnordered"||fn[1].type==="listOrdered")){if(st){let Tn=nt;for(dn=void 0;Tn--;){const Kn=ue[Tn];if(Kn[1].type==="lineEnding"||Kn[1].type==="lineEndingBlank"){if(Kn[0]==="exit")continue;dn&&(ue[dn][1].type="lineEndingBlank",_t=!0),Kn[1].type="lineEnding",dn=Tn}else if(!(Kn[1].type==="linePrefix"||Kn[1].type==="blockQuotePrefix"||Kn[1].type==="blockQuotePrefixWhitespace"||Kn[1].type==="blockQuoteMarker"||Kn[1].type==="listItemIndent"))break}on&&(!dn||on<dn)&&(st._spread=!0),st.end=Object.assign({},dn?ue[dn][1].start:fn[1].end),ue.splice(dn||nt,0,["exit",st,fn[2]]),nt++,He++}if(fn[1].type==="listItemPrefix"){const Tn={type:"listItem",_spread:!1,start:Object.assign({},fn[1].start),end:void 0};st=Tn,ue.splice(nt,0,["enter",Tn,fn[2]]),nt++,He++,on=void 0,Un=!0}}}return ue[Ne][1]._spread=_t,He}function i(ue,Ne){return He;function He(nt){l.call(this,ue(nt),nt),Ne&&Ne.call(this,nt)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(ue,Ne,He){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([Ne,He||void 0]),ue.position={start:Ba(Ne.start),end:void 0}}function u(ue){return Ne;function Ne(He){ue&&ue.call(this,He),d.call(this,He)}}function d(ue,Ne){const He=this.stack.pop(),nt=this.tokenStack.pop();if(nt)nt[0].type!==ue.type&&(Ne?Ne.call(this,ue,nt[0]):(nt[1]||nj).call(this,ue,nt[0]));else throw new Error("Cannot close `"+ue.type+"` ("+xf({start:ue.start,end:ue.end})+"): it’s not open");He.position.end=Ba(ue.end)}function p(){return o6(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function f(ue){if(this.data.expectingFirstListItemValue){const Ne=this.stack[this.stack.length-2];Ne.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function m(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.lang=ue}function y(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.meta=ue}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=ue.replace(/(\r?\n|\r)$/g,"")}function b(ue){const Ne=this.resume(),He=this.stack[this.stack.length-1];He.label=Ne,He.identifier=_u(this.sliceSerialize(ue)).toLowerCase()}function x(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.title=ue}function N(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.url=ue}function _(ue){const Ne=this.stack[this.stack.length-1];if(!Ne.depth){const He=this.sliceSerialize(ue).length;Ne.depth=He}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function T(ue){const Ne=this.stack[this.stack.length-1];Ne.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function H(){this.data.setextHeadingSlurpLineEnding=void 0}function L(ue){const He=this.stack[this.stack.length-1].children;let nt=He[He.length-1];(!nt||nt.type!=="text")&&(nt=cn(),nt.position={start:Ba(ue.start),end:void 0},He.push(nt)),this.stack.push(nt)}function F(ue){const Ne=this.stack.pop();Ne.value+=this.sliceSerialize(ue),Ne.position.end=Ba(ue.end)}function O(ue){const Ne=this.stack[this.stack.length-1];if(this.data.atHardBreak){const He=Ne.children[Ne.children.length-1];He.position.end=Ba(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ne.type)&&(L.call(this,ue),F.call(this,ue))}function D(){this.data.atHardBreak=!0}function W(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=ue}function $(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=ue}function M(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.value=ue}function I(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Ne=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Ne,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function z(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Ne=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Ne,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function P(ue){const Ne=this.sliceSerialize(ue),He=this.stack[this.stack.length-2];He.label=iW(Ne),He.identifier=_u(Ne).toLowerCase()}function R(){const ue=this.stack[this.stack.length-1],Ne=this.resume(),He=this.stack[this.stack.length-1];if(this.data.inReference=!0,He.type==="link"){const nt=ue.children;He.children=nt}else He.alt=Ne}function E(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.url=ue}function J(){const ue=this.resume(),Ne=this.stack[this.stack.length-1];Ne.title=ue}function Z(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function se(ue){const Ne=this.resume(),He=this.stack[this.stack.length-1];He.label=Ne,He.identifier=_u(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function pe(ue){this.data.characterReferenceType=ue.type}function he(ue){const Ne=this.sliceSerialize(ue),He=this.data.characterReferenceType;let nt;He?(nt=SI(Ne,He==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):nt=b0(Ne);const et=this.stack[this.stack.length-1];et.value+=nt}function xe(ue){const Ne=this.stack.pop();Ne.position.end=Ba(ue.end)}function le(ue){F.call(this,ue);const Ne=this.stack[this.stack.length-1];Ne.url=this.sliceSerialize(ue)}function Se(ue){F.call(this,ue);const Ne=this.stack[this.stack.length-1];Ne.url="mailto:"+this.sliceSerialize(ue)}function ie(){return{type:"blockquote",children:[]}}function oe(){return{type:"code",lang:null,meta:null,value:""}}function ye(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ve(){return{type:"emphasis",children:[]}}function Je(){return{type:"heading",depth:0,children:[]}}function We(){return{type:"break"}}function ot(){return{type:"html",value:""}}function ze(){return{type:"image",title:null,url:"",alt:null}}function mt(){return{type:"link",title:null,url:"",children:[]}}function ln(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function zn(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function Bt(){return{type:"paragraph",children:[]}}function en(){return{type:"strong",children:[]}}function cn(){return{type:"text",value:""}}function un(){return{type:"thematicBreak"}}}function Ba(e){return{line:e.line,column:e.column,offset:e.offset}}function LI(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?LI(e,r):cW(e,r)}}function cW(e,t){let n;for(n in t)if(RI.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 nj(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+xf({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xf({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+xf({start:t.start,end:t.end})+") is still open")}function uW(e){const t=this;t.parser=n;function n(r){return aW(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function dW(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 fW(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
+
`}]}function pW(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 hW(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mW(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gW(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=sd(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 u={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,u);const d={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,d),e.applyData(t,d)}function yW(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 xW(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function MI(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 wW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return MI(e,t);const s={src:sd(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 bW(e,t){const n={src:sd(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 vW(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 kW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return MI(e,t);const s={href:sd(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 SW(e,t){const n={href:sd(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 NW(e,t,n){const r=e.all(t),s=n?jW(n):OI(t),i={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let c;p&&p.type==="element"&&p.tagName==="p"?c=p:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.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 p=r[l];(s||l!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
+
`}),p.type==="element"&&p.tagName==="p"&&!s?a.push(...p.children):a.push(p)}const u=r[r.length-1];u&&(s||u.type!=="element"||u.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 jW(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=OI(n[r])}return t}function OI(e){const t=e.spread;return t??e.children.length>1}function CW(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 EW(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _W(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function PW(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AW(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=g0(t.children[1]),u=gI(t.children[t.children.length-1]);l&&u&&(a.position={start:l,end:u}),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 IW(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 u=-1;const d=[];for(;++u<l;){const c=t.children[u],f={},m=a?a[u]:void 0;m&&(f.align=m);let y={type:"element",tagName:i,properties:f,children:[]};c&&(y.children=e.all(c),e.patch(c,y),y=e.applyData(c,y)),d.push(y)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,p),e.applyData(t,p)}function TW(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const rj=9,sj=32;function RW(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(ij(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(ij(t.slice(s),s>0,!1)),i.join("")}function ij(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===rj||i===sj;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===rj||i===sj;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function LW(e,t){const n={type:"text",value:RW(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function MW(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const OW={blockquote:dW,break:fW,code:pW,delete:hW,emphasis:mW,footnoteReference:gW,heading:yW,html:xW,imageReference:wW,image:bW,inlineCode:vW,linkReference:kW,link:SW,listItem:NW,list:CW,paragraph:EW,root:_W,strong:PW,table:AW,tableCell:TW,tableRow:IW,text:LW,thematicBreak:MW,toml:Oh,yaml:Oh,definition:Oh,footnoteDefinition:Oh};function Oh(){}const $I=-1,uy=0,bf=1,og=2,S0=3,N0=4,j0=5,C0=6,DI=7,FI=8,oj=typeof self=="object"?self:globalThis,$W=(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 uy:case $I:return n(a,s);case bf:{const l=n([],s);for(const u of a)l.push(r(u));return l}case og:{const l=n({},s);for(const[u,d]of a)l[r(u)]=r(d);return l}case S0:return n(new Date(a),s);case N0:{const{source:l,flags:u}=a;return n(new RegExp(l,u),s)}case j0:{const l=n(new Map,s);for(const[u,d]of a)l.set(r(u),r(d));return l}case C0:{const l=n(new Set,s);for(const u of a)l.add(r(u));return l}case DI:{const{name:l,message:u}=a;return n(new oj[l](u),s)}case FI: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 oj[i](a),s)};return r},aj=e=>$W(new Map,e)(0),qc="",{toString:DW}={},{keys:FW}=Object,Bd=e=>{const t=typeof e;if(t!=="object"||!e)return[uy,t];const n=DW.call(e).slice(8,-1);switch(n){case"Array":return[bf,qc];case"Object":return[og,qc];case"Date":return[S0,qc];case"RegExp":return[N0,qc];case"Map":return[j0,qc];case"Set":return[C0,qc];case"DataView":return[bf,n]}return n.includes("Array")?[bf,n]:n.includes("Error")?[DI,n]:[og,n]},$h=([e,t])=>e===uy&&(t==="function"||t==="symbol"),zW=(e,t,n,r)=>{const s=(a,l)=>{const u=r.push(a)-1;return n.set(l,u),u},i=a=>{if(n.has(a))return n.get(a);let[l,u]=Bd(a);switch(l){case uy:{let p=a;switch(u){case"bigint":l=FI,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);p=null;break;case"undefined":return s([$I],a)}return s([l,p],a)}case bf:{if(u){let f=a;return u==="DataView"?f=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(a)),s([u,[...f]],a)}const p=[],c=s([l,p],a);for(const f of a)p.push(i(f));return c}case og:{if(u)switch(u){case"BigInt":return s([u,a.toString()],a);case"Boolean":case"Number":case"String":return s([u,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const p=[],c=s([l,p],a);for(const f of FW(a))(e||!$h(Bd(a[f])))&&p.push([i(f),i(a[f])]);return c}case S0:return s([l,a.toISOString()],a);case N0:{const{source:p,flags:c}=a;return s([l,{source:p,flags:c}],a)}case j0:{const p=[],c=s([l,p],a);for(const[f,m]of a)(e||!($h(Bd(f))||$h(Bd(m))))&&p.push([i(f),i(m)]);return c}case C0:{const p=[],c=s([l,p],a);for(const f of a)(e||!$h(Bd(f)))&&p.push(i(f));return c}}const{message:d}=a;return s([l,{name:u,message:d}],a)};return i},lj=(e,{json:t,lossy:n}={})=>{const r=[];return zW(!(t||n),!!t,new Map,r)(e),r},ag=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?aj(lj(e,t)):structuredClone(e):(e,t)=>aj(lj(e,t));function HW(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 BW(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function WW(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||HW,r=e.options.footnoteBackLabel||BW,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[u]);if(!d)continue;const p=e.all(d),c=String(d.identifier).toUpperCase(),f=sd(c.toLowerCase());let m=0;const y=[],v=e.footnoteCounts.get(c);for(;v!==void 0&&++m<=v;){y.length>0&&y.push({type:"text",value:" "});let b=typeof n=="string"?n:n(u,m);typeof b=="string"&&(b={type:"text",value:b}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,m),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const k=p[p.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const b=k.children[k.children.length-1];b&&b.type==="text"?b.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...y)}else p.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(p,!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:{...ag(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 zI=function(e){if(e==null)return qW;if(typeof e=="function")return dy(e);if(typeof e=="object")return Array.isArray(e)?VW(e):UW(e);if(typeof e=="string")return KW(e);throw new Error("Expected function, string, or object as test")};function VW(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=zI(e[n]);return dy(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function UW(e){const t=e;return dy(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function KW(e){return dy(t);function t(n){return n&&n.type===e}}function dy(e){return t;function t(n,r,s){return!!(YW(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function qW(){return!0}function YW(e){return e!==null&&typeof e=="object"&&"type"in e}const HI=[],GW=!0,cj=!1,XW="skip";function JW(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=zI(s),a=r?-1:1;l(e,void 0,[])();function l(u,d,p){const c=u&&typeof u=="object"?u:{};if(typeof c.type=="string"){const m=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(u.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=HI,y,v,k;if((!t||i(u,d,p[p.length-1]||void 0))&&(m=QW(n(u,p)),m[0]===cj))return m;if("children"in u&&u.children){const g=u;if(g.children&&m[0]!==XW)for(v=(r?g.children.length:-1)+a,k=p.concat(g);v>-1&&v<g.children.length;){const b=g.children[v];if(y=l(b,v,k)(),y[0]===cj)return y;v=typeof y[1]=="number"?y[1]:v+a}}return m}}}function QW(e){return Array.isArray(e)?e:typeof e=="number"?[GW,e]:e==null?HI:[e]}function BI(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),JW(e,i,l,s);function l(u,d){const p=d[d.length-1],c=p?p.children.indexOf(u):void 0;return a(u,c,p)}}const jb={}.hasOwnProperty,ZW={};function e9(e,t){const n=t||ZW,r=new Map,s=new Map,i=new Map,a={...OW,...n.handlers},l={all:d,applyData:n9,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:u,options:n,patch:t9,wrap:s9};return BI(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const c=p.type==="definition"?r:s,f=String(p.identifier).toUpperCase();c.has(f)||c.set(f,p)}}),l;function u(p,c){const f=p.type,m=l.handlers[f];if(jb.call(l.handlers,f)&&m)return m(l,p,c);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in p){const{children:v,...k}=p,g=ag(k);return g.children=l.all(p),g}return ag(p)}return(l.options.unknownHandler||r9)(l,p,c)}function d(p){const c=[];if("children"in p){const f=p.children;let m=-1;for(;++m<f.length;){const y=l.one(f[m],p);if(y){if(m&&f[m-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=uj(y.value)),!Array.isArray(y)&&y.type==="element")){const v=y.children[0];v&&v.type==="text"&&(v.value=uj(v.value))}Array.isArray(y)?c.push(...y):c.push(y)}}}return c}}function t9(e,t){e.position&&(t.position=D4(e))}function n9(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,ag(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function r9(e,t){const n=t.data||{},r="value"in t&&!(jb.call(n,"hProperties")||jb.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 s9(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 uj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function dj(e,t){const n=e9(e,t),r=n.one(e,void 0),s=WW(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 i9(e,t){return e&&"run"in e?async function(n,r){const s=dj(n,{file:r,...t});await e.run(s,r)}:function(n,r){return dj(n,{file:r,...e||t})}}function fj(e){if(e)throw e}var ym=Object.prototype.hasOwnProperty,WI=Object.prototype.toString,pj=Object.defineProperty,hj=Object.getOwnPropertyDescriptor,mj=function(t){return typeof Array.isArray=="function"?Array.isArray(t):WI.call(t)==="[object Array]"},gj=function(t){if(!t||WI.call(t)!=="[object Object]")return!1;var n=ym.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ym.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||ym.call(t,s)},yj=function(t,n){pj&&n.name==="__proto__"?pj(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},xj=function(t,n){if(n==="__proto__")if(ym.call(t,n)){if(hj)return hj(t,n).value}else return;return t[n]},o9=function e(){var t,n,r,s,i,a,l=arguments[0],u=1,d=arguments.length,p=!1;for(typeof l=="boolean"&&(p=l,l=arguments[1]||{},u=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});u<d;++u)if(t=arguments[u],t!=null)for(n in t)r=xj(l,n),s=xj(t,n),l!==s&&(p&&s&&(gj(s)||(i=mj(s)))?(i?(i=!1,a=r&&mj(r)?r:[]):a=r&&gj(r)?r:{},yj(l,{name:n,newValue:e(p,a,s)})):typeof s<"u"&&yj(l,{name:n,newValue:s}));return l};const Sx=xl(o9);function Cb(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 a9(){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(u,...d){const p=e[++i];let c=-1;if(u){a(u);return}for(;++c<s.length;)(d[c]===null||d[c]===void 0)&&(d[c]=s[c]);s=d,p?l9(p,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 l9(e,t){let n;return r;function r(...a){const l=e.length>a.length;let u;l&&a.push(s);try{u=e.apply(this,a)}catch(d){const p=d;if(l&&n)throw p;return s(p)}l||(u&&u.then&&typeof u.then=="function"?u.then(i,s):u instanceof Error?s(u):i(u))}function s(a,...l){n||(n=!0,t(a,...l))}function i(a){s(null,a)}}const xo={basename:c9,dirname:u9,extname:d9,join:f9,sep:"/"};function c9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Np(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 u9(e){if(Np(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 d9(e){Np(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 f9(...e){let t=-1,n;for(;++t<e.length;)Np(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":p9(n)}function p9(e){Np(e);const t=e.codePointAt(0)===47;let n=h9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function h9(e,t){let n="",r=0,s=-1,i=0,a=-1,l,u;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(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),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 Np(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const m9={cwd:g9};function g9(){return"/"}function Eb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function y9(e){if(typeof e=="string")e=new URL(e);else if(!Eb(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 x9(e)}function x9(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 Nx=["history","path","basename","stem","extname","dirname"];class VI{constructor(t){let n;t?Eb(t)?n={path:t}:typeof t=="string"||w9(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":m9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Nx.length;){const i=Nx[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)Nx.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?xo.basename(this.path):void 0}set basename(t){Cx(t,"basename"),jx(t,"basename"),this.path=xo.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?xo.dirname(this.path):void 0}set dirname(t){wj(this.basename,"dirname"),this.path=xo.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?xo.extname(this.path):void 0}set extname(t){if(jx(t,"extname"),wj(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=xo.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Eb(t)&&(t=y9(t)),Cx(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?xo.basename(this.path,this.extname):void 0}set stem(t){Cx(t,"stem"),jx(t,"stem"),this.path=xo.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 cs(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 jx(e,t){if(e&&e.includes(xo.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+xo.sep+"`")}function Cx(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wj(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function w9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const b9=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},v9={}.hasOwnProperty;class E0 extends b9{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=a9()}copy(){const t=new E0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Sx(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Px("data",this.frozen),this.namespace[t]=n,this):v9.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Px("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=Dh(t),r=this.parser||this.Parser;return Ex("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ex("process",this.parser||this.Parser),_x("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=Dh(t),u=r.parse(l);r.run(u,l,function(p,c,f){if(p||!c||!f)return d(p);const m=c,y=r.stringify(m,f);N9(y)?f.value=y:f.result=y,d(p,f)});function d(p,c){p||!c?a(p):i?i(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Ex("processSync",this.parser||this.Parser),_x("processSync",this.compiler||this.Compiler),this.process(t,s),vj("processSync","process",n),r;function s(i,a){n=!0,fj(i),r=a}}run(t,n,r){bj(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 u=Dh(n);s.run(t,u,d);function d(p,c,f){const m=c||t;p?l(p):a?a(m):r(void 0,m,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),vj("runSync","run",r),s;function i(a,l){fj(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=Dh(n),s=this.compiler||this.Compiler;return _x("stringify",s),bj(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Px("use",this.frozen),t!=null)if(typeof t=="function")u(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")u(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[p,...c]=d;u(p,c)}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=Sx(!0,s.settings,d.settings))}function l(d){let p=-1;if(d!=null)if(Array.isArray(d))for(;++p<d.length;){const c=d[p];i(c)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function u(d,p){let c=-1,f=-1;for(;++c<r.length;)if(r[c][0]===d){f=c;break}if(f===-1)r.push([d,...p]);else if(p.length>0){let[m,...y]=p;const v=r[f][1];Cb(v)&&Cb(m)&&(m=Sx(!0,v,m)),r[f]=[d,m,...y]}}}}const k9=new E0().freeze();function Ex(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _x(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Px(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 bj(e){if(!Cb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vj(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Dh(e){return S9(e)?e:new VI(e)}function S9(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function N9(e){return typeof e=="string"||j9(e)}function j9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const C9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kj=[],Sj={allowDangerousHtml:!0},E9=/^(https?|ircs?|mailto|xmpp)$/i,_9=[{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 jp(e){const t=P9(e),n=A9(e);return I9(t.runSync(t.parse(n),n),e)}function P9(e){const t=e.rehypePlugins||kj,n=e.remarkPlugins||kj,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Sj}:Sj;return k9().use(uW).use(n).use(i9,r).use(t)}function A9(e){const t=e.children||"",n=new VI;return typeof t=="string"&&(n.value=t),n}function I9(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||T9;for(const p of _9)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+C9+p.id,void 0);return BI(e,d),W4(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(p,c,f){if(p.type==="raw"&&f&&typeof c=="number")return a?f.children.splice(c,1):f.children[c]={type:"text",value:p.value},c;if(p.type==="element"){let m;for(m in bx)if(Object.hasOwn(bx,m)&&Object.hasOwn(p.properties,m)){const y=p.properties[m],v=bx[m];(v===null||v.includes(p.tagName))&&(p.properties[m]=u(String(y||""),m,p))}}if(p.type==="element"){let m=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!m&&r&&typeof c=="number"&&(m=!r(p,c,f)),m&&f&&typeof c=="number")return l&&p.children?f.children.splice(c,1,...p.children):f.children.splice(c,1),c}}}function T9(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||E9.test(e.slice(0,t))?e:""}function R9(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function lg(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>lg(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${lg(t[r])}`).join(",")}}`}function Nj(e){return lg({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 ep(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function jj(e){return lg({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 Cj(e,t){return!R9(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function Ej(e,t=!1){const n=new Map;for(const r of e){const s=ep(r);if(t&&n.has(s))throw new Error(`存在重复连线键: ${s}`);n.set(s,r)}return n}function L9(e,t,n,r){const s=new Map(e.map(b=>[b.id,b])),i=new Set(n.map(b=>b.id)),a=new Set,l=[],u=[],d=n.map(b=>{const x=s.get(b.id);return x?Nj(x)===Nj(b)?(a.add(b.id),x):(u.push(b.id),Cj(b,x)):(l.push(b.id),b)}),p=Ej(t),c=Ej(r,!0),f=new Set,m=[],y=[],v=r.map(b=>{const x=ep(b),N=p.get(x);return N?jj(N)===jj(b)?(f.add(x),N):(y.push(x),Cj(b,N)):(m.push(x),b)}),k=e.filter(b=>!i.has(b.id)).map(b=>b.id),g=t.map(b=>ep(b)).filter(b=>!c.has(b));return{nodes:d,edges:v,changes:{addedNodeIds:l,updatedNodeIds:u,removedNodeIds:k,addedEdgeKeys:m,updatedEdgeKeys:y,removedEdgeKeys:g},stats:{nodeAdded:l.length,nodeRemoved:k.length,nodeReused:a.size,edgeAdded:m.length,edgeRemoved:g.length,edgeReused:f.size,nextEdgeCount:c.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function UI(e){return typeof e>"u"||e===null}function M9(e){return typeof e=="object"&&e!==null}function O9(e){return Array.isArray(e)?e:UI(e)?[]:[e]}function $9(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 D9(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function F9(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var z9=UI,H9=M9,B9=O9,W9=D9,V9=F9,U9=$9,kr={isNothing:z9,isObject:H9,toArray:B9,repeat:W9,isNegativeZero:V9,extend:U9};function KI(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 tp(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=KI(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}tp.prototype=Object.create(Error.prototype);tp.prototype.constructor=tp;tp.prototype.toString=function(t){return this.name+": "+KI(this,t)};var vs=tp;function Ax(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 Ix(e,t){return kr.repeat(" ",t-e.length)+e}function K9(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="",u,d,p=Math.min(e.line+t.linesAfter,s.length).toString().length,c=t.maxLength-(t.indent+p+3);for(u=1;u<=t.linesBefore&&!(a-u<0);u++)d=Ax(e.buffer,r[a-u],s[a-u],e.position-(r[a]-r[a-u]),c),l=kr.repeat(" ",t.indent)+Ix((e.line-u+1).toString(),p)+" | "+d.str+`
|
|
82
|
+
`+l;for(d=Ax(e.buffer,r[a],s[a],e.position,c),l+=kr.repeat(" ",t.indent)+Ix((e.line+1).toString(),p)+" | "+d.str+`
|
|
83
|
+
`,l+=kr.repeat("-",t.indent+p+3+d.pos)+`^
|
|
84
|
+
`,u=1;u<=t.linesAfter&&!(a+u>=s.length);u++)d=Ax(e.buffer,r[a+u],s[a+u],e.position-(r[a]-r[a+u]),c),l+=kr.repeat(" ",t.indent)+Ix((e.line+u+1).toString(),p)+" | "+d.str+`
|
|
85
|
+
`;return l.replace(/\n$/,"")}var q9=K9,Y9=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],G9=["scalar","sequence","mapping"];function X9(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function J9(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(Y9.indexOf(n)===-1)throw new vs('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=X9(t.styleAliases||null),G9.indexOf(this.kind)===-1)throw new vs('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Ur=J9;function _j(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 Q9(){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 _b(e){return this.extend(e)}_b.prototype.extend=function(t){var n=[],r=[];if(t instanceof Ur)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 vs("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof Ur))throw new vs("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new vs("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 vs("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 Ur))throw new vs("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(_b.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=_j(s,"implicit"),s.compiledExplicit=_j(s,"explicit"),s.compiledTypeMap=Q9(s.compiledImplicit,s.compiledExplicit),s};var qI=_b,YI=new Ur("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),GI=new Ur("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),XI=new Ur("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),JI=new qI({explicit:[YI,GI,XI]});function Z9(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function eV(){return null}function tV(e){return e===null}var QI=new Ur("tag:yaml.org,2002:null",{kind:"scalar",resolve:Z9,construct:eV,predicate:tV,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function nV(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 rV(e){return e==="true"||e==="True"||e==="TRUE"}function sV(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var ZI=new Ur("tag:yaml.org,2002:bool",{kind:"scalar",resolve:nV,construct:rV,predicate:sV,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 iV(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function oV(e){return 48<=e&&e<=55}function aV(e){return 48<=e&&e<=57}function lV(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(!iV(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!oV(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!aV(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function cV(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 uV(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!kr.isNegativeZero(e)}var eT=new Ur("tag:yaml.org,2002:int",{kind:"scalar",resolve:lV,construct:cV,predicate:uV,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"]}}),dV=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function fV(e){return!(e===null||!dV.test(e)||e[e.length-1]==="_")}function pV(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 hV=/^[-+]?[0-9]+e/;function mV(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(kr.isNegativeZero(e))return"-0.0";return n=e.toString(10),hV.test(n)?n.replace("e",".e"):n}function gV(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||kr.isNegativeZero(e))}var tT=new Ur("tag:yaml.org,2002:float",{kind:"scalar",resolve:fV,construct:pV,predicate:gV,represent:mV,defaultStyle:"lowercase"}),nT=JI.extend({implicit:[QI,ZI,eT,tT]}),rT=nT,sT=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),iT=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 yV(e){return e===null?!1:sT.exec(e)!==null||iT.exec(e)!==null}function xV(e){var t,n,r,s,i,a,l,u=0,d=null,p,c,f;if(t=sT.exec(e),t===null&&(t=iT.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(u=t[7].slice(0,3);u.length<3;)u+="0";u=+u}return t[9]&&(p=+t[10],c=+(t[11]||0),d=(p*60+c)*6e4,t[9]==="-"&&(d=-d)),f=new Date(Date.UTC(n,r,s,i,a,l,u)),d&&f.setTime(f.getTime()-d),f}function wV(e){return e.toISOString()}var oT=new Ur("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:yV,construct:xV,instanceOf:Date,represent:wV});function bV(e){return e==="<<"||e===null}var aT=new Ur("tag:yaml.org,2002:merge",{kind:"scalar",resolve:bV}),_0=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
+
\r`;function vV(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=_0;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 kV(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=_0,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 SV(e){var t="",n=0,r,s,i=e.length,a=_0;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 NV(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var lT=new Ur("tag:yaml.org,2002:binary",{kind:"scalar",resolve:vV,construct:kV,predicate:NV,represent:SV}),jV=Object.prototype.hasOwnProperty,CV=Object.prototype.toString;function EV(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,CV.call(s)!=="[object Object]")return!1;for(i in s)if(jV.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 _V(e){return e!==null?e:[]}var cT=new Ur("tag:yaml.org,2002:omap",{kind:"sequence",resolve:EV,construct:_V}),PV=Object.prototype.toString;function AV(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],PV.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function IV(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 uT=new Ur("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:AV,construct:IV}),TV=Object.prototype.hasOwnProperty;function RV(e){if(e===null)return!0;var t,n=e;for(t in n)if(TV.call(n,t)&&n[t]!==null)return!1;return!0}function LV(e){return e!==null?e:{}}var dT=new Ur("tag:yaml.org,2002:set",{kind:"mapping",resolve:RV,construct:LV}),P0=rT.extend({implicit:[oT,aT],explicit:[lT,cT,uT,dT]}),hl=Object.prototype.hasOwnProperty,cg=1,fT=2,pT=3,ug=4,Tx=1,MV=2,Pj=3,OV=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,$V=/[\x85\u2028\u2029]/,DV=/[,\[\]\{\}]/,hT=/^(?:!|!!|![a-z\-]+!)$/i,mT=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Aj(e){return Object.prototype.toString.call(e)}function Po(e){return e===10||e===13}function oc(e){return e===9||e===32}function Ms(e){return e===9||e===32||e===10||e===13}function gu(e){return e===44||e===91||e===93||e===123||e===125}function FV(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function zV(e){return e===120?2:e===117?4:e===85?8:0}function HV(e){return 48<=e&&e<=57?e-48:-1}function Ij(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 BV(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function gT(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var yT=new Array(256),xT=new Array(256);for(var Yc=0;Yc<256;Yc++)yT[Yc]=Ij(Yc)?1:0,xT[Yc]=Ij(Yc);function WV(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||P0,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 wT(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=q9(n),new vs(t,n)}function it(e,t){throw wT(e,t)}function dg(e,t){e.onWarning&&e.onWarning.call(null,wT(e,t))}var Tj={YAML:function(t,n,r){var s,i,a;t.version!==null&&it(t,"duplication of %YAML directive"),r.length!==1&&it(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),s===null&&it(t,"ill-formed argument of the YAML directive"),i=parseInt(s[1],10),a=parseInt(s[2],10),i!==1&&it(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&dg(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var s,i;r.length!==2&&it(t,"TAG directive accepts exactly two arguments"),s=r[0],i=r[1],hT.test(s)||it(t,"ill-formed tag handle (first argument) of the TAG directive"),hl.call(t.tagMap,s)&&it(t,'there is a previously declared suffix for "'+s+'" tag handle'),mT.test(i)||it(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{it(t,"tag prefix is malformed: "+i)}t.tagMap[s]=i}};function cl(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||it(e,"expected valid JSON character");else OV.test(l)&&it(e,"the stream contains non-printable characters");e.result+=l}}function Rj(e,t,n,r){var s,i,a,l;for(kr.isObject(n)||it(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],hl.call(t,i)||(gT(t,i,n[i]),r[i]=!0)}function yu(e,t,n,r,s,i,a,l,u){var d,p;if(Array.isArray(s))for(s=Array.prototype.slice.call(s),d=0,p=s.length;d<p;d+=1)Array.isArray(s[d])&&it(e,"nested arrays are not supported inside keys"),typeof s=="object"&&Aj(s[d])==="[object Object]"&&(s[d]="[object Object]");if(typeof s=="object"&&Aj(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,p=i.length;d<p;d+=1)Rj(e,t,i[d],n);else Rj(e,t,i,n);else!e.json&&!hl.call(n,s)&&hl.call(t,s)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=u||e.position,it(e,"duplicated mapping key")),gT(t,s,i),delete n[s];return t}function A0(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++):it(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function mr(e,t,n){for(var r=0,s=e.input.charCodeAt(e.position);s!==0;){for(;oc(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(Po(s))for(A0(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&&dg(e,"deficient indentation"),r}function fy(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||Ms(n)))}function I0(e,t){t===1?e.result+=" ":t>1&&(e.result+=kr.repeat(`
|
|
88
|
+
`,t-1))}function VV(e,t,n){var r,s,i,a,l,u,d,p,c=e.kind,f=e.result,m;if(m=e.input.charCodeAt(e.position),Ms(m)||gu(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96||(m===63||m===45)&&(s=e.input.charCodeAt(e.position+1),Ms(s)||n&&gu(s)))return!1;for(e.kind="scalar",e.result="",i=a=e.position,l=!1;m!==0;){if(m===58){if(s=e.input.charCodeAt(e.position+1),Ms(s)||n&&gu(s))break}else if(m===35){if(r=e.input.charCodeAt(e.position-1),Ms(r))break}else{if(e.position===e.lineStart&&fy(e)||n&&gu(m))break;if(Po(m))if(u=e.line,d=e.lineStart,p=e.lineIndent,mr(e,!1,-1),e.lineIndent>=t){l=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=u,e.lineStart=d,e.lineIndent=p;break}}l&&(cl(e,i,a,!1),I0(e,e.line-u),i=a=e.position,l=!1),oc(m)||(a=e.position+1),m=e.input.charCodeAt(++e.position)}return cl(e,i,a,!1),e.result?!0:(e.kind=c,e.result=f,!1)}function UV(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(cl(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 Po(n)?(cl(e,r,s,!0),I0(e,mr(e,!1,t)),r=s=e.position):e.position===e.lineStart&&fy(e)?it(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);it(e,"unexpected end of the stream within a single quoted scalar")}function KV(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 cl(e,n,e.position,!0),e.position++,!0;if(l===92){if(cl(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),Po(l))mr(e,!1,t);else if(l<256&&yT[l])e.result+=xT[l],e.position++;else if((a=zV(l))>0){for(s=a,i=0;s>0;s--)l=e.input.charCodeAt(++e.position),(a=FV(l))>=0?i=(i<<4)+a:it(e,"expected hexadecimal character");e.result+=BV(i),e.position++}else it(e,"unknown escape sequence");n=r=e.position}else Po(l)?(cl(e,n,r,!0),I0(e,mr(e,!1,t)),n=r=e.position):e.position===e.lineStart&&fy(e)?it(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}it(e,"unexpected end of the stream within a double quoted scalar")}function qV(e,t){var n=!0,r,s,i,a=e.tag,l,u=e.anchor,d,p,c,f,m,y=Object.create(null),v,k,g,b;if(b=e.input.charCodeAt(e.position),b===91)p=93,m=!1,l=[];else if(b===123)p=125,m=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),b=e.input.charCodeAt(++e.position);b!==0;){if(mr(e,!0,t),b=e.input.charCodeAt(e.position),b===p)return e.position++,e.tag=a,e.anchor=u,e.kind=m?"mapping":"sequence",e.result=l,!0;n?b===44&&it(e,"expected the node content, but found ','"):it(e,"missed comma between flow collection entries"),k=v=g=null,c=f=!1,b===63&&(d=e.input.charCodeAt(e.position+1),Ms(d)&&(c=f=!0,e.position++,mr(e,!0,t))),r=e.line,s=e.lineStart,i=e.position,qu(e,t,cg,!1,!0),k=e.tag,v=e.result,mr(e,!0,t),b=e.input.charCodeAt(e.position),(f||e.line===r)&&b===58&&(c=!0,b=e.input.charCodeAt(++e.position),mr(e,!0,t),qu(e,t,cg,!1,!0),g=e.result),m?yu(e,l,y,k,v,g,r,s,i):c?l.push(yu(e,null,y,k,v,g,r,s,i)):l.push(v),mr(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(n=!0,b=e.input.charCodeAt(++e.position)):n=!1}it(e,"unexpected end of the stream within a flow collection")}function YV(e,t){var n,r,s=Tx,i=!1,a=!1,l=t,u=0,d=!1,p,c;if(c=e.input.charCodeAt(e.position),c===124)r=!1;else if(c===62)r=!0;else return!1;for(e.kind="scalar",e.result="";c!==0;)if(c=e.input.charCodeAt(++e.position),c===43||c===45)Tx===s?s=c===43?Pj:MV:it(e,"repeat of a chomping mode identifier");else if((p=HV(c))>=0)p===0?it(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?it(e,"repeat of an indentation width identifier"):(l=t+p-1,a=!0);else break;if(oc(c)){do c=e.input.charCodeAt(++e.position);while(oc(c));if(c===35)do c=e.input.charCodeAt(++e.position);while(!Po(c)&&c!==0)}for(;c!==0;){for(A0(e),e.lineIndent=0,c=e.input.charCodeAt(e.position);(!a||e.lineIndent<l)&&c===32;)e.lineIndent++,c=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>l&&(l=e.lineIndent),Po(c)){u++;continue}if(e.lineIndent<l){s===Pj?e.result+=kr.repeat(`
|
|
89
|
+
`,i?1+u:u):s===Tx&&i&&(e.result+=`
|
|
90
|
+
`);break}for(r?oc(c)?(d=!0,e.result+=kr.repeat(`
|
|
91
|
+
`,i?1+u:u)):d?(d=!1,e.result+=kr.repeat(`
|
|
92
|
+
`,u+1)):u===0?i&&(e.result+=" "):e.result+=kr.repeat(`
|
|
93
|
+
`,u):e.result+=kr.repeat(`
|
|
94
|
+
`,i?1+u:u),i=!0,a=!0,u=0,n=e.position;!Po(c)&&c!==0;)c=e.input.charCodeAt(++e.position);cl(e,n,e.position,!1)}return!0}function Lj(e,t){var n,r=e.tag,s=e.anchor,i=[],a,l=!1,u;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=i),u=e.input.charCodeAt(e.position);u!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,it(e,"tab characters must not be used in indentation")),!(u!==45||(a=e.input.charCodeAt(e.position+1),!Ms(a))));){if(l=!0,e.position++,mr(e,!0,-1)&&e.lineIndent<=t){i.push(null),u=e.input.charCodeAt(e.position);continue}if(n=e.line,qu(e,t,pT,!1,!0),i.push(e.result),mr(e,!0,-1),u=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&u!==0)it(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 GV(e,t,n){var r,s,i,a,l,u,d=e.tag,p=e.anchor,c={},f=Object.create(null),m=null,y=null,v=null,k=!1,g=!1,b;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),b=e.input.charCodeAt(e.position);b!==0;){if(!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,it(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,(b===63||b===58)&&Ms(r))b===63?(k&&(yu(e,c,f,m,y,null,a,l,u),m=y=v=null),g=!0,k=!0,s=!0):k?(k=!1,s=!0):it(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,b=r;else{if(a=e.line,l=e.lineStart,u=e.position,!qu(e,n,fT,!1,!0))break;if(e.line===i){for(b=e.input.charCodeAt(e.position);oc(b);)b=e.input.charCodeAt(++e.position);if(b===58)b=e.input.charCodeAt(++e.position),Ms(b)||it(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(yu(e,c,f,m,y,null,a,l,u),m=y=v=null),g=!0,k=!1,s=!1,m=e.tag,y=e.result;else if(g)it(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=p,!0}else if(g)it(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=p,!0}if((e.line===i||e.lineIndent>t)&&(k&&(a=e.line,l=e.lineStart,u=e.position),qu(e,t,ug,!0,s)&&(k?y=e.result:v=e.result),k||(yu(e,c,f,m,y,v,a,l,u),m=y=v=null),mr(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&b!==0)it(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return k&&yu(e,c,f,m,y,null,a,l,u),g&&(e.tag=d,e.anchor=p,e.kind="mapping",e.result=c),g}function XV(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&&it(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)):it(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!Ms(a);)a===33&&(r?it(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),hT.test(s)||it(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),DV.test(i)&&it(e,"tag suffix cannot contain flow indicator characters")}i&&!mT.test(i)&&it(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{it(e,"tag name is malformed: "+i)}return n?e.tag=i:hl.call(e.tagMap,s)?e.tag=e.tagMap[s]+i:s==="!"?e.tag="!"+i:s==="!!"?e.tag="tag:yaml.org,2002:"+i:it(e,'undeclared tag handle "'+s+'"'),!0}function JV(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&it(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Ms(n)&&!gu(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&it(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function QV(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&&!Ms(r)&&!gu(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&it(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),hl.call(e.anchorMap,n)||it(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],mr(e,!0,-1),!0}function qu(e,t,n,r,s){var i,a,l,u=1,d=!1,p=!1,c,f,m,y,v,k;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=a=l=ug===n||pT===n,r&&mr(e,!0,-1)&&(d=!0,e.lineIndent>t?u=1:e.lineIndent===t?u=0:e.lineIndent<t&&(u=-1)),u===1)for(;XV(e)||JV(e);)mr(e,!0,-1)?(d=!0,l=i,e.lineIndent>t?u=1:e.lineIndent===t?u=0:e.lineIndent<t&&(u=-1)):l=!1;if(l&&(l=d||s),(u===1||ug===n)&&(cg===n||fT===n?v=t:v=t+1,k=e.position-e.lineStart,u===1?l&&(Lj(e,k)||GV(e,k,v))||qV(e,v)?p=!0:(a&&YV(e,v)||UV(e,v)||KV(e,v)?p=!0:QV(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&it(e,"alias node should not have any properties")):VV(e,v,cg===n)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):u===0&&(p=l&&Lj(e,k))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&it(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,f=e.implicitTypes.length;c<f;c+=1)if(y=e.implicitTypes[c],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(hl.call(e.typeMap[e.kind||"fallback"],e.tag))y=e.typeMap[e.kind||"fallback"][e.tag];else for(y=null,m=e.typeMap.multi[e.kind||"fallback"],c=0,f=m.length;c<f;c+=1)if(e.tag.slice(0,m[c].tag.length)===m[c].tag){y=m[c];break}y||it(e,"unknown tag !<"+e.tag+">"),e.result!==null&&y.kind!==e.kind&&it(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)):it(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||p}function ZV(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&&(mr(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&&!Ms(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),s=[],r.length<1&&it(e,"directive name must not be less than one character in length");a!==0;){for(;oc(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!Po(a));break}if(Po(a))break;for(n=e.position;a!==0&&!Ms(a);)a=e.input.charCodeAt(++e.position);s.push(e.input.slice(n,e.position))}a!==0&&A0(e),hl.call(Tj,r)?Tj[r](e,r,s):dg(e,'unknown document directive "'+r+'"')}if(mr(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,mr(e,!0,-1)):i&&it(e,"directives end mark is expected"),qu(e,e.lineIndent-1,ug,!1,!0),mr(e,!0,-1),e.checkLineBreaks&&$V.test(e.input.slice(t,e.position))&&dg(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&fy(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,mr(e,!0,-1));return}if(e.position<e.length-1)it(e,"end of the stream or a document separator is expected");else return}function bT(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 WV(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,it(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;)ZV(n);return n.documents}function eU(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=bT(e,n);if(typeof t!="function")return r;for(var s=0,i=r.length;s<i;s+=1)t(r[s])}function tU(e,t){var n=bT(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new vs("expected a single document in the stream, but found more")}}var nU=eU,rU=tU,vT={loadAll:nU,load:rU},kT=Object.prototype.toString,ST=Object.prototype.hasOwnProperty,T0=65279,sU=9,np=10,iU=13,oU=32,aU=33,lU=34,Pb=35,cU=37,uU=38,dU=39,fU=42,NT=44,pU=45,fg=58,hU=61,mU=62,gU=63,yU=64,jT=91,CT=93,xU=96,ET=123,wU=124,_T=125,us={};us[0]="\\0";us[7]="\\a";us[8]="\\b";us[9]="\\t";us[10]="\\n";us[11]="\\v";us[12]="\\f";us[13]="\\r";us[27]="\\e";us[34]='\\"';us[92]="\\\\";us[133]="\\N";us[160]="\\_";us[8232]="\\L";us[8233]="\\P";var bU=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],vU=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function kU(e,t){var n,r,s,i,a,l,u;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)),u=e.compiledTypeMap.fallback[a],u&&ST.call(u.styleAliases,l)&&(l=u.styleAliases[l]),n[a]=l;return n}function SU(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 vs("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+kr.repeat("0",r-t.length)+t}var NU=1,rp=2;function jU(e){this.schema=e.schema||P0,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=kr.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=kU(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==='"'?rp:NU,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 Mj(e,t){for(var n=kr.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 Ab(e,t){return`
|
|
98
|
+
`+kr.repeat(" ",e.indent*t)}function CU(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 pg(e){return e===oU||e===sU}function sp(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==T0||65536<=e&&e<=1114111}function Oj(e){return sp(e)&&e!==T0&&e!==iU&&e!==np}function $j(e,t,n){var r=Oj(e),s=r&&!pg(e);return(n?r:r&&e!==NT&&e!==jT&&e!==CT&&e!==ET&&e!==_T)&&e!==Pb&&!(t===fg&&!s)||Oj(t)&&!pg(t)&&e===Pb||t===fg&&s}function EU(e){return sp(e)&&e!==T0&&!pg(e)&&e!==pU&&e!==gU&&e!==fg&&e!==NT&&e!==jT&&e!==CT&&e!==ET&&e!==_T&&e!==Pb&&e!==uU&&e!==fU&&e!==aU&&e!==wU&&e!==hU&&e!==mU&&e!==dU&&e!==lU&&e!==cU&&e!==yU&&e!==xU}function _U(e){return!pg(e)&&e!==fg}function ef(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 PT(e){var t=/^\n* /;return t.test(e)}var AT=1,Ib=2,IT=3,TT=4,Qc=5;function PU(e,t,n,r,s,i,a,l){var u,d=0,p=null,c=!1,f=!1,m=r!==-1,y=-1,v=EU(ef(e,0))&&_U(ef(e,e.length-1));if(t||a)for(u=0;u<e.length;d>=65536?u+=2:u++){if(d=ef(e,u),!sp(d))return Qc;v=v&&$j(d,p,l),p=d}else{for(u=0;u<e.length;d>=65536?u+=2:u++){if(d=ef(e,u),d===np)c=!0,m&&(f=f||u-y-1>r&&e[y+1]!==" ",y=u);else if(!sp(d))return Qc;v=v&&$j(d,p,l),p=d}f=f||m&&u-y-1>r&&e[y+1]!==" "}return!c&&!f?v&&!a&&!s(e)?AT:i===rp?Qc:Ib:n>9&&PT(e)?Qc:a?i===rp?Qc:Ib:f?TT:IT}function AU(e,t,n,r,s){e.dump=function(){if(t.length===0)return e.quotingType===rp?'""':"''";if(!e.noCompatMode&&(bU.indexOf(t)!==-1||vU.test(t)))return e.quotingType===rp?'"'+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 u(d){return CU(e,d)}switch(PU(t,l,e.indent,a,u,e.quotingType,e.forceQuotes&&!r,s)){case AT:return t;case Ib:return"'"+t.replace(/'/g,"''")+"'";case IT:return"|"+Dj(t,e.indent)+Fj(Mj(t,i));case TT:return">"+Dj(t,e.indent)+Fj(Mj(IU(t,a),i));case Qc:return'"'+TU(t)+'"';default:throw new vs("impossible error: invalid scalar style")}}()}function Dj(e,t){var n=PT(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 Fj(e){return e[e.length-1]===`
|
|
103
|
+
`?e.slice(0,-1):e}function IU(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,zj(e.slice(0,d),t)}(),s=e[0]===`
|
|
105
|
+
`||e[0]===" ",i,a;a=n.exec(e);){var l=a[1],u=a[2];i=u[0]===" ",r+=l+(!s&&!i&&u!==""?`
|
|
106
|
+
`:"")+zj(u,t),s=i}return r}function zj(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,s=0,i,a=0,l=0,u="";r=n.exec(e);)l=r.index,l-s>t&&(i=a>s?a:l,u+=`
|
|
107
|
+
`+e.slice(s,i),s=i+1),a=l;return u+=`
|
|
108
|
+
`,e.length-s>t&&a>s?u+=e.slice(s,a)+`
|
|
109
|
+
`+e.slice(a+1):u+=e.slice(s),u.slice(1)}function TU(e){for(var t="",n=0,r,s=0;s<e.length;n>=65536?s+=2:s++)n=ef(e,s),r=us[n],!r&&sp(n)?(t+=e[s],n>=65536&&(t+=e[s+1])):t+=r||SU(n);return t}function RU(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)),(wa(e,t,l,!1,!1)||typeof l>"u"&&wa(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=s,e.dump="["+r+"]"}function Hj(e,t,n,r){var s="",i=e.tag,a,l,u;for(a=0,l=n.length;a<l;a+=1)u=n[a],e.replacer&&(u=e.replacer.call(n,String(a),u)),(wa(e,t+1,u,!0,!0,!1,!0)||typeof u>"u"&&wa(e,t+1,null,!0,!0,!1,!0))&&((!r||s!=="")&&(s+=Ab(e,t)),e.dump&&np===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}function LU(e,t,n){var r="",s=e.tag,i=Object.keys(n),a,l,u,d,p;for(a=0,l=i.length;a<l;a+=1)p="",r!==""&&(p+=", "),e.condenseFlow&&(p+='"'),u=i[a],d=n[u],e.replacer&&(d=e.replacer.call(n,u,d)),wa(e,t,u,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),wa(e,t,d,!1,!1)&&(p+=e.dump,r+=p));e.tag=s,e.dump="{"+r+"}"}function MU(e,t,n,r){var s="",i=e.tag,a=Object.keys(n),l,u,d,p,c,f;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new vs("sortKeys must be a boolean or a function");for(l=0,u=a.length;l<u;l+=1)f="",(!r||s!=="")&&(f+=Ab(e,t)),d=a[l],p=n[d],e.replacer&&(p=e.replacer.call(n,d,p)),wa(e,t+1,d,!0,!0,!0)&&(c=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,c&&(e.dump&&np===e.dump.charCodeAt(0)?f+="?":f+="? "),f+=e.dump,c&&(f+=Ab(e,t)),wa(e,t+1,p,!0,c)&&(e.dump&&np===e.dump.charCodeAt(0)?f+=":":f+=": ",f+=e.dump,s+=f));e.tag=i,e.dump=s||"{}"}function Bj(e,t,n){var r,s,i,a,l,u;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(u=e.styleMap[l.tag]||l.defaultStyle,kT.call(l.represent)==="[object Function]")r=l.represent(t,u);else if(ST.call(l.represent,u))r=l.represent[u](t,u);else throw new vs("!<"+l.tag+'> tag resolver accepts not "'+u+'" style');e.dump=r}return!0}return!1}function wa(e,t,n,r,s,i,a){e.tag=null,e.dump=n,Bj(e,n,!1)||Bj(e,n,!0);var l=kT.call(e.dump),u=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var p=l==="[object Object]"||l==="[object Array]",c,f;if(p&&(c=e.duplicates.indexOf(n),f=c!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(s=!1),f&&e.usedDuplicates[c])e.dump="*ref_"+c;else{if(p&&f&&!e.usedDuplicates[c]&&(e.usedDuplicates[c]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(MU(e,t,e.dump,s),f&&(e.dump="&ref_"+c+e.dump)):(LU(e,t,e.dump),f&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?Hj(e,t-1,e.dump,s):Hj(e,t,e.dump,s),f&&(e.dump="&ref_"+c+e.dump)):(RU(e,t,e.dump),f&&(e.dump="&ref_"+c+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&AU(e,e.dump,t,i,u);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new vs("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 OU(e,t){var n=[],r=[],s,i;for(Tb(e,n,r),s=0,i=r.length;s<i;s+=1)t.duplicates.push(n[r[s]]);t.usedDuplicates=new Array(i)}function Tb(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)Tb(e[s],t,n);else for(r=Object.keys(e),s=0,i=r.length;s<i;s+=1)Tb(e[r[s]],t,n)}function $U(e,t){t=t||{};var n=new jU(t);n.noRefs||OU(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),wa(n,0,r,!0,!0)?n.dump+`
|
|
110
|
+
`:""}var DU=$U,FU={dump:DU};function R0(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 zU=Ur,HU=qI,BU=JI,WU=nT,VU=rT,UU=P0,KU=vT.load,qU=vT.loadAll,YU=FU.dump,GU=vs,XU={binary:lT,float:tT,map:XI,null:QI,pairs:uT,set:dT,timestamp:oT,bool:ZI,int:eT,merge:aT,omap:cT,seq:GI,str:YI},JU=R0("safeLoad","load"),QU=R0("safeLoadAll","loadAll"),ZU=R0("safeDump","dump"),RT={Type:zU,Schema:HU,FAILSAFE_SCHEMA:BU,JSON_SCHEMA:WU,CORE_SCHEMA:VU,DEFAULT_SCHEMA:UU,load:KU,loadAll:qU,dump:YU,YAMLException:GU,types:XU,safeLoad:JU,safeLoadAll:QU,safeDump:ZU};const ml=["requirement","planning","code","test","normal"],Rb={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},eK=["agent","control","provide","condition","jump","condition_jump","start","end"];function tK(e){return eK.includes(e)?e:"agent"}function nK(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function rK(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=RT.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:{},u=a.nodeSizes&&typeof a.nodeSizes=="object"?a.nodeSizes:{},d=a.viewport&&typeof a.viewport=="object"?a.viewport:null,p=d&&Number.isFinite(Number(d.x))&&Number.isFinite(Number(d.y))&&Number.isFinite(Number(d.zoom))?{x:Number(d.x),y:Number(d.y),zoom:Math.min(Math.max(Number(d.zoom),.1),4)}:void 0,c=typeof a.description=="string"&&a.description.trim()?a.description.trim():void 0,f=new Set(Object.keys(s));for(const v of i)v!=null&&v.source&&f.add(String(v.source)),v!=null&&v.target&&f.add(String(v.target));const m=Array.from(f).map(v=>{const k=s[v],g=l[v]&&typeof l[v].x=="number"&&typeof l[v].y=="number"?{x:l[v].x,y:l[v].y}:{x:0,y:0},b=u[v]&&typeof u[v].width=="number"&&typeof u[v].height=="number"?{width:u[v].width,height:u[v].height}:null,x=(k==null?void 0:k.definitionId)??v,N=nK(x),_=(k==null?void 0:k.label)!=null?String(k.label):v,C=(k==null?void 0:k.role)!=null?String(k.role).trim():"",T=Rb[C]||C,H=ml.includes(T)?T:"normal",L=(k==null?void 0:k.model)!=null?String(k.model).trim():void 0,F=(k==null?void 0:k.body)!=null?String(k.body):"",O=(k==null?void 0:k.script)!=null?String(k.script):"",D=Array.isArray(k==null?void 0:k.images)?k.images:[];return{id:v,type:tK(N),position:g,...b?{width:b.width,height:b.height}:{},data:{label:_,definitionId:x,schemaType:N,role:H,model:L||void 0,body:F,images:D,...b?{displaySize:b}:{},...O.trim()!==""?{script:O}:{}}}}),y=i.filter(v=>(v==null?void 0:v.source)&&(v==null?void 0:v.target)).map((v,k)=>({id:`e-${v.source}-${v.target}-${k}`,source:String(v.source),target:String(v.target),sourceHandle:v.sourceHandle??void 0,targetHandle:v.targetHandle??void 0,markerEnd:{type:Hs.ArrowClosed}}));return{nodes:m,edges:y,instances:s,description:c,...p?{viewport:p}:{}}}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 Cp(e,t){var s,i,a,l,u,d,p,c,f,m,y,v;const n=k=>{const g={type:(k==null?void 0:k.type)??"node",name:(k==null?void 0:k.name)??"",value:(k==null?void 0:k.value)??(k==null?void 0:k.default)??""};return(k==null?void 0:k.required)===!0&&(g.required=!0),(k==null?void 0:k.showOnNode)!=null&&(g.showOnNode=!!k.showOnNode),g},r={};for(const k of e){const g=t[k.id]&&typeof t[k.id]=="object"?{...t[k.id]}:{},b=((s=k.data)==null?void 0:s.definitionId)||k.id,x=((i=k.data)==null?void 0:i.inputs)??[],N=((a=k.data)==null?void 0:a.outputs)??[],_=((l=k.data)==null?void 0:l.role)!=null?String(k.data.role).trim():"",C=g.role!=null?String(g.role).trim():"",T=Rb[_]||_,H=Rb[C]||C,L=ml.includes(T)?T:ml.includes(H)?H:"normal",F=Array.isArray(x)?x.map(n):Array.isArray(g.input)?g.input.map(U=>n(U)):[],O=Array.isArray(N)?N.map(n):Array.isArray(g.output)?g.output.map(U=>n(U)):[],D=((u=k.data)==null?void 0:u.label)!=null?String(k.data.label):g.label!=null?String(g.label):k.id,W=(d=k.data)==null?void 0:d.body,$=W!=null?String(W):g.body!=null?String(g.body):"";let M=((p=k.data)==null?void 0:p.model)!=null&&String(k.data.model).trim()!==""?String(k.data.model).trim():g.model!=null&&String(g.model).trim()!==""?String(g.model).trim():void 0;(M===""||M==="default")&&(M=void 0);const I={...g,definitionId:b,label:D,role:L,model:M,input:F,output:O},z=((c=k.data)==null?void 0:c.marketplaceRef)||g.marketplaceRef;z?I.marketplaceRef=String(z):delete I.marketplaceRef;const P=((f=k.data)==null?void 0:f.marketplacePackageId)||g.marketplacePackageId;P?I.marketplacePackageId=String(P):delete I.marketplacePackageId;const R=((m=k.data)==null?void 0:m.marketplaceVersion)||g.marketplaceVersion;R?I.marketplaceVersion=String(R):delete I.marketplaceVersion,b.startsWith("provide_")||$.trim()===""?delete I.body:I.body=$;const E=Array.isArray((y=k.data)==null?void 0:y.images)?k.data.images:Array.isArray(g.images)?g.images:[];E.length>0?I.images=E:delete I.images;const J=(v=k.data)==null?void 0:v.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[k.id]=I}return r}function vf(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function sK(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 LT(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=>vf(a)),edges:i.map(a=>vf(a)),instances:Cp(r,n||{})}}function MT(e,t,n,r,s={}){var c;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(f=>f.id)),l=new Map;for(const f of e.nodes)l.set(f.id,sK(f.id,a));const u=e.nodes.map(f=>{var y,v;const m=l.get(f.id);return{...vf(f),id:m,selected:!0,dragging:!1,position:{x:Number(((y=f.position)==null?void 0:y.x)||0)+i.x,y:Number(((v=f.position)==null?void 0:v.y)||0)+i.y}}}),d=(e.edges||[]).filter(f=>l.has(f.source)&&l.has(f.target)).map((f,m)=>{const y=l.get(f.source),v=l.get(f.target);return{...vf(f),id:`e-${y}-${v}-${Date.now()}-${m}`,source:y,target:v,selected:!1}}),p={...r||{}};for(const[f,m]of l.entries()){const y=(c=e.instances)==null?void 0:c[f];y&&(p[m]={...vf(y),label:y.label!=null?String(y.label):m})}return{nodes:[...(t||[]).map(f=>({...f,selected:!1})),...u],edges:[...(n||[]).map(f=>({...f,selected:!1})),...d],instances:p,pastedNodeIds:u.map(f=>f.id)}}function Wj(e,t,n,r){var p,c,f,m;const s=Cp(e,n),i=t.map(y=>({source:y.source,target:y.target,sourceHandle:y.sourceHandle??null,targetHandle:y.targetHandle??null})),a={},l={};for(const y of e){const v=y.position??{x:0,y:0};a[y.id]={x:v.x,y:v.y};const k=Number(((c=(p=y.data)==null?void 0:p.displaySize)==null?void 0:c.width)||y.width||0),g=Number(((m=(f=y.data)==null?void 0:f.displaySize)==null?void 0:m.height)||y.height||0);k>0&&g>0&&(l[y.id]={width:Math.round(k),height:Math.round(g)})}const u={nodePositions:a};Object.keys(l).length>0&&(u.nodeSizes=l),r!=null&&r.viewport&&Number.isFinite(Number(r.viewport.x))&&Number.isFinite(Number(r.viewport.y))&&Number.isFinite(Number(r.viewport.zoom))&&(u.viewport={x:Number(r.viewport.x),y:Number(r.viewport.y),zoom:Math.min(Math.max(Number(r.viewport.zoom),.1),4)}),(r==null?void 0:r.description)!=null&&String(r.description).trim()!==""&&(u.description=String(r.description).trim());const d={instances:s,edges:i,ui:u};return RT.dump(d,{lineWidth:-1})}function iK(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],u=(l&&l.name!=null?String(l.name).trim():"")||`input-${a}`;t.inputNames.push(u)}for(let a=0;a<r.length;a++){const l=r[a],u=(l&&l.name!=null?String(l.name).trim():"")||`output-${a}`;t.outputNames.push(u)}return t}function oK(e,t,n){var u,d,p;const r=new Set(e.map(c=>c.id)),s={};for(const c of e)s[c.id]=iK(c);const i=new Map,a=new Map;for(const c of t)c.target&&r.has(c.target)&&(i.has(c.target)||i.set(c.target,new Set),c.targetHandle&&i.get(c.target).add(c.targetHandle)),c.source&&r.has(c.source)&&(a.has(c.source)||a.set(c.source,new Set),c.sourceHandle&&a.get(c.source).add(c.sourceHandle));const l=[];for(const c of e){const f=((u=c.data)==null?void 0:u.definitionId)!=null?String(c.data.definitionId):"",m=s[c.id]||{inputNames:[],outputNames:[]},y=m.inputNames.length,v=m.outputNames.length;if(!(f==="control_start"||f.startsWith("provide_"))&&y>0)for(let b=0;b<y;b++){const x=`input-${b}`;if(!((d=i.get(c.id))==null?void 0:d.has(x))){const _=m.inputNames[b]||x;l.push({nodeId:c.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:_,handle:x}),key:`${c.id}-${x}-in`})}}if(!(f==="control_end")&&v>0)for(let b=0;b<v;b++){const x=`output-${b}`;if(!((p=a.get(c.id))==null?void 0:p.has(x))){const _=m.outputNames[b]||x;l.push({nodeId:c.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:_,handle:x}),key:`${c.id}-${x}-out`})}}}return l}const hg=/\[image\s+(\d+)\]/gi;function Os(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 aK(e){return`image ${Os(e).length+1}`}function lK(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function cK(e,t){const n=Os(e),r=String(t||""),s=new Set;hg.lastIndex=0;let i;for(;i=hg.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function uK(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 OT(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 mg(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 $T({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=Os(n);for(const a of r){const l=await uK(a),u=aK(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:u,...l}),s=lK(s,u)}return{body:s,images:i}}function Lb(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 dK={agent_subAgent:["SubAgent"],control_start:["Start"],control_end:["End"],control_agent_toBool:["Agent ToBool"],control_anyOne:["Any One"],control_cancelled:["Cancelled","Cancel Check"],control_cd_workspace:["CD Workspace"],control_delay:["Delay"],control_if:["If Branch"],control_interval_loop:["Interval Loop"],control_load_skills:["Load Skills"],control_load_mcp:["Load MCP"],control_user_workspace:["User Workspace"],control_toBool:["To Bool","Code ToBool"],control_wait_until:["Wait Until"],tool_git_checkout:["Git Checkout"],tool_get_env:["Get Env"],tool_load_key:["Load Key"],tool_nodejs:["Node.js Script"],tool_print:["Print"],tool_save_key:["Save Key"],tool_user_ask:["UserAsk"],tool_user_check:["User Confirm"],provide_file:["File"],provide_bool:["Boolean"],provide_text:["Text"],provide_str:["Text"],display_markdown:["Markdown Display"],display_mermaid:["Mermaid Display"],display_ascii:["ASCII Display"],display_chart:["Chart Display"],display_table:["Table Display"]};function fK(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(dK[e]||[]).includes(s)?r:s}const pK={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"])},hK={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"])},mK=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_image","display_chart","display_table"]);function gK(e,t){if(!mK.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function yK(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function xK(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 Vj(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var d,p;const i=n[s],l=n.find(c=>(c==null?void 0:c.name)&&c.name===r.name)||i;if(!l)return r;const u=r.showOnNode===!1&&l.showOnNode==null&&((d=pK[e])==null?void 0:d.has(r.name));return{...r,...r.required==null&&l.required!=null?{required:!!l.required}:{},...u?{showOnNode:!0}:{},...!r._showOnNodeExplicit&&l.showOnNode!=null?{showOnNode:!!l.showOnNode}:{},...!r._showOnNodeExplicit&&l.showOnNode==null?{showOnNode:!!r.required||String(r.type||"").trim().toLowerCase()==="node"}:{},...!r._showOnNodeExplicit&&gK(e,r)?{showOnNode:!0}:{},...(p=hK[e])!=null&&p.has(r.name)?{showOnNode:!1}:{}}})}function DT(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 u=Lb(l);return{type:String(u.type||"node"),name:String(u.name??""),default:String(u.default??""),required:!!u.required,showOnNode:u.showOnNode!=null?u.showOnNode!==!1:!!u.required||String(u.type||"").trim().toLowerCase()==="node"}});return{inputs:r(t),outputs:r(n)}}function ip(e,t,n,r,s){var z,P,R,E,J,Z,U,se,pe,he,xe,le,Se,ie,oe,ye,ke,Ve,Je,We,ot;const i=((z=e.data)==null?void 0:z.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(ze=>ze.id===i),l=t[e.id];let u=[],d=[],p=((P=e.data)==null?void 0:P.label)??e.id,c,f,m,y,v;const k=!!l;l&&(Array.isArray(l.input)&&(u=l.input.map(Lb)),Array.isArray(l.output)&&(d=l.output.map(Lb)),l.label&&(p=String(l.label)),l.role&&typeof l.role=="string"&&(c=l.role),l.model!=null&&(f=String(l.model).trim()),l.body!=null&&(m=String(l.body)),Array.isArray(l.images)&&(y=l.images),l.script!=null&&(v=String(l.script)));const g=c??(typeof((R=e.data)==null?void 0:R.role)=="string"?e.data.role:"普通"),b=f??((E=e.data)==null?void 0:E.model)??void 0,x=(a==null?void 0:a.description)!=null?String(a.description).trim():"",N=x!==""?x:void 0,_=m??((J=e.data)==null?void 0:J.body)??"",C=Array.isArray(y)?y:Array.isArray((Z=e.data)==null?void 0:Z.images)?e.data.images:[],T=v!==void 0?v:((U=e.data)==null?void 0:U.script)!=null?String(e.data.script):"",H=String(e.id),L=(se=r==null?void 0:r[s])==null?void 0:se[H],F=(pe=L==null?void 0:L.label)==null?void 0:pe.label,O=L==null?void 0:L.body,D=L==null?void 0:L.description;k||(u.length===0&&((he=a==null?void 0:a.inputs)!=null&&he.length)&&(u=a.inputs.map(ze=>({...ze}))),d.length===0&&((xe=a==null?void 0:a.outputs)!=null&&xe.length)&&(d=a.outputs.map(ze=>({...ze}))));const W=xK(a,(a==null?void 0:a.id)??i),$=(l==null?void 0:l.marketplaceRef)||((le=e.data)==null?void 0:le.marketplaceRef)||yK(a);if(W==="agent_subAgent"&&!d.some(ze=>(ze==null?void 0:ze.name)==="result")){const ze=(Se=a==null?void 0:a.outputs)==null?void 0:Se.find(mt=>(mt==null?void 0:mt.name)==="result");d=[...d,ze?{...ze}:{type:"text",name:"result",default:""}]}if((W==="display_markdown"||W==="display_mermaid"||W==="display_ascii"||W==="display_chart"||W==="display_table")&&!d.some(ze=>(ze==null?void 0:ze.name)==="next")){const ze=(ie=a==null?void 0:a.outputs)==null?void 0:ie.find(mt=>(mt==null?void 0:mt.name)==="next");d=[...d,ze?{...ze}:{type:"node",name:"next",default:""}]}if(W==="workspace_run"){if(!u.some(ze=>(ze==null?void 0:ze.name)==="prev")){const ze=(oe=a==null?void 0:a.inputs)==null?void 0:oe.find(mt=>(mt==null?void 0:mt.name)==="prev");u=[ze?{...ze}:{type:"node",name:"prev",default:""},...u]}if(!d.some(ze=>(ze==null?void 0:ze.name)==="next")){const ze=(ye=a==null?void 0:a.outputs)==null?void 0:ye.find(mt=>(mt==null?void 0:mt.name)==="next");d=[...d,ze?{...ze}:{type:"node",name:"next",default:""}]}}u=Vj(W,u,a==null?void 0:a.inputs),d=Vj(W,d,a==null?void 0:a.outputs),W.startsWith("provide_")&&d[0]&&String(d[0].default??d[0].value??"").trim()===""&&String(_).trim()!==""&&(d=d.map((ze,mt)=>mt===0?{...ze,default:_,value:_}:ze));const M=fK(W,F||p,a),I=W==="tool_nodejs"||String(T).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:F||p,displayLabel:M,definitionDisplayName:a==null?void 0:a.displayName,definitionId:W,...$?{marketplaceRef:$}:{},...l!=null&&l.marketplacePackageId||(ke=e.data)!=null&&ke.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((Ve=e.data)==null?void 0:Ve.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(Je=e.data)!=null&&Je.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((We=e.data)==null?void 0:We.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((ot=e.data)==null?void 0:ot.schemaType)??e.type??"agent",role:g,model:b,body:O||_,images:C,script:T,inputs:u,outputs:d,description:D||N,originalLabel:p,originalBody:_,...I?{script:T}:{}}}}function FT(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var p,c,f,m;const s=n.get(r.source),i=n.get(r.target),a=((c=(p=s==null?void 0:s.data)==null?void 0:p.outputs)==null?void 0:c.length)??0,l=((m=(f=i==null?void 0:i.data)==null?void 0:f.inputs)==null?void 0:m.length)??0,u=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,d=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return s&&i&&u>=0&&u<a&&d>=0&&d<l})}function Uj(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 Kj(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function gg(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=Uj(t==null?void 0:t.sourceHandle,"output"),i=Uj(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(u=>{var d,p,c,f;if(u.id===n){const m=Kj((d=u.data)==null?void 0:d.outputs,s);if(m!==((p=u.data)==null?void 0:p.outputs))return a=!0,{...u,data:{...u.data,outputs:m}}}if(u.id===r){const m=Kj((c=u.data)==null?void 0:c.inputs,i);if(m!==((f=u.data)==null?void 0:f.inputs))return a=!0,{...u,data:{...u.data,inputs:m}}}return u});return a?l:e}const qj=80,wK=220;function bK(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:i,measured:a,internals:l,...u}=e;return u}function vK(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function Fh(e,t,n){const r={nodes:Array.isArray(e)?e.map(bK):[],edges:Array.isArray(t)?t.map(vK):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function Rx(e,t){const n=[...e,t];return n.length>qj?n.slice(n.length-qj):n}function zT({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[i,a]=h.useState(0),l=h.useRef([]),u=h.useRef([]),d=h.useRef(null),p=h.useRef(null),c=h.useRef(null),f=h.useRef(null),m=h.useRef(!1),y=h.useCallback(()=>a(_=>_+1),[]),v=h.useCallback(()=>{f.current&&(window.clearTimeout(f.current),f.current=null)},[]),k=h.useCallback(()=>{v();const _=p.current,C=c.current;return p.current=null,c.current=null,!_||!C||_.signature===C.signature?(C&&(d.current=C),!1):(l.current=Rx(l.current,_),u.current=[],d.current=C,y(),!0)},[y,v]),g=h.useCallback((_=[],C=[],T={})=>{v(),l.current=[],u.current=[],p.current=null,c.current=null,d.current=Fh(_,C,T),m.current=!1,y()},[y,v]),b=h.useCallback(_=>{m.current=!0,d.current=_,p.current=null,c.current=null,v(),s==null||s(_.value),y()},[y,v,s]),x=h.useCallback(()=>{k();const _=d.current||Fh(e,t,n),C=l.current.pop();return C?(u.current=Rx(u.current,_),b(C),!0):(y(),!1)},[y,t,n,k,e,b]),N=h.useCallback(()=>{k();const _=d.current||Fh(e,t,n),C=u.current.pop();return C?(l.current=Rx(l.current,_),b(C),!0):(y(),!1)},[y,t,n,k,e,b]);return h.useEffect(()=>()=>v(),[v]),h.useEffect(()=>{if(!r)return;const _=Fh(e,t,n);if(!d.current){d.current=_;return}if(m.current){m.current=!1,d.current=_;return}_.signature!==d.current.signature&&(p.current||(p.current=d.current),c.current=_,v(),f.current=window.setTimeout(()=>{k()},wK))},[v,t,r,n,k,e]),{canUndo:l.current.length>0||!!p.current,canRedo:u.current.length>0,resetHistory:g,undo:x,redo:N,version:i}}function rr(e){switch(yg(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function yg(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 kK(e,t){const n=yg(e),r=yg(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const SK=new Set(["workspaceContext","skillsContext","mcpContext"]);function Mb(e){const t=yg(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&SK.has(n)?`${t}+${n}`:t}function HT(e){return Mb(e)}function Yu(e,t){if(!e||!t||!kK(e.type,t.type))return!1;const n=Mb(e),r=Mb(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function NK(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 Gu(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=NK(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 na(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function jK(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 CK(e){const t=String(e||"").trim();return t?t.match(/^marketplace:/i)?"MARKETPLACE":t:""}function EK(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function Hr(e){e.stopPropagation()}function _K(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function PK(e,t){const n=`\\[${_K(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
124
|
+
`).replace(/\n{3,}/g,`
|
|
125
|
+
|
|
126
|
+
`).trimEnd()}function Lx(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function AK(e){const t=String(e||"");let n="",r=0;hg.lastIndex=0;let s;for(;s=hg.exec(t);)n+=Lx(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${Lx(s[0])}</span>`,r=s.index+s[0].length;return n+=Lx(t.slice(r)),n||" "}function IK(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,u=String(t||"").split(/\r\n|\r|\n/).length,d=Math.min(Math.max(u,2),8);return Math.ceil(d*r+s+i+a+l)}function BT({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:u,onModelChange:d}){var Kn,Nr;const{t:p}=In(),c=(e==null?void 0:e.inputs)??[],f=(e==null?void 0:e.outputs)??[],m=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),y=jK(e),v=CK(y),k=(e==null?void 0:e.isRunMode)??!1,g=!!(e!=null&&e.readOnly),b=(e==null?void 0:e.isExecuting)??!1,x=(e==null?void 0:e.isDim)??!1,N=(e==null?void 0:e.nodeStatus)??null,_=(e==null?void 0:e.nodeElapsed)??null,C=(e==null?void 0:e.definitionId)||"",T=C.startsWith("provide_"),H=C==="provide_bool",L=C==="provide_str",F=C==="provide_file",O=C==="agent_subAgent",D=O&&!k,W=H?EK(f[0]):!1,$=T?String(((Kn=f[0])==null?void 0:Kn.value)??((Nr=f[0])==null?void 0:Nr.default)??(e==null?void 0:e.body)??""):"",M=String((e==null?void 0:e.body)||""),I=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||p("flow:node.fallbackLabel"),z=!T&&!D&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",P=Os(e==null?void 0:e.images),R=h.useRef(!1),E=h.useRef(!1),J=h.useRef(null),Z=h.useRef(null),U=h.useRef(null),[se,pe]=h.useState($),[he,xe]=h.useState(M);h.useEffect(()=>{R.current||pe($)},[n,$]),h.useEffect(()=>{E.current||xe(M)},[n,M]),h.useEffect(()=>{const we=Z.current;if(!we)return;const Me=IK(we,he);we.style.minHeight=`${Me}px`,we.style.height="",U.current&&(U.current.style.minHeight=`${Me}px`,U.current.style.height="")},[he]),h.useEffect(()=>{const we=J.current,Me=e==null?void 0:e.onNodeContentResize;if(!D||!we||!Me||typeof ResizeObserver>"u")return;let ct=0;const vt=()=>{window.cancelAnimationFrame(ct),ct=window.requestAnimationFrame(()=>Me(n))},ae=new ResizeObserver(vt);return ae.observe(we),vt(),()=>{window.cancelAnimationFrame(ct),ae.disconnect()}},[e==null?void 0:e.onNodeContentResize,D,n]);const le=Array.isArray(u==null?void 0:u.cursor)?u.cursor:[],Se=Array.isArray(u==null?void 0:u.opencode)?u.opencode:[],ie=Array.isArray(u==null?void 0:u.claudeCode)?u.claudeCode:[],oe=((e==null?void 0:e.model)??"").trim(),ye=m==="agent"&&!C.startsWith("tool_nodejs"),ke=new Set(le.map(na)),Ve=new Set(Se.map(na)),Je=new Set(ie.map(na)),We=oe?oe.startsWith("cursor:")||oe.startsWith("opencode:")||oe.startsWith("claude-code:")?oe:Je.has(oe)?`claude-code:${oe}`:Ve.has(oe)?`opencode:${oe}`:ke.has(oe)?`cursor:${oe}`:oe:"",ot=oe&&!We.startsWith("cursor:")&&!We.startsWith("opencode:")&&!We.startsWith("claude-code:")&&!ke.has(oe)&&!Ve.has(oe)&&!Je.has(oe),ze=oe.startsWith("cursor:")?oe.slice(7):oe.startsWith("opencode:")?oe.slice(9):oe.startsWith("claude-code:")?oe.slice(12):oe,mt=we=>{if(g)return;const Me=we.target.value;d&&d(n,Me)},ln=we=>{we.stopPropagation(),!g&&r&&r(n)},zn=we=>{we.stopPropagation(),s&&s()},Bt=we=>{we.stopPropagation(),!g&&(i==null||i(n,we.target.value==="true"?"true":"false"))},en=we=>{if(we.stopPropagation(),g)return;const Me=we.target.value;pe(Me),R.current||i==null||i(n,Me)},cn=we=>{we.stopPropagation(),R.current=!0},un=we=>{if(we.stopPropagation(),g)return;R.current=!1;const Me=we.currentTarget.value;pe(Me),i==null||i(n,Me)},ue=()=>{g||i==null||i(n,se)},Ne=we=>{if(we.stopPropagation(),g)return;const Me=window.prompt("文件路径",se);Me!=null&&(pe(Me),i==null||i(n,Me))},He=we=>{if(xe(we),a==null||a(n,we),l){const Me=cK(P,we);(Me.length!==P.length||Me.some((ct,vt)=>{var ae;return ct.id!==((ae=P[vt])==null?void 0:ae.id)}))&&l(n,Me)}},nt=we=>{if(we.stopPropagation(),g)return;const Me=we.target.value;E.current?xe(Me):He(Me)},et=we=>{we.stopPropagation(),!g&&(E.current=!0)},_t=we=>{if(we.stopPropagation(),g)return;E.current=!1;const Me=we.currentTarget.value;He(Me)},st=()=>{g||He(he)},dn=async we=>{if(g)return;const Me=await $T({files:we,body:he,images:P});Me&&(xe(Me.body),a==null||a(n,Me.body),l==null||l(n,Me.images))},on=(we,Me)=>{if(we.stopPropagation(),g)return;const ct=P.filter(ae=>ae.id!==Me.id),vt=PK(he,Me.label);xe(vt),a==null||a(n,vt),l==null||l(n,ct)},Un=we=>{if(g)return;const Me=OT(we);Me.length!==0&&(we.preventDefault(),we.stopPropagation(),dn(Me).catch(()=>{}))},fn=we=>{if(g)return;const Me=mg(we);Me.length!==0&&(we.preventDefault(),we.stopPropagation(),dn(Me).catch(()=>{}))},Tn=()=>{const we=Z.current,Me=U.current;!we||!Me||(Me.scrollTop=we.scrollTop,Me.scrollLeft=we.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(b?" af-flow-node--executing":"")+(N==="success"?" af-flow-node--done":"")+(N==="failed"?" af-flow-node--failed":"")+(N==="running"&&!b?" af-flow-node--running-disk":"")+(x?" af-flow-node--dim":"")+(D?" af-flow-node--inline-body-editor":"")+(L?" af-flow-node--provide-text":"")+" af-flow-node--"+m.replace(/[^a-z0-9_-]/g,""),"data-schema":m,children:[o.jsxs("div",{className:"af-flow-node__chrome",children:[o.jsx("span",{className:"af-flow-node__type",title:y,children:v}),!k&&ye&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:Hr,onMouseDown:Hr,onClick:Hr,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:We,onChange:mt,onPointerDown:Hr,onMouseDown:Hr,onClick:Hr,"aria-label":p("flow:node.model"),title:ze||p("flow:node.defaultModel"),disabled:g,children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),ot&&o.jsx("option",{value:oe,children:oe}),le.length>0&&o.jsx("optgroup",{label:"Cursor",children:le.map(we=>o.jsx("option",{value:`cursor:${na(we)}`,children:na(we)},`c-${we}`))}),Se.length>0&&o.jsx("optgroup",{label:"OpenCode",children:Se.map(we=>o.jsx("option",{value:`opencode:${na(we)}`,children:na(we)},`o-${we}`))}),ie.length>0&&o.jsx("optgroup",{label:"Claude Code",children:ie.map(we=>o.jsx("option",{value:`claude-code:${na(we)}`,children:na(we)},`cc-${we}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),b&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),N==="running"&&!b&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:p("flow:node.diskRunning"),children:"RUNNING"}),N==="success"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:_!=null&&String(_).trim()!==""?_:"--"}),N==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!k&&T&&!H&&!L&&!F&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:zn,"aria-label":p("flow:node.expandProvide"),title:p("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!k&&o.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:g,onClick:ln,"aria-label":p("flow:node.deleteNode"),title:p("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:c.map((we,Me)=>{if(we.showOnNode===!1)return null;const ct=p("flow:node.inputTooltip",{name:we.name||`#${Me}`,type:we.type})+(we.default!=null&&we.default!==""?p("flow:node.defaultSuffix",{value:we.default}):""),vt=we.name||`#${Me+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:ct,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[vt,we.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Ws,{type:"target",position:Xe.Left,id:`input-${Me}`,className:"af-flow-node__handle",style:{background:rr(we.type)},title:ct})]},`in-${Me}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[o.jsx("span",{className:"af-flow-node__title",children:I}),n?o.jsx("span",{className:"af-flow-node__subtitle",title:n,children:n}):null,H?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(W?" af-flow-node__bool-select--true":""),value:W?"true":"false",onChange:Bt,onPointerDown:Hr,onMouseDown:Hr,onClick:Hr,"aria-label":"Boolean value",title:W?"true":"false",disabled:g,children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):L?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:se,onChange:en,onCompositionStart:cn,onCompositionEnd:un,onBlur:ue,onPointerDown:Hr,onMouseDown:Hr,onClick:Hr,placeholder:"输入文本",rows:2,readOnly:g}):F?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:Hr,onMouseDown:Hr,onClick:Hr,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:se,onChange:en,onCompositionStart:cn,onCompositionEnd:un,onBlur:ue,placeholder:"选择或输入文件路径",title:se||"选择或输入文件路径",readOnly:g}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:g,onClick:Ne,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):O&&!k?o.jsxs("div",{ref:J,className:"af-flow-node__prompt-stack nodrag",children:[o.jsx("pre",{ref:U,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:AK(he)+`
|
|
127
|
+
`}}),o.jsx("textarea",{ref:Z,className:"af-flow-node__prompt-editor nodrag",value:he,onChange:nt,onCompositionStart:et,onCompositionEnd:_t,onBlur:st,onPaste:Un,onDrop:fn,onScroll:Tn,onDragOver:we=>{mg(we).length>0&&we.preventDefault()},placeholder:"输入 prompt",rows:2,readOnly:g})]}):null,O&&P.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:P.map((we,Me)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:we.name,children:[o.jsx("img",{src:we.dataUrl,alt:""}),o.jsxs("span",{children:["[",we.label||`image ${Me+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:g,onClick:ct=>on(ct,we),onPointerDown:Hr,onMouseDown:Hr,"aria-label":`删除 ${we.label||`image ${Me+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},we.id||Me))}):null,z?o.jsx("span",{className:"af-flow-node__prompt-preview",title:z,children:z}):null]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:f.map((we,Me)=>{if(we.showOnNode===!1)return null;const ct=p("flow:node.outputTooltip",{name:we.name||`#${Me}`,type:we.type})+(we.default!=null&&we.default!==""?p("flow:node.defaultSuffix",{value:we.default}):""),vt=we.name||`#${Me+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:ct,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[vt,we.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Ws,{type:"source",position:Xe.Right,id:`output-${Me}`,className:"af-flow-node__handle",style:{background:rr(we.type)},title:ct})]},`out-${Me}`)})})]})]})}const Ep="flowNode";function WT(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 xg(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function TK(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function VT({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=In(),a=h.useId(),l=h.useRef(null),[u,d]=h.useState(""),[p,c]=h.useState(!1),[f,m]=h.useState("");if(h.useEffect(()=>{if(!e)return;d(""),m(""),c(!1);const g=requestAnimationFrame(()=>{var b;return(b=l.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(g)},[e,n]),!e)return null;const y=u.trim(),v=y===n;async function k(g){if(g.preventDefault(),!(!v||p)){c(!0),m("");try{const b=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:y})}),x=await b.json().catch(()=>({}));if(!b.ok){m(typeof x.error=="string"?x.error:i("project:archiveModal.archiveFailed"));return}s()}catch(b){m(String((b==null?void 0:b.message)||b))}finally{c(!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:k,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:i("project:archiveModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:i("project:archiveModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:u,onChange:g=>d(g.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!v})]}),f?o.jsx("p",{className:"af-err af-new-pipeline-err",children:f}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:p,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!v||p,children:i(p?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function Yj({open:e,title:t,message:n,confirmLabel:r,cancelLabel:s,destructive:i=!1,secondaryLabel:a,secondaryDestructive:l=!1,onSecondary:u,onConfirm:d,onCancel:p}){const{t:c}=In(),f=h.useId(),m=h.useRef(null);if(h.useEffect(()=>{if(!e)return;const g=requestAnimationFrame(()=>{var x;return(x=m.current)==null?void 0:x.focus()});function b(x){x.key==="Escape"&&p(),x.key==="Enter"&&d()}return window.addEventListener("keydown",b),()=>{cancelAnimationFrame(g),window.removeEventListener("keydown",b)}},[e,p,d]),!e)return null;const y=r??c("common:common.confirm","确定"),v=s??c("common:common.cancel","取消"),k=t??c("common:common.confirmTitle","请确认");return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&p()},children:o.jsxs("div",{ref:m,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":f,tabIndex:-1,onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:f,className:"af-shortcuts-panel__title",children:k}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:p,"aria-label":v,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-shortcuts-panel__body af-new-pipeline-form",children:[o.jsx("p",{className:"af-new-pipeline-lead",children:n}),o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:p,children:v}),a&&u?o.jsx("button",{type:"button",className:l?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:u,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 UT({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=In(),l=h.useId(),u=h.useRef(null),[d,p]=h.useState(""),[c,f]=h.useState(!1),[m,y]=h.useState("");if(h.useEffect(()=>{if(!e)return;p(""),y(""),f(!1);const b=requestAnimationFrame(()=>{var x;return(x=u.current)==null?void 0:x.focus()});return()=>cancelAnimationFrame(b)},[e,n]),!e)return null;const v=d.trim(),k=v===n;async function g(b){if(b.preventDefault(),!k||c)return;f(!0),y("");let x=null;try{const N=new AbortController;x=setTimeout(()=>N.abort(),15e3);const _=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:v,flowArchived:s}),signal:N.signal}),C=await _.json().catch(()=>({}));if(!_.ok){y(typeof C.error=="string"?C.error:a("project:deleteModal.deleteFailed"));return}try{for(let T=localStorage.length-1;T>=0;T--){const H=localStorage.key(T);H&&(H.startsWith(`af:composer-sessions:${n}:${r}`)||H.startsWith(`af:composer-active-session:${n}:${r}`)||H.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(H)}}catch{}await i()}catch(N){if((N==null?void 0:N.name)==="AbortError"){y(a("project:deleteModal.deleteTimeout"));return}y(String((N==null?void 0:N.message)||N))}finally{x&&clearTimeout(x),f(!1)}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&t()},children:o.jsxs("div",{ref:u,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:l,className:"af-shortcuts-panel__title",children:a("project:deleteModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":a("project:deleteModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit: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:b=>p(b.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":v.length>0&&!k})]}),m?o.jsx("p",{className:"af-err af-new-pipeline-err",children:m}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:c,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!k||c,children:a(c?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function RK({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Bi({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(RK,{children:t})]},n))})}function KT({open:e,onClose:t}){const{t:n}=In(),r=h.useRef(null);if(h.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=TK()?"⌘":"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(Bi,{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(Bi,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Bi,{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(Bi,{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(Bi,{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(Bi,{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(Bi,{keys:["Space"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveViewport")}),o.jsx(Bi,{keys:["F"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),o.jsx(Bi,{keys:[i,"A"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.undo")}),o.jsx(Bi,{keys:[i,"Z"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.redo")}),o.jsx(Bi,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function LK(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 qT({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=In(),[i,a]=h.useState(""),[l,u]=h.useState(0),d=h.useRef(null),p=h.useRef(null);h.useEffect(()=>{if(!e)return;a(""),u(0);const y=requestAnimationFrame(()=>{var v;return(v=d.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(y)},[e]);const c=h.useMemo(()=>{const y=(r||[]).map(g=>{var b,x,N;return{id:g.id,label:((b=g.data)==null?void 0:b.label)||"",definitionId:((x=g.data)==null?void 0:x.definitionId)||"",schemaType:((N=g.data)==null?void 0:N.schemaType)||""}}),v=i.trim(),k=y.map(g=>({e:g,s:LK(g,v)})).filter(g=>g.s>0);return k.sort((g,b)=>b.s-g.s||g.e.id.localeCompare(b.e.id)),k.slice(0,50).map(g=>g.e)},[r,i]);if(h.useEffect(()=>{l>=c.length&&u(0)},[c.length,l]),h.useEffect(()=>{var v;const y=(v=p.current)==null?void 0:v.querySelector(`[data-idx="${l}"]`);y&&y.scrollIntoView({block:"nearest"})},[l]),!e)return null;const f=y=>{const v=c[y];v&&(n(v.id),t())},m=y=>{if(y.key==="Escape"){y.preventDefault(),t();return}if(y.key==="ArrowDown"){y.preventDefault(),u(v=>Math.min(c.length-1,v+1));return}if(y.key==="ArrowUp"){y.preventDefault(),u(v=>Math.max(0,v-1));return}y.key==="Enter"&&(y.preventDefault(),f(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),u(0)},onKeyDown:m,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:c.length})]}),c.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:p,className:"af-jump-panel__list",role:"listbox",children:c.map((y,v)=>o.jsxs("li",{"data-idx":v,role:"option","aria-selected":v===l,className:"af-jump-panel__item"+(v===l?" af-jump-panel__item--active":""),onMouseEnter:()=>u(v),onMouseDown:k=>{k.preventDefault(),f(v)},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 MK({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,filePath:i,fileName:a,onSaved:l,onAiEdit:u}){const{t:d}=In(),p=h.useId(),c=h.useRef(null),f=h.useRef(null),[m,y]=h.useState(""),[v,k]=h.useState(""),[g,b]=h.useState(!1),[x,N]=h.useState(!1),[_,C]=h.useState(!1),[T,H]=h.useState(""),[L,F]=h.useState("");if(h.useEffect(()=>{if(!e||!i)return;y(""),k(""),H(""),F(""),b(!0),N(!1),C(!1);const I=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i});(async()=>{try{const P=await fetch(`/api/pipeline-file-content?${I}`),R=await P.json();if(!P.ok)throw new Error(R.error||"HTTP "+P.status);y(R.content||""),k(R.content||"")}catch(P){H(P.message||String(P))}finally{b(!1)}})();const z=requestAnimationFrame(()=>{var P;return(P=c.current)==null?void 0:P.focus()});return()=>cancelAnimationFrame(z)},[e,i,n,r,s]),!e)return null;const O=m!==v;async function D(I){if(I.preventDefault(),!x){N(!0),H(""),F("");try{const z=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i}),P=await fetch(`/api/pipeline-file-save?${z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:m})}),R=await P.json();if(!P.ok)throw new Error(R.error||"HTTP "+P.status);k(m),F(d("flow:fileEdit.saved")),l&&l()}catch(z){H(z.message||String(z))}finally{N(!1)}}}async function W(){if(!(!u||_||!m)){C(!0),H("");try{const I=await u(m);typeof I=="string"&&I&&y(I)}catch(I){H(I.message||String(I))}finally{C(!1)}}}function $(){y(v),H(""),F("")}const M=m.length>1e5;return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:I=>{I.target===I.currentTarget&&t()},children:o.jsxs("div",{ref:c,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":p,tabIndex:-1,onMouseDown:I=>I.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:p,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")}):T&&!m?o.jsx("div",{className:"af-file-edit-error",children:T}):o.jsxs(o.Fragment,{children:[M&&o.jsx("div",{className:"af-file-edit-warning",children:d("flow:fileEdit.largeFileWarning")}),o.jsx("textarea",{ref:f,className:"af-file-edit-textarea",value:m,onChange:I=>y(I.target.value),spellCheck:!1,placeholder:d("flow:fileEdit.placeholder")})]})}),(T||L)&&!g&&o.jsx("div",{className:`af-file-edit-status${L?" af-file-edit-status--success":""}`,children:L||T}),o.jsxs("div",{className:"af-file-edit-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:$,disabled:!O||x||_,children:d("flow:fileEdit.reset")}),u&&o.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:W,disabled:_||x||!m,children:d(_?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),o.jsx("button",{type:"button",className:"af-btn-primary",onClick:D,disabled:!O||x||_,children:d(x?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const YT=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),OK=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function $K(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 DK(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 Gj(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 GT(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(YT.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 XT(e){return{inputNames:Gj(e==null?void 0:e.inputs),outputNames:Gj(e==null?void 0:e.outputs)}}function FK(e,t,n){const r=XT(t),s=DK(e),i=[];for(const a of s)if(!GT(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 zK(e,t){const n=XT(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],u=GT(a[1],n);s.push({kind:u?"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 HK(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function BK(e){return e.map(t=>{const n=HK(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 WK(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 OK)YT.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function VK(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 UK(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(),u=parseFloat(r.lineHeight),d=Number.isFinite(u)&&u>0?u:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:d}}function zh({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:u,onImagesChange:d}){const{t:p}=In(),c=h.useId(),f=h.useRef(null),m=h.useRef(null),[y,v]=h.useState(0),[k,g]=h.useState(0),[b,x]=h.useState(null),N=h.useMemo(()=>Os(u),[u]),_=h.useMemo(()=>FK(e,a,p),[e,a,p]),C=_.length>0,T=h.useMemo(()=>zK(e,a),[e,a]),H=h.useMemo(()=>BK(T),[T]),L=h.useMemo(()=>n?null:$K(e,y),[e,y,n]),F=h.useMemo(()=>{if(!L)return[];const I=WK(a,p);return VK(I,L.query)},[L,a,p]);h.useEffect(()=>{g(I=>{const z=Math.max(0,F.length-1);return Math.min(Math.max(0,I),z)})},[F.length]);const O=h.useCallback(()=>{const I=f.current;if(!I||!L||F.length===0){x(null);return}const z=UK(I,y);if(!z){x(null);return}const P=4,R=44,E=13.5*16,J=Math.min(F.length*R+8,E);let Z=z.bottom+P;Z+J>window.innerHeight-8&&(Z=Math.max(8,z.top-J-P));const U=288;let se=z.left;se=Math.max(8,Math.min(se,window.innerWidth-U-8)),x({top:Z,left:se})},[L,F.length,y]);h.useLayoutEffect(()=>{if(!L||F.length===0){x(null);return}const I=requestAnimationFrame(()=>O());return()=>cancelAnimationFrame(I)},[L,F.length,y,e,O]),h.useEffect(()=>{if(!L||F.length===0)return;const I=()=>O();return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[L,F.length,O]);const D=h.useCallback(I=>{if(!L)return;const{atIndex:z}=L,P=e.slice(0,z)+"${"+I+"}"+e.slice(y);t(P);const R=z+I.length+3;queueMicrotask(()=>{const E=f.current;E&&(E.focus(),E.setSelectionRange(R,R)),v(R)})},[L,e,y,t]),W=h.useCallback(()=>{const I=f.current,z=m.current;!I||!z||(z.scrollTop=I.scrollTop,z.scrollLeft=I.scrollLeft,L&&F.length>0&&queueMicrotask(()=>O()))},[L,F.length,O]),$=h.useCallback(I=>{if(!n&&L&&F.length>0&&(I.key==="ArrowDown"||I.key==="ArrowUp"||I.key==="Enter")){if(I.key==="ArrowDown")I.preventDefault(),g(z=>(z+1)%F.length);else if(I.key==="ArrowUp")I.preventDefault(),g(z=>(z-1+F.length)%F.length);else if(I.key==="Enter"&&!I.shiftKey){I.preventDefault();const z=F[k];z&&D(z.insert)}}},[n,L,F,k,D]),M=h.useCallback(async I=>{if(n||typeof d!="function")return!1;const z=await $T({files:I,body:e,images:N});return z?(t(z.body),d(z.images),queueMicrotask(()=>{const P=f.current;if(!P)return;P.focus();const R=z.body.length;P.setSelectionRange(R,R),v(R)}),!0):!1},[n,N,t,d,e]);return o.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[N.length>0?o.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:N.map((I,z)=>o.jsxs("span",{className:"af-body-image-chip",title:I.name,children:[o.jsx("img",{src:I.dataUrl,alt:""}),o.jsxs("span",{children:["[",I.label||`image ${z+1}`,"]"]})]},I.id||z))}):null,o.jsxs("div",{className:"af-body-prompt-stack",children:[o.jsx("pre",{ref:m,className:"af-body-prompt-backdrop "+i,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:H+`
|
|
128
|
+
`}}),o.jsx("textarea",{ref:f,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":C,"aria-describedby":C?c:void 0,onChange:I=>{t(I.target.value),v(I.target.selectionStart??I.target.value.length)},onSelect:I=>{const z=I.target;z instanceof HTMLTextAreaElement&&v(z.selectionStart??0)},onClick:I=>{const z=I.target;z instanceof HTMLTextAreaElement&&v(z.selectionStart??0)},onKeyUp:I=>{const z=I.target;z instanceof HTMLTextAreaElement&&v(z.selectionStart??z.value.length)},onKeyDown:$,onPaste:I=>{const z=OT(I);z.length!==0&&(I.preventDefault(),M(z).catch(()=>{}))},onDragOver:I=>{mg(I).length>0&&I.preventDefault()},onDrop:I=>{const z=mg(I);z.length!==0&&(I.preventDefault(),M(z).catch(()=>{}))},onScroll:W})]}),L&&F.length>0&&b?Wr.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":p("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:b.top,left:b.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:F.map((I,z)=>o.jsx("li",{role:"option","aria-selected":z===k,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(z===k?" af-composer-mention-item--active":""),onMouseDown:P=>P.preventDefault(),onMouseEnter:()=>g(z),onClick:()=>D(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,C?o.jsx("p",{id:c,className:"af-body-ph-issues",role:"status",children:_.map(I=>I.message).join(" · ")}):null]})}const JT=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Hh(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function Xj({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=In(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),u=c=>r(n.filter((f,m)=>m!==c)),d=(c,f,m)=>{const y=n.map((v,k)=>{if(k!==c)return v;const g={...v,[f]:m};return f==="required"&&m===!0&&(g.showOnNode=!0),g});r(y)},p=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:p})}),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((c,f)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${p}-${f}`,children:[p,"-",f]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:c.type,onChange:m=>d(f,"type",m.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:f}),children:["node","text","file","bool"].map(m=>o.jsx("option",{value:m,children:m},m))}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:c.name,onChange:m=>d(f,"name",m.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:f})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:c.default,onChange:m=>d(f,"default",m.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:f})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!c.required,onChange:m=>{i||d(f,"required",m.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:f})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:c.showOnNode!==!1,onChange:m=>d(f,"showOnNode",m.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:f})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>u(f),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:f}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${p}-${f}`))]}):null]})}function QT({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:u,allowEditRequiredPins:d=!1,error:p,ioSlots:c}){const{t:f}=In(),[m,y]=h.useState(!1),[v,k]=h.useState(!1),[g,b]=h.useState({status:"idle",message:""}),x=h.useCallback(D=>{t(W=>W&&{...W,...D})},[t]),{cursorList:N,opencodeList:_,claudeCodeList:C,currentNotInLists:T}=h.useMemo(()=>{const D=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],W=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],$=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],M=new Set([...D,...W,...$].map(Hh)),I=((e==null?void 0:e.model)??"").trim(),z=I.startsWith("cursor:")?I.slice(7):I.startsWith("opencode:")?I.slice(9):I.startsWith("claude-code:")?I.slice(12):I,P=I&&!M.has(z)?I:"";return{cursorList:D,opencodeList:W,claudeCodeList:$,currentNotInLists:P}},[s,e==null?void 0:e.model]);if(!e)return null;const H=String(e.script??""),L=n==="tool_nodejs"||H.trim()!=="",F=typeof u=="function"&&!i&&(e==null?void 0:e.newId),O=async()=>{if(F){b({status:"running",message:f("flow:nodeProps.publishRunning")});try{const D=await u(e,n);b({status:"success",message:D!=null&&D.definitionId?f("flow:nodeProps.publishSuccessWithId",{id:D.definitionId}):f("flow:nodeProps.publishSuccess")})}catch(D){b({status:"error",message:String((D==null?void 0:D.message)||D)})}}};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:f("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:O,disabled:!F||g.status==="running",title:f("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),g.status==="running"?f("flow:nodeProps.publishing"):f("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:f("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[p?o.jsx("p",{className:"af-err af-node-props-err",children:p}):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:f("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:[f("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:f("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:D=>x({newId:D.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":f("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:[f("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:D=>x({label:D.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:[f("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:ml.includes(e.role)?e.role:f("flow:roles.normal"),onChange:D=>x({role:D.target.value}),disabled:i,children:ml.map(D=>o.jsx("option",{value:D,children:D},D))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:f("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const D=(e.model||"").trim();return D?T||D:""})(),onChange:D=>x({model:D.target.value}),disabled:i,"aria-label":f("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:f("flow:node.defaultModel")}),T?o.jsxs("option",{value:T,children:[T,f("flow:nodeProps.yamlValueNotInList")]}):null,N.length>0?o.jsx("optgroup",{label:"Cursor",children:N.map(D=>o.jsx("option",{value:Hh(D),children:D},`c-${D}`))}):null,_.length>0?o.jsx("optgroup",{label:"OpenCode",children:_.map(D=>o.jsx("option",{value:Hh(D),children:D},`o-${D}`))}):null,C.length>0?o.jsx("optgroup",{label:"Claude Code",children:C.map(D=>o.jsx("option",{value:`claude-code:${Hh(D)}`,children:D},`cc-${D}`))}):null]})]}),o.jsx(Xj,{kind:"input",label:f("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:D=>x({inputs:D}),disabled:i,requiredReadonly:!d}),o.jsx(Xj,{kind:"output",label:f("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:D=>x({outputs:D}),disabled:i,requiredReadonly:!d}),L?o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:f("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>k(!0),"aria-label":f("flow:nodeProps.expandEditScript"),title:f("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(zh,{value:H,onChange:D=>x({script:D}),disabled:i,placeholder:f("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:c,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:f("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>y(!0),"aria-label":f("flow:nodeProps.expandEdit"),title:f("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(zh,{value:e.body,onChange:D=>x({body:D}),images:e.images,onImagesChange:D=>x({images:D}),disabled:i,placeholder:f("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:c,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:f("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||f("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),v?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":f("flow:nodeProps.editScript"),onMouseDown:D=>{D.target===D.currentTarget&&k(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:f("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>k(!1),"aria-label":f("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(zh,{value:H,onChange:D=>x({script:D}),disabled:i,placeholder:f("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:c,variant:"expand"})]})}):null,m?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":f("flow:nodeProps.editUserPrompt"),onMouseDown:D=>{D.target===D.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:f("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>y(!1),"aria-label":f("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(zh,{value:e.body,onChange:D=>x({body:D}),images:e.images,onImagesChange:D=>x({images:D}),disabled:i,placeholder:f("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:c,variant:"expand"})]})}):null]})}function L0(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 KK(e){const t=L0(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 ZT(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function Jj({text:e}){const{t}=In(),n=e||"";return n.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(jp,{children:n})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function Qj({o:e}){var r;const{t}=In(),n=L0(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:ZT(e.content||"")});if(n==="markdown"){const s=e.content||"";return s.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(jp,{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 Zj(e){return KK(e)}function e1(e){var r;if(!e)return null;const t=L0(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"?ZT(String(n)):String(n)}function t1({text:e,title:t,copiedLabel:n}){const[r,s]=h.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 n1=2e4,e2="af:run-node-ctx-width";function xm(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function Ja(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):Ja(xm())}function qK(){try{const e=localStorage.getItem(e2);if(e==null)return Ja(xm());const t=parseInt(e,10);return Number.isFinite(t)?Ja(t):Ja(xm())}catch{return Ja(xm())}}async function r1(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 YK(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function GK({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:s}){const{t:i}=In(),[a,l]=h.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[u,d]=h.useState(qK),p=h.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[c,f]=h.useState(!0),[m,y]=h.useState(""),[v,k]=h.useState([]),[g,b]=h.useState(null),[x,N]=h.useState(null),_=h.useRef(null),C=h.useRef(null),T=h.useRef(0),H=h.useRef(0);h.useLayoutEffect(()=>{const P=window.matchMedia("(max-width: 960px)"),R=()=>l(P.matches);return P.addEventListener("change",R),()=>P.removeEventListener("change",R)},[]),h.useEffect(()=>{function P(){d(R=>Ja(R))}return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const L=h.useCallback(()=>{d(P=>{const R=Ja(P);try{localStorage.setItem(e2,String(R))}catch{}return R})},[]),F=h.useCallback(P=>{if(a||P.button!==0)return;P.preventDefault();const R=P.currentTarget;p.current={active:!0,pointerId:P.pointerId,startX:P.clientX,startW:u},R.setPointerCapture(P.pointerId)},[a,u]),O=h.useCallback(P=>{const R=p.current;if(!R.active||P.pointerId!==R.pointerId)return;const E=R.startX-P.clientX;d(Ja(R.startW+E))},[]),D=h.useCallback(P=>{const R=p.current;if(!(!R.active||P.pointerId!==R.pointerId)){R.active=!1;try{P.currentTarget.releasePointerCapture(P.pointerId)}catch{}L()}},[L]),W=h.useCallback(()=>{const P=p.current;P.active&&(P.active=!1,L())},[L]),$=h.useCallback(P=>{const R=Array.isArray(P)?P:[];k(R),b(E=>E&&R.some(J=>J.execId===E)?E:R.length>0?R[R.length-1].execId:null)},[]),M=h.useCallback(()=>{if(!e||!t)return;const P=++T.current,R=new AbortController,E=window.setTimeout(()=>R.abort(),n1);(async()=>{try{const J=await r1(t,e,n,R.signal);if(P!==T.current)return;$(Array.isArray(J.rounds)?J.rounds:[])}catch{}finally{window.clearTimeout(E)}})()},[e,t,n,$]);h.useEffect(()=>{if(!e||!t){f(!1),y(""),k([]);return}const P=++H.current;f(!0),y(""),k([]),b(null);const R=new AbortController,E=window.setTimeout(()=>R.abort(),n1);return(async()=>{try{const J=await r1(t,e,n,R.signal);if(P!==H.current)return;$(Array.isArray(J.rounds)?J.rounds:[])}catch(J){if(P!==H.current)return;const Z=(J==null?void 0:J.name)==="AbortError"?"requestTimeout":J.message||String(J);y(Z)}finally{window.clearTimeout(E),P===H.current&&f(!1)}})(),()=>{R.abort(),H.current++,T.current++}},[e,t,n,$]),h.useEffect(()=>{r&&M()},[r,M]),h.useEffect(()=>{clearInterval(C.current);const P=v.length>0?v[v.length-1]:null;return(r==="running"&&v.length===0||!!(P&&P.status==="running"))&&e&&t&&(C.current=setInterval(()=>M(),2e3)),()=>clearInterval(C.current)},[v,e,t,n,r,M]),h.useEffect(()=>{_.current&&(_.current.scrollTop=0)},[g]);const I=v.find(P=>P.execId===g),z=a?void 0:{width:`${u}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:F,onPointerMove:O,onPointerUp:D,onPointerCancel:D,onLostPointerCapture:W}),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"})})]}),c&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("common:common.loading")}),m&&o.jsx("div",{className:"af-run-ctx-error",children:YK(i,m)}),!c&&!m&&v.length===0&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),v.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+JK((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:P=>{const R=P.target.value;b(R==="latest"?"latest":Number(R))},children:[...v].reverse().map(P=>{const R=P.execId==="latest"?i("flow:runContext.latest"):`#${P.execId}`,E=QK(i,P.status),J=P.finishedAt?` · ${XK(P.finishedAt)}`:"";return o.jsx("option",{value:String(P.execId),children:`${R} · ${E}${J}`},P.execId)})})]}),I&&o.jsxs("div",{className:"af-run-ctx-body",ref:_,children:[I.inputs&&I.inputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"input"}),"Inputs"]}),I.inputs.map((P,R)=>o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsx("div",{className:"af-run-ctx-slot-head",children:o.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot})}),o.jsx("pre",{className:"af-run-ctx-slot-text",children:P.value})]},`${P.slot}-${R}`))]}),I.prompt!=null&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>N("prompt"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(Jj,{text:I.prompt})]}),I.outputs&&I.outputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>N("output"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),I.outputs.map((P,R)=>{const E=Zj(P),J=e1(P);return o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot}),E?o.jsx("span",{className:"af-run-ctx-format-badge",title:i("flow:runContext.detectedContentType"),children:E}):null,o.jsx(t1,{text:J,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Qj,{o:P})]},`${P.slot}-${R}`)})]}),!I.prompt&&(!I.outputs||I.outputs.length===0)&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("flow:runContext.roundNoContent")})]})]})]}),x&&I&&o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:P=>{P.target===P.currentTarget&&N(null)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:x==="prompt"?"Prompt":"Outputs"}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>N(null),"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[x==="prompt"&&I.prompt!=null&&o.jsx(Jj,{text:I.prompt}),x==="output"&&I.outputs&&I.outputs.map((P,R)=>{const E=Zj(P),J=e1(P);return o.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:P.slot}),E?o.jsx("span",{className:"af-run-ctx-format-badge",children:E}):null,o.jsx(t1,{text:J,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Qj,{o:P})]},`${P.slot}-${R}`)})]})]})})]})}function XK(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 JK(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 QK(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 ZK({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:s,nodes:i,onCliInputsChange:a,onBackToEdit:l}){const{t:u}=In(),[d,p]=h.useState({}),[c,f]=h.useState(null),[m,y]=h.useState({}),[v,k]=h.useState(!0),[g,b]=h.useState(!1),[x,N]=h.useState(""),[_,C]=h.useState(!1),[T,H]=h.useState(null),L=h.useRef(null),F=h.useRef(!0),O=h.useRef({});h.useMemo(()=>{var E,J,Z;const R={};for(const U of r){const se=(Z=(J=(E=U.data)==null?void 0:E.outputs)==null?void 0:J[0])==null?void 0:Z.default;se!=null&&se!==""&&(R[U.id]=String(se))}return O.current=R,R},[r]);const D=h.useMemo(()=>{var E;const R={};for(const J of i){if(!((E=J.data)!=null&&E.inputs))continue;const Z=J.data.inputs;for(let U=0;U<Z.length;U++){const se=Z[U];if(!(se!=null&&se.name))continue;const pe=s.find(xe=>xe.target===J.id&&xe.targetHandle===`input-${U}`);if(!(pe!=null&&pe.source))continue;r.find(xe=>xe.id===pe.source)&&(R[pe.source]=se.name)}}return R},[i,s,r]);h.useEffect(()=>(F.current=!0,()=>{F.current=!1}),[]),h.useEffect(()=>{if(!e){k(!1);return}k(!0);const R=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&R.set("archived","1"),fetch(`/api/flow/run-config?${R.toString()}`).then(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{var Z;if(!F.current)return;p(E.presets||{}),f(E.activePreset||null);const J=E.activePreset&&((Z=E.presets)!=null&&Z[E.activePreset])?E.presets[E.activePreset]:{};y({...O.current,...J}),k(!1)}).catch(()=>{F.current&&(y(O.current),k(!1))})},[e,t,n]),h.useEffect(()=>{var E;if(!a)return;const R={};for(const[J,Z]of Object.entries(m)){const U=D[J];if(!U)continue;const se=r.find(he=>he.id===J);if(!se)continue;(((E=se.data)==null?void 0:E.definitionId)||"").startsWith("provide_file")?R[U]={type:"file",path:Z}:R[U]={type:"str",value:Z}}a(R)},[m,D,r,a]);const W=h.useCallback((R,E)=>{y(J=>({...J,[R]:E}))},[]),$=h.useCallback(R=>{R!==c&&(f(R),R&&d[R]?y({...O.current,...d[R]}):y(O.current))},[c,d]),M=h.useCallback(async()=>{if(x.trim()){b(!0);try{const R={...d,[x.trim()]:m},E={flowId:e,flowSource:t,archived:n,presets:R,activePreset:x.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})).ok&&(p(R),f(x.trim()),N(""),C(!1))}finally{b(!1)}}},[e,t,n,d,m,x]),I=h.useCallback(async()=>{if(c){b(!0);try{const R={...d};delete R[c];const E=Object.keys(R)[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:R,activePreset:E})})).ok&&(p(R),f(E),E&&R[E]?y({...O.current,...R[E]}):y(O.current))}finally{b(!1)}}},[e,t,n,d,c]),z=h.useCallback(async()=>{if(c){b(!0);try{const R={...d,[c]:m};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:R,activePreset:c})})).ok&&p(R)}finally{b(!1)}}},[e,t,n,d,c,m]),P=Object.keys(d);return P.length>0,v?o.jsx("aside",{className:"af-run-config-panel",children:o.jsx("div",{className:"af-run-config-loading",children:u("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:u("flow:runConfig.preset")}),o.jsxs("div",{className:"af-run-config-preset-row",children:[o.jsxs("select",{className:"af-run-config-preset-select",value:c||"",onChange:R=>$(R.target.value||null),disabled:g,children:[o.jsx("option",{value:"",children:u("flow:runConfig.default")}),P.map(R=>o.jsx("option",{value:R,children:R},R))]}),o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>C(!0),disabled:g,title:u("flow:runConfig.newPreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),c&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:z,disabled:g,title:u("flow:runConfig.savePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),c&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:I,disabled:g,title:u("flow:runConfig.deletePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),_&&o.jsxs("div",{className:"af-run-config-save-dialog",children:[o.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:u("flow:runConfig.presetNamePlaceholder"),value:x,onChange:R=>N(R.target.value),disabled:g}),o.jsxs("div",{className:"af-run-config-save-actions",children:[o.jsx("button",{type:"button",className:"af-btn-primary",onClick:M,disabled:g||!x.trim(),children:u(g?"common.saving":"common.save")}),o.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{C(!1),N("")},disabled:g,children:u("common.cancel")})]})]}),o.jsxs("div",{className:"af-run-config-inputs",children:[o.jsx("div",{className:"af-run-config-inputs-header",children:u("flow:runConfig.inputParams")}),r.length===0?o.jsx("div",{className:"af-run-config-empty",children:u("flow:runConfig.noProvideNodes")}):o.jsx("div",{className:"af-run-config-input-list",children:r.map(R=>{var xe,le;const E=((xe=R.data)==null?void 0:xe.definitionId)||"",J=E.startsWith("provide_file"),Z=E==="provide_bool",U=((le=R.data)==null?void 0:le.label)||R.id,se=R.id,pe=m[se]||"",he=["true","1","yes","on"].includes(String(pe).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:U}),Z?null:o.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>H({instanceId:se,label:U,content:pe}),"aria-label":u("flow:runConfig.expandInput"),title:u("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:se}),Z?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(he?" af-run-config-bool-toggle--true":""),onClick:()=>W(se,he?"false":"true"),"aria-pressed":he,children:he?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-config-input-field",value:pe,onChange:Se=>W(se,Se.target.value),placeholder:u(J?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},se)})})]}),T&&Wr.createPortal(o.jsx("div",{className:"af-provide-edit-overlay",children:o.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-provide-edit-modal__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),o.jsx("span",{className:"af-provide-edit-modal__title",children:T.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>H(null),"aria-label":u("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-provide-edit-modal__body",children:o.jsx("textarea",{ref:L,className:"af-provide-edit-modal__textarea",defaultValue:T.content,autoFocus:!0})}),o.jsxs("div",{className:"af-provide-edit-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:()=>{!T||!L.current||(W(T.instanceId,L.current.value),H(null))},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),u("flow:provideEdit.save")]}),o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>H(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),u("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const t2={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"]},e7={"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 t7(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function n7(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 r7(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 s1(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(t2))if(r.includes(e))return n;return"other"}function s7({event:e,defaultExpanded:t}){const[n,r]=h.useState(!!t),s=e7[e.tag]||"#a8a8a8",i=e.payload,a=i&&typeof i=="object",l=a?typeof i.text=="string"?i.text:"":String(i||""),u=a?i.meta:null,d=h.useMemo(()=>l?l.slice(0,140).replace(/\s+/g," "):a?Object.keys(i).filter(m=>m!=="text"&&m!=="meta").slice(0,3).map(m=>{const y=i[m];return y==null?`${m}:null`:typeof y=="object"?`${m}:{…}`:`${m}:${String(y).slice(0,30)}`}).join(" "):"",[i,l,a]),p=h.useCallback(c=>{c.stopPropagation();const f=a?JSON.stringify(i,null,2):String(i);try{navigator.clipboard.writeText(f)}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(c=>!c),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:n7(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:p,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:[u&&Object.keys(u).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(u,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 i7({open:e,onClose:t,flowId:n}){var H;const[r,s]=h.useState([]),[i,a]=h.useState(!1),[l,u]=h.useState(null),[d,p]=h.useState(null),[c,f]=h.useState(!1),[m,y]=h.useState(!0),[v,k]=h.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[g,b]=h.useState(""),x=h.useRef(null),N=h.useCallback(async()=>{a(!0);try{const L=m&&n?`?flowId=${encodeURIComponent(n)}`:"",O=await(await fetch(`/api/composer-logs${L}`)).json();s(Array.isArray(O.sessions)?O.sessions:[])}catch{s([])}finally{a(!1)}},[n,m]),_=h.useCallback(async L=>{if(!L){p(null);return}f(!0);try{const O=await(await fetch(`/api/composer-logs/${encodeURIComponent(L)}`)).json();p(O)}catch{p(null)}finally{f(!1)}},[]);h.useEffect(()=>{e&&N()},[e,N]),h.useEffect(()=>{if(!(!e||!l))return _(l),x.current=setInterval(()=>_(l),2e3),()=>{x.current&&clearInterval(x.current),x.current=null}},[e,l,_]);const C=h.useMemo(()=>{const L=(d==null?void 0:d.events)||[],F=g.trim().toLowerCase();return L.filter(O=>{const D=s1(O.tag,O.payload);return!v[D]&&D!=="other"?!1:F?[O.tag,JSON.stringify(O.payload||"")].join(" ").toLowerCase().includes(F):!0})},[d,v,g]),T=h.useMemo(()=>{const L=(d==null?void 0:d.events)||[],F={};for(const O of L){const D=s1(O.tag,O.payload);F[D]=(F[D]||0)+1}return F},[d]);return e?o.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,width:"min(1100px, 80vw)",background:"#131313",borderLeft:"1px solid rgba(255,255,255,0.08)",display:"flex",flexDirection:"column",zIndex:9999,boxShadow:"-8px 0 32px rgba(0,0,0,0.5)",color:"#e5e2e1",fontFamily:"Inter, system-ui, sans-serif"},children:[o.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:12,flexShrink:0,background:"#1c1b1b"},children:[o.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Composer Logs"}),o.jsx("span",{style:{fontSize:11,color:"#9a9a9a"},children:n?`flowId: ${n}`:"no flow selected"}),o.jsxs("label",{style:{fontSize:11,color:"#9a9a9a",display:"flex",alignItems:"center",gap:4,cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:m,onChange:L=>y(L.target.checked),disabled:!n}),"仅显示当前 flow"]}),o.jsx("button",{type:"button",onClick:N,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),o.jsx("span",{style:{flex:1}}),o.jsx("button",{type:"button",onClick:t,style:{background:"transparent",color:"#e5e2e1",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,padding:"4px 12px",fontSize:12,cursor:"pointer"},children:"Close"})]}),o.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[i&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!i&&r.length===0&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:m&&n?"no sessions for this flow":"no sessions"}),r.map(L=>{const F=l===L.sessionId;return o.jsxs("div",{onClick:()=>u(L.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:F?"rgba(124,77,255,0.18)":"transparent",borderLeft:F?"3px solid #7c4dff":"3px solid transparent"},children:[o.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:r7(L.mtime)}),o.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:L.flowId||"(no flow)"}),L.promptPreview&&o.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:L.promptPreview}),o.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[t7(L.size)," · ",L.model||"default"]})]},L.sessionId)})]}),o.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",flexShrink:0,background:"#1c1b1b"},children:[Object.keys(t2).map(L=>o.jsxs("button",{type:"button",onClick:()=>k(F=>({...F,[L]:!F[L]})),style:{background:v[L]?"rgba(124,77,255,0.25)":"transparent",color:v[L]?"#e8deff":"#6a6a6a",border:`1px solid ${v[L]?"rgba(124,77,255,0.4)":"rgba(255,255,255,0.08)"}`,borderRadius:999,padding:"3px 12px",fontSize:11,cursor:"pointer",fontFamily:"monospace",textTransform:"uppercase"},children:[L," ",T[L]!=null?`(${T[L]})`:""]},L)),o.jsx("input",{type:"text",placeholder:"search…",value:g,onChange:L=>b(L.target.value),style:{marginLeft:8,flex:1,minWidth:120,background:"#0e0e0e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:4,color:"#e5e2e1",padding:"4px 8px",fontSize:12}})]}),o.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!l&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),c&&!d&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&C.length===0&&o.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",((H=d.events)==null?void 0:H.length)||0," total)"]}),C.map((L,F)=>o.jsx(s7,{event:L,defaultExpanded:L.tag==="error"},`${L.ts}_${F}`))]})]})]})]}):null}const o7="0.1.68";function i1(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 Mx(e,t){return t==="running"?i1(e):e==null||!Number.isFinite(e)||e<=0?"--":i1(e)}const n2=h.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function a7(e){var b,x,N,_,C,T,H,L,F,O,D;const{setNodes:t}=kc(),n=d0(),{modelLists:r,onModelChange:s}=h.useContext(n2),i=h.useRef(null),a=!!((b=e.data)!=null&&b.readOnly),l=(x=e.data)!=null&&x.displaySize&&Number(e.data.displaySize.width)>0&&Number(e.data.displaySize.height)>0?{width:Number(e.data.displaySize.width),height:Number(e.data.displaySize.height)}:null,u=((N=e.data)==null?void 0:N.definitionId)==="agent_subAgent"&&!((_=e.data)!=null&&_.isRunMode)&&!a,d=h.useCallback(W=>{const $=()=>n(W);window.requestAnimationFrame($),window.setTimeout($,80)},[n]),p=h.useCallback((W,$)=>{const M=p1($);M&&(t(I=>I.map(z=>{var E,J,Z,U,se,pe;if(z.id!==W)return z;const P=Number(((J=(E=z.data)==null?void 0:E.displaySize)==null?void 0:J.width)||z.width||((Z=z.measured)==null?void 0:Z.width)||0),R=Number(((se=(U=z.data)==null?void 0:U.displaySize)==null?void 0:se.height)||z.height||((pe=z.measured)==null?void 0:pe.height)||0);return Math.abs(P-M.width)<2&&Math.abs(R-M.height)<2?z:{...z,width:M.width,height:M.height,data:{...z.data,displaySize:M}}})),d(W))},[d,t]),c=h.useCallback(W=>{if(a)return;const $=i.current;if(!$)return;const M=$.getBoundingClientRect();p(W,{width:Math.max(M.width,$.scrollWidth),height:Math.max(M.height,$.scrollHeight)})},[p,a]),f=h.useCallback(W=>{var se,pe,he,xe,le,Se;if(!u)return;W.preventDefault(),W.stopPropagation();const $=i.current,M=$==null?void 0:$.getBoundingClientRect(),I=Number(((pe=(se=e.data)==null?void 0:se.displaySize)==null?void 0:pe.width)||e.width||((he=e.measured)==null?void 0:he.width)||(M==null?void 0:M.width)||o2),z=Number(((le=(xe=e.data)==null?void 0:xe.displaySize)==null?void 0:le.height)||e.height||((Se=e.measured)==null?void 0:Se.height)||(M==null?void 0:M.height)||Ob),P=W.clientX,R=W.clientY,E=e.id;let J=0;const Z=ie=>{const oe=p1({width:I+ie.clientX-P,height:z+ie.clientY-R});oe&&(window.cancelAnimationFrame(J),J=window.requestAnimationFrame(()=>p(E,oe)))},U=()=>{window.cancelAnimationFrame(J),window.removeEventListener("pointermove",Z),window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),d(E)};window.addEventListener("pointermove",Z),window.addEventListener("pointerup",U,{once:!0}),window.addEventListener("pointercancel",U,{once:!0})},[p,(T=(C=e.data)==null?void 0:C.displaySize)==null?void 0:T.height,(L=(H=e.data)==null?void 0:H.displaySize)==null?void 0:L.width,e.height,e.id,(F=e.measured)==null?void 0:F.height,(O=e.measured)==null?void 0:O.width,e.width,d,u]),m=h.useCallback(W=>{t($=>$.filter(M=>M.id!==W))},[t]),y=h.useCallback(()=>{var I,z,P,R,E,J,Z,U;const W=((I=e.data)==null?void 0:I.definitionId)||"",$=((z=e.data)==null?void 0:z.label)||e.id,M=((E=(R=(P=e.data)==null?void 0:P.outputs)==null?void 0:R[0])==null?void 0:E.value)||((U=(Z=(J=e.data)==null?void 0:J.outputs)==null?void 0:Z[0])==null?void 0:U.default)||"";window.__provideEditContent={instanceId:e.id,label:$,definitionId:W,content:M},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),v=h.useCallback((W,$)=>{t(M=>M.map(I=>{var P;if(I.id!==W)return I;const z=Array.isArray((P=I.data)==null?void 0:P.outputs)&&I.data.outputs.length?I.data.outputs.map((R,E)=>E===0?{...R,default:$,value:$}:R):[{type:"bool",name:"value",default:$,value:$}];return{...I,data:{...I.data,body:"",outputs:z}}}))},[t]),k=h.useCallback((W,$)=>{t(M=>M.map(I=>I.id===W?{...I,data:{...I.data,body:$}}:I))},[t]),g=h.useCallback((W,$)=>{t(M=>M.map(I=>I.id===W?{...I,data:{...I.data,images:Os($)}}:I))},[t]);return o.jsxs("div",{ref:i,className:"af-flow-node-shell"+(u?" af-flow-node-shell--resizable":""),style:l?{width:l.width,height:l.height}:void 0,children:[o.jsx(BT,{...e,data:{...e.data,onNodeContentResize:c},deleteNode:m,onProvideExpand:y,onProvideValueChange:v,onNodeBodyChange:k,onNodeImagesChange:g,modelLists:r,onModelChange:s}),u?o.jsx("span",{className:"af-flow-node-shell__resize-grip nodrag","aria-label":((D=e.data)==null?void 0:D.resizeLabel)||"Resize node",role:"separator",onPointerDown:f}):null]})}const l7={[Ep]:a7},tf=["CONTROL","TOOL","PROVIDE","AGENT"],c7=1200,o1="af-flow-node--sync-flash",a1="af-flow-edge--sync-flash";function l1(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function c1(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function M0(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 u7(e){const t=M0(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function Bh(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 r2(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function s2(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Ox(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 u1(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 d1(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 d7(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function f7(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 i2(e,t,n,r,s){const i=u7(e),a={id:t,type:Ep,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 ip(a,r,s)}const o2=320,p7=220,h7=1600,Ob=104,m7=900;function f1(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function p1(e){if(!e||typeof e!="object")return null;const t=Number(e.width),n=Number(e.height);return!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0?null:{width:f1(t,p7,h7)||o2,height:f1(n,Ob,m7)||Ob}}function g7(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function h1(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=Gu(i,e.sourceHandle||"output-0","source"),u=Gu(a,e.targetHandle||"input-0","target");return!l||!u?!1:Yu(l,u)}function y7(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=Gu(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:HT(a)}:null}function x7(e,t,n){var a;const r=i2(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 u=i[l];if(n.handleType==="source"?Yu(n.slot,u):Yu(u,n.slot))return{slot:u,slotIndex:l,hydrated:r}}return null}function w7(e,t){return t?e.map((n,r)=>{const s=x7(n,e,t);if(!s)return null;const i=M0(n);return{def:n,order:r,category:i,categoryRank:tf.indexOf(i),slot:s.slot,slotIndex:s.slotIndex,displayLabel:r2(s.hydrated.data||n),description:s2(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 b7=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function v7(e){const t=new Set,n=[];let r;const s=new RegExp(b7.source,"g");for(;(r=s.exec(e))!==null;){const i=r[1];t.has(i)||(t.add(i),n.push(i))}return n}function m1(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 ia(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function Wh(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:[],u=i.map(ia),d=a.map(ia);return l.map(ia).includes(s)&&!u.includes(s)&&!d.includes(s)?`claude-code:${s}`:d.includes(s)&&!u.includes(s)?`opencode:${s}`:s}function k7(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function $x(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 S7({steps:e}){const{t}=In();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:k7(s)}):null]}):null})]},n.index)})})}function N7(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 j7(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 C7(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 E7(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 g1({thread:e,liveSegments:t,running:n,className:r="",autoScroll:s=!0}){const{t:i}=In(),a=h.useRef(null),l=["af-composer-ai-stack","af-composer-ai-stack--in-panel","af-composer-thread-stack",r].filter(Boolean).join(" ");return h.useEffect(()=>{if(!s||!a.current)return;const u=a.current;requestAnimationFrame(()=>{u.scrollTop=u.scrollHeight})},[e,t,s]),o.jsxs("div",{ref:a,className:l,children:[e.map((u,d)=>u.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:u.text})]},`composer-u-${d}-${u.text.slice(0,48)}`):o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(y1,{segments:u.segments,running:!1})},`composer-a-${d}`)),o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(y1,{segments:t,running:n})})]})}function y1({segments:e,running:t=!1}){const{t:n}=In(),r=e.filter(c=>c.kind==="assistant").map(c=>c.text).join(""),s=e.filter(c=>c.kind==="result").map(c=>c.text).join(""),i=N7(r,s),a=e.filter(c=>c.kind==="error").map(c=>c.text).join(`
|
|
131
|
+
`),l=e.filter(c=>c.kind!=="error"),u=i?l.filter(c=>c.kind!=="result"):l,d=j7(u),p=!!(d.length>0||a);return o.jsxs(o.Fragment,{children:[d.map((c,f)=>o.jsxs("section",{className:E7(c.kind),children:[o.jsx("div",{className:"af-composer-ai-block-label",children:C7(c.kind,n)}),o.jsx("div",{className:"af-composer-ai-block-body",children:c.text})]},`${c.kind}-${f}`)),t&&!p?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 _7({fitViewEpoch:e}){const{fitView:t}=kc(),n=h.useRef(t);return n.current=t,h.useEffect(()=>{if(e>0){const r=requestAnimationFrame(()=>n.current({padding:.2,duration:200,maxZoom:1}));return()=>cancelAnimationFrame(r)}},[e]),null}function P7({onReady:e}){const t=d0();return h.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function x1(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}function w1(e){if(!e||typeof e!="object")return null;const t=Number(e.x),n=Number(e.y),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)?null:{x:t,y:n,zoom:Math.min(Math.max(r,.1),4)}}const wm=1500,b1=500,A7=262144,I7=2e3;function Dx(e){return typeof e!="string"?"":e.length<=I7?e:`[log line truncated, ${e.length} chars]`}const T7=wm;function R7(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:Dx(s)}}catch{return{ts:n,type:"info",text:Dx(s)}}return{ts:n,type:"log",text:Dx(`[${r}] ${s}`)}}function v1(e){if(!e)return[];const t=[],n=e.split(`
|
|
132
|
+
`);for(let r=n.length-1;r>=0&&t.length<T7;r--){const s=n[r];if(!s)continue;const i=R7(s);i&&t.push(i)}return t.reverse(),t}function L7(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 M7(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 O7({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:s,onEdgesChange:i,onConnect:a,onConnectStart:l,onConnectEnd:u,isValidConnection:d,onNodesDelete:p,onNodeClick:c,onNodeDoubleClick:f,onEdgeClick:m,onFlowInit:y,onDrop:v,onDragOver:k,hideMinimapAndControls:g,bottomSlot:b}){const{t:x}=In(),N=!s,_=N||t==="pan"?!0:[1,2],C=N?!1:t==="select",T="af-flow-canvas"+(N?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),H=h.useCallback(()=>{},[]),L=h.useMemo(()=>{const F=new Map(n.map(M=>[M.id,M])),O=new Set(n.filter(M=>M.selected).map(M=>M.id)),D=O.size>0,W=(M,I)=>{const z=/^#([0-9a-f]{6})$/i.exec(M);if(!z)return M;const P=parseInt(z[1],16);return`rgba(${P>>16&255}, ${P>>8&255}, ${P&255}, ${I})`},$="#ff5169";return r.map(M=>{var oe,ye,ke,Ve;const I=F.get(M.source),z=F.get(M.target),P=/^output-(\d+)$/.exec(M.sourceHandle||""),R=/^input-(\d+)$/.exec(M.targetHandle||""),E=I&&P?(ye=(oe=I.data)==null?void 0:oe.outputs)==null?void 0:ye[parseInt(P[1],10)]:null,J=z&&R?(Ve=(ke=z.data)==null?void 0:ke.inputs)==null?void 0:Ve[parseInt(R[1],10)]:null,Z=E!=null&&E.type?rr(E.type):null,U=J!=null&&J.type?rr(J.type):null,se=Z&&U&&Z!==U,pe=D&&(O.has(M.source)||O.has(M.target)),he=M.style||{};if(se){const Je=M.selected?.95:pe?.85:.78,We=W($,Je);return{...M,className:((M.className||"")+" af-flow-edge--type-mismatch"+(pe?" af-flow-edge--adjacent":"")).trim(),style:{...he,stroke:We,strokeWidth:pe?2.75:2.5,strokeDasharray:"6 4"},markerEnd:M.markerEnd&&typeof M.markerEnd=="object"?{...M.markerEnd,color:We}:{type:Hs.ArrowClosed,color:We}}}const xe=Z||U;if(!xe)return pe?{...M,className:((M.className||"")+" af-flow-edge--adjacent").trim(),style:{...he,strokeWidth:2.5}}:M;const le=pe||M.selected?.7:.38,Se=W(xe,le),ie=pe?2.5:he.strokeWidth??2;return{...M,className:((M.className||"")+(pe?" af-flow-edge--adjacent":"")).trim(),style:{...he,stroke:Se,strokeWidth:ie},markerEnd:M.markerEnd&&typeof M.markerEnd=="object"?{...M.markerEnd,color:Se}:{type:Hs.ArrowClosed,color:Se}}})},[n,r]);return o.jsxs(u0,{className:T,nodes:n,edges:L,onNodesChange:s||H,onEdgesChange:i||H,onConnect:N?void 0:a,onConnectStart:N?void 0:l,onConnectEnd:N?void 0:u,isValidConnection:N?void 0:d,onNodesDelete:N?void 0:p,onNodeClick:c,onNodeDoubleClick:N?void 0:f,onEdgeClick:N?void 0:m,onInit:y,onDrop:N?void 0:v,onDragOver:N?void 0:k,nodeTypes:l7,selectionOnDrag:C,panOnDrag:_,nodesDraggable:!N,nodesConnectable:!N,elementsSelectable:!N,edgesFocusable:!N,panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,defaultEdgeOptions:{style:{stroke:"rgba(205, 189, 255, 0.45)",strokeWidth:2}},connectionLineStyle:{stroke:"rgba(205, 189, 255, 0.65)",strokeWidth:2},children:[o.jsx(f0,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),o.jsx(Ku,{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(WB,{zoomable:!0,pannable:!0,position:"bottom-left",className:"af-flow-bottom-minimap",style:{width:152,height:104},maskColor:"rgba(14, 14, 14, 0.85)",nodeColor:F=>{var D;const O=(((D=F.data)==null?void 0:D.schemaType)??"agent").toLowerCase();return O==="control"?"rgba(237, 108, 2, 0.85)":O==="provide"?"rgba(0, 228, 117, 0.35)":O==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),o.jsx("div",{className:"af-flow-bottom-unified__center",children:b}),g?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:o.jsx(AB,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!g&&o.jsx(Ku,{position:"bottom-left",className:"af-pin-legend",children:[{type:"node",color:"#ff9800"},{type:"text",color:"#2196f3"},{type:"file",color:"#4caf50"},{type:"bool",color:"#9c27b0"}].map(({type:F,color:O})=>o.jsxs("span",{className:"af-pin-legend__item",children:[o.jsx("span",{className:"af-pin-legend__dot",style:{background:O}}),o.jsx("span",{className:"af-pin-legend__label",children:F})]},F))}),o.jsx(_7,{fitViewEpoch:e}),!N&&n.length===0?o.jsxs("div",{className:"af-flow-empty-hint",children:[o.jsx("span",{className:"af-flow-empty-hint-icon material-symbols-outlined",children:"account_tree"}),o.jsx("p",{className:"af-flow-empty-hint-text",children:x("flow:emptyCanvas.composerHint")}),o.jsx("p",{className:"af-flow-empty-hint-sub",dangerouslySetInnerHTML:{__html:x("flow:emptyCanvas.composerSub")}})]}):null]})}function k1(e){if(!window.location.pathname.startsWith("/flow"))return;if(!e){window.history.replaceState({},"","/flow");return}const t=new URLSearchParams(window.location.search),n=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});e.archived&&n.set("flowArchived","1"),t.get("panel")==="settings"&&n.set("panel","settings"),window.history.replaceState({},"","/flow?"+n.toString())}function $7(e){return e==="builtin"||e==="admin"?"workspace":e??"user"}function Si(e){return e==="builtin"||e==="admin"}function Gc(e,t){return t(e==="builtin"||e==="admin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}function D7(e){var r,s,i,a;const t=Number(((s=(r=e==null?void 0:e.data)==null?void 0:r.displaySize)==null?void 0:s.width)||(e==null?void 0:e.width)||0),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.height)||(e==null?void 0:e.height)||0);return t>0&&n>0?{width:Math.round(t),height:Math.round(n)}:null}const a2="af:run-console-height",kf=230,Wd={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},Vh={};function bm(e){if(!Number.isFinite(e))return kf;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function F7(){try{const e=localStorage.getItem(a2);if(e==null)return kf;const t=parseInt(e,10);return Number.isFinite(t)?bm(t):kf}catch{return kf}}function z7(){var dk,fk;const{t:e,i18n:t}=In(),{navigate:n,path:r}=Lo(),s=h.useRef(null),i=h.useRef(new Map),a=h.useCallback(w=>{s.current=typeof w=="function"?w:null},[]),[l,u]=h.useState([]),[d,p]=h.useState(""),[c,f]=h.useState(null),[m,y]=h.useState(0),[v,k]=h.useState(""),[g,b]=h.useState(""),[x,N]=h.useState(""),[_,C]=h.useState(""),[T,H]=h.useState(!1),[L,F]=h.useState(""),[O,D]=h.useState(!1),[W,$]=h.useState(""),[M,I]=h.useState(!1),[z,P]=h.useState(!1),[R,E]=h.useState(!1),[J,Z]=h.useState(null),[U,se]=h.useState(!1),[pe,he]=h.useState(!1),xe=h.useRef(!1),[le,Se]=h.useState([]),[ie,oe]=h.useState(""),[ye,ke]=h.useState("nodes"),Ve=h.useRef(null),[Je,We]=h.useState([]),[ot,ze]=h.useState(!1),[mt,ln]=h.useState(""),[zn,Bt]=h.useState(!1),[en,cn]=h.useState({name:"",id:"",description:""}),[un,ue]=h.useState(!1),[Ne,He]=h.useState(""),[nt,et]=h.useState(""),_t=h.useRef(null),[st,dn]=h.useState([]),[on,Un]=h.useState(!1),[fn,Tn]=h.useState(""),[Kn,Nr]=h.useState(""),[we,Me]=h.useState(null),[ct,vt]=h.useState(null),[ae,Le]=h.useState([]),[rt,Tt]=h.useState(""),[Wt,Zn]=h.useState(!1),ds=h.useCallback(w=>{_t.current&&window.clearTimeout(_t.current),et(w),_t.current=window.setTimeout(()=>{et(""),_t.current=null},3800)},[]),Us=h.useCallback(w=>{const j=String(w||"").trim();if(!j)return;const B=()=>{var q;return(q=s.current)==null?void 0:q.call(s,j)};window.requestAnimationFrame(B),window.setTimeout(B,80)},[]);h.useEffect(()=>()=>{_t.current&&window.clearTimeout(_t.current)},[]);const[Yr,fs]=h.useState(!1),[qn,cr]=h.useState({files:[]}),[Ks,ft]=h.useState(!1),[Lr,$o]=h.useState(!0);h.useEffect(()=>{let w=!1;const j=()=>{fetch("/api/flows",{method:"HEAD"}).then(q=>{w||$o(q.ok)}).catch(()=>{w||$o(!1)})};j();const B=window.setInterval(j,5e3);return()=>{w=!0,window.clearInterval(B)}},[]),h.useEffect(()=>{let w=!1;return fetch("/api/dev-info").then(j=>j.json()).then(j=>{w||Do(!!(j!=null&&j.isDev))}).catch(()=>{}),()=>{w=!0}},[]),h.useEffect(()=>{c!=null&&c.id&&aP(c.id,c.source??"user","pipeline",!!c.archived)},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived]);const[Fe,Mt]=h.useState("edit"),[ur,lt]=h.useState([]),Mr=h.useRef(0),[jr,Te]=h.useState(new Set),[ps,Yn]=h.useState({}),[qs,ut]=h.useState(null),[Xt,Jt]=h.useState(0),[Cr,tt]=h.useState(!1),[hs,Do]=h.useState(!1),[js,Fo]=h.useState(!1),[ms,zo]=h.useState(F7),dr=h.useRef({active:!1,pointerId:-1,startY:0,startH:kf}),[jn,Ys]=h.useState(null),[Ri,sr]=h.useState(null),[Gr,Or]=h.useState({}),Ho=h.useRef(Gr);h.useEffect(()=>{Ho.current=Gr},[Gr]);const[K,me]=h.useState(!1),[De,Ie]=h.useState(!1),[Ze,Yt]=h.useState({}),[Ct,ir]=h.useState({}),[Xr,di]=h.useState(null),[mn,Bo]=h.useState(Wd),[Nc,dd]=h.useState(!1),[fi,Rp]=h.useState(!1),[jc,Li]=h.useState(""),[Sl,$r]=h.useState(""),[tn,Cc]=h.useState(Vh),[Cn,Ec]=h.useState(null),Dr=h.useRef(0),pi=h.useRef(null),io=h.useRef(null),Nl=h.useRef(!0),oo=h.useRef(!1),[Er,Na]=h.useState(null),[ja,jl]=h.useState(null),[Wo,hi]=h.useState(!1),[Ca,Ea]=h.useState(""),[Cl,Vo]=h.useState(!1),fd=h.useRef(null),[mi,El]=h.useState(null),[pd,yr]=h.useState(!1),[_c,Uo]=h.useState(null),[Ko,qo]=h.useState(!1),[Jr,_l]=h.useState(null),Gs=h.useRef(null),[Qr,Cs]=h.useState(""),[Pc,Ee]=h.useState(0),[gs,_a]=h.useState(0),[Lp,ao]=h.useState("pan"),[Pl,Al]=h.useState(!1),[Gn,Il]=h.useState(!1),bn=h.useRef(null),hd=h.useRef(null),Tl=h.useRef(null),[by,Mp]=h.useState(0),[Et,Ac]=h.useState(null),[Pa,Ic]=h.useState(""),[bt,Op]=h.useState({cursor:[],opencode:[],claudeCode:[]}),[lo,md]=h.useState(""),[Aa,gd]=h.useState(""),[gi,$p]=h.useState([]),[co,Ia]=h.useState([]),[Zr,Tc]=h.useState(!1),[Rl,Dp]=h.useState([]),[yd,Fp]=h.useState(!1),[zp,Hp]=h.useState(()=>new Set),[es,Rc]=h.useState(!1),Yo=h.useRef(null),Go=h.useRef(null),[yt,an]=h.useState({}),Ta=h.useCallback(w=>{if(!w)return null;const j=w.id,B=w.source??"user",q=w.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${j}:${B}${q?":"+q:""}`,activeKey:`af:composer-active-session:${j}:${B}${q?":"+q:""}`}},[]),Bp=h.useCallback(w=>{if(!w)return"";const j=w.id,B=w.source??"user",q=w.archived?"archived":"";return`af:composer-skills:pipeline:${j}:${B}${q?":"+q:""}`},[]),Lc=h.useCallback(w=>{const j=Ta(w);if(!j)return{sessions:[],activeSessionId:null};try{const B=localStorage.getItem(j.sessionsKey);if(!B)return{sessions:[],activeSessionId:null};const q=JSON.parse(B);if(!Array.isArray(q))return{sessions:[],activeSessionId:null};const Y=q.filter(te=>te&&typeof te.id=="string").map(te=>({...te,running:!1,statusLine:te.running?e("flow:composer.pageRefreshReset"):te.statusLine,steps:[]}));let X=null;try{X=localStorage.getItem(j.activeKey),X&&!Y.some(te=>te.id===X)&&(X=null)}catch{X=null}return{sessions:Y,activeSessionId:X}}catch{return{sessions:[],activeSessionId:null}}},[Ta]),Mc=h.useCallback((w,j,B)=>{const q=Ta(w);if(q)try{localStorage.setItem(q.sessionsKey,JSON.stringify(j)),B?localStorage.setItem(q.activeKey,B):localStorage.removeItem(q.activeKey)}catch{}},[Ta]),Xo=h.useRef(0),Oc=h.useRef({sessions:[],activeSessionId:null,flowKey:null}),[Xs,yi]=h.useState([]),[xr,xi]=h.useState(null),Es=h.useMemo(()=>Bp(c),[Bp,c]),[Ra,Wp]=h.useState(""),$c=h.useMemo(()=>{if(!c)return null;const w=c.id,j=c.source??"user",B=c.archived?"archived":"";return`${w}:${j}${B?":"+B:""}`},[c]),Ll=h.useRef(!1);h.useEffect(()=>{if(!$c){yi([]),xi(null),Oc.current={sessions:[],activeSessionId:null,flowKey:null};return}const w=Oc.current;if(w.flowKey===$c)return;w.flowKey=$c,Ll.current&&w.sessions.length>0&&Mc(c,w.sessions,w.activeSessionId);const{sessions:j,activeSessionId:B}=Lc(c);if(j.length===0){const q=`session-1-${Date.now()}`,Y={id:q,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};w.sessions=[Y],w.activeSessionId=q,yi([Y]),xi(q)}else{const q=j[j.length-1];if(q&&(!q.thread||q.thread.length===0))Xo.current=$x(j),w.sessions=j,w.activeSessionId=q.id,yi(j),xi(q.id);else{const X=$x(j)+1;Xo.current=X;const te=`session-${X}-${Date.now()}`,ne={id:te,label:e("flow:composer.conversationLabel",{n:X}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},ge=[...j,ne];w.sessions=ge,w.activeSessionId=te,yi(ge),xi(te)}}Ll.current=!0},[$c,c,Lc,Mc]);const gn=h.useMemo(()=>Xs.find(w=>w.id===xr)||null,[Xs,xr]),Pt=(gn==null?void 0:gn.running)??!1,uo=(gn==null?void 0:gn.statusLine)??"",fo=(gn==null?void 0:gn.segments)??[],Jo=(gn==null?void 0:gn.thread)??[],Vp=(gn==null?void 0:gn.steps)??[];gn==null||gn.outputDismissed;const kt=(gn==null?void 0:gn.phaseContext)??null,Ml=h.useRef([]),[Dc,Ol]=h.useState(!1),$l=h.useRef(null),xd=h.useRef(null);h.useEffect(()=>{const w=xd.current;w&&requestAnimationFrame(()=>{w.scrollTop=w.scrollHeight})},[Jo,fo]);const La=h.useRef(null),Fc=h.useRef(!1),vy=h.useRef(null),wd=h.useCallback(w=>{const j=++Xo.current,B=`session-${j}-${Date.now()}`,q={id:B,label:w||e("flow:composer.conversationLabel",{n:j}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return yi(Y=>[...Y,q]),xi(B),B},[]);h.useEffect(()=>{!c||!Ll.current||(Oc.current.sessions=Xs,Oc.current.activeSessionId=xr,Mc(c,Xs,xr))},[Xs,xr,c,Mc]),h.useEffect(()=>{Xo.current=Math.max(Xo.current,$x(Xs))},[Xs]);const bd=h.useCallback(w=>{var j;La.current===w&&((j=$l.current)==null||j.abort()),yi(B=>{const q=B.filter(X=>X.id!==w);if(B.some((X,te)=>X.id===w&&B.findIndex(ne=>ne.id===xr)===te)||xr===w){const X=q;X.length>0?xi(X[X.length-1].id):setTimeout(()=>{Xo.current=0;const te=++Xo.current,ne=`session-${te}-${Date.now()}`,ge={id:ne,label:e("flow:composer.conversationLabel",{n:te}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};yi(be=>[...be,ge]),xi(ne)},0)}return q})},[xr]),fr=h.useCallback(w=>{yi(j=>{const B=j.findIndex(X=>X.id===xr);if(B<0)return j;const q={...j[B]};w(q);const Y=[...j];return Y[B]=q,Y})},[xr]),Up=h.useCallback(w=>{fr(j=>{j.running=w})},[fr]),wi=h.useCallback(w=>{fr(j=>{j.statusLine=w})},[fr]),bi=h.useCallback(w=>{fr(j=>{typeof w=="function"?j.segments=w(j.segments):j.segments=w})},[fr]),Kp=h.useCallback(w=>{fr(j=>{typeof w=="function"?j.thread=w(j.thread):j.thread=w})},[fr]),Ma=h.useCallback(w=>{fr(j=>{typeof w=="function"?j.steps=w(j.steps):j.steps=w})},[fr]),vd=h.useCallback(w=>{fr(j=>{j.outputDismissed=w})},[fr]),Dl=h.useCallback(w=>{fr(j=>{j.phaseContext=typeof w=="function"?w(j.phaseContext):w})},[fr]),Qo=h.useCallback(w=>{xi(w),yi(j=>{const B=j.findIndex(Y=>Y.id===w);if(B<0||!j[B].outputDismissed)return j;const q=[...j];return q[B]={...j[B],outputDismissed:!1},q})},[]);h.useEffect(()=>{Ml.current=fo},[fo]);const wr=h.useRef({}),qp=h.useRef(!1),ts=h.useRef(null),Zo=h.useRef(null),_r=h.useRef(null),Oa=h.useRef(!1),kd=h.useRef(0),zc=h.useRef(""),[Ot,St,Yp]=rI([]),[yn,pn,ky]=sI([]),Js=h.useRef(Ot),vi=h.useRef(yn),Gp=h.useRef(null),Sd=h.useRef(null),Xp=h.useRef(null),Fl=h.useRef(null),[Fr,Mi]=h.useState(null),Jp=h.useCallback(w=>{var j;wr.current=(j=w==null?void 0:w.extra)!=null&&j.instances&&typeof w.extra.instances=="object"?w.extra.instances:{},St(Array.isArray(w==null?void 0:w.nodes)?w.nodes:[]),pn(Array.isArray(w==null?void 0:w.edges)?w.edges:[]),Mi(null)},[pn,St]),ns=h.useMemo(()=>({instances:wr.current}),[yn,Ot]),{resetHistory:Qp,undo:Nd,redo:Zp}=zT({nodes:Ot,edges:yn,extra:ns,enabled:!!c&&Oa.current&&Fe==="edit",onRestore:Jp}),_s=h.useMemo(()=>Ot.filter(w=>{var j;return(((j=w.data)==null?void 0:j.definitionId)||"").startsWith("provide_")}),[Ot]),ea=h.useMemo(()=>{var j;const w={};for(const B of Ot){if(!((j=B.data)!=null&&j.inputs))continue;const q=B.data.inputs;for(let Y=0;Y<q.length;Y++){const X=q[Y];if(!(X!=null&&X.name))continue;const te=yn.find(ge=>ge.target===B.id&&ge.targetHandle===`input-${Y}`);if(!(te!=null&&te.source))continue;_s.find(ge=>ge.id===te.source)&&(w[te.source]=X.name)}}return w},[Ot,yn,_s]),S=h.useMemo(()=>{if(Fe==="edit"||jr.size===0)return null;const w=new Set(jr);for(const j of yn)jr.has(j.source)&&w.add(j.target),jr.has(j.target)&&w.add(j.source);return w},[Fe,jr,yn]),A=h.useMemo(()=>Fe==="edit"?Ot:Ot.map(w=>{var j,B;return{...w,draggable:!1,connectable:!1,data:{...w.data,isRunMode:!0,isExecuting:jr.has(w.id),nodeStatus:((j=ps[w.id])==null?void 0:j.status)??null,nodeElapsed:((B=ps[w.id])==null?void 0:B.elapsed)??null,isDim:S?!S.has(w.id):!1}}}),[Fe,Ot,jr,ps,S]),V=h.useMemo(()=>S?yn.map(w=>{const j=jr.has(w.source)||jr.has(w.target),B=w.className?w.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",q=j?"af-flow-edge--focus":"af-flow-edge--dim";return{...w,className:(B?B+" ":"")+q}}):yn,[yn,jr,S]);h.useEffect(()=>{if(!c){ir({}),di(null),Bo(Wd),Cc(Vh),Ec(null),Li(""),$r("");return}const w=new URLSearchParams({flowId:c.id,flowSource:c.source||"user"});c.archived&&w.set("archived","1"),fetch(`/api/flow/run-config?${w.toString()}`).then(j=>j.json()).then(j=>{ir(j.presets||{}),di(j.activePreset||null)}).catch(()=>{ir({}),di(null)})},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived]);const G=h.useCallback(w=>{Dr.current+=1,Bo(w)},[]),Q=h.useCallback(async(w,j={})=>{if(!w)return;const B=!!j.quiet,q=!!j.force,Y=Dr.current;B||(dd(!0),Li(""),$r(""));const X=new URLSearchParams({flowId:w.id,flowSource:w.source||"user"});w.archived&&X.set("archived","1");try{const te=await fetch(`/api/flow/schedule?${X.toString()}`),ne=await te.json().catch(()=>({}));if(!te.ok)throw new Error(ne.error||`HTTP ${te.status}`);if(!q&&Dr.current!==Y)return;Bo({...Wd,...ne.schedule||{}}),Cc(ne.state&&typeof ne.state=="object"?ne.state:Vh),Ec(ne.status||null)}catch(te){if(!q&&Dr.current!==Y)return;Bo(Wd),Cc(Vh),Ec(null),Li(String(te.message||te))}finally{dd(!1)}},[]);h.useEffect(()=>{if(!c)return;let w=!1;return(async()=>{await Q(c)})(),()=>{w=!0}},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived,Q]),h.useEffect(()=>{var B,q,Y,X;if(!Xr||!Ct[Xr]||_s.length===0)return;const w=Ct[Xr],j={};for(const te of _s){const ne=ea[te.id];if(!ne)continue;const ge=((B=te.data)==null?void 0:B.definitionId)||"",be=w[te.id]??((X=(Y=(q=te.data)==null?void 0:q.outputs)==null?void 0:Y[0])==null?void 0:X.default)??"";ge.startsWith("provide_file")?j[ne]={type:"file",path:be}:j[ne]={type:"str",value:be}}Object.keys(j).length>0&&Or(j)},[Xr,Ct,_s,ea]);const re=h.useCallback(()=>{if(!Jr||!Gs.current)return;const w=Gs.current.value;St(j=>j.map(B=>{var q,Y;return B.id!==Jr.instanceId?B:{...B,data:{...B.data,outputs:((Y=(q=B.data)==null?void 0:q.outputs)==null?void 0:Y.map((X,te)=>te===0?{...X,default:w}:X))||[{type:"text",name:"value",default:w}]}}})),_l(null)},[Jr,St]),ee=h.useMemo(()=>{const w=Ot.filter(j=>j.selected);return w.length===1?w[0]:null},[Ot]),ce=h.useMemo(()=>c?oK(Ot,yn,e):[],[c,Ot,yn,e]),de=h.useMemo(()=>ce.map(w=>w.key).join("|"),[ce]),ve=h.useMemo(()=>ce.some(w=>String((w==null?void 0:w.level)||"warning").toLowerCase()==="error"),[ce]);h.useLayoutEffect(()=>{se(ce.length>0&&!ve)},[de,c==null?void 0:c.id,c==null?void 0:c.source,ce.length,ve]),Tl.current=ee,h.useEffect(()=>{Js.current=Ot},[Ot]),h.useEffect(()=>{const w=i.current,j=new Map,B=[];for(const te of Ot){const ne=g7(te);j.set(te.id,ne),w.get(te.id)!==ne&&B.push(te.id)}if(i.current=j,B.length===0)return;const q=()=>B.forEach(te=>{var ne;return(ne=s.current)==null?void 0:ne.call(s,te)}),Y=window.requestAnimationFrame(q),X=window.setTimeout(q,80);return()=>{window.cancelAnimationFrame(Y),window.clearTimeout(X)}},[Ot]),h.useEffect(()=>{vi.current=yn},[yn]),h.useEffect(()=>{Xp.current=Fr},[Fr]),h.useEffect(()=>{if(!Fr)return;const w=B=>{B.key==="Escape"&&Mi(null)},j=B=>{var q,Y;(Y=(q=B.target)==null?void 0:q.closest)!=null&&Y.call(q,".af-connect-node-menu")||Mi(null)};return document.addEventListener("keydown",w),document.addEventListener("pointerdown",j),()=>{document.removeEventListener("keydown",w),document.removeEventListener("pointerdown",j)}},[Fr]),h.useEffect(()=>()=>{_r.current!=null&&(clearTimeout(_r.current),_r.current=null)},[]);const Pe=h.useMemo(()=>{var j;if(!ee)return null;const w=(j=ee.data)==null?void 0:j.definitionId;return le.find(B=>B.id===w)??null},[ee,le]),Oe=h.useMemo(()=>{const w={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const j of le){const B=M0(j);w[B].push(j)}for(const j of tf)w[j].sort((B,q)=>B.id.localeCompare(q.id));return w},[le]),pt=h.useMemo(()=>{const w=ie.trim().toLowerCase();if(!w)return Oe;const j={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const B of tf)j[B]=Oe[B].filter(q=>f7(q,w));return j},[Oe,ie]),Qe=h.useMemo(()=>tf.reduce((w,j)=>w+pt[j].length,0),[pt]),At=h.useMemo(()=>le.filter(w=>{const j=String(w.id??""),B=String(w.source??"");return j.startsWith("marketplace:")||B==="marketplace"||B==="collection"}),[le]),Rn=h.useMemo(()=>{const w=new Set;for(const j of At){const B=String(j.id??"");if(B&&(w.add(B),B.startsWith("marketplace:"))){const q=B.slice(12),[Y]=q.split("@");Y&&w.add(`marketplace:${Y}`)}}return w},[At]),Pr=h.useCallback(async()=>{p("");try{const w=await fetch("/api/flows");if(!w.ok)throw new Error("HTTP "+w.status);u(await w.json())}catch(w){p(String(w.message||w))}},[]);h.useEffect(()=>{Pr()},[Pr]),h.useEffect(()=>{if(r!=="/flow")return;const w=new URLSearchParams(window.location.search);w.get("new")==="1"&&!w.get("flowId")&&n("/projects?new=1")},[r,n]),h.useEffect(()=>{if(r!=="/flow"||!c)return;new URLSearchParams(window.location.search).get("panel")==="settings"&&vt("settings")},[r,c==null?void 0:c.id,c==null?void 0:c.source]),h.useEffect(()=>{let w=!1;const j=()=>{fetch("/api/model-lists").then(q=>q.json()).then(q=>{w||Op({cursor:Array.isArray(q.cursor)?q.cursor.map(String):[],opencode:Array.isArray(q.opencode)?q.opencode.map(String):[],claudeCode:Array.isArray(q.claudeCode)?q.claudeCode.map(String):[]})}).catch(()=>{})};j();const B=setTimeout(j,4e3);return()=>{w=!0,clearTimeout(B)}},[]),h.useEffect(()=>{let w=!1;return fetch("/api/skills").then(j=>j.json()).then(j=>{if(w)return;const B=Array.isArray(j.skills)?j.skills.filter(q=>q&&typeof q.key=="string"&&q.key.trim()).map(q=>({key:String(q.key),name:String(q.name||q.id||q.key),description:q.description?String(q.description):"",sourceLabel:q.sourceLabel?String(q.sourceLabel):""})):[];$p(B),Tc(!0)}).catch(()=>{}),()=>{w=!0}},[]),h.useEffect(()=>{let w=!1;return fetch("/api/skill-collections").then(j=>j.json()).then(j=>{w||(Dp(al(j)),Fp(!0))}).catch(()=>{}),()=>{w=!0}},[]),h.useEffect(()=>{if(Wp(""),!(!Zr||!yd)){if(!Es){Ia([]);return}Ia(dP(Es,"pipeline",gi,Rl)),Wp(Es)}},[Rl,yd,gi,Zr,Es]),h.useEffect(()=>{if(!(Ra!==Es||!Es))try{localStorage.setItem(Es,JSON.stringify(co))}catch{}},[co,Es,Ra]);const xn=h.useCallback(async w=>{const j=w.source??"user",B=!!w.archived,q=new URLSearchParams({flowId:w.id,flowSource:j});B&&q.set("archived","1");const Y=new URLSearchParams({flowId:w.id,flowSource:j});B&&Y.set("archived","1"),Y.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[X,te]=await Promise.all([fetch("/api/flow?"+q.toString()),fetch("/api/nodes?"+Y.toString())]),ne=await X.json();if(!X.ok||ne.error)throw new Error(ne.error||e("flow:nodePropsError.loadFlowFailed"));const ge=await te.json();if(!te.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const be=Array.isArray(ge)?ge:Array.isArray(ge==null?void 0:ge.nodes)?ge.nodes:[],Be=!Array.isArray(ge)&&(ge==null?void 0:ge.pipelineTranslations)||{},fe=rK(ne.flowYaml||"");if(fe.error)throw new Error(fe.error);const $e={...fe.instances||{}},Ce=fe.nodes.map(vn=>ip(vn,$e,be,Be,w.id)),gt=FT(fe.edges,Ce);return{flowSource:j,paletteList:be,instances:$e,flowDescriptionText:fe.description??"",viewport:w1(fe.viewport),nodes:Ce,edges:gt}},[t.language,e]),Dt=h.useCallback(async(w,j={})=>{const B=!!j.preserveComposer,q=B&&!!j.incrementalSync;Oa.current=!1,kd.current+=1,f(w),b(""),B||(N(""),oe(""),vt(null),k(""),F(""),$(""),Cs(""),Kp([]),bi([]),Ma([]),vd(!1),Dl(null),ao("pan")),q||(wr.current={},St([]),pn([])),k1(w);try{const Y=await xn(w);if(Se(Y.paletteList),wr.current=Y.instances,k(Y.flowDescriptionText),F(w.id||""),q){const X=Js.current,te=vi.current;try{const ne=L9(X,te,Y.nodes,Y.edges),ge=new Set([...ne.changes.addedNodeIds,...ne.changes.updatedNodeIds]),be=new Set([...ne.changes.addedEdgeKeys,...ne.changes.updatedEdgeKeys]),Be=ge.size>0?ne.nodes.map($e=>ge.has($e.id)?{...$e,className:l1($e.className,o1)}:$e):ne.nodes,fe=be.size>0?ne.edges.map($e=>be.has(ep($e))?{...$e,className:l1($e.className,a1)}:$e):ne.edges;St(Be),pn(fe),_r.current!=null&&(clearTimeout(_r.current),_r.current=null),(ge.size>0||be.size>0)&&(_r.current=window.setTimeout(()=>{_r.current=null,ge.size>0&&St($e=>$e.map(Ce=>{if(!ge.has(Ce.id))return Ce;const gt=c1(Ce.className,o1);return gt===String(Ce.className||"")?Ce:{...Ce,className:gt}})),be.size>0&&pn($e=>$e.map(Ce=>{if(!be.has(ep(Ce)))return Ce;const gt=c1(Ce.className,a1);return gt===String(Ce.className||"")?Ce:{...Ce,className:gt}}))},c7))}catch{St(Y.nodes),pn(Y.edges)}}else if(St(Y.nodes),pn(Y.edges),Zo.current=Y.viewport||null,Y.viewport){const X=()=>{var te;try{(te=ts.current)==null||te.setViewport(Y.viewport,{duration:0})}catch{}};requestAnimationFrame(()=>requestAnimationFrame(X))}else y(X=>X+1);Nh(w.id,Y.flowSource),Mp(X=>X+1),Qp(Y.nodes,Y.edges,{instances:Y.instances});try{zc.current=Wj(Y.nodes,Y.edges,Y.instances,{description:Y.flowDescriptionText,viewport:Zo.current})}catch{zc.current=""}Oa.current=!0}catch(Y){b(String(Y.message||Y))}},[xn,Qp,St,pn]),er=h.useCallback(async()=>{if(!(c!=null&&c.id))return;const w=c.source??"user",j=new URLSearchParams({flowId:c.id,flowSource:w});c.archived&&j.set("archived","1"),j.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const B=await fetch("/api/nodes?"+j.toString()),q=await B.json();if(!B.ok)throw new Error((q==null?void 0:q.error)||e("flow:nodePropsError.loadNodesFailed"));const Y=Array.isArray(q)?q:Array.isArray(q==null?void 0:q.nodes)?q.nodes:[];Se(Y)},[c,e,t.language]),Ft=h.useCallback(async()=>{Un(!0),Tn("");try{const w=await fetch("/api/marketplace/nodes"),j=await w.json().catch(()=>({}));if(!w.ok)throw new Error((j==null?void 0:j.error)||"Failed to load marketplace nodes");dn(Array.isArray(j==null?void 0:j.nodes)?j.nodes:[])}catch(w){Tn(String(w.message||w)),dn([])}finally{Un(!1)}},[]),wn=h.useCallback(async()=>{ze(!0),ln("");try{const w=await fetch("/api/marketplace/flow-snippets"),j=await w.json().catch(()=>({}));if(!w.ok)throw new Error((j==null?void 0:j.error)||"Failed to load flow snippets");We(Array.isArray(j==null?void 0:j.snippets)?j.snippets:[])}catch(w){ln(String(w.message||w)),We([])}finally{ze(!1)}},[]);h.useEffect(()=>{c&&(Ft(),wn())},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived,Ft,wn]);const qe=h.useCallback(async w=>{if(!c||!w)return;const j=w.definitionId||`marketplace:${w.id}${w.version?`@${w.version}`:""}`;if(j){Nr(j),Tn("");try{const B=await fetch("/api/marketplace/install-node",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user",archived:!!c.archived,nodeSpec:j})}),q=await B.json().catch(()=>({}));if(!B.ok||(q==null?void 0:q.ok)===!1)throw new Error((q==null?void 0:q.error)||"Failed to install marketplace node");await er()}catch(B){Tn(String(B.message||B))}finally{Nr("")}}},[c,er]),It=h.useCallback(async(w,j)=>{const B={packageId:(w==null?void 0:w.newId)||(w==null?void 0:w.id)||(w==null?void 0:w.label),label:(w==null?void 0:w.label)||(w==null?void 0:w.newId)||(w==null?void 0:w.id),version:"1.0.0",definitionId:j,body:(w==null?void 0:w.body)||"",script:(w==null?void 0:w.script)||"",inputs:Array.isArray(w==null?void 0:w.inputs)?w.inputs:[],outputs:Array.isArray(w==null?void 0:w.outputs)?w.outputs:[],flowId:c==null?void 0:c.id,flowSource:(c==null?void 0:c.source)||"user"},q=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)}),Y=await q.json();if(!q.ok||(Y==null?void 0:Y.ok)===!1)throw new Error((Y==null?void 0:Y.error)||"Publish failed");return await er(),Y},[er,c]),rs=h.useCallback(async()=>{var q;if(!c||xe.current)return;const w=c.id,j=c.source??"user",B=((q=Tl.current)==null?void 0:q.id)??null;xe.current=!0,he(!0);try{await Dt({id:w,source:j,archived:c.archived},{preserveComposer:!0,incrementalSync:!0}),B&&St(Y=>Y.map(X=>({...X,selected:X.id===B})))}finally{xe.current=!1,he(!1)}},[c,c==null?void 0:c.archived,Dt,St]);h.useEffect(()=>{if(qp.current||l.length===0)return;const w=new URLSearchParams(window.location.search),j=w.get("flowId");if(!j)return;const B=w.get("flowSource")??"user",q=w.get("flowArchived")==="1",Y=l.find(X=>X.id===j&&(X.source??"user")===B&&!!X.archived===q);Y&&(qp.current=!0,Dt(Y))},[l,Dt]);const Oi=h.useRef(0);h.useEffect(()=>{if(!c)return;const w=c.id,j=c.source??"user",B=!!c.archived;Oi.current=0;let q=!1;const Y=async()=>{var ne;if(q)return;const te=new URLSearchParams({flowId:w,flowSource:j,v:String(Oi.current)});B&&te.set("archived","1");try{const ge=await fetch("/api/flow-editor-sync-poll?"+te.toString());if(!ge.ok||q)return;const be=await ge.json();if(q)return;if(be.changed){Oi.current=be.version;const Be=((ne=Tl.current)==null?void 0:ne.id)??null;await Dt({id:w,source:j,archived:B},{preserveComposer:!0,incrementalSync:!0}),await Q({id:w,source:j,archived:B},{quiet:!0,force:!0}),Be&&St(fe=>fe.map($e=>({...$e,selected:$e.id===Be})))}else Oi.current=be.version}catch{}},X=window.setInterval(Y,2e3);return Y(),()=>{q=!0,window.clearInterval(X)}},[c==null?void 0:c.id,c==null?void 0:c.source,c==null?void 0:c.archived,Dt,Q,St]);const zl=h.useMemo(()=>x?x.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":x===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[x]);h.useEffect(()=>{if(!x)return;x===e("flow:status.saved")||x.startsWith(e("flow:status.runInTerminal"));const w=x.startsWith(e("flow:status.runInTerminal"))?5200:2800,j=window.setTimeout(()=>N(""),w);return()=>clearTimeout(j)},[x,e]),h.useEffect(()=>{C("")},[c==null?void 0:c.id,c==null?void 0:c.source]),h.useEffect(()=>{const w=()=>{window.__provideEditContent&&(_l(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",w),()=>window.removeEventListener("provide-expand",w)},[]),h.useEffect(()=>{var ne,ge,be,Be,fe,$e,Ce;if(!ee){Ac(null);return}const w=wr.current[ee.id]||{},{inputs:j,outputs:B}=DT(ee),q=String(((ne=ee.data)==null?void 0:ne.definitionId)??ee.id??""),Y=((ge=ee.data)==null?void 0:ge.script)!=null?String(ee.data.script):void 0,X=w.script!=null?String(w.script):void 0,te=q==="tool_nodejs"||Y&&Y.trim()!==""||X&&X.trim()!==""?String(Y??X??""):"";Ac({id:ee.id,newId:ee.id,label:String(((be=ee.data)==null?void 0:be.label)??ee.id),role:((Be=ee.data)==null?void 0:Be.role)??"普通",model:String(((fe=ee.data)==null?void 0:fe.model)??w.model??""),body:String((($e=ee.data)==null?void 0:$e.body)??w.body??""),images:Os(((Ce=ee.data)==null?void 0:Ce.images)??w.images),script:te,inputs:j,outputs:B})},[ee==null?void 0:ee.id,by]),h.useEffect(()=>{c&&(ee||(hd.current=null,vt(w=>w==="node"?null:w)))},[c,ee==null?void 0:ee.id]);const je=h.useCallback(()=>{hd.current=null,vt(w=>w==="settings"||w==="history"?w:"node")},[]),dt=h.useCallback((w,j)=>{w.metaKey||w.ctrlKey||w.shiftKey||Fe!=="edit"&&sr((j==null?void 0:j.id)??null)},[Fe]),ht=h.useCallback((w,j)=>{Fe==="edit"&&(w.preventDefault(),St(B=>B.map(q=>({...q,selected:q.id===j.id}))),pn(B=>B.map(q=>({...q,selected:!1}))),je())},[je,Fe,pn,St]),xt=h.useCallback((w,j)=>{if(Fe!=="edit")return;const B=w.metaKey||w.ctrlKey||w.shiftKey;pn(q=>q.map(Y=>Y.id===j.id?{...Y,selected:!Y.selected||!B}:B?Y:{...Y,selected:!1})),B||St(q=>q.map(Y=>({...Y,selected:!1})))},[Fe,pn,St]),Re=h.useCallback(w=>h1(w,Js.current),[]),$t=h.useCallback(w=>{if(!h1(w,Js.current)){N("端口类型不匹配,已取消连线");return}Mi(null),St(j=>gg(j,w)),pn(j=>{const B=j.filter(q=>!(q.target===w.target&&q.targetHandle===w.targetHandle));return Jf({...w,markerEnd:{type:Hs.ArrowClosed}},B)})},[pn,St]),nn=h.useCallback((w,j)=>{Sd.current=y7(j,Js.current),Mi(null)},[]),Qt=h.useCallback((w,j)=>{var Ce,gt,vn,kn;const B=Sd.current;if(Sd.current=null,!c||!B||j!=null&&j.toNode)return;const q=w7(le,B);if(q.length===0){N(`没有匹配 ${B.slotType} 端口的节点`);return}const Y=((gt=(Ce=w==null?void 0:w.changedTouches)==null?void 0:Ce[0])==null?void 0:gt.clientX)??(w==null?void 0:w.clientX),X=((kn=(vn=w==null?void 0:w.changedTouches)==null?void 0:vn[0])==null?void 0:kn.clientY)??(w==null?void 0:w.clientY);if(!Number.isFinite(Y)||!Number.isFinite(X))return;const te=ts.current,ne=document.querySelector(".af-pipeline-flow .react-flow");if(!te||!ne)return;const ge=ne.getBoundingClientRect(),be=320,Be=Math.min(440,104+q.length*58),fe=Math.max(12,Math.min(Y-ge.left,ge.width-be-12)),$e=Math.max(12,Math.min(X-ge.top,ge.height-Be-12));Mi({left:fe,top:$e,flowPosition:te.screenToFlowPosition({x:Y,y:X}),draft:B,candidates:q,query:""})},[le,c]),Ln=h.useCallback(w=>{for(const j of w)delete wr.current[j.id]},[]),Hn=h.useCallback(w=>{ts.current=w},[]),Vt=h.useCallback(w=>{St(B=>B.map(q=>({...q,selected:q.id===w}))),pn(B=>B.map(q=>({...q,selected:!1}))),je();const j=()=>{var ge,be,Be;const B=ts.current;if(!(B!=null&&B.getNode))return;const q=B.getNode(w);if(!q)return;const Y=(ge=B.getInternalNode)==null?void 0:ge.call(B,w),X=((be=Y==null?void 0:Y.measured)==null?void 0:be.width)??(Y==null?void 0:Y.width)??q.width??200,te=((Be=Y==null?void 0:Y.measured)==null?void 0:Be.height)??(Y==null?void 0:Y.height)??q.height??88,{zoom:ne}=B.getViewport();B.setCenter(q.position.x+X/2,q.position.y+te/2,{zoom:x1(ne),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(j))},[St,pn,je]),rn=h.useCallback(w=>{St(B=>B.map(q=>({...q,selected:q.id===w}))),pn(B=>B.map(q=>({...q,selected:!1})));const j=()=>{var be,Be,fe;const B=ts.current;if(!(B!=null&&B.getNode))return;const q=B.getNode(w);if(!q)return;const Y=(be=B.getInternalNode)==null?void 0:be.call(B,w),X=((Be=Y==null?void 0:Y.measured)==null?void 0:Be.width)??(Y==null?void 0:Y.width)??q.width??200,te=((fe=Y==null?void 0:Y.measured)==null?void 0:fe.height)??(Y==null?void 0:Y.height)??q.height??88,{zoom:ne}=B.getViewport(),ge=x1(ne);B.setCenter(q.position.x+X/2,q.position.y+te/2,{zoom:ge,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(j))},[St,pn]),or=h.useCallback((w,j)=>{const B=`node-${Date.now()}`;return i2(w,B,j,wr.current,le)},[le]),ys=h.useCallback(w=>{if(!c||!w)return;let j={x:180,y:160};const B=ts.current,q=document.querySelector(".af-pipeline-flow .react-flow");if(B&&q){const Y=q.getBoundingClientRect();j=B.screenToFlowPosition({x:Y.left+Y.width*.45,y:Y.top+Y.height*.38})}St(Y=>[...Y,or(w,j)])},[c,St,or]),Qs=h.useCallback(w=>{const j=Xp.current;if(!c||!j||!(w!=null&&w.def))return;const B=or(w.def,j.flowPosition),q=j.draft.handleType==="source"?{source:j.draft.nodeId,sourceHandle:j.draft.handleId,target:B.id,targetHandle:`input-${w.slotIndex}`}:{source:B.id,sourceHandle:`output-${w.slotIndex}`,target:j.draft.nodeId,targetHandle:j.draft.handleId};St(Y=>gg([...Y,B],q)),pn(Y=>{const X=Y.filter(te=>!(te.target===q.target&&te.targetHandle===q.targetHandle));return Jf({...q,markerEnd:{type:Hs.ArrowClosed}},X)}),Mi(null)},[c,or,St,pn]),ki=h.useCallback(w=>{w.preventDefault(),w.dataTransfer.dropEffect="move"},[]),Hc=h.useCallback(w=>{var te;if(w.preventDefault(),!c)return;const j=ts.current;if(!j)return;const B=j.screenToFlowPosition({x:w.clientX,y:w.clientY}),q=w.dataTransfer.getData("application/agentflow-snippet");if(q){const ne=Je.find(ge=>`${ge.id}@${ge.version}`===q);ne&&((te=Fl.current)==null||te.call(Fl,ne,B));return}const Y=w.dataTransfer.getData("application/agentflow-node");if(!Y)return;const X=le.find(ne=>ne.id===Y);X&&St(ne=>[...ne,or(X,B)])},[c,le,Je,St,or]),br=h.useCallback(async(w,j)=>{if(!c)return;const B=Wj(w,j,wr.current,{description:v,viewport:Zo.current});if(B!==zc.current){N(e("flow:status.saving"));try{const q=$7(c.source),Y=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:q,flowYaml:B,...c.archived?{flowArchived:!0}:{}})}),X=await Y.json();if(!Y.ok||!X.success)throw new Error(X.error||e("flow:status.saveFailed"));if(zc.current=B,N(e("flow:status.saved")),Si(c.source)&&q==="workspace"){const te={id:c.id,source:"workspace",path:void 0};f(te),k1(te),Nh(c.id,"workspace")}}catch(q){N(e("flow:status.saveFailed")+": "+(q.message||q))}}},[c,v]);h.useEffect(()=>{if(!c||!Oa.current||Fe!=="edit"||c.archived)return;const w=kd.current,j=setTimeout(()=>{w===kd.current&&Oa.current&&br(Js.current,vi.current)},400);return()=>clearTimeout(j)},[Ot,yn,v,Fe,c,br]);const $i=h.useCallback(async w=>{if(!c||c.archived)return;const j=c.source??"user";if(!(j!=="user"&&j!=="workspace")&&j!==w){H(!0),C("");try{const B=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,fromSource:j,toSource:w})}),q=await B.json().catch(()=>({}));if(!B.ok)throw new Error(typeof q.error=="string"?q.error:e("flow:composer.requestFailed"));const Y=q.flowSource==="workspace"||q.flowSource==="user"?q.flowSource:w;let X={id:c.id,source:Y,archived:c.archived};try{const te=await fetch("/api/flows");if(te.ok){const ne=await te.json(),ge=Array.isArray(ne)?ne.find(be=>be.id===c.id&&(be.source??"user")===Y&&!!be.archived==!!c.archived):null;ge&&(X=ge)}}catch{}await Dt(X,{preserveComposer:!0}),Nh(c.id,Y)}catch(B){C(String(B.message||B))}finally{H(!1)}}},[c,Dt]),Hl=h.useCallback(async()=>{if(c){Rp(!0),Li(""),$r("");try{const w=await fetch("/api/flow/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user",archived:!!c.archived,schedule:mn})}),j=await w.json().catch(()=>({}));if(!w.ok||!j.success)throw new Error(j.error||"Failed to save schedule");Bo({...Wd,...j.schedule||{}}),$r(e("flow:schedule.saved")),await Q(c,{quiet:!0,force:!0})}catch(w){Li(String(w.message||w))}finally{Rp(!1)}}},[c,mn,Q,e]),hR=h.useCallback(async()=>{c&&(await br(Js.current,vi.current),!c.archived&&c.source!=="builtin"&&await Hl())},[c,br,Hl]),eh=h.useCallback(async()=>{if(!c||!L.trim())return;const w=L.trim();if(w===c.id){$("");return}D(!0),$("");try{const j=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",newFlowId:w})}),B=await j.json().catch(()=>({}));if(!j.ok)throw new Error(typeof B.error=="string"?B.error:e("flow:composer.requestFailed"));let q={id:B.flowId,source:B.flowSource??c.source,archived:c.archived};try{const Y=await fetch("/api/flows");if(Y.ok){const X=await Y.json(),te=Array.isArray(X)?X.find(ne=>ne.id===B.flowId&&(ne.source??"user")===(B.flowSource??c.source)):null;te&&(q=te)}}catch{}await Dt(q,{preserveComposer:!0}),Nh(B.flowId,B.flowSource??c.source)}catch(j){$(String(j.message||j))}finally{D(!1)}},[c,L,Dt]),Z0=h.useCallback(w=>{navigator.clipboard.writeText(w).then(()=>{I(!0),setTimeout(()=>I(!1),2e3)}).catch(()=>{})},[]),Sy=h.useCallback(()=>{br(Ot,yn)},[br,Ot,yn]),ek=h.useCallback(()=>{var j,B;if(!c)return;const w=w1((B=(j=ts.current)==null?void 0:j.getViewport)==null?void 0:B.call(j));w&&(Zo.current=w,N("已固定 Pipeline 进入视角"),br(Js.current,vi.current))},[br,c]),mR=h.useCallback((w,j)=>{const B=j.trim()===""||j==="default"?void 0:j.trim(),q=Ot.map(Y=>Y.id===w?{...Y,data:{...Y.data,model:B}}:Y);St(q),br(q,yn)},[Ot,yn,St,br]),th=h.useCallback(()=>{var gt,vn;if(!Et||!c||!ee)return!1;const w=ee.id,j=Et.newId.trim();if(Ic(""),!JT.test(j))return Ic(e("flow:nodePropsError.invalidInstanceId")),!1;if(Ot.some(kn=>kn.id===j&&kn.id!==w))return Ic(e("flow:nodePropsError.duplicateInstanceId")),!1;const B=Et.role.trim(),q=ml.includes(B)?B:"普通",Y=Et.model.trim(),X=kn=>(Array.isArray(kn)?kn:[]).map(Kt=>({type:String((Kt==null?void 0:Kt.type)??"节点").trim()||"节点",name:String((Kt==null?void 0:Kt.name)??""),default:String((Kt==null?void 0:Kt.default)??""),required:!!(Kt!=null&&Kt.required),showOnNode:(Kt==null?void 0:Kt.showOnNode)!=null?Kt.showOnNode!==!1:!!(Kt!=null&&Kt.required)||String((Kt==null?void 0:Kt.type)??"节点").trim().toLowerCase()==="node"})),te=X(Et.inputs),ne=X(Et.outputs),ge=String(((gt=ee.data)==null?void 0:gt.definitionId)??j),be=ge.startsWith("provide_"),Be={...ee.data,label:Et.label.trim()||j,displayLabel:Et.label.trim()||j,role:q,model:Y===""||Y==="default"?void 0:Y,body:be?"":Et.body,images:be?[]:Os(Et.images),inputs:te,outputs:be&&Array.isArray((vn=ee.data)==null?void 0:vn.outputs)?ee.data.outputs:ne},fe=String(Et.script??"").trim();ge==="tool_nodejs"||fe!==""?Be.script=String(Et.script??""):delete Be.script;let $e,Ce=yn;if(j!==w){const kn={...wr.current},Kt={...kn[w]||{}};delete kn[w],kn[j]=Kt,wr.current=kn,$e=Ot.map(Nt=>Nt.id!==w?Nt:{...Nt,id:j,selected:!0,data:Be}),Ce=yn.map((Nt,Zt)=>({...Nt,source:Nt.source===w?j:Nt.source,target:Nt.target===w?j:Nt.target,id:`e-${Nt.source===w?j:Nt.source}-${Nt.target===w?j:Nt.target}-${Zt}`}))}else $e=Ot.map(kn=>kn.id===w?{...kn,data:Be}:kn);return St($e),pn(Ce),Us(j),br($e,Ce),!0},[Et,c,ee,Ot,yn,St,pn,Us,br]),Ny=h.useCallback(()=>{var vn,kn;if(!Et||!c||!ee)return!1;const w=ee.id,j=Et.role.trim(),B=ml.includes(j)?j:"普通",q=Et.model.trim(),Y=Kt=>(Array.isArray(Kt)?Kt:[]).map(Nt=>({type:String((Nt==null?void 0:Nt.type)??"节点").trim()||"节点",name:String((Nt==null?void 0:Nt.name)??""),default:String((Nt==null?void 0:Nt.default)??""),required:!!(Nt!=null&&Nt.required),showOnNode:(Nt==null?void 0:Nt.showOnNode)!=null?Nt.showOnNode!==!1:!!(Nt!=null&&Nt.required)||String((Nt==null?void 0:Nt.type)??"节点").trim().toLowerCase()==="node"})),X=Y(Et.inputs),te=Y(Et.outputs),ne=String(((vn=ee.data)==null?void 0:vn.definitionId)??w),ge=ne.startsWith("provide_"),be=Et.label.trim()||w,Be=q===""||q==="default"?void 0:q,fe={...ee.data,label:be,displayLabel:be,role:B,model:Be,body:ge?"":Et.body,images:ge?[]:Os(Et.images),inputs:X,outputs:ge&&Array.isArray((kn=ee.data)==null?void 0:kn.outputs)?ee.data.outputs:te},$e=String(Et.script??"").trim();ne==="tool_nodejs"||$e!==""?fe.script=String(Et.script??""):delete fe.script;const Ce=ee.data||{};return(Ce.label!==fe.label||Ce.role!==fe.role||Ce.model!==fe.model||Ce.body!==fe.body||JSON.stringify(Os(Ce.images))!==JSON.stringify(fe.images)||(Ce.script??void 0)!==(fe.script??void 0)||JSON.stringify(Ce.inputs||[])!==JSON.stringify(X)||JSON.stringify(Ce.outputs||[])!==JSON.stringify(te))&&(St(Kt=>Kt.map(Nt=>Nt.id===w?{...Nt,data:fe}:Nt)),Us(w)),!0},[Et,c,ee,St,Us]),tk=h.useRef(Ny);h.useEffect(()=>{tk.current=Ny},[Ny]),h.useEffect(()=>{if(!Et||!c||!Oa.current||Fe!=="edit")return;const w=setTimeout(()=>{tk.current()},400);return()=>clearTimeout(w)},[Et,c,Fe]);const gR=h.useCallback(()=>{if(!(!Et||!ee)){if(Et.newId.trim()===ee.id){Ic("");return}th()}},[Et,ee,th]);h.useEffect(()=>{const w=j=>{var te,ne,ge;if(Fe!=="edit")return;const B=WT(j.target);if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="s"){if(ct==="node"&&ee&&Et){j.preventDefault(),j.stopPropagation(),th()||Sy();return}if(B)return;j.preventDefault(),j.stopPropagation(),Sy();return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"){j.preventDefault(),j.stopPropagation(),Il(be=>!be);return}if(Gn)return;if(Pl){if(j.key==="Escape"){j.preventDefault(),Al(!1);return}if(xg(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),Al(!1);return}(j.key==="v"||j.key==="V"||j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey&&j.preventDefault();return}if(B)return;const q=j.key.toLowerCase(),Y=(j.metaKey||j.ctrlKey)&&!j.shiftKey&&q==="z",X=(j.metaKey||j.ctrlKey)&&(j.shiftKey&&q==="z"||q==="y");if(Y||X){j.preventDefault(),j.stopPropagation();const be=Y?Nd():Zp();N(be?Y?"Undo canvas change":"Redo canvas change":Y?"Nothing to undo":"Nothing to redo");return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="c"){const be=LT(Js.current,vi.current,wr.current);be&&(j.preventDefault(),j.stopPropagation(),Gp.current=be,N(`Copied ${be.nodes.length} node${be.nodes.length>1?"s":""}`));return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="v"){const be=MT(Gp.current,Js.current,vi.current,wr.current);be&&(j.preventDefault(),j.stopPropagation(),wr.current=be.instances,St(be.nodes),pn(be.edges),N(`Pasted ${be.pastedNodeIds.length} node${be.pastedNodeIds.length>1?"s":""}`));return}if((j.key==="a"||j.key==="A")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),j.stopPropagation(),(te=Ve.current)==null||te.focus(),(ge=(ne=Ve.current)==null?void 0:ne.select)==null||ge.call(ne);return}if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="a"){j.preventDefault(),j.stopPropagation(),St(be=>be.map(Be=>({...Be,selected:!0}))),pn(be=>be.map(Be=>({...Be,selected:!1})));return}if(xg(j)&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),Al(be=>!be);return}if((j.key==="v"||j.key==="V")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),ao("select");return}if((j.key==="h"||j.key==="H")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),ao("pan");return}if((j.key==="f"||j.key==="F")&&!j.metaKey&&!j.ctrlKey&&!j.altKey){j.preventDefault(),ek();return}};return window.addEventListener("keydown",w,!0),()=>window.removeEventListener("keydown",w,!0)},[Sy,ek,Pl,Gn,ct,ee,Et,th,Fe,Nd,Zp]),h.useEffect(()=>{if(Fe!=="running"||qs==null)return;let w=Math.floor((Date.now()-qs)/1e3);const j=setInterval(()=>{const B=Date.now()-qs,q=Math.floor(B/1e3);q!==w&&(w=q,Jt(B))},500);return()=>clearInterval(j)},[Fe,qs]),h.useEffect(()=>{const w=io.current;!w||!w.parentElement||Nl.current&&(oo.current=!0,w.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{oo.current=!1}))},[ur]),h.useEffect(()=>{const w=io.current;if(!w)return;const j=w.parentElement;if(!j)return;const B=()=>{if(oo.current)return;const q=j.scrollHeight-j.scrollTop-j.clientHeight;Nl.current=q<40};return j.addEventListener("scroll",B,{passive:!0}),()=>j.removeEventListener("scroll",B)},[Cr,Fe]),h.useEffect(()=>{if(Fe==="edit"||!Cr)return;Nl.current=!0;const w=io.current;w&&(oo.current=!0,w.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{oo.current=!1}))},[Fe,Cr]),h.useEffect(()=>{ur.length>wm+b1&<(w=>w.length>wm+b1?w.slice(-wm):w)},[ur]);const yR=h.useCallback(w=>{if(w.button!==0)return;w.preventDefault();const j=w.currentTarget;dr.current={active:!0,pointerId:w.pointerId,startY:w.clientY,startH:ms},j.setPointerCapture(w.pointerId)},[ms]),xR=h.useCallback(w=>{const j=dr.current;if(!j.active||w.pointerId!==j.pointerId)return;const B=j.startY-w.clientY;zo(bm(j.startH+B))},[]),nh=h.useCallback(()=>{zo(w=>{const j=bm(w);try{localStorage.setItem(a2,String(j))}catch{}return j})},[]),nk=h.useCallback(w=>{const j=dr.current;if(!(!j.active||w.pointerId!==j.pointerId)){j.active=!1;try{w.currentTarget.releasePointerCapture(w.pointerId)}catch{}nh()}},[nh]),wR=h.useCallback(()=>{const w=dr.current;w.active&&(w.active=!1,nh())},[nh]);h.useEffect(()=>{function w(){zo(j=>bm(j))}return window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]);const po=h.useCallback(async(w={})=>{if(!c)return;const j=w.runUuid!=null&&String(w.runUuid).trim()?String(w.runUuid).trim():null,B=w.cliInputsOverride??Ho.current,q=!!w.prepareOnly;if(Mt(q?"ready":"running"),lt(q?[]:[{ts:new Date().toISOString(),type:"info",text:j?e("flow:run.connectingApiResume",{uuid:j}):e("flow:run.connectingApi")}]),Te(new Set),Yn({}),tt(!q),vt(null),j||Ys(null),q)return;if(!j){const X=Date.now();ut(X),Jt(0)}const Y=new AbortController;pi.current=Y;try{const X=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user",...j?{uuid:j}:{},cliInputs:B}),signal:Y.signal});if(!X.ok){const fe=await X.json().catch(()=>({error:e("flow:composer.requestFailed")}));lt($e=>[...$e,{ts:new Date().toISOString(),type:"error",text:fe.error||e("flow:composer.requestFailed")}]),Mt("error");return}if(lt(fe=>[...fe,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!X.body){lt(fe=>[...fe,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),Mt("error");return}const te=X.body.getReader(),ne=new TextDecoder;let ge="";const be=fe=>{const $e=fe.ts||new Date().toISOString();if(fe.type==="event")if(fe.event==="node-start")Te(Ce=>new Set(Ce).add(fe.instanceId)),Yn(Ce=>({...Ce,[fe.instanceId]:{status:"running",startMs:Date.now()}})),lt(Ce=>[...Ce,{ts:$e,type:"node-start",text:fe.label?e("flow:run.nodeStartWithLabel",{instanceId:fe.instanceId,label:fe.label}):e("flow:run.nodeStart",{instanceId:fe.instanceId})}]);else if(fe.event==="node-done"){Te(gt=>{const vn=new Set(gt);return vn.delete(fe.instanceId),vn});const Ce=fe.elapsed??null;Yn(gt=>({...gt,[fe.instanceId]:{status:"success",elapsed:Ce}})),lt(gt=>[...gt,{ts:$e,type:"node-done",text:Ce?e("flow:run.nodeDoneWithElapsed",{instanceId:fe.instanceId,elapsed:Ce}):e("flow:run.nodeDone",{instanceId:fe.instanceId})}])}else if(fe.event==="node-failed")Te(Ce=>{const gt=new Set(Ce);return gt.delete(fe.instanceId),gt}),Yn(Ce=>({...Ce,[fe.instanceId]:{status:"failed",elapsed:fe.elapsed??null}})),lt(Ce=>[...Ce,{ts:$e,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:fe.instanceId})}]);else if(fe.event==="apply-start"){if(fe.uuid&&Ys(String(fe.uuid)),typeof fe.runStartTime=="number"&&fe.runStartTime>0)ut(fe.runStartTime),Jt(Math.max(0,Date.now()-fe.runStartTime));else if(typeof fe.totalExecutedMs=="number"&&fe.totalExecutedMs>0){const Ce=Date.now()-fe.totalExecutedMs;ut(Ce),Jt(fe.totalExecutedMs)}lt(Ce=>[...Ce,{ts:$e,type:"info",text:e("flow:run.pipelineStart",{uuid:fe.uuid||"?"})}])}else fe.event==="apply-done"?lt(Ce=>[...Ce,{ts:$e,type:"info",text:fe.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:fe.totalElapsed}):e("flow:run.pipelineDone")}]):fe.event==="apply-paused"?lt(Ce=>[...Ce,{ts:$e,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(fe.pendingNodes||[]).join(", ")})}]):lt(Ce=>[...Ce,{ts:$e,type:"event",text:`[${fe.event}] ${JSON.stringify(fe)}`}]);else fe.type==="user-check-content"?(Na({instanceId:fe.instanceId,execId:fe.execId??1,inputPath:fe.inputPath,outputPath:fe.outputPath,content:fe.content||""}),jl(fe.content||""),hi(!1),Ea(""),Vo(!1),lt(Ce=>[...Ce,{ts:$e,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:fe.instanceId})}])):fe.type==="user-ask-prompt"?(El({instanceId:fe.instanceId,execId:fe.execId??1,question:fe.question||"",options:Array.isArray(fe.options)?fe.options:[]}),yr(!1),lt(Ce=>[...Ce,{ts:$e,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:fe.instanceId,defaultValue:`等待用户选择 (${fe.instanceId})`})}])):fe.type==="tool-print-content"?(Uo({instanceId:fe.instanceId,execId:fe.execId??1,content:fe.content||"",createdAt:Date.now()}),qo(!1)):fe.type==="log"?lt(Ce=>[...Ce,{ts:$e,type:"log",text:fe.text!=null?String(fe.text):""}]):fe.type==="error"?lt(Ce=>[...Ce,{ts:$e,type:"error",text:fe.message||e("flow:run.unknownError")}]):fe.type==="done"?lt(Ce=>[...Ce,{ts:$e,type:"done",text:e("flow:run.executionEnd",{exitCode:fe.exitCode??"?"})}]):lt(Ce=>[...Ce,{ts:$e,type:"log",text:JSON.stringify(fe)}])},Be=fe=>{if(fe.trim())try{be(JSON.parse(fe))}catch{lt($e=>[...$e,{ts:new Date().toISOString(),type:"log",text:fe}])}};for(;;){const{done:fe,value:$e}=await te.read();ge+=ne.decode($e??new Uint8Array,{stream:!fe});const Ce=ge.split(`
|
|
133
|
+
`);ge=Ce.pop()??"";for(const gt of Ce)Be(gt);if(fe)break}ge.trim()&&Be(ge),Mt("done")}catch(X){X.name==="AbortError"?(lt(te=>[...te,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),Mt("stopped")):(lt(te=>[...te,{ts:new Date().toISOString(),type:"error",text:X.message||e("flow:run.unknownError")}]),Mt("error"))}finally{pi.current=null,Te(new Set)}},[c]),[bR,jy]=h.useState(!1),vR=h.useCallback(()=>{jy(!0)},[]),kR=h.useCallback(async()=>{if(jy(!1),pi.current&&(pi.current.abort(),pi.current=null),c)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user"})})}catch{}Mt("stopped"),Te(new Set)},[c]),Bl=h.useCallback(()=>{Mt("edit"),Te(new Set),Yn({}),sr(null),Ys(null)},[]),[SR,rh]=h.useState(!1),NR=h.useCallback(async()=>{if(rh(!1),pi.current&&(pi.current.abort(),pi.current=null),c)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source||"user"})})}catch{}Bl()},[c,Bl]),jR=h.useCallback(()=>{rh(!1),n("/projects")},[n]),CR=h.useCallback(w=>{const j=w.runId!=null&&String(w.runId).trim()?String(w.runId).trim():null,B=w.flowId!=null&&String(w.flowId).trim()?String(w.flowId).trim():(c==null?void 0:c.id)!=null?String(c.id):null;Ys(j);const q=w.status||"unknown";let Y="stopped";q==="success"?Y="done":q==="failed"?Y="error":q==="running"?Y="running":Y="stopped",Mt(Y);const X=typeof w.at=="number"?w.at:null;if(Y==="running"&&X!=null?(ut(X),Jt(Math.max(0,Date.now()-X))):X!=null&&typeof w.endedAt=="number"&&w.endedAt>X?(ut(null),Jt(w.endedAt-X)):(ut(null),Jt(Math.max(0,w.durationMs??0))),lt([]),Te(new Set),Yn({}),sr(null),vt(null),tt(!1),j&&B){const te=new URLSearchParams({flowId:B,runId:j});fetch(`/api/run-node-statuses?${te}`).then(ne=>ne.json()).then(ne=>{const ge=ne.statuses&&typeof ne.statuses=="object"?ne.statuses:{},be={};for(const[Be,fe]of Object.entries(ge))fe&&typeof fe=="object"&&typeof fe.status=="string"&&(be[Be]={status:fe.status,...fe.elapsed!=null&&String(fe.elapsed).trim()!==""?{elapsed:String(fe.elapsed)}:{}});Yn(be)}).catch(()=>{})}},[c==null?void 0:c.id]);h.useEffect(()=>{if(!(c!=null&&c.id)||Fe!=="edit")return;let w=!1;return(async()=>{try{const j=await fetch("/api/pipeline-recent-runs"),B=await j.json();if(w||!j.ok)return;const Y=(Array.isArray(B.runs)?B.runs:[]).find(ne=>ne.flowId===c.id&&ne.status==="running");if(!Y||w)return;const X=Y.runId||null;Ys(X),Mt("running"),tt(!0),ut(Y.at||Date.now()),Mr.current=0;const te=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${X},已恢复运行视图`}];if(X){const ne=new URLSearchParams({flowId:c.id,runId:X}),be=await(await fetch(`/api/run-node-statuses?${ne}`)).json();if(w)return;const Be=be.statuses&&typeof be.statuses=="object"?be.statuses:{},fe={},$e=new Set;for(const[Ce,gt]of Object.entries(Be))gt&&typeof gt=="object"&&typeof gt.status=="string"&&(fe[Ce]={status:gt.status,...gt.elapsed!=null&&String(gt.elapsed).trim()!==""?{elapsed:String(gt.elapsed)}:{}},gt.status==="running"&&$e.add(Ce));Yn(fe),Te($e);try{const Ce=new URLSearchParams({flowId:c.id,runId:X,sinceBytes:"0",tailBytes:"262144"}),gt=await fetch(`/api/run-log?${Ce}`);if(gt.ok){const vn=await gt.json();if(!w){Mr.current=Number(vn.bytes||0);const kn=v1(typeof vn.text=="string"?vn.text:"");lt([...kn,...te]);return}}}catch{}}lt(te)}catch{}})(),()=>{w=!0}},[c==null?void 0:c.id]),h.useEffect(()=>{if(Fe==="edit"||!(c!=null&&c.id)||!jn)return;let w=!1,j=null;const B=async()=>{try{const q=new URLSearchParams({flowId:c.id,runId:jn}),Y=await fetch(`/api/run-node-statuses?${q}`);if(!Y.ok)return;const X=await Y.json();if(w)return;const te=X.statuses&&typeof X.statuses=="object"?X.statuses:{},ne={},ge=new Set;for(const[be,Be]of Object.entries(te))Be&&typeof Be=="object"&&typeof Be.status=="string"&&(ne[be]={status:Be.status,...Be.elapsed!=null&&String(Be.elapsed).trim()!==""?{elapsed:String(Be.elapsed)}:{}},Be.status==="running"&&ge.add(be));Yn(be=>L7(be,ne)?be:ne),Te(be=>M7(be,ge)?be:ge);try{const be=new URLSearchParams({flowId:c.id,runId:jn,sinceBytes:String(Mr.current||0),tailBytes:String(A7)}),Be=await fetch(`/api/run-log?${be}`);if(Be.ok){const fe=await Be.json();if(w)return;const $e=Number(fe.bytes||0),Ce=typeof fe.text=="string"?fe.text:"";if(Ce){const gt=v1(Ce);gt.length>0&<(vn=>[...vn,...gt])}Mr.current=$e}}catch{}try{const be=await fetch("/api/pipeline-recent-runs");if(!be.ok)return;const Be=await be.json();if(w)return;const $e=(Array.isArray(Be.runs)?Be.runs:[]).find(Ce=>Ce.flowId===c.id&&Ce.runId===jn);if($e&&$e.status){const Ce=$e.status;Ce==="running"?Mt(gt=>gt==="running"?gt:"running"):Ce==="success"?Mt("done"):Ce==="failed"?Mt("error"):(Ce==="stopped"||Ce==="interrupted")&&Mt("stopped")}}catch{}}catch{}};return B(),j=window.setInterval(B,2500),()=>{w=!0,j&&window.clearInterval(j)}},[Fe,c==null?void 0:c.id,jn]),h.useEffect(()=>{if(ct!=="history"||!c)return;let w=!1;return(async()=>{Zn(!0),Tt("");try{const j=await fetch("/api/pipeline-recent-runs"),B=await j.json();if(!j.ok)throw new Error(B.error||"HTTP "+j.status);w||Le(Array.isArray(B.runs)?B.runs:[])}catch(j){w||(Tt(String(j.message||j)),Le([]))}finally{w||Zn(!1)}})(),()=>{w=!0}},[ct,c]),h.useEffect(()=>{if(!c){cr({files:[]});return}let w=!1;return(async()=>{ft(!0);try{const j=new URLSearchParams({flowId:c.id,flowSource:c.source||"user",archived:c.archived?"1":"0"}),B=await fetch(`/api/pipeline-files?${j}`),q=await B.json();if(!B.ok)throw new Error(q.error||"HTTP "+B.status);w||cr({files:Array.isArray(q.files)?q.files:[],path:q.path,error:q.error})}catch(j){w||cr({files:[],error:j.message||String(j)})}finally{w||ft(!1)}})(),()=>{w=!0}},[c]);const jd=h.useMemo(()=>c?ae.filter(w=>w&&w.flowId===c.id).sort((w,j)=>j.at-w.at):[],[ae,c]),xs=h.useMemo(()=>{let w=0,j=0,B=0,q=0,Y=0;for(const X of jd){const te=X.status||"unknown";te==="success"?w+=1:te==="failed"?j+=1:te==="running"?B+=1:te==="stopped"?q+=1:te==="interrupted"&&(Y+=1)}return{success:w,failed:j,running:B,stopped:q,interrupted:Y}},[jd]),Cd=h.useMemo(()=>c?m1(Qr,Pc):null,[c,Qr,Pc]),Di=h.useMemo(()=>{if(!Cd||!c)return[];const w=Cd.query.toLowerCase(),j=Y=>w?Y.some(X=>X&&String(X).toLowerCase().includes(w)):!0,B=Ot.map(Y=>{var be,Be;const X=Y.id,te=String(((be=Y.data)==null?void 0:be.label)??X),ne=(Be=Y.data)!=null&&Be.definitionId?String(Y.data.definitionId):"",ge=[te!==X?te:"",ne&&ne!==X?ne:""].filter(Boolean);return{id:X,label:te,defId:ne,subs:ge}}).filter(({id:Y,label:X,defId:te})=>j([Y,X,te])).sort((Y,X)=>Y.id.localeCompare(X.id)).slice(0,18).map(({id:Y,label:X,defId:te})=>{const ne=[X!==Y?X:null,te||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:Y,title:Y,subtitle:ne}}),q=le.filter(Y=>Y&&Y.id&&j([Y.id,Y.label,Y.description])).sort((Y,X)=>Y.id.localeCompare(X.id)).slice(0,22).map(Y=>({kind:"definition",id:Y.id,title:Y.id,subtitle:Y.label&&Y.label!==Y.id?String(Y.label):String(Y.type||"")}));return[...B,...q]},[Cd,Ot,le,c]),Ed=h.useMemo(()=>{const w=Di.filter(B=>B.kind==="instance"),j=Di.filter(B=>B.kind==="definition");return{instances:w,definitions:j}},[Di]);h.useEffect(()=>{_a(w=>{const j=Math.max(0,Di.length-1);return Math.min(Math.max(0,w),j)})},[Di]);const rk=h.useMemo(()=>v7(Qr),[Qr]),zr=h.useMemo(()=>Ot.filter(w=>w.selected),[Ot]),Cy=h.useMemo(()=>new Set(zr.map(w=>w.id)),[zr]),sh=h.useMemo(()=>yn.filter(w=>Cy.has(w.source)&&Cy.has(w.target)),[yn,Cy]),sk=h.useMemo(()=>{const w=ie.trim().toLowerCase();return w?Je.filter(j=>[j.id,j.version,j.displayName,j.name,j.description,...Array.isArray(j.tags)?j.tags:[]].filter(Boolean).some(B=>String(B).toLowerCase().includes(w))):Je},[Je,ie]),ik=h.useCallback((w,j)=>{const B=String(w||"snippet-node").trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"snippet-node",q=Date.now().toString(36);let Y=`${B}-${q}`,X=2;for(;j.has(Y);)Y=`${B}-${q}-${X}`,X+=1;return j.add(Y),Y},[]),ok=h.useCallback((w,j)=>{var Zt,ws;if(!c||!w)return;const B=w.snippet&&typeof w.snippet=="object"?w.snippet:{},q=B.instances&&typeof B.instances=="object"?B.instances:{},Y=Object.keys(q);if(Y.length===0)return;const X=new Set(Js.current.map(Ye=>Ye.id)),te={};for(const Ye of Y)te[Ye]=ik(Ye,X);const ne=(Zt=B.ui)!=null&&Zt.nodePositions&&typeof B.ui.nodePositions=="object"?B.ui.nodePositions:{},ge=(ws=B.ui)!=null&&ws.nodeSizes&&typeof B.ui.nodeSizes=="object"?B.ui.nodeSizes:{},be=Y.map(Ye=>{const Sn=ne[Ye];return{id:Ye,x:typeof(Sn==null?void 0:Sn.x)=="number"?Sn.x:0,y:typeof(Sn==null?void 0:Sn.y)=="number"?Sn.y:0}}),Be=Math.min(...be.map(Ye=>Ye.x)),fe=Math.min(...be.map(Ye=>Ye.y));let $e=j||{x:180,y:160};const Ce=ts.current,gt=document.querySelector(".af-pipeline-flow .react-flow");if(!j&&Ce&>){const Ye=gt.getBoundingClientRect();$e=Ce.screenToFlowPosition({x:Ye.left+Ye.width*.48,y:Ye.top+Ye.height*.32})}const vn={};for(const Ye of Y)vn[te[Ye]]={...q[Ye]||{}};wr.current={...wr.current,...vn};const kn=Y.map(Ye=>{const Sn=q[Ye]||{},ho=be.find(Pd=>Pd.id===Ye)||{x:0,y:0},Fi=ge[Ye]&&typeof ge[Ye].width=="number"&&typeof ge[Ye].height=="number"?{width:ge[Ye].width,height:ge[Ye].height}:null,Vl={id:te[Ye],type:"flowNode",selected:!0,position:{x:$e.x+(ho.x-Be),y:$e.y+(ho.y-fe)},...Fi?{width:Fi.width,height:Fi.height}:{},data:{label:Sn.label||te[Ye],definitionId:Sn.definitionId||Ye,role:Sn.role||"normal",body:Sn.body||"",script:Sn.script||"",...Fi?{displaySize:Fi}:{}}};return ip(Vl,wr.current,le,{},c.id)}),Kt=new Set(Y),Nt=(Array.isArray(B.edges)?B.edges:[]).filter(Ye=>Kt.has(Ye==null?void 0:Ye.source)&&Kt.has(Ye==null?void 0:Ye.target)).map((Ye,Sn)=>({id:`e-${te[Ye.source]}-${te[Ye.target]}-${Date.now()}-${Sn}`,source:te[Ye.source],target:te[Ye.target],sourceHandle:Ye.sourceHandle??void 0,targetHandle:Ye.targetHandle??void 0,markerEnd:{type:Hs.ArrowClosed}}));St(Ye=>[...Ye.map(Sn=>({...Sn,selected:!1})),...kn]),pn(Ye=>[...Ye.map(Sn=>({...Sn,selected:!1})),...Nt]),N(`已添加流程片段:${w.displayName||w.id}`)},[ik,le,c,pn,St]);Fl.current=ok;const ER=h.useCallback(()=>{var B,q;if(zr.length<2){ln("请先在画布上选择至少两个节点。"),ke("flows");return}const w=zr[0],j=zr.length===2?`${((B=w.data)==null?void 0:B.label)||w.id} 片段`:`${((q=w.data)==null?void 0:q.label)||w.id} 等 ${zr.length} 个节点`;cn({name:j,id:j.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),He(""),Bt(!0),ke("flows")},[zr]),_R=h.useCallback(async()=>{var X,te;if(!c||zr.length<2)return;const w=en.name.trim();if(!w){He("请填写片段名称。");return}const j=Cp(zr,wr.current),B={},q={};for(const ne of zr){B[ne.id]={x:((X=ne.position)==null?void 0:X.x)||0,y:((te=ne.position)==null?void 0:te.y)||0};const ge=D7(ne);ge&&(q[ne.id]=ge)}const Y=sh.map(ne=>({source:ne.source,target:ne.target,sourceHandle:ne.sourceHandle??null,targetHandle:ne.targetHandle??null}));ue(!0),He("");try{const ne=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:en.id,name:w,displayName:w,version:"1.0.0",description:en.description,snippet:{instances:j,edges:Y,ui:{nodePositions:B,nodeSizes:q}}})}),ge=await ne.json().catch(()=>({}));if(!ne.ok||(ge==null?void 0:ge.ok)===!1)throw new Error((ge==null?void 0:ge.error)||"Publish failed");Bt(!1),N(`流程片段已发布:${ge.id||w}`),ds(`流程片段已发布:${ge.id||w}`),await wn(),ke("flows")}catch(ne){He(String(ne.message||ne))}finally{ue(!1)}},[c,zr,sh,en,wn,ds]),ih=h.useMemo(()=>{const w=[],j=new Set;for(const Y of zr)j.add(Y.id),w.push({node:Y,kind:"canvas"});const B=new Map(Ot.map(Y=>[Y.id,Y])),q=new Map(le.map(Y=>[Y.id,Y]));for(const Y of rk){if(j.has(Y))continue;const X=B.get(Y);if(X){j.add(Y),w.push({node:X,kind:"mention"});continue}const te=q.get(Y);te&&(j.add(Y),w.push({definition:te,kind:"definition"}))}return w},[zr,rk,Ot,le]),Ps=h.useMemo(()=>{const w=Array.isArray(bt==null?void 0:bt.cursor)?bt.cursor:[],j=Array.isArray(bt==null?void 0:bt.opencode)?bt.opencode:[],B=Array.isArray(bt==null?void 0:bt.claudeCode)?bt.claudeCode:[],q=j.map(be=>`opencode:${ia(be)}`),Y=B.map(be=>`claude-code:${ia(be)}`),X=new Set([...w,...j,...B].map(ia).concat(q).concat(Y)),te=(lo||"").trim(),ne=Wh(lo,w,j,B),ge=ne&&!X.has(ne)&&!X.has(te)?te:"";return{cursorList:w,opencodeList:j,claudeCodeList:B,currentNotInLists:ge}},[bt,lo]),Ey=h.useMemo(()=>new Set(co),[co]),_y=co.length,oh=h.useMemo(()=>{const w=new Map(gi.map(X=>[X.key,X])),j=new Set,B=new Set,q=Rl.map(X=>{const te=pl(X,gi).map(ne=>w.get(ne)).filter(Boolean);for(const ne of te)j.add(ne.key),B.add(String(ne.name||ne.id||ne.key||"").trim());return{...X,skills:te}}).filter(X=>X.skills.length>0),Y=gi.filter(X=>{const te=String(X.name||X.id||X.key||"").trim();return!j.has(X.key)&&!B.has(te)});return{groups:q,ungrouped:Y}},[Rl,gi]),Bc=h.useCallback(()=>{const w=Yo.current;if(!w)return;const j=w.getBoundingClientRect(),B=Math.min(400,Math.max(300,window.innerWidth-24)),q=Math.min(Math.max(12,j.right-B),window.innerWidth-B-12),Y=Math.max(140,j.top-22),X=Math.min(360,Y);an({position:"fixed",left:`${q}px`,top:`${Math.max(12,j.top-X-10)}px`,width:`${B}px`,maxHeight:`${X}px`})},[]);h.useEffect(()=>{const w=Array.isArray(bt==null?void 0:bt.cursor)?bt.cursor:[],j=Array.isArray(bt==null?void 0:bt.opencode)?bt.opencode:[],B=Array.isArray(bt==null?void 0:bt.claudeCode)?bt.claudeCode:[];md(q=>{const Y=Wh(q,w,j,B);return Y===q?q:Y})},[bt.cursor,bt.opencode,bt.claudeCode]),h.useEffect(()=>{if(!es)return;Bc();const w=B=>{var Y,X;const q=B.target;(Y=Yo.current)!=null&&Y.contains(q)||(X=Go.current)!=null&&X.contains(q)||Rc(!1)},j=B=>{B.key==="Escape"&&Rc(!1)};return window.addEventListener("resize",Bc),window.addEventListener("scroll",Bc,!0),document.addEventListener("pointerdown",w),document.addEventListener("keydown",j),()=>{window.removeEventListener("resize",Bc),window.removeEventListener("scroll",Bc,!0),document.removeEventListener("pointerdown",w),document.removeEventListener("keydown",j)}},[es,Bc]);const Wl=h.useCallback(async(w,j={})=>{var Nt;if(!c||Fc.current)return;const B=j.phaseContextSnapshot,q=(typeof w=="string"?w:Qr).trim();if(!q)return;const Y=Ml.current;Fc.current=!0,Up(!0),wi(e("flow:composer.connecting")),vt(Zt=>Zt!=="composer"?"composer":Zt);const X=[...Jo];if(Y.length>0&&X.push({type:"assistant",segments:[...Y]}),Kp([...X,{type:"user",text:q}]),X.filter(Zt=>Zt.type==="user").length===0){const Zt=q.replace(/\s+/g," ").slice(0,30)+(q.length>30?"…":"");yi(ws=>ws.map(Ye=>Ye.id===xr?{...Ye,label:Zt}:Ye))}const te=X.map(Zt=>Zt.type==="user"?{role:"user",text:Zt.text}:{role:"assistant",text:(Zt.segments||[]).filter(Ye=>Ye.kind==="assistant"||Ye.kind==="result").map(Ye=>Ye.text).join(`
|
|
134
|
+
`)}).filter(Zt=>Zt.text),ne=B??kt;Cs(""),bi([]),Ma([]),vd(!1);const ge=new AbortController;$l.current=ge,La.current=xr;let be=null;const Be=Array.isArray(bt==null?void 0:bt.cursor)?bt.cursor:[],fe=Array.isArray(bt==null?void 0:bt.opencode)?bt.opencode:[],$e=Array.isArray(bt==null?void 0:bt.claudeCode)?bt.claudeCode:[],Ce=Wh(lo,Be,fe,$e),gt=ih.filter(Zt=>Zt.kind!=="definition"&&Zt.node).map(Zt=>Zt.node.id),vn=c;let kn=!1,Kt=!1;try{be=setTimeout(()=>ge.abort(),12e4);const Zt={prompt:q,model:Ce,flowId:c.id,flowSource:c.source??"user",...c.archived?{flowArchived:!0}:{},contextInstanceIds:gt,thread:te,selectedSkills:co};ne&&ne.nextPhase&&!ne.isLastPhase&&(Zt.phaseContext={phaseIndex:ne.nextPhase.index,phases:ne.phases,userPromptOriginal:ne.userPromptOriginal||q}),Aa&&(Zt.phaseRole=Aa);const ws=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Zt),signal:ge.signal});if(be&&(clearTimeout(be),be=null),!ws.ok){let Fi=ws.statusText||e("flow:composer.requestFailed");try{const Vl=await ws.json();Vl&&Vl.error&&(Fi=String(Vl.error))}catch{}wi(Fi),bi([{kind:"error",text:Fi}]);return}const Ye=(Nt=ws.body)==null?void 0:Nt.getReader();if(!Ye){wi(e("flow:composer.cannotReadStream"));return}const Sn=new TextDecoder;let ho="";for(;;){const{done:Fi,value:Vl}=await Ye.read();if(Fi)break;for(ho+=Sn.decode(Vl,{stream:!0});;){const Pd=ho.indexOf(`
|
|
135
|
+
`);if(Pd<0)break;const pk=ho.slice(0,Pd).trim();if(ho=ho.slice(Pd+1),!pk)continue;let Ge;try{Ge=JSON.parse(pk)}catch{continue}if(Ge.type==="status"&&typeof Ge.line=="string"&&wi(Ge.line),Ge.type==="natural"&&typeof Ge.text=="string"&&Ge.text){const En=typeof Ge.kind=="string"&&Ge.kind?Ge.kind:"assistant";bi(Nn=>[...Nn,{kind:En,text:Ge.text}])}if(Ge.type==="error"&&Ge.message){Kt=!0;const En=Ge.code?` [${Ge.code}]`:"",Nn=String(Ge.message)+En;wi(Nn),bi(As=>[...As,{kind:"error",text:Nn}])}if(Ge.type==="plan"&&Array.isArray(Ge.steps)){Ma(Ge.steps.map(Nn=>({...Nn,status:"pending"})));const En=Ge.steps.map((Nn,As)=>`${As+1}. ${Nn.description||Nn.type}`).join(`
|
|
136
|
+
`);bi(Nn=>[...Nn,{kind:"assistant",text:e("flow:composer.taskPlan",{count:Ge.steps.length,summary:En})}])}if(Ge.type==="step-start"){const En=Ge.index??0,Nn=Ge.total??0,As=Ge.tier?` [${Ge.tier}]`:"",LR=Ge.model?` (${Ge.model})`:"";wi(e("flow:composer.step",{current:En+1,total:Nn,description:(Ge.description||"")+As+LR})),Ma(MR=>MR.map(Wc=>Wc.index===En?{...Wc,status:"running",model:Ge.model,tier:Ge.tier,nodeRole:Ge.nodeRole??Wc.nodeRole,instanceId:Ge.instanceId??Wc.instanceId,instanceLabel:Ge.instanceLabel??Wc.instanceLabel}:Wc))}if(Ge.type==="step-progress"){const En=Ge.index??0,Nn=Ge.total??0;wi(e("flow:composer.step",{current:En+1,total:Nn,description:Ge.description||""}))}if(Ge.type==="step-done"){const En=Ge.index??0;Ma(Nn=>Nn.map(As=>As.index===En?{...As,status:Ge.success?"done":"error"}:As))}if(Ge.type==="phase-plan"&&Array.isArray(Ge.phases)){Dl(Nn=>({...Nn||{},phases:Ge.phases,currentPhase:Ge.currentPhase??0,phaseTotal:Ge.phaseTotal??Ge.phases.length,phaseName:Ge.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(Nn==null?void 0:Nn.userPromptOriginal)||q}));const En=Ge.phases.map((Nn,As)=>`${As+1}. ${Nn.label}`).join(" → ");bi(Nn=>[...Nn,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:Ge.phases.length,labels:En,current:Ge.phaseName||""})}])}Ge.type==="phase-complete"&&(Dl(En=>{var As;return{...En||{},phases:Ge.phases||(En==null?void 0:En.phases)||[],currentPhase:Ge.phaseIndex??0,phaseTotal:Ge.phaseTotal??((As=Ge.phases)==null?void 0:As.length)??0,phaseName:Ge.phaseName||"",isLastPhase:!!Ge.isLastPhase,nextPhase:Ge.nextPhase||null,userPromptOriginal:Ge.userPromptOriginal||(En==null?void 0:En.userPromptOriginal)||q}}),!Ge.isLastPhase&&Ge.nextPhase&&bi(En=>[...En,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:Ge.phaseName||e("flow:composer.nextPhase"),nextPhase:Ge.nextPhase.label})}])),Ge.type==="done"&&(kn=!0,wi(En=>En||e("flow:composer.done")))}}}catch(Zt){const ws=Zt;if(ws.name==="AbortError"){const Ye=e(be?"flow:composer.connectTimeout":"flow:composer.aborted");wi(Ye),bi(Sn=>[...Sn,{kind:"error",text:Ye}])}else{const Ye=ws.code||ws.name||"UNKNOWN",Sn=`${ws.message||String(Zt)} [${Ye}]`;wi(Sn),bi(ho=>[...ho,{kind:"error",text:Sn}])}}finally{if(Fc.current=!1,Up(!1),$l.current=null,La.current=null,be&&clearTimeout(be),kn&&vn){const Zt={id:vn.id,source:vn.source??"user",archived:vn.archived};(async()=>(await Dt(Zt,{preserveComposer:!0,incrementalSync:!0}),await Q(Zt,{quiet:!0,force:!0})))()}}},[c,Qr,lo,bt,ih,Dt,Q,Jo,xr,kt,Aa,co]);vy.current=Wl;const ak=h.useCallback(()=>{!kt||kt.isLastPhase||(Dl(null),Wl(e("flow:composer.skipRemainingPhases")))},[kt,Wl]),lk=h.useCallback(()=>{if(!kt||kt.isLastPhase||!kt.nextPhase)return;const w=String(kt.nextPhase.label||"").trim()||e("flow:composer.nextPhase");Wl(e("flow:composer.continuePhase",{label:w}),{phaseContextSnapshot:kt})},[kt,Wl]);h.useEffect(()=>{if(!Dc)return;const w=j=>{j.key==="Escape"&&Ol(!1)};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[Dc]),h.useEffect(()=>{Fe!=="edit"&&Ol(!1)},[Fe]),h.useLayoutEffect(()=>{const w=bn.current;if(!w)return;if(!c){w.style.height="";return}w.style.height="0px";const j=getComputedStyle(w),B=parseFloat(j.lineHeight),q=(parseFloat(j.paddingTop)||0)+(parseFloat(j.paddingBottom)||0),Y=Number.isFinite(B)&&B>0?B:13*1.45,X=q+Y*2,te=q+Y*10,ne=Math.min(Math.max(w.scrollHeight,X),te);w.style.height=`${ne}px`},[Qr,c]);const Py=h.useCallback(w=>{const j=Qr,B=Pc,q=m1(j,B);if(!q)return;const Y=j.slice(0,q.atIndex)+`@${w} `+j.slice(B);Cs(Y);const X=q.atIndex+w.length+2;queueMicrotask(()=>{const te=bn.current;te&&(te.focus(),te.setSelectionRange(X,X)),Ee(X)})},[Qr,Pc]),Ay=h.useCallback(w=>{Cs(j=>{const B=`@${w}`,q=j.indexOf(B);return q<0?j:j.slice(0,q)+j.slice(q+B.length)})},[]),ck=h.useCallback(w=>{w.kind==="canvas"?St(j=>j.map(B=>B.id===w.node.id?{...B,selected:!1}:B)):w.kind==="mention"?Ay(w.node.id):Ay(w.definition.id)},[St,Ay]),PR=h.useCallback(()=>{vt(w=>w==="history"?null:"history")},[]),AR=h.useCallback(()=>{vt(w=>w==="settings"?null:"settings")},[]),IR=h.useCallback(()=>{vt(w=>w==="composer"?null:"composer")},[]),_d=h.useCallback(()=>{vt(w=>(w==="node"&&Tl.current&&(hd.current=Tl.current.id),null))},[]),uk=h.useCallback(()=>{Al(w=>!w)},[]),TR=()=>{if(!c)return null;const w=fi||c.archived||Si(c.source),j=Cn!=null&&Cn.running?e("flow:schedule.running"):mn.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),B=Cn!=null&&Cn.running?"running":mn.enabled?"waiting":"disabled",q=st.slice(0,12),Y=c.archived||Si(c.source);return o.jsxs("section",{className:"af-pipeline-settings-page","aria-label":e("flow:settings.title"),children:[o.jsxs("aside",{className:"af-pipeline-settings-nav","aria-label":e("flow:settings.sectionNav"),children:[o.jsx("div",{className:"af-pipeline-settings-nav-title",children:e("flow:settings.title")}),o.jsxs("a",{href:"#pipeline-basic",className:"af-pipeline-settings-nav-item af-pipeline-settings-nav-item--active",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"badge"}),e("flow:settings.basicInfo")]}),o.jsxs("a",{href:"#pipeline-storage",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),e("flow:settings.storageAndPath")]}),o.jsxs("a",{href:"#pipeline-marketplace",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"deployed_code"}),e("flow:settings.nodeMarketplace")]}),o.jsxs("a",{href:"#pipeline-schedule",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"schedule"}),e("flow:schedule.title")]}),o.jsxs("a",{href:"#pipeline-metadata",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"dataset"}),e("flow:pipeline.metadata")]}),o.jsxs("button",{type:"button",className:"af-pipeline-settings-nav-link",onClick:()=>n("/settings"),children:[e("flow:settings.globalSettings"),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]})]}),o.jsxs("main",{className:"af-pipeline-settings-main",children:[o.jsxs("div",{className:"af-pipeline-settings-main-head",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"af-pipeline-settings-title",children:e("flow:settings.title")}),o.jsx("p",{className:"af-pipeline-settings-subtitle",children:e("flow:settings.subtitle")})]}),o.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:_d,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")}),(c.source==="user"||c.source==="workspace")&&!c.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:L,onChange:X=>{F(X.target.value),$("")},onKeyDown:X=>{X.key==="Enter"&&(X.preventDefault(),eh())},onBlur:()=>{L.trim()&&L.trim()!==c.id&&eh()},placeholder:c.id,disabled:O,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:Gc(c.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[c.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:Gc(c.source??"user",e)}),c.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),W?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:W}):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"}),c.owner||"bigo"]})]})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-pipeline-settings-textarea",value:v,onChange:X=>k(X.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:4,spellCheck:!1})]})]}),o.jsxs("section",{id:"pipeline-storage",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"2."}),o.jsx("h2",{children:e("flow:settings.storageAndPath")})]}),typeof c.path=="string"&&c.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:c.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>Z0(c.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:M?"check":"content_copy"})})]})]}):null,c.source==="user"||c.source==="workspace"?c.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:c.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>$i("workspace"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>$i("user"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),_?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:_}):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:[st.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:Ft,disabled:on,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(on?"common:common.loading":"common:common.refresh")]})]}),fn?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:fn}):null,on?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):q.length>0?o.jsx("div",{className:"af-pipeline-market-list",children:q.map(X=>{const te=X.definitionId||`marketplace:${X.id}${X.version?`@${X.version}`:""}`,ne=Rn.has(te)||Rn.has(`marketplace:${X.id}`),ge=At.find($e=>String($e.id)===te||String($e.id)===`marketplace:${X.id}`),be=Kn===te,Be=Bh(X.inputs||X.input),fe=Bh(X.outputs||X.output);return o.jsxs("div",{className:"af-pipeline-market-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:ne?"check_circle":"extension"}),o.jsxs("div",{className:"af-pipeline-market-main",children:[o.jsxs("div",{className:"af-pipeline-market-title-row",children:[o.jsx("strong",{children:X.displayName||X.label||X.id}),o.jsx("span",{children:X.version?`v${X.version}`:te})]}),o.jsx("p",{className:"af-pipeline-market-purpose",children:X.description||e("flow:settings.marketplaceNoDescription")}),o.jsxs("div",{className:"af-pipeline-market-io",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-pipeline-market-io-label",children:"Inputs"}),o.jsx("div",{className:"af-pipeline-market-chips",children:Be.length>0?Be.map($e=>o.jsx("span",{className:"af-pipeline-market-chip",children:$e},`in-${te}-${$e}`)):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:fe.length>0?fe.map($e=>o.jsx("span",{className:"af-pipeline-market-chip",children:$e},`out-${te}-${$e}`)):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:()=>Me(X),children:e("flow:settings.previewNode")}),o.jsx("button",{type:"button",className:ne?"af-btn-secondary af-pipeline-market-action":"af-btn-primary af-pipeline-market-action",disabled:Y||be,onClick:()=>{ne&&ge?(ys(ge),vt(null)):qe(X)},children:e(be?"flow:settings.installingNode":ne?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},te)})}):o.jsx("div",{className:"af-pipeline-settings-empty",children:e("flow:settings.marketplaceEmpty")})]}),o.jsxs("section",{id:"pipeline-schedule",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"4."}),o.jsx("h2",{children:e("flow:schedule.title")})]}),Nc?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:!!mn.enabled,disabled:w,onChange:X=>G(te=>({...te,enabled:X.target.checked}))}),o.jsx("span",{children:e("flow:schedule.enabled")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:mn.cron||"",disabled:w,onChange:X=>G(te=>({...te,cron:X.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:mn.timezone||"",disabled:w,onChange:X=>G(te=>({...te,timezone:X.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),o.jsxs("select",{className:"af-pipeline-flow-select",value:mn.preset||"",disabled:w,onChange:X=>G(te=>({...te,preset:X.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Ct).map(X=>o.jsx("option",{value:X,children:X},X))]})]})]}),o.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[o.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${B}`}),o.jsx("span",{children:mn.nextRunAt?e("flow:schedule.nextRun",{time:new Date(mn.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),o.jsxs("span",{children:[e("flow:schedule.runtime"),":",j]})]}),o.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[tn.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(tn.lastTriggeredAt).toLocaleString()})]}):null,tn.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(tn.lastSkippedAt).toLocaleString(),tn.lastSkipReason?` · ${tn.lastSkipReason}`:""]})]}):null,tn.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:tn.lastRunUuid})]}):null,tn.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(tn.lastExitCode)})]}):null,tn.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(tn.lastFinishedAt).toLocaleString()})]}):null]}),Cn!=null&&Cn.lastError||tn.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Cn==null?void 0:Cn.lastError)||tn.lastError}):null,c.archived||Si(c.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,jc?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:jc}):null,Sl?o.jsx("p",{className:"af-pipeline-drawer-muted",children:Sl}):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:[Ot.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:At.length})]}),o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:Gc(c.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:c.id}),o.jsx("span",{className:`af-pipeline-settings-status af-pipeline-settings-status--${B}`,children:j})]})]}),o.jsxs("dl",{className:"af-pipeline-settings-side-dl",children:[o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:pipeline.nodeCount")}),o.jsx("dd",{children:Ot.length})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.owner")}),o.jsx("dd",{children:c.owner||"bigo"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:Gc(c.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 hR(),disabled:fi,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(fi?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:_d,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")})]})]})]})},RR=()=>{const w=we;if(!w)return null;const j=w.definitionId||`marketplace:${w.id}${w.version?`@${w.version}`:""}`,B=w.displayName||w.label||w.id,q=Bh(w.inputs||w.input),Y=Bh(w.outputs||w.output);return Wr.createPortal(o.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:X=>{X.target===X.currentTarget&&Me(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:B})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Me(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:(q.length>0?q:[""]).slice(0,4).map((X,te)=>o.jsx("span",{title:X},`preview-in-${te}`))}),o.jsxs("div",{className:"af-market-preview-node-main",children:[o.jsx("span",{className:"af-market-preview-node-icon material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("strong",{children:B}),o.jsx("span",{children:j})]}),o.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(Y.length>0?Y:[""]).slice(0,4).map((X,te)=>o.jsx("span",{title:X},`preview-out-${te}`))})]})}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:e("flow:settings.nodeFunction")}),o.jsx("p",{children:w.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:q.length>0?q.map(X=>o.jsx("span",{className:"af-pipeline-market-chip",children:X},`preview-input-${X}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:"Outputs"}),o.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:Y.length>0?Y.map(X=>o.jsx("span",{className:"af-pipeline-market-chip",children:X},`preview-output-${X}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:e("flow:settings.nodePackageInfo")}),o.jsxs("dl",{className:"af-market-preview-dl",children:[o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.definitionId")}),o.jsx("dd",{children:j})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.version")}),o.jsx("dd",{children:w.version||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagePath")}),o.jsx("dd",{children:w.packageDir||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagedFiles")}),o.jsx("dd",{children:Array.isArray(w.packagedFiles)&&w.packagedFiles.length>0?w.packagedFiles.map(X=>X.to||X).join(", "):"-"})]})]})]})]})]})}),document.body)};return o.jsxs(ay,{children:[o.jsx(P7,{onReady:a}),o.jsxs(n2.Provider,{value:{modelLists:bt,onModelChange:mR},children:[o.jsxs("div",{className:"af-pipeline-page"+(Fe!=="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:()=>{Fe==="running"?rh(!0):Fe!=="edit"?Bl():n("/projects")},"aria-label":e(Fe!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(Fe!=="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",o7,"-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(Bf(c,"workspace")),children:"Workspace"}),o.jsx("button",{type:"button",onClick:()=>n(Bf(c,"display")),children:"Display"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[hs&&o.jsx("button",{type:"button",className:"af-icon-btn"+(js?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>Fo(w=>!w),children:o.jsx("span",{className:"material-symbols-outlined",children:"description"})}),Fe==="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:Mx(Xt,"running")})]}),Fe==="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:Mx(Xt,"stopped")})]}),(Fe==="done"||Fe==="error")&&o.jsxs("div",{className:"af-run-timer"+(Fe==="error"?" af-run-timer--error":" af-run-timer--done"),children:[o.jsx("span",{className:"af-run-timer__label",children:Fe==="error"?"FAILED":"COMPLETED"}),o.jsx("span",{className:"af-run-timer__value",children:Mx(Xt,Fe)})]}),Fe!=="edit"&&o.jsx("button",{type:"button",className:"af-icon-btn"+(Cr?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>tt(w=>!w),children:o.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),Fe==="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:!c,onClick:PR,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:AR,"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),disabled:!c,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":"")+(Pt?" af-composer-topbar-btn--running":""),onClick:IR,"aria-label":"AI Composer",title:"AI Composer",disabled:!c,children:"AI"}),o.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(Pl?" af-icon-btn--active":""),onClick:uk,"aria-label":e("flow:topbar.shortcutsLabel"),title:e("flow:topbar.shortcutsTitle"),disabled:!c,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:!c||Si(c.source)||c.source!=="user"&&c.source!=="workspace",onClick:()=>E(!0),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!c||Si(c.source)||c.archived||c.source!=="user"&&c.source!=="workspace",onClick:()=>P(!0),children:"Archive"})]}),Fe==="running"?o.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:vR,title:e("flow:run.pauseRun"),children:[o.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):Fe==="ready"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!c,onClick:()=>void po(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Bl,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Fe==="stopped"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!c,onClick:()=>void po({runUuid:jn}),title:jn?e("flow:topbar.resumeTitle",{uuid:jn}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Bl,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Fe==="done"||Fe==="error"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!c,onClick:()=>void po(),title:e("flow:topbar.rerunTitle"),children:"Run"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Bl,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:!c,onClick:()=>void po(),children:"Run"}),o.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!c,onClick:()=>me(w=>!w),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":K,children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),K&&c&&o.jsxs("div",{className:"af-run-dropdown-menu",children:[o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var j,B,q,Y,X;me(!1);const w={};for(const te of _s){const ne=ea[te.id];ne&&(w[ne]=((j=Gr[ne])==null?void 0:j.value)??((B=Gr[ne])==null?void 0:B.path)??((X=(Y=(q=te.data)==null?void 0:q.outputs)==null?void 0:Y[0])==null?void 0:X.default)??"")}Yt(w),Ie(!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:()=>{me(!1),po({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:()=>{me(!1),po()},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys(Ct).map(w=>o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var q;me(!1);const j=Ct[w]||{},B={};for(const Y of _s){const X=ea[Y.id];if(!X)continue;const te=((q=Y.data)==null?void 0:q.definitionId)||"",ne=j[Y.id]??"";te.startsWith("provide_file")?B[X]={type:"file",path:ne}:B[X]={type:"str",value:ne}}po({cliInputsOverride:B})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),w]},w))]})]})]})]})]}),nt?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:nt}),o.jsx("button",{type:"button",onClick:()=>et(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-pipeline-body"+(Fe!=="edit"?" af-pipeline-body--run-mode":""),children:[Fe==="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${Yr?" af-palette-workspace--expanded":""}`,children:[o.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>fs(w=>!w),"aria-expanded":Yr,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:Yr?"expand_less":"expand_more"})]}),o.jsx("div",{className:"af-palette-workspace-path",title:c&&(c.path||qn.path)||"",children:c?c.id:e("flow:palette2.noPipelineSelected")}),Yr&&o.jsx("div",{className:"af-palette-workspace-tree",children:Ks?o.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):qn.error?o.jsx("div",{className:"af-palette-workspace-empty",children:qn.error}):c?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:c.id}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",qn.files.length,")"]})]}),qn.files.length>0?o.jsx("ul",{className:"af-palette-workspace-list",children:qn.files.filter(w=>w.type==="file").map(w=>o.jsxs("li",{className:"af-palette-workspace-item af-palette-workspace-item--clickable",title:w.path,onClick:()=>Z({filePath:w.path,fileName:w.name}),children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:w.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:w.name}),w.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:w.size<1024?`${w.size}B`:w.size<1024*1024?`${(w.size/1024).toFixed(1)}KB`:`${(w.size/1024/1024).toFixed(1)}MB`})]},w.path))}):qn.files.filter(w=>w.type==="directory").length===0?o.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),qn.files.filter(w=>{var j;return w.type==="directory"&&((j=w.children)==null?void 0:j.length)>0}).map(w=>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:w.icon}),o.jsxs("span",{children:[w.name,"/"]}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",w.children.length,")"]})]}),o.jsx("ul",{className:"af-palette-workspace-list",children:w.children.map(j=>o.jsxs("li",{className:`af-palette-workspace-item${j.type==="file"?" af-palette-workspace-item--clickable":""}`,title:j.path,onClick:j.type==="file"?()=>Z({filePath:j.path,fileName:j.name}):void 0,children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:j.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:j.name}),j.type==="file"&&j.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:j.size<1024?`${j.size}B`:j.size<1024*1024?`${(j.size/1024).toFixed(1)}KB`:`${(j.size/1024/1024).toFixed(1)}MB`})]},j.path))})]},w.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:ye==="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:Ve,type:"search",className:"af-palette-search-input",value:ie,onChange:w=>oe(w.target.value),placeholder:(ye==="flows"?"搜索流程片段":e("flow:palette.searchNodes"))+"…","aria-label":ye==="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":ye==="nodes",className:"af-palette-tab"+(ye==="nodes"?" af-palette-tab--active":""),onClick:()=>ke("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":ye==="flows",className:"af-palette-tab"+(ye==="flows"?" af-palette-tab--active":""),onClick:()=>ke("flows"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),d?o.jsx("p",{className:"af-err af-palette-list-err",children:d}):null,o.jsx("div",{className:"af-node-palette-scroll",children:ye==="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:ER,disabled:!c||zr.length<2,title:zr.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:["已选 ",zr.length," 节点 / ",sh.length," 连线"]})]})}),mt?o.jsx("p",{className:"af-err af-palette-list-err",children:mt}):null,ot?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段…"}):sk.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:sk.map(w=>{const j=`${w.id}@${w.version}`,B=w.displayName||w.name||w.id,q=w.description||`${w.nodeCount||0} 个节点,${w.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",onClick:()=>ok(w),draggable:!!c,onDragStart:Y=>{Y.dataTransfer.setData("application/agentflow-snippet",j),Y.dataTransfer.effectAllowed="move"},disabled:!c,title:q,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:B}),o.jsxs("span",{className:"af-palette-card-id",children:[w.id,"@",w.version]})]})]}),q?o.jsx("span",{className:"af-palette-card-desc",children:q}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[w.nodeCount||0," nodes"]}),o.jsxs("span",{children:[w.edgeCount||0," edges"]})]})]},j)})})]}):o.jsx("p",{className:"af-palette-empty",children:ie.trim()?"无匹配流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[tf.filter(w=>pt[w].length>0).map(w=>o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${w}`,children:[o.jsx("h3",{className:"af-palette-cat",children:w}),o.jsx("div",{className:"af-palette-cards",children:pt[w].map(j=>{const B=d1(j.inputs,"input"),q=d1(j.outputs,"output"),X=j.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":s2(j),te=r2(j);return o.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>ys(j),draggable:!!c,onDragStart:ne=>{ne.dataTransfer.setData("application/agentflow-node",j.id),ne.dataTransfer.effectAllowed="move"},disabled:!c,title:X||j.id,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:d7(w)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:te}),te!==j.id?o.jsx("span",{className:"af-palette-card-id",children:j.id}):null]})]}),X?o.jsx("span",{className:"af-palette-card-desc",children:X}):null,o.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[B.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[B.shown.map((ne,ge)=>o.jsxs("span",{className:"af-palette-card-port",title:u1("input",ne,ge),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:rr(ne==null?void 0:ne.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:Ox(ne,ge)})]},`in-${ge}`)),B.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",B.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:[q.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[q.shown.map((ne,ge)=>o.jsxs("span",{className:"af-palette-card-port",title:u1("output",ne,ge),children:[o.jsx("span",{className:"af-palette-card-port-name",children:Ox(ne,ge)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:rr(ne==null?void 0:ne.type)}})]},`out-${ge}`)),q.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",q.hidden]}):null]})]})]})]},j.id)})})]},w)),c&&le.length===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,c&&le.length>0&&ie.trim()&&Qe===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noMatch")}):null,c?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"+(Lr?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),o.jsx("span",{className:"af-palette-engine-label",children:e(Lr?"common:engine.online":"common:engine.offline")})]}),x?o.jsx("div",{className:"af-palette-tip"+zl,role:"status","aria-live":"polite",children:x}):null]})]}):Fe!=="edit"&&c?o.jsx(ZK,{flowId:c.id,flowSource:c.source||"user",flowArchived:c.archived,provideNodes:_s,edges:yn,nodes:Ot,onCliInputsChange:Or,onBackToEdit:Bl}):null,o.jsxs("div",{className:"af-pipeline-main-stack",children:[o.jsxs("div",{className:"af-pipeline-canvas-col",children:[g?o.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:g}):null,c&&ce.length>0&&!U?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:pe,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void rs(),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:()=>se(!0),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),o.jsx("ul",{className:"af-flow-slot-warnings-list",children:ce.map(w=>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:w.nodeId}),onClick:j=>{j.preventDefault(),Vt(w.nodeId)},children:w.nodeId}),'"',w.suffix]},w.key))})]}):null,c&&ce.length>0&&U?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:ce.length})}),o.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:uk,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:()=>se(!1),children:e("flow:validation.show")}),o.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",disabled:pe,onClick:()=>void rs(),children:e("common:common.refresh")})]})]}):null,ct==="settings"&&c&&Fe==="edit"?TR():o.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:c?o.jsxs(o.Fragment,{children:[o.jsx(O7,{fitViewEpoch:m,canvasTool:Lp,nodes:A,edges:V,onNodesChange:Fe!=="edit"?void 0:Yp,onEdgesChange:Fe!=="edit"?void 0:ky,onConnect:Fe!=="edit"?void 0:$t,onConnectStart:Fe!=="edit"?void 0:nn,onConnectEnd:Fe!=="edit"?void 0:Qt,isValidConnection:Fe!=="edit"?void 0:Re,onNodesDelete:Fe!=="edit"?void 0:Ln,onNodeClick:dt,onNodeDoubleClick:ht,onEdgeClick:xt,onFlowInit:Hn,onDrop:Hc,onDragOver:ki,hideMinimapAndControls:!!(c&&ct),bottomSlot:Fe==="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:ih.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):ih.map((w,j)=>{var ge,be;if(w.kind==="definition"){const Be=w.definition,fe=String(Be.label??Be.id),$e=[Be.id,Be.description?String(Be.description).slice(0,120):""].filter(Boolean).join(" — ");return o.jsxs("div",{className:"af-composer-node-chip af-composer-node-chip--definition",title:$e,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:fe}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>ck(w),"aria-label":e("flow:composer.removeFromInput",{id:Be.id}),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${Be.id}`)}const B=w.node,q=w.kind,Y=String(((ge=B.data)==null?void 0:ge.label)??B.id),X=(be=B.data)!=null&&be.definitionId?String(B.data.definitionId):"",te=X&&X!==Y?`${Y} · ${B.id} · ${X}`:`${Y} · ${B.id}`,ne=q==="canvas"?e("flow:composer.deselectNode",{id:B.id}):e("flow:composer.removeFromInput",{id:B.id});return o.jsxs("div",{className:"af-composer-node-chip"+(q==="mention"?" af-composer-node-chip--mention":""),title:te,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:Y}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>ck(w),"aria-label":ne,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},B.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:bn,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!c,value:Qr,rows:2,onChange:w=>{Cs(w.target.value),Ee(w.target.selectionStart??w.target.value.length)},onSelect:w=>{const j=w.target;j instanceof HTMLTextAreaElement&&Ee(j.selectionStart??0)},onKeyDown:w=>{if((w.metaKey||w.ctrlKey)&&w.key==="Enter"){w.preventDefault(),Wl();return}if(Cd&&Di.length>0&&(w.key==="ArrowDown"||w.key==="ArrowUp"||w.key==="Enter")){if(w.key==="ArrowDown")w.preventDefault(),_a(j=>(j+1)%Di.length);else if(w.key==="ArrowUp")w.preventDefault(),_a(j=>(j-1+Di.length)%Di.length);else if(w.key==="Enter"){w.preventDefault();const j=Di[gs];j&&Py(j.id)}}},onKeyUp:w=>{const j=w.target;j instanceof HTMLTextAreaElement&&Ee(j.selectionStart??j.value.length)},onClick:w=>{const j=w.target;j instanceof HTMLTextAreaElement&&Ee(j.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),Cd&&c&&Di.length>0?o.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[Ed.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,Ed.instances.map((w,j)=>{const B=j;return o.jsx("li",{role:"option","aria-selected":B===gs,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(B===gs?" af-composer-mention-item--active":""),onMouseDown:q=>q.preventDefault(),onMouseEnter:()=>_a(B),onClick:()=>Py(w.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:w.title}),w.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:w.subtitle}):null]})},`i-${w.id}`)}),Ed.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,Ed.definitions.map((w,j)=>{const B=Ed.instances.length+j;return o.jsx("li",{role:"option","aria-selected":B===gs,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(B===gs?" af-composer-mention-item--active":""),onMouseDown:q=>q.preventDefault(),onMouseEnter:()=>_a(B),onClick:()=>Py(w.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:w.title}),w.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:w.subtitle}):null]})},`d-${w.id}`)})]}):null]}),o.jsxs("div",{className:"af-composer-toolbar",children:[Xs.length>0&&o.jsx("label",{className:"af-composer-session-field",children:o.jsxs("select",{className:"af-composer-session-select",value:xr||"",onChange:w=>{w.target.value==="__new__"?wd():Qo(w.target.value)},disabled:Pt,"aria-label":e("flow:composer.switchConversation"),children:[Xs.map(w=>o.jsxs("option",{value:w.id,children:[w.label,w.running?" ⏳":""]},w.id)),o.jsxs("option",{value:"__new__",children:["+ ",e("flow:composer.newConversation")]})]})}),o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:Yo,type:"button",className:"af-composer-skills-button"+(_y>0?" af-composer-skills-button--active":""),disabled:!c||Pt,"aria-haspopup":"listbox","aria-expanded":es,onClick:()=>Rc(w=>!w),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:_y>0?`Skills ${_y}`:"Skills"})]}),es&&!Pt?Wr.createPortal(o.jsx("div",{ref:Go,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:yt,children:gi.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[oh.groups.map(w=>{const j=pl(w,gi),B=uP(w,Ey,gi),q=zp.has(w.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(q?" 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:B==="all",disabled:j.length===0,onChange:Y=>{const X=Y.target.checked;Ia(te=>X?lP(te,j):cP(te,j))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:w.name}),w.builtin?o.jsx("em",{children:"built-in"}):null,B==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":q?`展开 ${w.name}`:`收起 ${w.name}`,onClick:()=>{Hp(Y=>{const X=new Set(Y);return X.has(w.id)?X.delete(w.id):X.add(w.id),X})},children:[o.jsx("span",{children:w.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:q?"expand_more":"expand_less"})]})]}),q?null:o.jsx("div",{className:"af-composer-skill-group-items",children:w.skills.map(Y=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Ey.has(Y.key),onChange:X=>{const te=X.target.checked;Ia(ne=>te?ne.includes(Y.key)?ne:[...ne,Y.key]:ne.filter(ge=>ge!==Y.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:Y.name}),Y.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:Y.description}):null]})]},`${w.id}:${Y.key}`))})]},w.id)}),oh.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:oh.ungrouped.length})]}),oh.ungrouped.map(w=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Ey.has(w.key),onChange:j=>{const B=j.target.checked;Ia(q=>B?q.includes(w.key)?q:[...q,w.key]:q.filter(Y=>Y!==w.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:w.name}),w.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:w.description}):null]})]},`ungrouped:${w.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:(lo||"").trim()?Ps.currentNotInLists?Ps.currentNotInLists:Wh(lo,Ps.cursorList,Ps.opencodeList,Ps.claudeCodeList):"",onChange:w=>md(w.target.value),disabled:!c||Pt,"aria-label":e("flow:composer.modelAriaLabel"),children:[o.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),Ps.currentNotInLists?o.jsxs("option",{value:Ps.currentNotInLists,children:[Ps.currentNotInLists,e("flow:composer.modelNotInList")]}):null,Ps.cursorList.length>0?o.jsx("optgroup",{label:"Cursor",children:Ps.cursorList.map(w=>o.jsx("option",{value:ia(w),children:w},`composer-c-${w}`))}):null,Ps.opencodeList.length>0?o.jsx("optgroup",{label:"OpenCode",children:Ps.opencodeList.map(w=>o.jsx("option",{value:`opencode:${ia(w)}`,children:w},`composer-o-${w}`))}):null,Ps.claudeCodeList.length>0?o.jsx("optgroup",{label:"Claude Code",children:Ps.claudeCodeList.map(w=>o.jsx("option",{value:`claude-code:${ia(w)}`,children:w},`composer-cc-${w}`))}):null]})]}),o.jsx("button",{type:"button",className:"af-composer-send"+(c&&Qr.trim()&&!Pt?" af-composer-send--active":"")+(Pt?" af-composer-send--stop":""),disabled:!c||!Pt&&!Qr.trim(),"aria-label":e(Pt?"flow:composer.stopGeneration":"flow:composer.send"),title:Pt?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var w;if(Pt){(w=$l.current)==null||w.abort();return}Wl()},children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Pt?"stop":"arrow_upward"})})]})]}),Dc?Wr.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:w=>{w.target===w.currentTarget&&Ol(!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"+(Pt?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:uo||void 0,children:Pt&&!uo?e("flow:composer.executing"):uo||e("flow:composer.ready")})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Ol(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Vp.length>1&&!(kt&&Array.isArray(kt.phases)&&kt.phases.length>1)?o.jsx("div",{className:"af-composer-steps-track-wrap",children:o.jsx(S7,{steps:Vp})}):null,kt&&Array.isArray(kt.phases)&&kt.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:kt.phases.map((w,j)=>{const B=w.status||(j<(kt.currentPhase??0)?"done":j===(kt.currentPhase??0)?Pt?"running":kt.nextPhase||kt.isLastPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(B==="done"?" af-composer-phase-item--done":"")+(B==="running"?" af-composer-phase-item--running":"")+(B==="pending"?" af-composer-phase-item--pending":""),title:`${w.label}${w.description?":"+w.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:B==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:j+1})}),o.jsx("span",{className:"af-composer-phase-label",children:w.label})]},w.name||j)})}):null,o.jsx("div",{className:"af-composer-thread-dialog-scroll",children:o.jsx(g1,{thread:Jo,liveSegments:fo,running:Pt})}),kt&&!kt.isLastPhase&&kt.nextPhase&&!Pt?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:kt.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:lk,children:e("flow:composer.phaseReviewContinue",{label:kt.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:ak,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),Fr&&Fe==="edit"?(()=>{var q;const w=String(Fr.query||"").trim().toLowerCase(),j=w?Fr.candidates.filter(Y=>{var X,te,ne;return[(X=Y.def)==null?void 0:X.id,Y.displayLabel,Y.description,(te=Y.slot)==null?void 0:te.name,(ne=Y.slot)==null?void 0:ne.type].filter(Boolean).some(ge=>String(ge).toLowerCase().includes(w))}):Fr.candidates,B=Fr.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:Fr.left,top:Fr.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:rr((q=Fr.draft.slot)==null?void 0:q.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",Fr.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>Mi(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:Fr.query,onChange:Y=>Mi(X=>X&&{...X,query:Y.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[j.map(Y=>{var ne,ge;const X=Y.displayLabel||((ne=Y.def)==null?void 0:ne.id),te=Ox(Y.slot,Y.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>Qs(Y),title:Y.description||Y.def.id,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:X}),X!==Y.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:Y.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:B}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:rr((ge=Y.slot)==null?void 0:ge.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:te})]})]},`${Y.def.id}-${Y.slotIndex}`)}),j.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null]}):o.jsx("div",{className:"af-placeholder af-pipeline-placeholder",children:e("flow:pipeline.selectPipeline")})})]}),Fe!=="edit"&&Cr&&o.jsxs("div",{className:"af-run-console",style:{height:ms},children:[o.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:yR,onPointerMove:xR,onPointerUp:nk,onPointerCancel:nk,onLostPointerCapture:wR}),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:[Fe==="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:()=>tt(!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:[ur.map((w,j)=>o.jsxs("div",{className:"af-run-console__line"+(w.type==="error"?" af-run-console__line--error":"")+(w.type==="warn"?" af-run-console__line--warn":"")+(w.type==="node-start"?" af-run-console__line--start":"")+(w.type==="node-done"?" af-run-console__line--done":"")+(w.type==="node-failed"?" af-run-console__line--error":"")+(w.type==="done"?" af-run-console__line--done":""),children:[o.jsxs("span",{className:"af-run-console__ts",children:["[",w.ts?new Date(w.ts).toLocaleTimeString():"--:--:--","]"]}),o.jsx("span",{className:"af-run-console__text",children:w.text!=null?String(w.text):""})]},j)),o.jsx("div",{ref:io})]})]})]}),Fe!=="edit"&&Ri&&c?o.jsx(GK,{instanceId:Ri,flowId:c.id,runId:jn,nodeStatus:((dk=ps[Ri])==null?void 0:dk.status)??null,onClose:()=>sr(null)}):null,ct&&ct!=="settings"&&c&&Fe==="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:_d,"aria-label":e("flow:composer.closeSidebar"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Xs.length>0&&o.jsxs("div",{className:"af-composer-session-tabs",children:[Xs.map(w=>o.jsxs("button",{type:"button",ref:j=>{j&&w.id===xr&&j.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",w.id===xr?"af-composer-session-tab--active":"",w.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>Qo(w.id),title:w.label,children:[o.jsx("span",{className:"af-composer-session-label",children:w.label}),o.jsx("span",{className:"af-composer-session-close",role:"button",tabIndex:0,onClick:j=>{j.stopPropagation(),bd(w.id)},onKeyDown:j=>{j.key!=="Enter"&&j.key!==" "||(j.preventDefault(),j.stopPropagation(),bd(w.id))},title:w.running?e("flow:composer.endConversation"):e("flow:composer.closeConversation"),children:o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.75rem"},children:"close"})})]},w.id)),o.jsx("button",{type:"button",className:"af-composer-session-add",onClick:()=>wd(),title:e("flow:composer.newConversation"),children:o.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),o.jsx("div",{className:"af-composer-sidebar-status"+(Pt?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Pt&&!uo?e("flow:composer.executing"):uo||e("flow:composer.ready")}),kt&&Array.isArray(kt.phases)&&kt.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:kt.phases.map((w,j)=>{const B=w.status||(j<(kt.currentPhase??0)?"done":j===(kt.currentPhase??0)?Pt?"running":kt.isLastPhase&&j===kt.phases.length-1||kt.nextPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(B==="done"?" af-composer-phase-item--done":"")+(B==="running"?" af-composer-phase-item--running":"")+(B==="pending"?" af-composer-phase-item--pending":""),title:`${w.label}${w.description?":"+w.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:B==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:j+1})}),o.jsx("span",{className:"af-composer-phase-label",children:w.label})]},w.name||j)})}):null,o.jsx("div",{className:"af-composer-sidebar-thread",ref:xd,children:o.jsx(g1,{thread:Jo,liveSegments:fo,running:Pt})}),kt&&!kt.isLastPhase&&kt.nextPhase&&!Pt?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:kt.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:lk,children:e("flow:composer.phaseReviewContinue",{label:kt.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:ak,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):ct==="node"&&ee?Et?o.jsx(QT,{draft:Et,setDraft:Ac,definitionId:String(((fk=ee.data)==null?void 0:fk.definitionId)??ee.id),systemPromptReadonly:String((Pe==null?void 0:Pe.description)??""),modelLists:bt,disabled:!c,onIdBlur:gR,onClose:_d,onPublishToMarketplace:It,error:Pa,ioSlots:{inputs:Array.isArray(Et==null?void 0:Et.inputs)?Et.inputs:[],outputs:Array.isArray(Et==null?void 0:Et.outputs)?Et.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:_d,"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")}),(c.source==="user"||c.source==="workspace")&&!c.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:L,onChange:w=>{F(w.target.value),$("")},onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),eh())},onBlur:()=>{L.trim()&&L.trim()!==c.id&&eh()},placeholder:c.id,disabled:O,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:Gc(c.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[c.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:Gc(c.source??"user",e)}),c.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),W?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:W}):null]}),typeof c.path=="string"&&c.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:c.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>Z0(c.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:M?"check":"content_copy"})})]})]}):null,c.source==="user"||c.source==="workspace"?c.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:c.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>$i("workspace"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:T,onClick:()=>$i("user"),children:e(T?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),_?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:_}):null]}):o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea",value:v,onChange:w=>k(w.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")}),Nc?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:!!mn.enabled,disabled:fi||c.archived||Si(c.source),onChange:w=>G(j=>({...j,enabled:w.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:mn.cron||"",disabled:fi||c.archived||Si(c.source),onChange:w=>G(j=>({...j,cron:w.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:mn.timezone||"",disabled:fi||c.archived||Si(c.source),onChange:w=>G(j=>({...j,timezone:w.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:mn.preset||"",disabled:fi||c.archived||Si(c.source),onChange:w=>G(j=>({...j,preset:w.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Ct).map(w=>o.jsx("option",{value:w,children:w},w))]})]}),o.jsx("div",{className:"af-pipeline-drawer-readonly",children:o.jsx("span",{children:e("flow:schedule.overlapSkip")})}),mn.nextRunAt?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(mn.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:Cn!=null&&Cn.running?e("flow:schedule.running"):mn.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),tn.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(tn.lastTriggeredAt).toLocaleString()})]}):null,tn.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(tn.lastSkippedAt).toLocaleString(),tn.lastSkipReason?` · ${tn.lastSkipReason}`:""]})]}):null,tn.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:tn.lastRunUuid})]}):null,tn.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(tn.lastExitCode)})]}):null,tn.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(tn.lastFinishedAt).toLocaleString()})]}):null]}),Cn!=null&&Cn.lastError||tn.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Cn==null?void 0:Cn.lastError)||tn.lastError}):null,c.archived||Si(c.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,jc?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:jc}):null,Sl?o.jsx("p",{className:"af-pipeline-drawer-muted",children:Sl}):null,o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:fi||c.archived||Si(c.source),onClick:Hl,children:e(fi?"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:[Ot.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:c.id})]}),Wt?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):rt?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:rt}):jd.length===0?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):o.jsxs(o.Fragment,{children:[xs.success+xs.failed+xs.running+xs.stopped+xs.interrupted>0?o.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[xs.success>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:xs.success})}):null,xs.failed>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:xs.failed})}):null,xs.stopped>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:xs.stopped})}):null,xs.interrupted>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:xs.interrupted})}):null,xs.running>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:xs.running})}):null]}):null,o.jsx("ul",{className:"af-exec-history-list",children:jd.map((w,j)=>{const B=w.status||"unknown",q=B==="success"?"af-exec-history-card--success":B==="failed"?"af-exec-history-card--failed":B==="stopped"?"af-exec-history-card--stopped":B==="interrupted"?"af-exec-history-card--interrupted":B==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",Y=e(B==="success"?"flow:history.success":B==="failed"?"flow:history.failed":B==="stopped"?"flow:history.stopped":B==="interrupted"?"flow:history.interrupted":B==="running"?"flow:history.running":"flow:history.unknown"),X=B==="success"?"check_circle":B==="failed"?"error":B==="stopped"?"stop_circle":B==="interrupted"?"sync_disabled":B==="running"?"progress_activity":"help",te=w.runId||`${w.at}-${j}`,ne=w.runId!=null&&w.runId.length>=6?e("flow:history.runLabel",{id:w.runId.length>8?w.runId.slice(-8):w.runId}):e("flow:history.runLabel",{id:jd.length-j});return o.jsx("li",{className:"af-exec-history-list-item",children:o.jsxs("button",{type:"button",className:`af-exec-history-card ${q}`,onClick:()=>CR(w),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:Gw(w.at,e)})]}),o.jsxs("div",{className:"af-exec-history-card-bottom",children:[o.jsxs("span",{className:"af-exec-history-card-status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:X}),Y]}),o.jsxs("span",{className:"af-exec-history-card-duration",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),LO(w.durationMs,e)]})]})]})},`${c.id}-${te}`)})})]})]})})]})}):null]}),o.jsx(Yj,{open:bR,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:kR,onCancel:()=>jy(!1)}),o.jsx(Yj,{open:SR,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:jR,onSecondary:NR,onCancel:()=>rh(!1)}),o.jsx(KT,{open:Pl,onClose:()=>Al(!1)}),RR(),o.jsx(qT,{open:Gn,onClose:()=>Il(!1),onJump:rn,nodes:Ot}),o.jsx(i7,{open:js,onClose:()=>Fo(!1),flowId:(c==null?void 0:c.id)??""}),o.jsx(VT,{open:z,onClose:()=>P(!1),flowId:(c==null?void 0:c.id)??"",flowSource:(c==null?void 0:c.source)??"user",onArchived:async()=>{P(!1),await Pr(),n("/projects?tab=archived")}}),o.jsx(UT,{open:R&&!!(c!=null&&c.id),onClose:()=>E(!1),flowId:(c==null?void 0:c.id)??"",flowSource:(c==null?void 0:c.source)??"user",flowArchived:!!(c!=null&&c.archived),onDeleted:async()=>{E(!1),f(null),St([]),pn([]),Dl(null),await Pr(),n("/projects")}}),zn&&Wr.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:()=>Bt(!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:en.name,onChange:w=>{const j=w.target.value;cn(B=>({...B,name:j,id:B.id?B.id:j.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:PR 检查片段",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"ID"}),o.jsx("input",{type:"text",value:en.id,onChange:w=>cn(j=>({...j,id:w.target.value})),placeholder:"pr-check-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:en.description,onChange:w=>cn(j=>({...j,description:w.target.value})),placeholder:"这段流程适合什么场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",zr.length," 个节点和 ",sh.length," 条内部连线。"]}),Ne?o.jsx("div",{className:"af-flow-snippet-error",children:Ne}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Bt(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:un||!en.name.trim(),onClick:()=>void _R(),children:un?"发布中…":"发布"})]})]})}),document.body),o.jsx(MK,{open:!!J,onClose:()=>Z(null),flowId:(c==null?void 0:c.id)??"",flowSource:(c==null?void 0:c.source)??"user",flowArchived:!!(c!=null&&c.archived),filePath:(J==null?void 0:J.filePath)??"",fileName:(J==null?void 0:J.fileName)??"",onSaved:()=>{cr(w=>({...w}))}})]}),Er&&Fe!=="edit"&&Wr.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:Er.instanceId})]}),o.jsx("div",{className:"af-user-check-modal__actions",children:Wo?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(!Er||!c||!jn)return;const w=ja||Er.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",action:"save-user-check-content",runUuid:jn,instanceId:Er.instanceId,content:w})})).ok?(Na(B=>B&&{...B,content:w}),hi(!1),lt(B=>[...B,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):lt(B=>[...B,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{lt(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:userCheck.save")]}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>{jl(Er.content),hi(!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:()=>hi(!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:()=>Na(null),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),o.jsx("div",{className:"af-user-check-modal__body",children:Wo?o.jsx("textarea",{ref:fd,className:"af-user-check-modal__textarea",value:ja||Er.content,onChange:w=>jl(w.target.value)}):o.jsx("div",{className:"af-user-check-modal__preview",children:o.jsx("pre",{children:ja||Er.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:Ca,onChange:w=>Ea(w.target.value),disabled:Cl}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:Cl||!Ca.trim(),onClick:()=>{!Er||!c||!jn||!Ca.trim()||(Vo(!0),lt(w=>[...w,{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:c.id,flowSource:c.source??"user",action:"ai-edit-user-check-content",runUuid:jn,instanceId:Er.instanceId,content:ja||Er.content,prompt:Ca})}).then(w=>w.json()).then(w=>{Vo(!1),w.ok&&w.content?(jl(w.content),hi(!0),Ea(""),lt(j=>[...j,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):lt(j=>[...j,{ts:new Date().toISOString(),type:"error",text:w.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{Vo(!1),lt(w=>[...w,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[Cl?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(!Er||!c||!jn)return;const w=ja||Er.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",action:"save-user-check-content",runUuid:jn,instanceId:Er.instanceId,content:w})})).ok?(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",action:"confirm-user-check",runUuid:jn,instanceId:Er.instanceId,execId:Er.execId})}),Na(null),Ea(""),po({runUuid:jn})):lt(B=>[...B,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{lt(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:userCheck.continue")]})]})]})}),document.body),mi&&Fe!=="edit"&&Wr.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:mi.instanceId})]}),o.jsx("div",{className:"af-user-ask-modal__actions",children:o.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>El(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:[mi.question.trim()?o.jsx("div",{className:"af-user-ask-modal__question",children:o.jsx("pre",{children:mi.question})}):null,mi.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:mi.options.map(w=>o.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:pd,onClick:async()=>{if(!(!mi||!c||!jn)){yr(!0);try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:c.id,flowSource:c.source??"user",action:"confirm-user-ask",runUuid:jn,instanceId:mi.instanceId,execId:mi.execId,branch:w.name,selectedIndex:w.index,selectedLabel:w.label})})).ok?(El(null),yr(!1),po({runUuid:jn})):(yr(!1),lt(B=>[...B,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{yr(!1),lt(j=>[...j,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}])}}},children:[o.jsxs("span",{className:"af-user-ask-option__index",children:["[",w.index,"]"]}),o.jsx("span",{className:"af-user-ask-option__label",children:w.label})]},w.name))})]}),o.jsx("div",{className:"af-user-ask-modal__foot",children:o.jsx("span",{className:"af-user-ask-modal__hint",children:e(pd?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),_c&&Fe!=="edit"&&o.jsxs("div",{className:"af-tool-print-toast"+(Ko?" 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:_c.instanceId})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>qo(w=>!w),"aria-label":e(Ko?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(Ko?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:Ko?"close_fullscreen":"open_in_full"})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Uo(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(jp,{children:_c.content})})})]}),Jr&&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:Jr.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>_l(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:Gs,className:"af-provide-edit-modal__textarea",defaultValue:Jr.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:re,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:()=>_l(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),De&&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:()=>Ie(!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:_s.length===0?o.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):o.jsx("div",{className:"af-run-params-list",children:_s.map(w=>{var ge,be;const j=ea[w.id];if(!j)return null;const B=((ge=w.data)==null?void 0:ge.definitionId)||"",q=B.startsWith("provide_file"),Y=B==="provide_bool",X=((be=w.data)==null?void 0:be.label)||w.id,te=Ze[j]??"",ne=["true","1","yes","on"].includes(String(te).trim().toLowerCase());return o.jsxs("div",{className:"af-run-params-item",children:[o.jsxs("div",{className:"af-run-params-item__head",children:[o.jsx("span",{className:"af-run-params-item__icon material-symbols-outlined"+(q?" af-run-params-item__icon--file":""),children:q?"description":Y?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-params-item__label",children:X}),o.jsx("span",{className:"af-run-params-item__slot",children:j})]}),Y?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ne?" af-run-config-bool-toggle--true":""),onClick:()=>Yt(Be=>({...Be,[j]:ne?"false":"true"})),"aria-pressed":ne,children:ne?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-params-item__input",value:te,onChange:Be=>Yt(fe=>({...fe,[j]:Be.target.value})),placeholder:e(q?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},w.id)})})}),o.jsxs("div",{className:"af-run-params-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-run-params-modal__btn af-run-params-modal__btn--run",onClick:()=>{var j;const w={};for(const B of _s){const q=ea[B.id];if(!q)continue;const Y=((j=B.data)==null?void 0:j.definitionId)||"",X=Ze[q]??"";Y.startsWith("provide_file")?w[q]={type:"file",path:X}:w[q]={type:"str",value:X}}Ie(!1),me(!1),po({cliInputsOverride:w})},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:()=>Ie(!1),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})]})}const H7="modulepreload",B7=function(e){return"/"+e},S1={},W7=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(u=>{if(u=B7(u),u in S1)return;S1[u]=!0;const d=u.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const c=document.createElement("link");if(c.rel=d?"stylesheet":H7,d||(c.as="script"),c.crossOrigin="",c.href=u,l&&c.setAttribute("nonce",l),document.head.appendChild(c),d)return new Promise((f,m)=>{c.addEventListener("load",f),c.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${u}`)))})}))}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)})},V7=new Set(["echarts"]),U7=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),K7=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),q7=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function ul(e){return e&&typeof e=="object"&&!Array.isArray(e)}function xc(e,t){if(!ul(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:ul(n[r])&&ul(s)&&(n[r]=xc(n[r],s));return n}function py(e,t){return e==null?e:Array.isArray(e)?e.map(n=>ul(n)?xc(n,t):n):ul(e)?xc(e,t):e}function Y7(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 $b(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)=>$b(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||K7.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);$b(r,`${t}.${n}`)}}}function G7(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(!U7.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function X7(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:xc(e,t)}function J7(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(!ul(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return xc(i,n)}):ul(e)?xc(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function Q7(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:py(e,n)}function N1(e,t="rgba(255, 255, 255, 0.62)"){return py(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 Z7(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:py(e,n)}function eq(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:py(e,t)}function tq(e,t,n){const r=J7(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>ul(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??q7,textStyle:xc(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:X7(e.tooltip),legend:Q7(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?Z7(e.grid,s||i):e.grid,xAxis:N1(e.xAxis),yAxis:N1(e.yAxis),radar:eq(e.radar),series:t}}function nq(e){const t=Y7(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(!V7.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");$b(n);const r=G7(n.option.series),s=n.title==null?"":String(n.title),i=tq(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)}}}function ua(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 l2(e){const t=ua(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function c2(e){return ua(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function rq(e){return/^\s*(sequenceDiagram|flowchart\s+(?:TD|TB|BT|LR|RL)|graph\s+(?:TD|TB|BT|LR|RL))\b/i.test(String(e||""))}function sq(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,u="")=>{const d=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(d)?u&&(n.get(d).label=u):n.set(d,{id:d,label:u||d}),d},a=l=>{const u=String(l||"").trim().replace(/[;,]+$/,""),d=u.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return d?i(d[1],d[2]||d[3]||d[4]||d[1]):i(u.replace(/[^A-Za-z0-9_]/g,"_"),u)};for(const l of t){const u=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(u){s=u[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 iq({code:e}){const t=h.useMemo(()=>sq(e),[e]),n=t.direction==="LR"||t.direction==="RL",r=150,s=46,i=n?102:38,a=n?34:72,l=new Map;t.nodes.forEach((p,c)=>{l.set(p.id,{x:28+(n?c*(r+i):c%3*(r+i)),y:28+(n?c%3*(s+a):c*(s+a))})});const u=Math.max(520,...Array.from(l.values()).map(p=>p.x+r+28)),d=Math.max(220,...Array.from(l.values()).map(p=>p.y+s+28));return o.jsxs("svg",{viewBox:`0 0 ${u} ${d}`,role:"img","aria-label":"Mermaid flowchart preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-mermaid-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((p,c)=>{const f=l.get(p.from),m=l.get(p.to);if(!f||!m)return null;const y=n?`M ${f.x+r} ${f.y+s/2} C ${(f.x+m.x+r)/2} ${f.y+s/2}, ${(f.x+m.x+r)/2} ${m.y+s/2}, ${m.x} ${m.y+s/2}`:`M ${f.x+r/2} ${f.y+s} C ${f.x+r/2} ${f.y+s+28}, ${m.x+r/2} ${m.y-28}, ${m.x+r/2} ${m.y}`;return o.jsx("path",{className:"af-md-mermaid-edge",d:y,markerEnd:"url(#af-md-mermaid-arrow)"},`${p.from}-${p.to}-${c}`)}),t.nodes.map(p=>{const c=l.get(p.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:c.x,y:c.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:c.x+r/2,y:c.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,24)})]},p.id)})]})}function oq(e){const t=String(e||"").split(/\r?\n/).map(i=>i.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[],s=(i,a="")=>{const l=String(i||"").trim();l&&(n.has(l)||n.set(l,a||l))};for(const i of t){if(/^sequenceDiagram\b/i.test(i))continue;const a=i.match(/^(participant|actor)\s+([A-Za-z0-9_]+)(?:\s+as\s+(.+))?$/i);if(a){s(a[2],a[3]||a[2]);continue}const l=i.match(/^([A-Za-z0-9_]+)\s*[-=]+>>\+?\s*([A-Za-z0-9_]+)\s*:\s*(.+)$/);if(l){s(l[1]),s(l[2]),r.push({type:"message",from:l[1],to:l[2],text:l[3]});continue}const u=i.match(/^note\s+(?:over|right of|left of)\s+([^:]+):\s*(.+)$/i);r.push({type:"note",text:u?u[2]:i})}return{participants:Array.from(n,([i,a])=>({id:i,label:a})),rows:r}}function aq({code:e}){const t=h.useMemo(()=>oq(e),[e]),n=t.participants.length?t.participants:[{id:"A",label:"A"},{id:"B",label:"B"}],r=190,s=48,i=26,a=44,l=48,u=Math.max(620,s*2+n.length*r),d=Math.max(220,i+a+Math.max(1,t.rows.length)*l+34),p=c=>{const f=Math.max(0,n.findIndex(m=>m.id===c));return s+f*r+r/2};return o.jsxs("svg",{viewBox:`0 0 ${u} ${d}`,role:"img","aria-label":"Mermaid sequence diagram preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-sequence-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"})})}),n.map((c,f)=>{const m=s+f*r+r/2;return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:m-68,y:i,width:"136",height:"34",rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:m,y:i+22,textAnchor:"middle",children:c.label.slice(0,18)}),o.jsx("line",{className:"af-md-sequence-life",x1:m,y1:i+a,x2:m,y2:d-18})]},c.id)}),t.rows.map((c,f)=>{const m=i+a+f*l+24;if(c.type!=="message")return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-sequence-note",x:s,y:m-17,width:u-s*2,height:"30",rx:"7"}),o.jsx("text",{className:"af-md-mermaid-text",x:s+12,y:m+4,children:c.text.slice(0,120)})]},`note-${f}`);const y=p(c.from),v=p(c.to),k=(y+v)/2;return o.jsxs("g",{children:[o.jsx("line",{className:"af-md-mermaid-edge",x1:y,y1:m,x2:v,y2:m,markerEnd:"url(#af-md-sequence-arrow)"}),o.jsx("text",{className:"af-md-sequence-label",x:k,y:m-8,textAnchor:"middle",children:c.text.slice(0,72)})]},`msg-${f}`)})]})}function u2({code:e}){const t=String(e||"").trim();if(!t)return null;const n=/^sequenceDiagram\b/i.test(t);return o.jsx("div",{className:"af-md-mermaid-preview",children:n?o.jsx(aq,{code:t}):o.jsx(iq,{code:t})})}function lq(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]||"",u=l.match(/^\s*```\s*(mermaid|mmd)\s*$/i);if(!s&&u){i();const d=[];for(a++;a<t.length&&!/^\s*```\s*$/.test(t[a]||"");)d.push(t[a]||""),a++;a<t.length&&a++,n.push({type:"mermaid",text:d.join(`
|
|
140
|
+
`)});continue}if(!s&&rq(l)){i();const d=[];for(;a<t.length;){const p=t[a]||"";if(d.length>0&&(!p.trim()||/^-{3,}\s*$/.test(p)||/^#{1,6}\s+/.test(p)))break;d.push(p),a++}n.push({type:"mermaid",text:d.join(`
|
|
141
|
+
`)});continue}if(/^\s*```/.test(l)){s=!s,r.push(l),a++;continue}if(!s&&a+1<t.length&&ua(l).length>1&&l2(t[a+1])){i();const d=ua(l),p=c2(t[a+1]),c=[];for(a+=2;a<t.length&&t[a].trim()&&ua(t[a]).length>1;)c.push(ua(t[a])),a++;n.push({type:"table",headers:d,align:p,rows:c});continue}r.push(l),a++}return i(),n}function j1(e,t=""){const n=String(e||"").trim();if(!n||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n)||n.startsWith("/")||n.startsWith("#")||!t||n.startsWith("outputs/"))return n;const r=String(t||"").split("/").filter(Boolean);r.pop();const s=[...r,...n.split("/")].filter(Boolean),i=[];for(const a of s)if(a!=="."){if(a===".."){if(i.length===0)return n;i.pop();continue}i.push(a)}return i.join("/")}function d2(e,t=!1,n=""){const r=s=>{const i=String(s||"").trim();if(!i)return"";if(/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(i)||i.startsWith("#"))return i;const a=j1(i,n);return e?e(a,{kind:"link",download:!0}):a};return{...t?{p:({children:s})=>o.jsx(o.Fragment,{children:s})}:{},code:({inline:s,className:i,children:a})=>{var d;const l=((d=String(i||"").match(/language-(\w+)/i))==null?void 0:d[1])||"",u=String(a||"").replace(/\n$/,"");return!s&&/^(mermaid|mmd)$/i.test(l)?o.jsx(u2,{code:u}):s?o.jsx("code",{className:i,children:a}):o.jsx("code",{className:i,children:a})},img:({src:s,alt:i})=>o.jsx("img",{src:e?e(j1(s,n)):s||"",alt:i||"",loading:"lazy"}),a:({href:s,children:i})=>o.jsx("a",{href:r(s),target:"_blank",rel:"noopener noreferrer",children:i})}}function C1({children:e,resolveSrc:t,basePath:n=""}){return o.jsx(jp,{components:d2(t,!0,n),children:String(e||"")})}function O0({content:e,resolveSrc:t,basePath:n=""}){const r=h.useMemo(()=>lq(e),[e]),s=h.useMemo(()=>d2(t,!1,n),[n,t]);return o.jsx(o.Fragment,{children:r.map((i,a)=>i.type==="mermaid"?o.jsx(u2,{code:i.text},`mermaid-${a}`):i.type!=="table"?o.jsx(jp,{components:s,children:i.text},`md-${a}`):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:i.headers.map((l,u)=>o.jsx("th",{style:{textAlign:i.align[u]||"left"},children:o.jsx(C1,{resolveSrc:t,basePath:n,children:l})},u))})}),o.jsx("tbody",{children:i.rows.map((l,u)=>o.jsx("tr",{children:i.headers.map((d,p)=>o.jsx("td",{style:{textAlign:i.align[p]||"left"},children:o.jsx(C1,{resolveSrc:t,basePath:n,children:l[p]||""})},p))},u))})]})},`table-${a}`))})}function cq(e,t=","){const n=[];let r=[],s="",i=!1;const a=String(e||"").replace(/\r\n/g,`
|
|
142
|
+
`);for(let l=0;l<a.length;l+=1){const u=a[l],d=a[l+1];if(i){u==='"'&&d==='"'?(s+='"',l+=1):u==='"'?i=!1:s+=u;continue}u==='"'?i=!0:u===t?(r.push(s.trim()),s=""):u===`
|
|
143
|
+
`?(r.push(s.trim()),n.push(r),r=[],s=""):s+=u}return(s||r.length)&&(r.push(s.trim()),n.push(r)),n.filter(l=>l.some(u=>String(u||"").trim()))}function go(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function uq(e){if(Array.isArray(e)){if(e.every(s=>s&&typeof s=="object"&&!Array.isArray(s))){const s=Array.from(new Set(e.flatMap(i=>Object.keys(i))));return{columns:s.map(i=>({key:i,label:i,align:"left"})),rows:e.map(i=>s.map(a=>go(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>go(i)||`Column ${a+1}`);return{columns:s.map((i,a)=>({key:String(a),label:i,align:"left"})),rows:e.slice(1).map(i=>s.map((a,l)=>go(i[l])))}}}if(!e||typeof e!="object")return null;const t=Array.isArray(e.columns)?e.columns:Array.isArray(e.headers)?e.headers:[],n=Array.isArray(e.rows)?e.rows:Array.isArray(e.data)?e.data:[];let r=t.map((s,i)=>s&&typeof s=="object"?{key:String(s.key||s.name||s.field||i),label:String(s.label||s.title||s.name||s.key||`Column ${i+1}`),align:["left","center","right"].includes(s.align)?s.align:"left"}:{key:String(i),label:go(s)||`Column ${i+1}`,align:"left"});return r.length===0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s))&&(r=Array.from(new Set(n.flatMap(s=>Object.keys(s)))).map(s=>({key:s,label:s,align:"left"}))),r.length===0&&n.every(Array.isArray)&&n.length>0?(r=n[0].map((s,i)=>({key:String(i),label:go(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>go(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>go(s[a])):s&&typeof s=="object"?r.map(i=>go(s[i.key])):r.map((i,a)=>a===0?go(s):""))}}function dq(e){const t=String(e||"").trim();if(!t)return{columns:[],rows:[],error:""};const n=t.match(/^```(?:json|table|csv|tsv|markdown|md)?\s*\n?([\s\S]*?)```\s*$/i),r=n?n[1].trim():t;try{const l=uq(JSON.parse(r));if(l&&l.columns.length)return{...l,error:""}}catch{}const s=r.replace(/\r\n/g,`
|
|
144
|
+
`).split(`
|
|
145
|
+
`).filter(l=>l.trim());if(s.length>=2&&ua(s[0]).length>1&&l2(s[1])){const l=ua(s[0]),u=c2(s[1]);return{columns:l.map((d,p)=>({key:String(p),label:d,align:u[p]||"left"})),rows:s.slice(2).map(d=>ua(d)),error:""}}const i=r.includes(" ")?" ":",",a=cq(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((u,d)=>u||`Column ${d+1}`).map((u,d)=>({key:String(d),label:u,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function $0({content:e}){const t=h.useMemo(()=>dq(e),[e]);return t.error||t.columns.length===0?o.jsxs("div",{className:"af-work-display-table-empty",children:[o.jsx("strong",{children:"Table data error"}),o.jsx("span",{children:t.error||"No columns found"})]}):o.jsx("div",{className:"af-work-display-table-wrap af-work-display-table-wrap--standalone",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:t.columns.map((n,r)=>o.jsx("th",{style:{textAlign:n.align||"left"},children:n.label},`${n.key}-${r}`))})}),o.jsx("tbody",{children:t.rows.map((n,r)=>o.jsx("tr",{children:t.columns.map((s,i)=>o.jsx("td",{style:{textAlign:s.align||"left"},children:go(n[i])},`${s.key}-${i}`))},r))})]})})}function D0({content:e}){const t=h.useRef(null),n=h.useMemo(()=>nq(e),[e]),[r,s]=h.useState({loading:!1,error:""});return h.useEffect(()=>{if(!n.ok){s({loading:!1,error:n.error||"Invalid chart spec"});return}let i=!1,a=null,l=null,u=null;return s({loading:!0,error:""}),W7(()=>import("./index-DgQRkS4v.js"),[]).then(d=>{i||!t.current||(a=d.init(t.current,"dark",{renderer:"canvas"}),a.setOption(n.spec.option,!0),u=()=>a==null?void 0:a.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(u),l.observe(t.current)),window.addEventListener("resize",u),window.requestAnimationFrame(u),i||s({loading:!1,error:""}))}).catch(d=>{i||s({loading:!1,error:String((d==null?void 0:d.message)||d)})}),()=>{var d,p;i=!0,u&&window.removeEventListener("resize",u),(d=l==null?void 0:l.disconnect)==null||d.call(l),(p=a==null?void 0:a.dispose)==null||p.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]})}const fq="af:workspace-graph:v2",Zc=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],pq=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),hq={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:""}]},mq={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}]},gq={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}]},yq=new Set(["png","jpg","jpeg","gif","webp","svg"]),xq=320,f2=180,p2=960,Db=96,h2=900,Fb="display-ref:",wq="0.1.68";function bq(){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 wo(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 wg(e){if(!e)return!1;const t=String(e.type||"");if(t&&/^image\//i.test(t))return!0;const n=String(e.name||"").toLowerCase().split(".").pop();return yq.has(n)}function bg(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=wo(t||{});return s.set("path",r),n.download&&s.set("download","1"),`/api/workspace/file/raw?${s.toString()}`}function vq(e,t){const n=String(e||"").trim();if(!n)return"";const r=wo(t||{});return r.set("path",n),r.set("download","1"),`/api/workspace/file/raw?${r.toString()}`}function kq(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 Sq(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function Nq(e){var t;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return Number(e.selectionStart??0)!==Number(e.selectionEnd??0);if(e instanceof Element&&e.closest('[contenteditable="true"]')){const n=(t=window.getSelection)==null?void 0:t.call(window);return!!(n&&!n.isCollapsed)}return!1}function jq(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!Nq(e)}function Cq(e){const t=String(e||"").trim();if(!t)return"";if(/^运行完成/.test(t))return"运行完成";if(/^运行暂停/.test(t))return"运行暂停";if(/^运行停止/.test(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 E1(e){const t=Math.max(0,Number(e)||0);if(t<1e3)return`${t}ms`;if(t<6e4)return`${(t/1e3).toFixed(t<1e4?1:0)}s`;const n=Math.floor(t/6e4),r=Math.round(t%6e4/1e3);return`${n}m${r?`${r}s`:""}`}function Eq(e,t){const n=typeof e=="string"?e:String((e==null?void 0:e.text)||""),r=typeof e=="object"?Number(e==null?void 0:e.stepMs):NaN,s=typeof e=="object"?Number(e==null?void 0:e.totalMs):NaN,i=Number.isFinite(r)&&Number.isFinite(s)?`(+${E1(r)} / 总 ${E1(s)})`:"";return`${t+1}. ${n}${i}`}function _1(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 m2(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 g2(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function F0(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 nf(e){const t=String(F0(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 P1(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function vg(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function rf(e){return vg(e)}function zb(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Fx(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 A1(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 I1(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 T1(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=Gu(s.get(n),e.sourceHandle||"output-0","source"),a=Gu(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&Yu(i,a))}function _q(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=Gu(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:HT(a)}:null}function Pq(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"?Yu(t.slot,a):Yu(a,t.slot)))continue;const u=nf(n);return{def:n,order:r,category:u,categoryRank:Zc.indexOf(u),slot:a,slotIndex:i,displayLabel:rf(n),description:zb(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 sf(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":n==="html"?"web":["csv","tsv"].includes(n)?"table":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function Aq(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 Iq(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Uh(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:Iq(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 y2(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function Tq(e){var s,i;const t=(e==null?void 0:e.data)||{},n=t!=null&&t.displaySize&&typeof t.displaySize=="object"?t.displaySize:{},r=t!=null&&t.nodeSize&&typeof t.nodeSize=="object"?t.nodeSize:{};return[y2(e),Number((e==null?void 0:e.width)||0)||"",Number((e==null?void 0:e.height)||0)||"",Number(((s=e==null?void 0:e.measured)==null?void 0:s.width)||0)||"",Number(((i=e==null?void 0:e.measured)==null?void 0:i.height)||0)||"",Number(r.width||0)||"",Number(r.height||0)||"",Number(n.width||0)||"",Number(n.height||0)||"",t!=null&&t.isExecuting?"executing":"",(t==null?void 0:t.nodeStatus)||"",(t==null?void 0:t.runningRunNodeId)||""].join("::")}function zx(e,t){var c,f;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=w2(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(c=e==null?void 0:e.ui)!=null&&c.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(f=e==null?void 0:e.ui)!=null&&f.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const m of s)m!=null&&m.source&&l.add(String(m.source)),m!=null&&m.target&&l.add(String(m.target));const d=Array.from(l).map(m=>{const y=r[m]||{},v=y.definitionId||m,k=t.find(H=>H.id===v),g=F0(k)||v,b=t.find(H=>H.id===g)||k,x=y.marketplaceRef||g2(k),N=i[m]&&typeof i[m].x=="number"&&typeof i[m].y=="number"?i[m]:{x:320+l.size*20,y:180+l.size*12},_=!!On(g),C=a[m]&&typeof a[m].width=="number"&&typeof a[m].height=="number"?{width:a[m].width,height:a[m].height}:null,T=Pu(C,{display:_});return{id:m,type:Ep,position:N,...T?{width:T.width,height:T.height}:{},data:{label:y.label||vg(k)||vg(b)||m,definitionId:g,...x?{marketplaceRef:x}:{},...k!=null&&k.packageId?{marketplacePackageId:k.packageId}:{},...k!=null&&k.version?{marketplaceVersion:k.version}:{},schemaType:m2(g,b||k),role:y.role||"normal",model:y.model||void 0,body:y.body||"",script:y.script||"",...T?{nodeSize:T}:{},..._&&T?{displaySize:T}:{}}}}).map(m=>ip(m,r,t)),p=s.filter(m=>(m==null?void 0:m.source)&&(m==null?void 0:m.target)).map((m,y)=>({id:m.id||`we-${m.source}-${m.target}-${y}`,source:String(m.source),target:String(m.target),sourceHandle:m.sourceHandle??void 0,targetHandle:m.targetHandle??void 0,markerEnd:{type:Hs.ArrowClosed}}));return{nodes:d,edges:FT(p,d),instances:r}}function R1(e){return`${Fb}${e}`}function Hx(e){const t=String(e||"");return t.startsWith(Fb)?t.slice(Fb.length):t}function x2(e){if(!e||typeof e!="object")return null;const t=Number(e.x),n=Number(e.y),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)?null:{x:t,y:n,zoom:Math.min(Math.max(r,.1),4)}}function Hb(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(c=>{var f;return On((f=c==null?void 0:c.data)==null?void 0:f.definitionId)}).map(c=>[c.id,c])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const c of r){const f=String(c||"").trim();!f||i.has(f)||!n.has(f)||(i.add(f),s.push(f))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((c,f)=>{const m=l[c];a[c]=m&&typeof m.x=="number"&&typeof m.y=="number"?{x:m.x,y:m.y}:{x:180+f*36,y:120+f*28}});const u={},d=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(c=>{const f=Pu(d[c],{display:!0});f&&(u[c]=f)});const p=x2(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:u,...p?{viewport:p}:{}}}function Rq(e,t=[]){return Hb(e,t)}function Lq(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function Mq(e){var n;const t=String(e||"");if(!t)return!1;try{if((n=navigator.clipboard)!=null&&n.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return document.body.removeChild(r),s}catch{return!1}}function L1(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function Pu(e,{display:t=!1}={}){if(!e||typeof e!="object")return null;const n=Number(e.width),r=Number(e.height);return!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r<=0?null:t?{width:Math.round(n),height:Math.round(r)}:{width:L1(n,f2,p2)||xq,height:L1(r,Db,h2)||Db}}function eu(e){var s,i,a,l,u,d,p,c,f,m,y;const t=!!On((s=e==null?void 0:e.data)==null?void 0:s.definitionId),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.width)||((u=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:u.width)||(e==null?void 0:e.width)||(t?(d=e==null?void 0:e.measured)==null?void 0:d.width:0)||0),r=Number(((c=(p=e==null?void 0:e.data)==null?void 0:p.displaySize)==null?void 0:c.height)||((m=(f=e==null?void 0:e.data)==null?void 0:f.nodeSize)==null?void 0:m.height)||(e==null?void 0:e.height)||(t?(y=e==null?void 0:e.measured)==null?void 0:y.height:0)||0);return Pu({width:n,height:r},{display:t})}function Kh(e,t,n){var l,u;const r=w2(Cp(e,n||{})),s=t.map(d=>({source:d.source,target:d.target,sourceHandle:d.sourceHandle??null,targetHandle:d.targetHandle??null})),i={},a={};for(const d of e){i[d.id]={x:((l=d.position)==null?void 0:l.x)||0,y:((u=d.position)==null?void 0:u.y)||0};const p=eu(d);p&&(a[d.id]=p)}return{version:1,instances:r,edges:s,ui:{nodePositions:i,nodeSizes:a}}}function w2(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!On(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 On(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":t==="display_html"?"html":t==="display_image"?"image":t==="display_chart"?"chart":t==="display_table"?"table":""}function ac(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=On(e==null?void 0:e.definitionId)==="image"?"src":"content",s=l=>String((l==null?void 0:l.value)??(l==null?void 0:l.default)??""),i=l=>s(l).trim(),a=t.find(l=>(l==null?void 0:l.name)===r&&i(l))||t.find(l=>(l==null?void 0:l.name)==="filePath"&&i(l))||t.find(l=>(l==null?void 0:l.type)==="text"&&i(l));return String((e==null?void 0:e.body)||(a?s(a):""))}function Xu(e,t=""){const n=String(e||"").trim();if(!n||n.length>260||/[\r\n<>]/.test(n)||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n))return"";const r=n.replace(/^\/+/,"");if(r.includes("..")||r.startsWith("."))return"";const s=r.split("?")[0].split("#")[0].toLowerCase().split(".").pop()||"";return({html:new Set(["html","htm"]),markdown:new Set(["md","markdown","txt"]),mermaid:new Set(["mmd","mermaid","txt"]),ascii:new Set(["txt","log"]),chart:new Set(["json"]),table:new Set(["json","csv","tsv"])}[t]||new Set(["html","htm","md","markdown","txt","json","csv","tsv"])).has(s)?r:""}function Oq(e){let t=String(e||"").replace(/\r\n/g,`
|
|
146
|
+
`).trim();return t.includes(`
|
|
147
|
+
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
148
|
+
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
149
|
+
$2`)),t}function pa(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const a=Oq(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const u=a.match(/^result\s*:\s*(.*)$/m);if(u){const p=String(u[1]||"").trim();return p==="|"||p===">"?a.slice((u.index||0)+u[0].length).split(`
|
|
150
|
+
`).filter(f=>/^\s+/.test(f)||!f.trim()).map(f=>f.replace(/^\s{2}/,"")).join(`
|
|
151
|
+
`).replace(/\s+$/g,""):p.replace(/^["']|["']$/g,"")}const d=t.replace(n[0],"").trim();if(d)return d}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const u=l.resultFile||l.result;return typeof u=="string"?u:JSON.stringify(u,null,2)}}catch{}return String(e||"")}async function Ju(e,t){const n=wo(e);n.set("path",t);const r=await fetch(`/api/workspace/file?${n.toString()}`),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`读取文件失败:${t}`);return String(s.content||"")}async function Bb(e,t,n){const r=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,path:t,content:String(n||"")})}),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`写入文件失败:${t}`);return s.path||t}function $q(e,t=[],n=[]){const r=String(e||"");if(!r)return"";const s=new Map(t.map(i=>[i.id,i]));return(Array.isArray(n)?n:[]).filter(i=>String((i==null?void 0:i.target)||"")===r).slice(0,4).map(i=>{const a=s.get(String((i==null?void 0:i.source)||""));if(!a)return"";const l=a.data||{},u=String(l.body||"").trim(),d=[`- upstreamId: ${a.id}`,` label: ${String(l.label||a.id).trim()}`,` definitionId: ${String(l.definitionId||"").trim()}`];return u&&d.push(` task: ${u.slice(0,4e3)}`),d.join(`
|
|
152
|
+
`)}).filter(Boolean).join(`
|
|
153
|
+
|
|
154
|
+
`)}function id(e){let t=pa(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 Dq(e){const t=id(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function tc(e,t){return e==="html"?Dq(t):""}function b2(e){const t=id(e);if(!t.trim())return"";const n=`<base target="_self"><script>
|
|
155
|
+
(() => {
|
|
156
|
+
document.addEventListener("click", (event) => {
|
|
157
|
+
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
158
|
+
if (!link) return;
|
|
159
|
+
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
160
|
+
if (!rawHref || rawHref.startsWith("#")) return;
|
|
161
|
+
if (/^(?:javascript|mailto|tel):/i.test(rawHref)) return;
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
window.location.href = link.href;
|
|
164
|
+
}, true);
|
|
165
|
+
})();
|
|
166
|
+
<\/script>`;return/<script\b[^>]*>\s*\(\(\)\s*=>\s*\{\s*document\.addEventListener\("click"/i.test(t)?t:/<head\b[^>]*>/i.test(t)?t.replace(/<head\b([^>]*)>/i,`<head$1>${n}`):/<html\b[^>]*>/i.test(t)?t.replace(/<html\b([^>]*)>/i,`<html$1><head>${n}</head>`):`<!doctype html><html><head>${n}</head><body>${t}</body></html>`}function Fq(e,t){const n=String(e).trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")||"html-render",r=String(t).replace(/^\.+/,"")||"png";return`${n}.${r}`}function zq(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function Hq(e,t){const n=URL.createObjectURL(e);try{zq(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function v2(e){var t;try{return(e==null?void 0:e.contentDocument)||((t=e==null?void 0:e.contentWindow)==null?void 0:t.document)||null}catch{return null}}function Bq(e){const t=v2(e);return t!=null&&t.documentElement?`${t.doctype?`<!DOCTYPE ${t.doctype.name}${t.doctype.publicId?` PUBLIC "${t.doctype.publicId}"`:""}${t.doctype.systemId?` "${t.doctype.systemId}"`:""}>`:"<!DOCTYPE html>"}
|
|
167
|
+
${t.documentElement.outerHTML}`:""}function Bx(e){var n;if(!e)return null;const t=(n=e.getBoundingClientRect)==null?void 0:n.call(e);return{rectWidth:t!=null&&t.width?Math.round(t.width):null,rectHeight:t!=null&&t.height?Math.round(t.height):null,clientWidth:e.clientWidth||null,clientHeight:e.clientHeight||null,scrollWidth:e.scrollWidth||null,scrollHeight:e.scrollHeight||null,offsetWidth:e.offsetWidth||null,offsetHeight:e.offsetHeight||null}}function Wq(e,t,n,r={}){var k;const s=(k=e==null?void 0:e.getBoundingClientRect)==null?void 0:k.call(e),i=v2(e),a=i==null?void 0:i.documentElement,l=i==null?void 0:i.body,u=(r==null?void 0:r.card)||null,d=(r==null?void 0:r.displayBody)||null,p=(r==null?void 0:r.scroller)||null,c=(r==null?void 0:r.displaySize)||null,f={fallbackWidth:Number(t)||null,fallbackHeight:Number(n)||null,displaySizeWidth:Number((c==null?void 0:c.width)||0)||null,displaySizeHeight:Number((c==null?void 0:c.height)||0)||null,rectWidth:s!=null&&s.width?Math.round(s.width):null,rectHeight:s!=null&&s.height?Math.round(s.height):null,iframeClientWidth:(e==null?void 0:e.clientWidth)||null,iframeClientHeight:(e==null?void 0:e.clientHeight)||null,docScrollWidth:(a==null?void 0:a.scrollWidth)||null,docScrollHeight:(a==null?void 0:a.scrollHeight)||null,bodyScrollWidth:(l==null?void 0:l.scrollWidth)||null,bodyScrollHeight:(l==null?void 0:l.scrollHeight)||null,docOffsetWidth:(a==null?void 0:a.offsetWidth)||null,bodyOffsetWidth:(l==null?void 0:l.offsetWidth)||null,card:Bx(u),displayBody:Bx(d),scroller:Bx(p)},m=[Number(t)||0,Number((c==null?void 0:c.width)||0),Number((u==null?void 0:u.clientWidth)||0),Number((u==null?void 0:u.scrollWidth)||0),Number((d==null?void 0:d.clientWidth)||0),Number((d==null?void 0:d.scrollWidth)||0),Number((p==null?void 0:p.clientWidth)||0),Number((p==null?void 0:p.scrollWidth)||0),Number(s==null?void 0:s.width)||0,Number(e==null?void 0:e.clientWidth)||0,Number((a==null?void 0:a.scrollWidth)||0),Number((l==null?void 0:l.scrollWidth)||0),Number((a==null?void 0:a.offsetWidth)||0),Number((l==null?void 0:l.offsetWidth)||0)].map(g=>Math.ceil(g)).filter(g=>g>0),y=Math.max(1,...m.length?m:[960]),v=Math.max(1,Math.round(Number(n)||(s==null?void 0:s.height)||(e==null?void 0:e.clientHeight)||640),Math.ceil(Number((a==null?void 0:a.scrollHeight)||0)),Math.ceil(Number((l==null?void 0:l.scrollHeight)||0)));return{width:y,height:v,debug:f}}async function Vq({flowParams:e,content:t,sourceFilePath:n,iframe:r,width:s,height:i,filename:a,snapshotElements:l,displaySize:u}){const d=Wq(r,s,i,{...l||{},displaySize:u}),p=Bq(r),c=await fetch("/api/workspace/html-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,content:p||t,sourceFilePath:n||"",width:d.width,height:d.height,filename:a})});if(!c.ok){const m=await c.json().catch(()=>({}));throw new Error(m.error||"截图失败")}const f=await c.blob();Hq(f,a)}function Uq(e){const n=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]].find(r=>(r==null?void 0:r.name)==="alt");return String((n==null?void 0:n.value)||(n==null?void 0:n.default)||(e==null?void 0:e.label)||"Image preview")}function Kq(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function qq(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,u="")=>{const d=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(d)?u&&(n.get(d).label=u):n.set(d,{id:d,label:u||d}),d},a=l=>{const u=String(l||"").trim().replace(/[;,]+$/,""),d=u.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return d?i(d[1],d[2]||d[3]||d[4]||d[1]):i(u.replace(/[^A-Za-z0-9_]/g,"_"),u)};for(const l of t){const u=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(u){s=u[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 k2({code:e}){const t=h.useMemo(()=>qq(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((p,c)=>{l.set(p.id,{x:24+(n?c*(r+i):c%3*(r+i)),y:24+(n?c%3*(s+a):c*(s+a))})});const u=Math.max(360,...Array.from(l.values()).map(p=>p.x+r+24)),d=Math.max(180,...Array.from(l.values()).map(p=>p.y+s+24));return o.jsx("div",{className:"af-work-node__mermaid-preview",children:o.jsxs("svg",{viewBox:`0 0 ${u} ${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((p,c)=>{const f=l.get(p.from),m=l.get(p.to);if(!f||!m)return null;const y=n?`M ${f.x+r} ${f.y+s/2} C ${(f.x+m.x+r)/2} ${f.y+s/2}, ${(f.x+m.x+r)/2} ${m.y+s/2}, ${m.x} ${m.y+s/2}`:`M ${f.x+r/2} ${f.y+s} C ${f.x+r/2} ${f.y+s+28}, ${m.x+r/2} ${m.y-28}, ${m.x+r/2} ${m.y}`;return o.jsx("path",{className:"af-work-node__mermaid-edge",d:y,markerEnd:"url(#af-work-arrow)"},`${p.from}-${p.to}-${c}`)}),t.nodes.map(p=>{const c=l.get(p.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:c.x,y:c.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:c.x+r/2,y:c.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,22)})]},p.id)})]})})}function Wi({className:e="",children:t}){const n=h.useRef(null),r=h.useRef(null),[s,i]=h.useState({visible:!1,top:0,height:100}),a=h.useCallback(()=>{const p=n.current;if(!p)return;const c=Math.max(1,p.scrollHeight),f=Math.max(1,p.clientHeight),m=c>f+1,y=m?Math.max(12,f/c*100):100,v=Math.max(0,100-y),k=m?Math.min(v,p.scrollTop/Math.max(1,c-f)*v):0;i({visible:m,top:k,height:y})},[]);h.useEffect(()=>{const p=requestAnimationFrame(a),c=n.current;if(!c||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const f=new ResizeObserver(a);f.observe(c);for(const m of Array.from(c.children))f.observe(m);return()=>{cancelAnimationFrame(p),f.disconnect()}},[t,a]);const l=h.useCallback(p=>{const c=n.current;if(!c)return;const f=Math.max(0,c.scrollHeight-c.clientHeight);c.scrollTop=Math.min(1,Math.max(0,p))*f,a()},[a]),u=h.useCallback((p,c=0)=>{const f=r.current;if(!f)return 0;const m=f.getBoundingClientRect(),y=s.height/100*m.height,v=Math.max(1,m.height-y);return(p-m.top-c)/v},[s.height]),d=h.useCallback(p=>{var N,_;if(!s.visible)return;p.preventDefault(),p.stopPropagation();const c=r.current;if(!c)return;const f=c.getBoundingClientRect(),m=s.top/100*f.height,y=s.height/100*f.height,k=p.clientY>=f.top+m&&p.clientY<=f.top+m+y?p.clientY-f.top-m:y/2;l(u(p.clientY,k));const g=p.pointerId;(_=(N=p.currentTarget).setPointerCapture)==null||_.call(N,g);const b=C=>{C.preventDefault(),l(u(C.clientY,k))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x)};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},[u,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 Yq({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=On(e==null?void 0:e.definitionId),i=ac(e),a=s==="image"?i:pa(i),l=s==="image"?"":Xu(a,s),[u,d]=h.useState(""),[p,c]=h.useState(""),[f,m]=h.useState(!1);if(h.useEffect(()=>{let g=!1;return l?(m(!0),c(""),d(""),Ju(t,l).then(b=>{g||d(b)}).catch(b=>{g||c(String(b.message||b))}).finally(()=>{g||m(!1)}),()=>{g=!0}):(d(""),c(""),m(!1),()=>{g=!0})},[l,t==null?void 0:t.flowId,t==null?void 0:t.flowSource,t==null?void 0:t.archived,e==null?void 0:e.displayReloadKey]),!s)return null;const y=l?u:a,v=s==="html"?id(y):pa(y),k=tc(s,v);if(f)return o.jsxs(Wi,{className:"af-work-display-empty",children:["Loading ",l,"..."]});if(p)return o.jsx(Wi,{className:"af-work-display-empty",children:p});if(k)return o.jsx(Wi,{className:"af-work-display-empty",children:k});if(!v.trim())return o.jsx(Wi,{className:"af-work-display-empty",children:"No display content"});if(s==="html")return o.jsx(Wi,{className:"af-work-display-body af-work-display-body--html",children:o.jsx("iframe",{ref:n,className:"af-work-display-html-frame",title:(e==null?void 0:e.label)||"HTML preview",sandbox:"allow-scripts allow-forms allow-modals",srcDoc:b2(v)},r)});if(s==="image"){const g=bg(v,t);return o.jsx(Wi,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:g,alt:Uq(e),loading:"lazy"})})}return s==="markdown"?o.jsx(Wi,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(O0,{content:v,basePath:l,resolveSrc:(g,b)=>bg(g,t,b)})}):s==="chart"?o.jsx(Wi,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx(D0,{content:v})}):s==="table"?o.jsx(Wi,{className:"af-work-display-body af-work-display-body--table",children:o.jsx($0,{content:v})}):s==="mermaid"?o.jsxs(Wi,{className:"af-work-display-body",children:[o.jsx(k2,{code:v}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:v})]}):o.jsx(Wi,{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:v})})}function Gq({node:e}){var f,m,y,v,k,g,b,x,N,_,C;const t=On((f=e==null?void 0:e.data)==null?void 0:f.definitionId),n=ac(e==null?void 0:e.data),r=t==="image"?n:pa(n),s=t==="image"?"":Xu(r,t),[i,a]=h.useState(""),[l,u]=h.useState(!1);h.useEffect(()=>{var H;let T=!1;return s?(u(!0),a(""),Ju(((H=e==null?void 0:e.data)==null?void 0:H.flowParams)||{},s).then(L=>{T||a(L)}).catch(()=>{T||a("")}).finally(()=>{T||u(!1)}),()=>{T=!0}):(a(""),u(!1),()=>{T=!0})},[s,(y=(m=e==null?void 0:e.data)==null?void 0:m.flowParams)==null?void 0:y.flowId,(k=(v=e==null?void 0:e.data)==null?void 0:v.flowParams)==null?void 0:k.flowSource,(b=(g=e==null?void 0:e.data)==null?void 0:g.flowParams)==null?void 0:b.archived,(x=e==null?void 0:e.data)==null?void 0:x.displayReloadKey]);const d=s?i:r,p=t==="html"?id(d):pa(d),c=tc(t,p);return l?o.jsx("div",{className:"af-display-picker-preview__empty",children:"Loading"}):c?o.jsx("div",{className:"af-display-picker-preview__empty",children:c}):p.trim()?t==="html"?o.jsx("iframe",{title:((N=e==null?void 0:e.data)==null?void 0:N.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals",srcDoc:b2(p)}):t==="image"?o.jsx("img",{src:bg(p,(_=e==null?void 0:e.data)==null?void 0:_.flowParams),alt:((C=e==null?void 0:e.data)==null?void 0:C.label)||(e==null?void 0:e.id),loading:"lazy"}):t==="markdown"?o.jsx("div",{className:"af-display-picker-preview__markdown",children:o.jsx(O0,{content:p,basePath:s,resolveSrc:(T,H)=>{var L;return bg(T,(L=e==null?void 0:e.data)==null?void 0:L.flowParams,H)}})}):t==="chart"?o.jsx(D0,{content:p}):t==="table"?o.jsx($0,{content:p}):t==="mermaid"?o.jsxs("div",{className:"af-display-picker-preview__diagram",children:[o.jsx(k2,{code:p}),o.jsx("pre",{children:p})]}):o.jsx("pre",{className:"af-display-picker-preview__pre",children:p}):o.jsx("div",{className:"af-display-picker-preview__empty",children:"No content"})}function Xq({value:e,onChange:t,onUploadImage:n,readOnly:r=!1}){const s=h.useRef(null),i=h.useRef(null),a=h.useRef(null),[l,u]=h.useState(!1),[d,p]=h.useState({visible:!1,top:0,height:100}),c=h.useCallback(()=>{const g=s.current;if(!g)return;const b=Math.max(1,g.scrollHeight),x=Math.max(1,g.clientHeight),N=b>x+1,_=N?Math.max(12,x/b*100):100,C=Math.max(0,100-_),T=N?Math.min(C,g.scrollTop/Math.max(1,b-x)*C):0;p({visible:N,top:T,height:_})},[]);h.useEffect(()=>{const g=requestAnimationFrame(c),b=s.current;if(!b||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(g);const x=new ResizeObserver(c);return x.observe(b),()=>{cancelAnimationFrame(g),x.disconnect()}},[c,e]);const f=h.useCallback(g=>{const b=s.current;if(!b)return;const x=Math.max(0,b.scrollHeight-b.clientHeight);b.scrollTop=Math.min(1,Math.max(0,g))*x,c()},[c]),m=h.useCallback((g,b=0)=>{const x=a.current;if(!x)return 0;const N=x.getBoundingClientRect(),_=d.height/100*N.height,C=Math.max(1,N.height-_);return(g-N.top-b)/C},[d.height]),y=h.useCallback(g=>{if(!d.visible)return;g.preventDefault(),g.stopPropagation();const b=a.current;if(!b)return;const x=b.getBoundingClientRect(),N=d.top/100*x.height,_=d.height/100*x.height,T=g.clientY>=x.top+N&&g.clientY<=x.top+N+_?g.clientY-x.top-N:_/2;f(m(g.clientY,T));const H=F=>{F.preventDefault(),f(m(F.clientY,T))},L=()=>{window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",L)};window.addEventListener("pointermove",H),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",L)},[m,f,d.height,d.top,d.visible]),v=h.useCallback(g=>{const b=String(e||""),x=s.current,N=Number((x==null?void 0:x.selectionStart)??b.length),_=Number((x==null?void 0:x.selectionEnd)??N),C=b.slice(0,N),T=b.slice(_),H=C&&!C.endsWith(`
|
|
168
|
+
`)?`
|
|
169
|
+
`:"",L=T&&!T.startsWith(`
|
|
170
|
+
`)?`
|
|
171
|
+
`:"",F=`${C}${H}${g}${L}${T}`;t==null||t(F),window.requestAnimationFrame(()=>{var D,W;const O=C.length+H.length+g.length;(D=s.current)==null||D.focus(),(W=s.current)==null||W.setSelectionRange(O,O)})},[t,e]),k=h.useCallback(async g=>{if(!r&&!(!g||l)){u(!0);try{const b=await(n==null?void 0:n(g)),x=String(b||"").trim();if(x){const N=String(g.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";v(``)}}finally{u(!1)}}},[v,n,r,l]);return o.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:g=>g.stopPropagation(),onDragOver:g=>{var x;Array.from(((x=g.dataTransfer)==null?void 0:x.items)||[]).some(N=>String((N==null?void 0:N.type)||"").startsWith("image/"))&&(g.preventDefault(),g.dataTransfer.dropEffect="copy")},onDrop:g=>{var x;const b=Array.from(((x=g.dataTransfer)==null?void 0:x.files)||[]).find(wg);b&&(g.preventDefault(),k(b))},children:[o.jsxs("div",{className:"af-work-display-editor__toolbar",children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:l||r,onClick:()=>{var g;return(g=i.current)==null?void 0:g.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:l?"hourglass_top":"add_photo_alternate"})}),o.jsx("input",{ref:i,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:g=>{var x;const b=(x=g.target.files)==null?void 0:x[0];g.target.value="",b&&k(b)}})]}),o.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:g=>t==null?void 0:t(g.target.value),onScroll:c,onKeyDown:g=>{g.key==="Escape"&&g.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r}),o.jsx("div",{ref:a,className:"af-work-display-editor__scrollbar"+(d.visible?" af-work-display-editor__scrollbar--visible":""),onPointerDown:y,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${d.height}%`,top:`${d.top}%`}})})]})}function Jq({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,u]=h.useState(a),d=h.useRef(!1),p=String(s.candidateContent||""),c=!!s.running,f=!!(t!=null&&t.readOnly),m=String(s.error||"");return h.useEffect(()=>{d.current||u(a)},[a]),!n&&!r?null:n?o.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:y=>y.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 y;return(y=t==null?void 0:t.onCloseNodeChat)==null?void 0:y.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||c||m||p.trim()?o.jsxs("div",{className:"af-work-node-chat__messages",children:[i.slice(-4).map((y,v)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${y.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:y.role==="assistant"?"AI":"你"}),o.jsx("p",{children:y.text})]},`${y.at||v}-${v}`)),c?o.jsx("div",{className:"af-work-node-chat__pending",children:"生成中..."}):null,m?o.jsx("div",{className:"af-work-node-chat__error",children:m}):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||f,"aria-label":"添加上下文",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),o.jsx("textarea",{className:"af-work-node-chat__input",rows:2,value:l,disabled:c||f,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{d.current=!0},onCompositionEnd:y=>{var k;d.current=!1;const v=y.currentTarget.value;u(v),(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,v)},onChange:y=>{var k;const v=y.target.value;u(v),d.current||(k=t==null?void 0:t.onUpdateNodeChatDraft)==null||k.call(t,e,v)},onKeyDown:y=>{var v,k;y.isComposing||(v=y.nativeEvent)!=null&&v.isComposing||y.keyCode===229||(y.metaKey||y.ctrlKey)&&y.key==="Enter"&&(y.preventDefault(),(k=t==null?void 0:t.onSendNodeChat)==null||k.call(t,e,l))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:c||f||!l.trim(),onClick:()=>{var y;return(y=t==null?void 0:t.onSendNodeChat)==null?void 0:y.call(t,e,l)},"aria-label":"发送",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]}),o.jsxs("div",{className:"af-work-node-chat__actions",children:[o.jsx("button",{type:"button",disabled:c||f||!p.trim(),onClick:()=>{var y;return(y=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:y.call(t,e,"replace")},children:"替换当前内容"}),o.jsx("button",{type:"button",disabled:c||f||!p.trim(),onClick:()=>{var y;return(y=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:y.call(t,e,"append")},children:"追加"})]})]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:y=>{var v;y.stopPropagation(),(v=t==null?void 0:t.onToggleNodeChat)==null||v.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 Qq(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function Zq(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function M1(e,t){const n=On(t==null?void 0:t.definitionId)||"markdown";return`outputs/${Zq((t==null?void 0:t.label)||e||n)}.${Qq(n)}`}function eY({id:e,data:t,selected:n,deleteNode:r}){var xe,le,Se;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((ie,oe)=>({slot:ie,idx:oe})).sort((ie,oe)=>{var We,ot,ze,mt;const ye=String(((We=ie.slot)==null?void 0:We.name)||"").trim(),ke=String(((ot=oe.slot)==null?void 0:ot.name)||"").trim();if(ye==="next"&&ke!=="next")return-1;if(ke==="next"&&ye!=="next")return 1;const Ve=String(((ze=ie.slot)==null?void 0:ze.type)||"").trim(),Je=String(((mt=oe.slot)==null?void 0:mt.type)||"").trim();return Ve==="node"&&Je!=="node"?-1:Je==="node"&&Ve!=="node"?1:ie.idx-oe.idx}),l=On(t==null?void 0:t.definitionId),u=h.useRef(null),d=h.useRef(null),[p,c]=h.useState(0),[f,m]=h.useState(!1),[y,v]=h.useState(!1),[k,g]=h.useState(!1),[b,x]=h.useState(""),[N,_]=h.useState(""),[C,T]=h.useState(!1),[H,L]=h.useState(!1),F=h.useRef(null),O=ac(t),D=l==="markdown"?pa(O):"",W=l==="markdown"?Xu(D,"markdown"):"",$=l==="markdown"?W?N:D:"",M=!!(t!=null&&t.readOnly),I=!!(t!=null&&t.displayPageMode);h.useEffect(()=>{let ie=!1;return l!=="markdown"||!W?(_(""),T(!1),()=>{ie=!0}):(T(!0),Ju((t==null?void 0:t.flowParams)||{},W).then(oe=>{ie||_(oe)}).catch(oe=>{var ye;ie||(_(""),(ye=t==null?void 0:t.onStatus)==null||ye.call(t,String(oe.message||oe)))}).finally(()=>{ie||T(!1)}),()=>{ie=!0})},[l,W,(xe=t==null?void 0:t.flowParams)==null?void 0:xe.flowId,(le=t==null?void 0:t.flowParams)==null?void 0:le.flowSource,(Se=t==null?void 0:t.flowParams)==null?void 0:Se.archived,t==null?void 0:t.displayReloadKey]),h.useEffect(()=>{if(!y)return;const ie=()=>v(!1);return window.addEventListener("pointerup",ie,!0),window.addEventListener("pointercancel",ie,!0),window.addEventListener("mouseup",ie,!0),window.addEventListener("blur",ie),()=>{window.removeEventListener("pointerup",ie,!0),window.removeEventListener("pointercancel",ie,!0),window.removeEventListener("mouseup",ie,!0),window.removeEventListener("blur",ie)}},[y]),h.useEffect(()=>{k||x(String($||""))},[$,k]);const z=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="image"?"Image":l==="chart"?"Chart":l==="table"?"Table":"Markdown"),P=String((t==null?void 0:t.sourceNodeId)||e),R=(t==null?void 0:t.sharingDisplayNodeId)===P,E=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,J=h.useCallback(async()=>{var ln,zn,Bt,en,cn,un,ue,Ne,He,nt;if(l!=="html"||f)return;const ie=ac(t),oe=Xu(ie,l);let ye=ie;if(oe)try{ye=await Ju((t==null?void 0:t.flowParams)||{},oe)}catch(et){m(!1),console.warn("Failed to read HTML display file before saving image.",et);return}const ke=id(ye);if(!ke.trim())return;const Ve=tc(l,ke);if(Ve){console.warn(Ve);return}const Je=(zn=(ln=d.current)==null?void 0:ln.getBoundingClientRect)==null?void 0:zn.call(ln),We=(en=(Bt=u.current)==null?void 0:Bt.querySelector)==null?void 0:en.call(Bt,".af-work-display-body"),ot=(un=(cn=u.current)==null?void 0:cn.querySelector)==null?void 0:un.call(cn,".af-visible-scroll-frame__scroller"),ze=Math.round(Math.max(Number((Je==null?void 0:Je.width)||0),Number((E==null?void 0:E.width)||0),Number(((ue=u.current)==null?void 0:ue.clientWidth)||0),Number((We==null?void 0:We.clientWidth)||0),Number((ot==null?void 0:ot.clientWidth)||0),Math.max(320,Number((E==null?void 0:E.width)||960)-2))),mt=Math.round(Math.max(Number((Je==null?void 0:Je.height)||0),Number((E==null?void 0:E.height)||0),Number(((Ne=u.current)==null?void 0:Ne.clientHeight)||0),Number((We==null?void 0:We.clientHeight)||0),Number((ot==null?void 0:ot.clientHeight)||0),Math.max(180,Number((E==null?void 0:E.height)||640)-46)));m(!0);try{await Vq({flowParams:(t==null?void 0:t.flowParams)||{},content:ke,sourceFilePath:oe,iframe:d.current,width:ze,height:mt,filename:Fq((t==null?void 0:t.label)||e||"html-render","png"),snapshotElements:{card:u.current,displayBody:We,scroller:ot},displaySize:E}),(He=t==null?void 0:t.onStatus)==null||He.call(t,"已导出 HTML 展示截图")}catch(et){const _t=String((et==null?void 0:et.message)||et||"截图失败");(nt=t==null?void 0:t.onStatus)==null||nt.call(t,`HTML 截图失败:${_t}`),console.warn("Failed to save HTML display as PNG.",et)}finally{m(!1)}},[t,E==null?void 0:E.height,E==null?void 0:E.width,e,l,f]),Z=h.useCallback(ie=>{var oe;M||!ie||l!=="image"||(oe=t==null?void 0:t.onUploadImageToDisplayNode)==null||oe.call(t,e,ie)},[t,e,l,M]),U=h.useCallback(ie=>{var oe,ye;(oe=ie==null?void 0:ie.stopPropagation)==null||oe.call(ie),!M&&((ye=t==null?void 0:t.onSetDisplayNodeContent)==null||ye.call(t,e,"","replace",{logChat:!1,reloadDisplay:!0,statusMessage:"已清空 Display 内容"}),l==="markdown"&&(x(""),g(!1)))},[t,e,l,M]),se=h.useCallback(ie=>{var ke,Ve;M||l!=="image"||!(Array.from(((ke=ie.dataTransfer)==null?void 0:ke.files)||[]).some(wg)||Array.from(((Ve=ie.dataTransfer)==null?void 0:Ve.items)||[]).some(Je=>String((Je==null?void 0:Je.type)||"").startsWith("image/")))||(ie.preventDefault(),ie.stopPropagation(),ie.dataTransfer.dropEffect="copy",L(!0))},[l,M]),pe=h.useCallback(ie=>{l==="image"&&(ie.currentTarget.contains(ie.relatedTarget)||L(!1))},[l]),he=h.useCallback(ie=>{var ye;if(l!=="image")return;const oe=Array.from(((ye=ie.dataTransfer)==null?void 0:ye.files)||[]).find(wg);oe&&(ie.preventDefault(),ie.stopPropagation(),L(!1),Z(oe))},[l,Z]);return o.jsxs("div",{className:"af-work-display-card"+(E?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(y?" af-work-display-card--resizing":"")+(H?" af-work-display-card--image-drop":"")+(I?" af-work-display-card--presentation":"")+(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:E?{width:E.width,height:E.height}:void 0,ref:u,onDragOver:se,onDragLeave:pe,onDrop:he,children:[o.jsx(lI,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>v(!0),onResizeEnd:()=>v(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((ie,oe)=>{if(ie.showOnNode===!1)return null;const ye=`${4.15+oe*1.75}rem`,ke=ie.name||`#${oe+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:ye},children:ke}),o.jsx(Ws,{type:"target",position:Xe.Left,id:`input-${oe}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:ye,background:rr(ie.type)},title:`${ke} · ${ie.type}`})]},`in-${oe}`)}),a.map(({slot:ie,idx:oe},ye)=>{if(ie.showOnNode===!1)return null;const ke=`${4.15+ye*1.75}rem`,Ve=ie.name||`#${oe+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:ke},children:Ve}),o.jsx(Ws,{type:"source",position:Xe.Right,id:`output-${oe}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:ke,background:rr(ie.type)},title:`${Ve} · ${ie.type}`})]},`out-${oe}`)}),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:Kq(l)}),o.jsx("strong",{children:z}),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:ie=>ie.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var ie,oe,ye,ke;try{(ke=(ye=(oe=(ie=d.current)==null?void 0:ie.contentWindow)==null?void 0:oe.history)==null?void 0:ye.back)==null||ke.call(ye)}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 ie,oe,ye,ke;try{(ke=(ye=(oe=(ie=d.current)==null?void 0:ie.contentWindow)==null?void 0:oe.history)==null?void 0:ye.forward)==null||ke.call(ye)}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:()=>c(ie=>ie+1),"aria-label":"刷新",title:"刷新",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:f,onClick:J,"aria-label":"截图另存为图片",title:"截图另存为图片",children:o.jsx("span",{className:"material-symbols-outlined",children:f?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?k?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:ie=>ie.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:M||C,onClick:async()=>{var ie,oe,ye;if(W){try{const ke=await Bb((t==null?void 0:t.flowParams)||{},W,b);_(b),(ie=t==null?void 0:t.onSetDisplayNodeContent)==null||ie.call(t,e,ke,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已更新 ${ke}`}),g(!1)}catch(ke){(oe=t==null?void 0:t.onStatus)==null||oe.call(t,String(ke.message||ke))}return}(ye=t==null?void 0:t.onSetDisplayNodeContent)==null||ye.call(t,e,b,"replace",{logChat:!1,statusMessage:"已更新 Markdown 内容"}),g(!1)},"aria-label":"保存并预览",title:"保存并预览",children:o.jsx("span",{className:"material-symbols-outlined",children:"done"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{x(String($||"")),g(!1)},"aria-label":"取消编辑",title:"取消编辑",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}):o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:M||C,onClick:ie=>{ie.stopPropagation(),x(String($||"")),g(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:o.jsx("span",{className:"material-symbols-outlined",children:"edit"})}):null,l==="image"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:F,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:ie=>{var ye;const oe=(ye=ie.target.files)==null?void 0:ye[0];ie.target.value="",oe&&Z(oe)}}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:M,onClick:ie=>{var oe;ie.stopPropagation(),(oe=F.current)==null||oe.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"upload"})})]}):null,o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:R,onClick:ie=>{var oe;ie.stopPropagation(),(oe=t==null?void 0:t.onShareDisplayNode)==null||oe.call(t,P)},"aria-label":"分享展示",title:"分享展示(1 天有效)",children:o.jsx("span",{className:"material-symbols-outlined",children:R?"hourglass_empty":"ios_share"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:M,onClick:U,"aria-label":"清空内容",title:"清空内容",children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_sweep"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:M,onClick:()=>{var ie;return(ie=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:ie.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",disabled:M,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&k?o.jsx(Xq,{value:b,onChange:x,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:M}):o.jsx(Yq,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:d,htmlFrameVersion:p}),o.jsx(Jq,{nodeId:e,data:t})]})}function tY({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",u=!!(t!=null&&t.readOnly);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((d,p)=>{if(d.showOnNode===!1)return null;const c=`${2.25+p*1.75}rem`,f=d.name||`#${p+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:c},children:f}),o.jsx(Ws,{type:"target",position:Xe.Left,id:`input-${p}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:c,background:rr(d.type)},title:`${f} · ${d.type}`})]},`in-${p}`)}),i.map((d,p)=>{if(d.showOnNode===!1)return null;const c=`${2.25+p*1.75}rem`,f=d.name||`#${p+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:c},children:f}),o.jsx(Ws,{type:"source",position:Xe.Right,id:`output-${p}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:c,background:rr(d.type)},title:`${f} · ${d.type}`})]},`out-${p}`)}),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",disabled:u,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":""),disabled:u,onClick:d=>{var p,c;d.stopPropagation(),a?(p=t==null?void 0:t.onStopWorkspaceNode)==null||p.call(t,e):(c=t==null?void 0:t.onRunWorkspaceNode)==null||c.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 nY(e){var m,y,v,k,g,b,x,N,_,C,T,H,L;const{setEdges:t,setNodes:n}=kc(),r=(m=e.data)==null?void 0:m.onSyncNodePropDraft,s=!!((y=e.data)!=null&&y.readOnly),[i,a]=h.useState(!1),l=(v=e.data)!=null&&v.nodeSize&&Number(e.data.nodeSize.width)>0&&Number(e.data.nodeSize.height)>0?{width:Number(e.data.nodeSize.width),height:Number(e.data.nodeSize.height)}:null,u=h.useCallback(F=>{s||(n(O=>O.filter(D=>D.id!==F)),t(O=>O.filter(D=>D.source!==F&&D.target!==F)))},[s,t,n]),d=h.useCallback((F,O)=>{s||(n(D=>D.map(W=>W.id===F?{...W,data:{...W.data,model:O}}:W)),r==null||r(F,{model:O}))},[s,n,r]),p=h.useCallback((F,O)=>{s||(n(D=>D.map(W=>{var M;if(W.id!==F)return W;const $=Array.isArray((M=W.data)==null?void 0:M.outputs)&&W.data.outputs.length?W.data.outputs.map((I,z)=>z===0?{...I,default:O,value:O}:I):[{type:"bool",name:"value",default:O,value:O}];return{...W,data:{...W.data,body:"",outputs:$}}})),r==null||r(F,D=>({body:"",outputs:Array.isArray(D==null?void 0:D.outputs)&&D.outputs.length?D.outputs.map(($,M)=>M===0?{...$,default:O,value:O}:$):[{type:"bool",name:"value",default:O,value:O}]})))},[s,n,r]),c=h.useCallback((F,O)=>{s||(n(D=>D.map(W=>W.id===F?{...W,data:{...W.data,body:O}}:W)),r==null||r(F,{body:O}))},[s,n,r]),f=h.useCallback((F,O)=>{if(s)return;const D=Os(O);n(W=>W.map($=>$.id===F?{...$,data:{...$.data,images:D}}:$)),r==null||r(F,{images:D})},[s,n,r]);return On((k=e.data)==null?void 0:k.definitionId)?o.jsx(eY,{...e,deleteNode:u}):((g=e.data)==null?void 0:g.definitionId)==="workspace_run"?o.jsx(tY,{...e,deleteNode:u}):((b=e.data)==null?void 0:b.definitionId)==="control_load_skills"?o.jsx(hY,{...e,deleteNode:u,skills:(x=e.data)==null?void 0:x.skills,skillCollections:(N=e.data)==null?void 0:N.skillCollections,onChangeSkillKeys:(_=e.data)==null?void 0:_.onChangeLoadSkillKeys}):((C=e.data)==null?void 0:C.definitionId)==="control_load_mcp"?o.jsx(mY,{...e,deleteNode:u,servers:(T=e.data)==null?void 0:T.mcpServers,onChangeMcpNames:(H=e.data)==null?void 0:H.onChangeLoadMcpNames}):o.jsxs("div",{className:"af-work-flow-node"+(e.selected?" af-work-flow-node--selected":"")+(i?" af-work-flow-node--resizing":""),style:l?{width:l.width,height:l.height}:void 0,children:[s?null:o.jsx(lI,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:f2,minHeight:Db,maxWidth:p2,maxHeight:h2,onResizeStart:()=>a(!0),onResizeEnd:()=>a(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),o.jsx(BT,{...e,deleteNode:u,modelLists:(L=e.data)==null?void 0:L.modelLists,onModelChange:d,onProvideValueChange:p,onNodeBodyChange:c,onNodeImagesChange:f})]})}const rY={[Ep]:nY};function S2(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&S2(n.children,t);return t}function N2(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&N2(n.children,t));return t}function qh(e){const t=String(e||"").replace(/\\/g,"/").split("/").filter(Boolean),n=[];for(let r=1;r<t.length;r++)n.push(t.slice(0,r).join("/"));return n}function sY(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function iY(e,t,n=0){const r=String(t||"").replace(/\\/g,"/").split("/").filter(Boolean);if(r.length===0)return e;const s=(i,a,l)=>{const u=r[a],d=l?`${l}/${u}`:u,p=a===r.length-1;let c=!1;const f=(Array.isArray(i)?i:[]).map(m=>m.name!==u?m:(c=!0,p?{...m,type:"file",name:u,path:d,icon:sf(u),size:n}:{...m,type:"directory",name:u,path:d,icon:sf(u,!0),children:s(m.children||[],a+1,d)}));return c||f.push(p?{type:"file",name:u,path:d,icon:sf(u),size:n}:{type:"directory",name:u,path:d,icon:sf(u,!0),children:s([],a+1,d)}),sY(f)};return s(e||[],0,"")}function j2({items:e,flowParams:t,onOpen:n,collapsedDirs:r,onToggleDir:s,onCreateFile:i,onCreateFolder:a,onDelete:l,onFileDragStart:u}){return o.jsx("ul",{className:"af-work-files",children:(e||[]).map(d=>{var f;const p=d.type==="directory",c=p&&(r==null?void 0:r.has(d.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--"+d.type,draggable:!p,onDragStart:m=>{p||u==null||u(m,d)},onClick:()=>p?s==null?void 0:s(d.path):n(d),title:d.path,children:[p?o.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:c?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:d.icon||sf(d.name,p)}),o.jsx("span",{children:d.name})]}),p?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>i==null?void 0:i(d.path),title:"新增文件","aria-label":`在 ${d.name} 新增文件`,children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>a==null?void 0:a(d.path),title:"新增文件夹","aria-label":`在 ${d.name} 新增文件夹`,children:o.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})})]}):null,p?null:o.jsx("a",{className:"af-work-file-action",href:vq(d.path,t),download:d.name,onClick:m=>m.stopPropagation(),title:"下载","aria-label":`下载 ${d.name}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"download"})}),o.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:()=>l==null?void 0:l(d),title:"删除","aria-label":`删除 ${d.name}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]}),p&&!c&&((f=d.children)!=null&&f.length)?o.jsx(j2,{items:d.children,flowParams:t,onOpen:n,collapsedDirs:r,onToggleDir:s,onCreateFile:i,onCreateFolder:a,onDelete:l,onFileDragStart:u}):null]},d.path)})})}function oY({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 kg(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 aY(e){const t=kg((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 kg((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function lY(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function cY(e){const t=kg((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 kg((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function uY(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function O1(e){var r,s,i,a,l,u;if(!e)return null;const{inputs:t,outputs:n}=DT(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:Os((l=e.data)==null?void 0:l.images),script:String(((u=e.data)==null?void 0:u.script)??""),inputs:t,outputs:n}}function $1(e){return(Array.isArray(e)?e:[]).map(t=>({type:String((t==null?void 0:t.type)??"node").trim()||"node",name:String((t==null?void 0:t.name)??""),default:String((t==null?void 0:t.default)??""),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 dY(e,t,n){var p,c;const r=String(((p=e==null?void 0:e.data)==null?void 0:p.definitionId)??n),s=r.startsWith("provide_"),i=String((t==null?void 0:t.role)||"").trim(),a=ml.includes(i)?i:"normal",l=String((t==null?void 0:t.model)||"").trim(),u={...e.data,label:String((t==null?void 0:t.label)||"").trim()||n,role:a,model:l===""||l==="default"?void 0:l,body:s?"":String((t==null?void 0:t.body)??""),images:s?[]:Os(t==null?void 0:t.images),inputs:$1(t==null?void 0:t.inputs),outputs:s&&Array.isArray((c=e.data)==null?void 0:c.outputs)?e.data.outputs:$1(t==null?void 0:t.outputs)},d=String((t==null?void 0:t.script)??"").trim();return r==="tool_nodejs"||d!==""?u.script=String((t==null?void 0:t.script)??""):delete u.script,u}function D1({nodes:e,edges:t,instances:n,selectedNode:r,draft:s,allowRename:i=!1}){if(!s||!r)return{ok:!1,error:""};const a=r.id,l=String(s.newId||"").trim(),u=i?l:a;if(i){if(!JT.test(u))return{ok:!1,error:"Invalid instance id"};if(e.some(v=>v.id===u&&v.id!==a))return{ok:!1,error:"Duplicate instance id"}}const d=dY(r,s,u),p=r.data||{};if(!(u!==a||p.label!==d.label||p.role!==d.role||p.model!==d.model||p.body!==d.body||JSON.stringify(Os(p.images))!==JSON.stringify(d.images)||(p.script??void 0)!==(d.script??void 0)||JSON.stringify(p.inputs||[])!==JSON.stringify(d.inputs||[])||JSON.stringify(p.outputs||[])!==JSON.stringify(d.outputs||[])))return{ok:!0,changed:!1,nextId:u,nodes:e,edges:t,instances:n};const f=e.map(v=>v.id===a?{...v,id:u,selected:!0,data:d}:v);let m=t,y=n;if(u!==a){y={...n||{}};const v={...y[a]||{}};delete y[a],y[u]=v,m=t.map((k,g)=>({...k,source:k.source===a?u:k.source,target:k.target===a?u:k.target,id:`we-${k.source===a?u:k.source}-${k.target===a?u:k.target}-${g}`}))}return{ok:!0,changed:!0,nextId:u,nodes:f,edges:m,instances:y}}function fY(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function pY(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"])fY(e[s],t[s])&&(r[s]=n[s]);return r}function hY({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:[],u=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],d=Array.isArray(s)?s:[],p=Array.isArray(i)?i:[],[c,f]=h.useState(!1),[m,y]=h.useState(""),[v,k]=h.useState(()=>new Set),g=h.useRef(null),b=h.useRef(null),[x,N]=h.useState({visible:!1,top:0,height:100}),_=h.useMemo(()=>new Set(aY(t)),[t]),C=h.useMemo(()=>new Map(d.map(M=>[M.key,M])),[d]),T=h.useMemo(()=>{const M=new Set,I=p.map(P=>{const R=pl(P,d).map(E=>C.get(E)).filter(Boolean);for(const E of R)M.add(E.key);return{...P,skills:R}}).filter(P=>P.skills.length>0),z=d.filter(P=>!M.has(P.key));return{collectionGroups:I,ungrouped:z}},[C,p,d]);h.useEffect(()=>{k(M=>{let I=!1;const z=new Set(M);for(const P of T.collectionGroups)z.has(P.id)||(z.add(P.id),I=!0);return I?z:M})},[T.collectionGroups]);const H=h.useMemo(()=>{const M=m.trim().toLowerCase();if(!M)return T;const I=P=>[P==null?void 0:P.key,P==null?void 0:P.name,P==null?void 0:P.description].map(E=>String(E||"").toLowerCase()).join(" ").includes(M);return{collectionGroups:T.collectionGroups.map(P=>{const E=[P==null?void 0:P.id,P==null?void 0:P.name,P==null?void 0:P.description].map(J=>String(J||"").toLowerCase()).join(" ").includes(M)?P.skills:P.skills.filter(I);return{...P,skills:E}}).filter(P=>P.skills.length>0),ungrouped:T.ungrouped.filter(I)}},[T,m]),L=h.useCallback((M,I)=>{const z=new Set(_);for(const P of M)I?z.add(P):z.delete(P);a==null||a(e,Array.from(z))},[e,_,a]),F=h.useCallback(M=>{k(I=>{const z=new Set(I);return z.has(M)?z.delete(M):z.add(M),z})},[]),O=h.useCallback(()=>{const M=g.current;if(!M)return;const I=Math.max(1,M.scrollHeight),z=Math.max(1,M.clientHeight),P=I>z+1,R=P?Math.max(12,z/I*100):100,E=Math.max(0,100-R),J=P?Math.min(E,M.scrollTop/Math.max(1,I-z)*E):0;N({visible:P,top:J,height:R})},[]);h.useEffect(()=>{if(!c)return;const M=requestAnimationFrame(O);return()=>cancelAnimationFrame(M)},[v,H,_.size,c,O]);const D=h.useCallback(M=>{const I=g.current;if(!I)return;const z=Math.max(0,I.scrollHeight-I.clientHeight);I.scrollTop=Math.min(1,Math.max(0,M))*z,O()},[O]),W=h.useCallback((M,I=0)=>{const z=b.current;if(!z)return 0;const P=z.getBoundingClientRect(),R=x.height/100*P.height,E=Math.max(1,P.height-R);return(M-P.top-I)/E},[x.height]),$=h.useCallback(M=>{var pe,he;if(!x.visible)return;M.preventDefault(),M.stopPropagation();const I=b.current;if(!I)return;const z=I.getBoundingClientRect(),P=x.top/100*z.height,R=x.height/100*z.height,J=M.clientY>=z.top+P&&M.clientY<=z.top+P+R?M.clientY-z.top-P:R/2;D(W(M.clientY,J));const Z=M.pointerId;(he=(pe=M.currentTarget).setPointerCapture)==null||he.call(pe,Z);const U=xe=>{xe.preventDefault(),D(W(xe.clientY,J))},se=()=>{window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",se),window.removeEventListener("pointercancel",se)};window.addEventListener("pointermove",U),window.addEventListener("pointerup",se),window.addEventListener("pointercancel",se)},[W,D,x.height,x.top,x.visible]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[l.map((M,I)=>{if(M.showOnNode===!1)return null;const z=`${2.6+I*1.7}rem`,P=M.name||`#${I+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:z},children:P}),o.jsx(Ws,{type:"target",position:Xe.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:z,background:rr(M.type)},title:`${P} · ${M.type}`})]},`in-${I}`)}),u.map((M,I)=>{if(M.showOnNode===!1)return null;const z=`${2.6+I*1.7}rem`,P=M.name||`#${I+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:z},children:P}),o.jsx(Ws,{type:"source",position:Xe.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:z,background:rr(M.type)},title:`${P} · ${M.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:M=>{var I;M.stopPropagation(),c||(I=t==null?void 0:t.onRefreshSkills)==null||I.call(t),f(z=>!z)},children:[o.jsx("span",{children:_.size>0?`${_.size} skills selected`:"选择 Skills"}),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:M=>M.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:m,onChange:M=>y(M.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),m?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:O,children:[H.collectionGroups.map(M=>{const I=M.skills.map(E=>E.key),z=I.filter(E=>_.has(E)).length,P=I.length>0&&z===I.length,R=v.has(M.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(R?" af-work-load-skills-menu__group--collapsed":""),children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head",children:[o.jsx("input",{type:"checkbox",checked:P,onChange:E=>L(I,E.target.checked),"aria-label":`选择 ${M.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>F(M.id),"aria-expanded":!R,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:M.name}),M.description?o.jsx("em",{children:M.description}):null]})}),o.jsxs("small",{children:[z,"/",I.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>F(M.id),"aria-label":R?`展开 ${M.name}`:`收起 ${M.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:R?"chevron_right":"expand_more"})})]}),R?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:M.skills.map(E=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:_.has(E.key),onChange:J=>L([E.key],J.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:E.name}),E.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:E.description}):null]})]},`${M.id}:${E.key}`))})]},M.id)}),H.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:H.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:H.ungrouped.map(M=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:_.has(M.key),onChange:I=>L([M.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:M.name}),M.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:M.description}):null]})]},`ungrouped:${M.key}`))})]}):null,H.collectionGroups.length===0&&H.ungrouped.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>a==null?void 0:a(e,[]),children:"清空"})]}),o.jsx("div",{ref:b,className:"af-work-load-skills-scrollbar"+(x.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:$,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${x.height}%`,top:`${x.top}%`}})})]}):null]})]})}function mY({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:[],[u,d]=h.useState(!1),[p,c]=h.useState(""),f=h.useMemo(()=>new Set(cY(t)),[t]),m=h.useMemo(()=>(Array.isArray(s)?s:[]).map(k=>({name:String((k==null?void 0:k.name)||""),description:String((k==null?void 0:k.description)||""),detail:String((k==null?void 0:k.url)||[k==null?void 0:k.command,...Array.isArray(k==null?void 0:k.args)?k.args:[]].filter(Boolean).join(" ")||""),type:String((k==null?void 0:k.type)||"")})).filter(k=>k.name),[s]),y=h.useMemo(()=>{const k=p.trim().toLowerCase();return k?m.filter(g=>[g.name,g.description,g.detail,g.type].join(" ").toLowerCase().includes(k)):m},[p,m]),v=h.useCallback((k,g)=>{const b=new Set(f);for(const x of k)g?b.add(x):b.delete(x);i==null||i(e,Array.from(b))},[e,f,i]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[a.map((k,g)=>{if(k.showOnNode===!1)return null;const b=`${2.6+g*1.7}rem`,x=k.name||`#${g+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:b},children:x}),o.jsx(Ws,{type:"target",position:Xe.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:b,background:rr(k.type)},title:`${x} · ${k.type}`})]},`in-${g}`)}),l.map((k,g)=>{if(k.showOnNode===!1)return null;const b=`${2.6+g*1.7}rem`,x=k.name||`#${g+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:b},children:x}),o.jsx(Ws,{type:"source",position:Xe.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:b,background:rr(k.type)},title:`${x} · ${k.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:k=>{var g;k.stopPropagation(),u||(g=t==null?void 0:t.onRefreshMcps)==null||g.call(t),d(b=>!b)},children:[o.jsx("span",{children:f.size>0?`${f.size} MCP selected`:"选择 MCP"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:u?"expand_less":"expand_more"})]}),u?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:p,onChange:k=>c(k.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),p?o.jsx("button",{type:"button",onClick:()=>c(""),"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(k=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:f.has(k.name),onChange:g=>v([k.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:k.name}),k.description||k.detail?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:k.description||k.detail}):null]})]},k.name))})]}),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 gY(){var _s,ea;const{t:e,i18n:t}=In(),{navigate:n}=Lo(),r=kc(),s=d0(),i=h.useMemo(bq,[]),[a,l]=h.useState(()=>new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace"),[u,d]=h.useState(!1),[p,c]=h.useState(!1),[f,m]=rI([]),[y,v,k]=sI([]),g=h.useRef([]),b=h.useRef([]),[x,N]=h.useState(()=>Hb(null,[])),_=h.useRef(x),[C,T]=h.useState(null),H=h.useRef(null),[L,F]=h.useState([]),O=h.useRef(new Map),D=h.useRef(new Map),W=h.useRef(null),$=h.useRef(null),M=h.useRef(null),[I,z]=h.useState(null),[P,R]=h.useState({}),E=h.useRef({}),J=h.useRef(!1),Z=h.useRef(null),[U,se]=h.useState([]),[pe,he]=h.useState(""),[xe,le]=h.useState("nodes"),[Se,ie]=h.useState([]),[oe,ye]=h.useState(!1),[ke,Ve]=h.useState(""),[Je,We]=h.useState(!1),[ot,ze]=h.useState({name:"",id:"",description:""}),[mt,ln]=h.useState(!1),[zn,Bt]=h.useState(""),[en,cn]=h.useState(""),un=h.useRef(null),[ue,Ne]=h.useState(!1),[He,nt]=h.useState(!1),[et,_t]=h.useState(""),[st,dn]=h.useState(null),[on,Un]=h.useState({title:"",layout:"gallery",nodeIds:[]}),[fn,Tn]=h.useState(""),[Kn,Nr]=h.useState(!1),[we,Me]=h.useState(""),[ct,vt]=h.useState(!1),[ae,Le]=h.useState(""),[rt,Tt]=h.useState(!1),[Wt,Zn]=h.useState("nodes"),[ds,Us]=h.useState(""),[Yr,fs]=h.useState(0),[qn,cr]=h.useState(""),Ks=h.useRef(""),[ft,Lr]=h.useState(null),$o=h.useRef(null),[Fe,Mt]=h.useState(""),[ur,lt]=h.useState([]),[Mr,jr]=h.useState(""),[Te,ps]=h.useState(!0),[Yn,qs]=h.useState(""),[ut,Xt]=h.useState(()=>new Set),Jt=h.useRef(null),[Cr,tt]=h.useState(()=>{try{const S=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(S)&&S>=160)return S}catch{}return 360}),[hs,Do]=h.useState(!1),[js,Fo]=h.useState({cursor:[],opencode:[],claudeCode:[]}),[ms,zo]=h.useState(""),[dr,jn]=h.useState([]),[Ys,Ri]=h.useState(!1),[sr,Gr]=h.useState([]),[Or,Ho]=h.useState([]),[K,me]=h.useState(!1),[De,Ie]=h.useState([]),Ze=h.useCallback(S=>{un.current&&window.clearTimeout(un.current),cn(S),un.current=window.setTimeout(()=>{cn(""),un.current=null},3800)},[]),Yt=h.useCallback(S=>{const A=String(S||"").trim();if(!A)return;const V=()=>s(A);window.requestAnimationFrame(V),window.setTimeout(V,80)},[s]);h.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(Cr)))}catch{}},[Cr]);const Ct=h.useCallback(S=>{const A=Jt.current;if(!A)return;const V=A.getBoundingClientRect(),G=16,Q=150,re=230,ee=V.top+G,ce=V.bottom-G,de=Math.max(Q,ce-ee-re),ve=Math.min(Math.max(S-ee,Q),de);tt(ve)},[]),ir=h.useCallback(S=>{S.preventDefault(),S.stopPropagation(),Do(!0),Ct(S.clientY);const A=G=>{G.preventDefault(),Ct(G.clientY)},V=()=>{Do(!1),window.removeEventListener("pointermove",A,!0),window.removeEventListener("pointerup",V,!0),window.removeEventListener("pointercancel",V,!0)};window.addEventListener("pointermove",A,!0),window.addEventListener("pointerup",V,!0),window.addEventListener("pointercancel",V,!0)},[Ct]);h.useEffect(()=>()=>{un.current&&window.clearTimeout(un.current)},[]);const[Xr,di]=h.useState(()=>new Set),[mn,Bo]=h.useState(!1),Nc=h.useRef(null),dd=h.useRef(null),fi=h.useRef(null),[Rp,jc]=h.useState({}),[Li,Sl]=h.useState(""),[$r,tn]=h.useState(!1),[Cc,Cn]=h.useState([]),[Ec,Dr]=h.useState([]),[pi,io]=h.useState("workspace"),[Nl,oo]=h.useState(!1),[Er,Na]=h.useState(!0),[ja,jl]=h.useState(""),[Wo,hi]=h.useState({}),[Ca,Ea]=h.useState(!1),[Cl,Vo]=h.useState(!1),[fd,mi]=h.useState(!1),[El,pd]=h.useState("pan"),[yr,_c]=h.useState(null),[Uo,Ko]=h.useState(""),qo=h.useRef(null),Jr=h.useRef(!1),[_l,Gs]=h.useState(()=>new Set),[Qr,Cs]=h.useState({}),[Pc,Ee]=h.useState(""),gs=h.useMemo(()=>kq(i),[i]),[_a,Lp]=h.useState(""),ao=i.flowSource||"user",Pl=!!(i.flowId&&!i.archived&&(ao==="user"||ao==="workspace")),Al=h.useMemo(()=>{if(!i.flowId)return"/flow?panel=settings";const S=Bf({id:i.flowId,source:ao,archived:!!i.archived},"pipeline"),[A,V=""]=S.split("?"),G=new URLSearchParams(V);return G.set("panel","settings"),`${A}?${G.toString()}`},[i.archived,i.flowId,ao]);h.useEffect(()=>{i.flowId&&aP(i.flowId,i.flowSource||"user","workspace",!!i.archived)},[i]),h.useEffect(()=>{const S=()=>{l(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",S),()=>window.removeEventListener("popstate",S)},[]),h.useEffect(()=>{Cn([]),Dr([]),io("workspace"),Na(!0)},[i]);const Gn=h.useCallback(async()=>{const S=wo(i),A=await fetch(`/api/workspace/files?${S.toString()}`),V=await A.json();if(!A.ok)throw new Error(V.error||"读取 workspace 失败");const G=V.files||[];lt(G),Xt(new Set(N2(G))),jr(V.root||"")},[i]),Il=h.useCallback(async()=>{ye(!0),Ve("");try{const S=await fetch("/api/marketplace/flow-snippets"),A=await S.json().catch(()=>({}));if(!S.ok)throw new Error(A.error||"读取流程片段失败");ie(Array.isArray(A.snippets)?A.snippets:[])}catch(S){Ve(String(S.message||S)),ie([])}finally{ye(!1)}},[]),bn=h.useCallback(async(S=f,A=y)=>{var re;if(!J.current)return;if(!Te)throw Ee("Readonly workspace"),new Error("Readonly workspace");const V=Kh(S,A,E.current);V.ui={...V.ui||{},...H.current?{viewport:H.current}:{},displayPage:Rq(_.current,S)};const G=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:V})}),Q=await G.json();if(!G.ok)throw new Error(Q.error||"保存 workspace graph 失败");E.current=((re=Q.graph)==null?void 0:re.instances)||V.instances,R(E.current),Ee("Workspace graph saved")},[y,i,f,Te]),hd=h.useCallback(S=>{var V;const A=(V=S==null?void 0:S.extra)!=null&&V.instances&&typeof S.extra.instances=="object"?S.extra.instances:{};E.current=A,R(A),m(Array.isArray(S==null?void 0:S.nodes)?S.nodes:[]),v(Array.isArray(S==null?void 0:S.edges)?S.edges:[]),cr(""),z(null)},[v,m]),Tl=h.useMemo(()=>({instances:P}),[P]),by=zT({nodes:f,edges:y,extra:Tl,enabled:J.current,onRestore:hd}),{resetHistory:Mp,undo:Et,redo:Ac}=by,Pa=h.useCallback(async()=>{var pt,Qe;J.current=!1;const S=wo(i),A=wo(i);A.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[V,G]=await Promise.all([fetch(`/api/nodes?${A.toString()}`),fetch(`/api/workspace/graph?${S.toString()}`),Gn()]),Q=await V.json(),re=await G.json();if(!V.ok)throw new Error(Q.error||"读取节点定义失败");if(!G.ok)throw new Error(re.error||"读取 workspace graph 失败");const ee=[...(Array.isArray(Q)?Q:Q.nodes||[]).filter(At=>!pq.has(At.id)),mq,gq,hq];se(ee);const ce=re.graph||JSON.parse(localStorage.getItem(fq)||"null")||{},de=zx(ce,ee),ve=Hb((pt=ce==null?void 0:ce.ui)==null?void 0:pt.displayPage,de.nodes),Pe=x2((Qe=ce==null?void 0:ce.ui)==null?void 0:Qe.viewport);E.current=de.instances,R(de.instances),m(de.nodes),v(de.edges),N(ve),_.current=ve,T(Pe),H.current=Pe,F([]),Mp(de.nodes,de.edges,{instances:de.instances});const Oe=re.writable!==!1;ps(Oe),Ee(Oe?"Workspace ready":"Readonly workspace"),J.current=!0},[i,t.language,Gn,Mp,v,m]),Ic=h.useCallback(async(S,A)=>{const V={packageId:(S==null?void 0:S.newId)||(S==null?void 0:S.id)||(S==null?void 0:S.label),label:(S==null?void 0:S.label)||(S==null?void 0:S.newId)||(S==null?void 0:S.id),version:"1.0.0",definitionId:A,body:(S==null?void 0:S.body)||"",script:(S==null?void 0:S.script)||"",inputs:Array.isArray(S==null?void 0:S.inputs)?S.inputs:[],outputs:Array.isArray(S==null?void 0:S.outputs)?S.outputs:[],flowId:i.flowId,flowSource:i.flowSource||"user",archived:!!i.archived},G=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)}),Q=await G.json().catch(()=>({}));if(!G.ok||(Q==null?void 0:Q.ok)===!1)throw new Error((Q==null?void 0:Q.error)||"Publish failed");return await Pa(),Ee(`Published node ${Q.definitionId||Q.id||V.packageId}`),Q},[i,Pa]),bt=h.useCallback((S="workspace")=>{oo(!0),Lr(null),io(S||"workspace")},[]),Op=h.useCallback(async(S="")=>{const A=String(S||Uo||"").trim();Jr.current=!0,qo.current&&(qo.current.abort(),qo.current=null),Ko(""),Gs(new Set),Cs(V=>{const G={...V};for(const[Q,re]of Object.entries(G))(re==null?void 0:re.status)==="running"&&(G[Q]={status:"stopped"});return A&&(G[A]={status:"stopped"}),G}),Ee(A?`Workspace run stopped: ${A}`:"Workspace run stopped"),Dr(V=>V.map(G=>(!A||G.runNodeId===A)&&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({...i,runNodeId:A})})}catch{}},[i,Uo]),lo=h.useCallback(async()=>{if(i.flowId)try{const S=wo(i),A=await fetch(`/api/workspace/run/status?${S.toString()}`),V=await A.json().catch(()=>({}));if(!A.ok||!V.running)return;const G=String(V.runNodeId||"").trim();G?(Ko(G),Gs(new Set([G])),Cs(Q=>({...Q,[G]:{status:"running"}})),Ee(`Workspace run still running: ${G}`)):Ee("Workspace run still running"),Dr(Q=>{if(Q.some(ee=>ee.status==="running"&&(!G||ee.runNodeId===G)))return Q;const re=`run-restored-${V.startedAt||Date.now()}`;return[...Q.slice(-7),{id:re,label:G?`Run ${G}`:"Workspace Run",runNodeId:G,status:"running",startedAt:V.startedAt||Date.now(),steps:G?[{id:G,label:G,status:"running"}]:[],messages:[{role:"assistant",kind:"run-summary",text:"Workspace run is still running in the background.",at:Date.now()}]}]})}catch{}},[i]),md=h.useCallback(async S=>{if(!Te){Ee("Readonly workspace");return}if(!S||Uo)return;let A=f,V=y,G=E.current;const Q=$o.current;if(Q!=null&&Q.id){const ve=A.find(Oe=>Oe.id===Q.id),Pe=D1({nodes:A,edges:V,instances:G,selectedNode:ve,draft:Q,allowRename:!1});if(Pe!=null&&Pe.error){Mt(Pe.error),Ee(Pe.error);return}Pe!=null&&Pe.ok&&Pe.changed&&(A=Pe.nodes,V=Pe.edges,G=Pe.instances,E.current=G,R(G),m(A),v(V),Yt(Pe.nextId||Q.id))}const re=Kh(A,V,G),ee=`run-${Date.now()}-${String(S).replace(/[^a-z0-9_-]+/gi,"_")}`,ce=`Run ${S}`,de=new AbortController;qo.current=de,Jr.current=!1,Ko(S),Gs(new Set([S])),Cs({[S]:{status:"running"}}),Ee(`Running ${S}...`),io(ee),Dr(ve=>[...ve.slice(-7),{id:ee,label:ce,runNodeId:S,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);try{await bn(A,V);const ve=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:de.signal,body:JSON.stringify({...i,graph:re,runNodeId:S,model:ms,selectedSkills:sr,stream:!0})});if(!ve.ok){const je=await ve.json().catch(()=>({}));throw new Error(je.error||"Workspace run failed")}if(!ve.body)throw new Error("Workspace run stream unavailable");const Pe=ve.body.getReader(),Oe=new TextDecoder;let pt="",Qe=[],At=[],Rn=S;const Pr=(je,dt)=>{var $t,nn;const ht=f.find(Qt=>Qt.id===je),xt=String((($t=ht==null?void 0:ht.data)==null?void 0:$t.label)||je||"").trim(),Re=String(dt||((nn=ht==null?void 0:ht.data)==null?void 0:nn.definitionId)||"").trim();return Re&&Re!==xt?`${xt} (${Re})`:xt},xn=(je,dt,ht)=>{const xt=String(je||"").trim();xt&&Dr(Re=>Re.map($t=>{if($t.id!==ee)return $t;const Qt=[...Array.isArray($t.steps)?$t.steps:[]],Ln=Qt.findIndex(ki=>ki.id===xt),Hn={id:xt,label:Pr(xt,dt),status:ht};Ln>=0?Qt[Ln]={...Qt[Ln],...Hn}:Qt.push(Hn);const Vt=Qt.map((ki,Hc)=>{const br=ki.status==="done"?"[done]":ki.status==="failed"?"[failed]":"[running]";return`${Hc+1}. ${br} ${ki.label}`}).join(`
|
|
172
|
+
`),rn=Array.isArray($t.messages)?$t.messages:[],or=rn.findIndex(ki=>ki.kind==="run-summary"),ys={role:"assistant",kind:"run-summary",text:Vt||"准备运行...",at:Date.now()},Qs=[...rn];return or>=0?Qs[or]=ys:Qs.unshift(ys),{...$t,steps:Qt,messages:Qs.slice(-160)}}))},Dt=je=>{const dt=String(je||"").trim();if(!dt)return;const ht=Rn;Rn=dt,Gs(new Set([dt])),Cs(xt=>{var Re;return{...xt,...ht&&ht!==dt&&((Re=xt[ht])==null?void 0:Re.status)==="running"?{[ht]:{status:"success"}}:{},[dt]:{status:"running"}}})},er=je=>{const dt=String(je||"").trim();dt&&(Gs(ht=>{const xt=new Set(ht);return xt.delete(dt),xt}),Cs(ht=>({...ht,[dt]:{status:"success"}})))},Ft=(je,dt)=>{const ht=String(dt||"");if(!ht.trim())return;const xt=["assistant","thinking","result","error","prompt"].includes(je)?je:"assistant";Dr(Re=>Re.map($t=>{if($t.id!==ee)return $t;let nn=Array.isArray($t.messages)?$t.messages:[];if(xt==="result"){const Hn=[...nn].reverse().find(Vt=>Vt.kind==="assistant");if(String((Hn==null?void 0:Hn.text)||"").trim()===ht.trim())return $t}if(xt==="assistant"){const Hn=nn.findIndex(Vt=>Vt.kind==="result"&&String(Vt.text||"").trim()===ht.trim());Hn>=0&&(nn=nn.filter((Vt,rn)=>rn!==Hn))}const Qt=[...nn],Ln=Qt[Qt.length-1];return Ln&&Ln.kind===xt&&!Ln.error?Qt[Qt.length-1]={...Ln,text:`${Ln.text||""}${Ln.text?`
|
|
173
|
+
`:""}${ht}`}:Qt.push({role:"assistant",kind:xt,text:ht,...xt==="error"?{error:!0}:{},at:Date.now()}),{...$t,messages:Qt.slice(-160)}}))},wn=je=>{const dt=String(je||"");dt.trim()&&Dr(ht=>ht.map(xt=>{var Qt;if(xt.id!==ee)return xt;const Re=Array.isArray(xt.messages)?xt.messages:[],$t=Re.findIndex(Ln=>Ln.kind==="thinking"),nn=[...Re];if($t>=0){const Ln=String(((Qt=nn[$t])==null?void 0:Qt.text)||"");nn[$t]={...nn[$t],text:`${Ln}${Ln&&!Ln.endsWith(`
|
|
174
|
+
`),""}${dt}`,at:Date.now()}}else{const Ln=nn.findIndex(Hn=>Hn.kind==="activity");nn.splice(Ln>=0?Ln+1:nn.length,0,{role:"assistant",kind:"thinking",text:dt,at:Date.now()})}return{...xt,messages:nn.slice(-160)}}))},qe=(je,dt=null)=>{const ht=Cq(je);ht&&Dr(xt=>xt.map(Re=>{if(Re.id!==ee)return Re;const $t=Number(dt==null?void 0:dt.ts)||Date.now(),nn=Number(Re.startedAt)||$t,Qt=Number(Re.lastActivityAt)||nn,Ln=Math.max(0,$t-Qt),Hn=Number.isFinite(Number(dt==null?void 0:dt.runElapsedMs))?Math.max(0,Number(dt.runElapsedMs)):Math.max(0,$t-nn),Vt=Array.isArray(Re.activities)?Re.activities:[],rn=Vt[Vt.length-1],ys=(typeof rn=="string"?rn:String((rn==null?void 0:rn.text)||""))===ht?Vt:[...Vt,{text:ht,stepMs:Ln,totalMs:Hn,at:$t}].slice(-8),Qs=Array.isArray(Re.messages)?Re.messages:[],ki=Qs.findIndex($i=>$i.kind==="activity"),Hc={role:"assistant",kind:"activity",text:ys.map(($i,Hl)=>Eq($i,Hl)).join(`
|
|
175
|
+
`),at:Date.now()},br=[...Qs];if(ki>=0)br[ki]=Hc;else{const $i=br.findIndex(Hl=>Hl.kind==="run-summary");br.splice($i>=0?$i+1:0,0,Hc)}return{...Re,activities:ys,lastActivityAt:$t,messages:br.slice(-160)}}))},It=je=>{const dt=String((je==null?void 0:je.source)||"runner"),ht=String((je==null?void 0:je.stream)||""),xt=String((je==null?void 0:je.eventType)||"event"),Re=String((je==null?void 0:je.text)||"").trim();if(!Re)return;const $t=`[${dt}${ht?`:${ht}`:""}] ${xt}
|
|
176
|
+
${Re}`;Dr(nn=>nn.map(Qt=>{if(Qt.id!==ee)return Qt;const Hn=[...Array.isArray(Qt.rawTrace)?Qt.rawTrace:[],$t].slice(-80),Vt=Array.isArray(Qt.messages)?Qt.messages:[],rn=Vt.findIndex(Qs=>Qs.kind==="raw"),or={role:"assistant",kind:"raw",text:Hn.join(`
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
`),at:Date.now()},ys=[...Vt];return rn>=0?ys[rn]=or:ys.push(or),{...Qt,rawTrace:Hn,messages:ys.slice(-160)}}))},rs=je=>{Dr(dt=>dt.map(ht=>ht.id===ee?{...ht,status:je,endedAt:Date.now()}:ht))},Oi=je=>{const dt=new Set,ht=String((je==null?void 0:je.nodeId)||"").trim();ht&&dt.add(ht);for(const xt of Array.isArray(je==null?void 0:je.displayNodeIds)?je.displayNodeIds:[]){const Re=String(xt||"").trim();Re&&dt.add(Re)}for(const xt of Array.isArray(je==null?void 0:je.touchedNodeIds)?je.touchedNodeIds:[]){const Re=String(xt||"").trim();Re&&dt.add(Re)}if(dt.size===0)for(const xt of Array.isArray(je==null?void 0:je.order)?je.order:[]){const Re=String(xt||"").trim();Re&&dt.add(Re)}return dt},zl=(je,dt=null)=>{const ht=zx(je||re,U),xt=new Map(ht.nodes.map(nn=>[nn.id,nn])),Re=ht.instances||{},$t=dt instanceof Set?dt:null;m(nn=>{const Qt=new Set(nn.map(Vt=>Vt.id)),Hn={...Kh(nn,b.current,E.current).instances||{}};for(const[Vt,rn]of Object.entries(Re)){if($t&&!$t.has(Vt)||!Qt.has(Vt))continue;const or=Hn[Vt];On((rn==null?void 0:rn.definitionId)||(or==null?void 0:or.definitionId))?Hn[Vt]=rn:Array.isArray(rn==null?void 0:rn.output)&&(Hn[Vt]={...or||rn,output:rn.output})}return E.current=Hn,R(Hn),nn.map(Vt=>{var or,ys,Qs;if($t&&!$t.has(Vt.id))return Vt;const rn=xt.get(Vt.id);return rn?On(((or=rn.data)==null?void 0:or.definitionId)||((ys=Vt.data)==null?void 0:ys.definitionId))?{...Vt,data:{...Vt.data,...rn.data}}:Array.isArray((Qs=rn.data)==null?void 0:Qs.outputs)?{...Vt,data:{...Vt.data,outputs:rn.data.outputs}}:Vt:Vt})})};for(;;){const{value:je,done:dt}=await Pe.read();if(dt)break;pt+=Oe.decode(je,{stream:!0});const ht=pt.split(`
|
|
181
|
+
`);pt=ht.pop()||"";for(const xt of ht){if(!xt.trim())continue;const Re=JSON.parse(xt);if(Re.type==="error")throw new Error(Re.error||"Workspace run failed");if(Re.type==="stopped"){Jr.current=!0,Qe=Array.isArray(Re.order)?Re.order:Qe,qe("运行停止",Re);continue}if(Re.type==="node-start"&&(Ee(`Running ${Re.nodeId}...`),Dt(Re.nodeId),xn(Re.nodeId,Re.definitionId,"running")),Re.type==="node-done"&&(er(Re.nodeId),xn(Re.nodeId,Re.definitionId,"done")),Re.type==="status"&&qe(Re.line||Re.message||"",Re),Re.type==="paused"&&(At=Array.isArray(Re.nodeIds)?Re.nodeIds:[],qe("运行暂停",Re)),Re.type==="natural"&&(Re.kind==="thinking"?wn(Re.text||""):Ft(Re.kind,Re.text||"")),Re.type==="raw"){const $t=_1(Re);$t&&wn($t),It(Re)}Re.type==="graph"&&Re.graph&&zl(Re.graph,Oi(Re)),Re.type==="done"&&(Re.graph&&zl(Re.graph,Oi(Re)),Qe=Array.isArray(Re.order)?Re.order:[],At=Array.isArray(Re.pauseNodeIds)?Re.pauseNodeIds:At,qe(At.length?"运行暂停":"运行完成",Re))}}if(pt.trim()){const je=JSON.parse(pt);if(je.type==="error")throw new Error(je.error||"Workspace run failed");if(je.type==="stopped"&&(Jr.current=!0,qe("运行停止",je)),je.type==="node-start"&&(Ee(`Running ${je.nodeId}...`),Dt(je.nodeId),xn(je.nodeId,je.definitionId,"running")),je.type==="node-done"&&(er(je.nodeId),xn(je.nodeId,je.definitionId,"done")),je.type==="status"&&qe(je.line||je.message||"",je),je.type==="paused"&&(At=Array.isArray(je.nodeIds)?je.nodeIds:[],qe("运行暂停",je)),je.type==="natural"&&(je.kind==="thinking"?wn(je.text||""):Ft(je.kind,je.text||"")),je.type==="raw"){const dt=_1(je);dt&&wn(dt),It(je)}je.type==="graph"&&je.graph&&zl(je.graph,Oi(je)),je.type==="done"&&(je.graph&&zl(je.graph,Oi(je)),Qe=Array.isArray(je.order)?je.order:[],At=Array.isArray(je.pauseNodeIds)?je.pauseNodeIds:At,qe(At.length?"运行暂停":"运行完成",je))}Jr.current&&(Gs(new Set),Cs(je=>{var ht;const dt=((ht=Object.entries(je).find(([,xt])=>(xt==null?void 0:xt.status)==="running"))==null?void 0:ht[0])||S;return dt?{...je,[dt]:{status:"stopped"}}:je})),Ee(Jr.current?`Workspace run stopped: ${S}`:At.length?`Workspace run paused at ${At.join(", ")}`:`Workspace run done: ${Qe.length?Qe.join(" -> "):S}`),rs(Jr.current?"stopped":At.length?"paused":"done"),Jr.current||await Gn()}catch(ve){if(Jr.current||(ve==null?void 0:ve.name)==="AbortError"){Gs(new Set),Cs(Pe=>{var pt;const Oe=((pt=Object.entries(Pe).find(([,Qe])=>(Qe==null?void 0:Qe.status)==="running"))==null?void 0:pt[0])||S;return Oe?{...Pe,[Oe]:{status:"stopped"}}:Pe}),Ee(`Workspace run stopped: ${S}`),Dr(Pe=>Pe.map(Oe=>Oe.id===ee?{...Oe,status:"stopped",endedAt:Date.now()}:Oe));return}Gs(new Set),Cs(Pe=>{var pt;const Oe=(pt=Object.entries(Pe).find(([,Qe])=>(Qe==null?void 0:Qe.status)==="running"))==null?void 0:pt[0];return Oe?{...Pe,[Oe]:{status:"failed"}}:Pe}),Ee(String(ve.message||ve)),Dr(Pe=>Pe.map(Oe=>Oe.id===ee?{...Oe,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(Oe.messages)?Oe.messages:[],{role:"assistant",error:!0,text:String(ve.message||ve),at:Date.now()}].slice(-160)}:Oe))}finally{qo.current===de&&(qo.current=null),Ko(""),Gs(new Set)}},[ms,y,i,Gn,f,U,Yt,Uo,bn,sr,v,m,Te]),Aa=h.useCallback(async()=>{try{const A=await(await fetch("/api/skills")).json().catch(()=>({})),V=Array.isArray(A.skills)?A.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):""})):[];jn(V),Ri(!0)}catch{Ri(!0)}},[]),gd=h.useCallback(async()=>{try{const A=await(await fetch("/api/mcps")).json().catch(()=>({})),V=Array.isArray(A.servers)?A.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):[];Ie(V)}catch{Ie([])}},[]);h.useEffect(()=>{Pa().catch(S=>Ee(String(S.message||S))),Il(),fetch("/api/model-lists").then(S=>S.json()).then(S=>Fo({cursor:Array.isArray(S.cursor)?S.cursor.map(String):[],opencode:Array.isArray(S.opencode)?S.opencode.map(String):[],claudeCode:Array.isArray(S.claudeCode)?S.claudeCode.map(String):[]})).catch(()=>{}),Aa(),gd(),lo(),fetch("/api/skill-collections").then(S=>S.json()).then(S=>{Ho(al(S)),me(!0)}).catch(()=>{}),fetch("/api/auth/me").then(S=>S.json()).then(S=>_c(S.user||null)).catch(()=>_c(null))},[Pa,Il,gd,Aa,lo,gs]),h.useEffect(()=>{if(Lp(""),!(!Ys||!K)){if(!gs){Gr([]);return}Gr(dP(gs,"workspace",dr,Or)),Lp(gs)}},[Or,K,dr,Ys,gs]),h.useEffect(()=>{if(!(_a!==gs||!gs))try{localStorage.setItem(gs,JSON.stringify(sr))}catch{}},[sr,gs,_a]),h.useEffect(()=>{E.current=P},[P]),h.useEffect(()=>{g.current=f},[f]),h.useEffect(()=>{const S=O.current,A=new Map,V=[];for(const ee of f){const ce=y2(ee);A.set(ee.id,ce),S.get(ee.id)!==ce&&V.push(ee.id)}if(O.current=A,V.length===0)return;const G=()=>V.forEach(ee=>s(ee)),Q=window.requestAnimationFrame(G),re=window.setTimeout(G,80);return()=>{window.cancelAnimationFrame(Q),window.clearTimeout(re)}},[f,s]),h.useEffect(()=>{b.current=y},[y]),h.useEffect(()=>{_.current=x},[x]),h.useEffect(()=>{H.current=C},[C]),h.useEffect(()=>{$o.current=ft},[ft]),h.useEffect(()=>{Ks.current=qn},[qn]),h.useEffect(()=>{M.current=I},[I]),h.useEffect(()=>{if(!I)return;const S=V=>{V.key==="Escape"&&z(null)},A=V=>{var G,Q;(Q=(G=V.target)==null?void 0:G.closest)!=null&&Q.call(G,".af-connect-node-menu")||z(null)};return document.addEventListener("keydown",S),document.addEventListener("pointerdown",A),()=>{document.removeEventListener("keydown",S),document.removeEventListener("pointerdown",A)}},[I]),h.useEffect(()=>{if(J.current&&Te)return Z.current&&window.clearTimeout(Z.current),Z.current=window.setTimeout(()=>{bn().catch(S=>Ee(String(S.message||S)))},650),()=>{Z.current&&window.clearTimeout(Z.current)}},[f,y,x,bn,Te]);const gi=h.useCallback((S,A)=>{if(!Te){Ee("Readonly workspace");return}const V=lY(A),G=de=>Array.isArray(de)?de.map(ve=>(ve==null?void 0:ve.name)!=="skillKeys"&&(ve==null?void 0:ve.name)!=="skillsContext"&&(ve==null?void 0:ve.type)!=="text"?ve:{...ve,default:V,value:V}):[],Q=f.map(de=>{var ve;return de.id!==S?de:{...de,data:{...de.data,body:V,inputs:G((ve=de.data)==null?void 0:ve.inputs)}}}),re=E.current||{},ee=re[S]&&typeof re[S]=="object"?re[S]:{},ce={...re,[S]:{...ee,body:V,input:G(ee.input)}};E.current=ce,m(Q),R(ce),Lr(de=>!de||de.id!==S?de:{...de,body:V,inputs:G(de.inputs)}),bn(Q,y).catch(de=>Ee(String(de.message||de)))},[y,f,bn,m,Te]),$p=h.useCallback((S,A)=>{if(!Te){Ee("Readonly workspace");return}const V=uY(A),G=de=>Array.isArray(de)?de.map(ve=>(ve==null?void 0:ve.name)!=="serverNames"&&(ve==null?void 0:ve.name)!=="mcpContext"&&(ve==null?void 0:ve.type)!=="text"?ve:{...ve,default:V,value:V}):[],Q=f.map(de=>{var ve;return de.id!==S?de:{...de,data:{...de.data,body:V,inputs:G((ve=de.data)==null?void 0:ve.inputs)}}}),re=E.current||{},ee=re[S]&&typeof re[S]=="object"?re[S]:{},ce={...re,[S]:{...ee,body:V,input:G(ee.input)}};E.current=ce,m(Q),R(ce),Lr(de=>!de||de.id!==S?de:{...de,body:V,inputs:G(de.inputs)}),bn(Q,y).catch(de=>Ee(String(de.message||de)))},[y,f,bn,m,Te]),co=h.useCallback(S=>{const A=String(S||"").trim();A&&(jl(V=>V===A?"":A),hi(V=>({...V,[A]:V[A]||{sessionId:`nodechat_${Date.now()}_${A.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),Ia=h.useCallback((S,A)=>{const V=String(S||"").trim();V&&hi(G=>({...G,[V]:{...G[V]||{sessionId:`nodechat_${Date.now()}_${V.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(A||""),error:""}}))},[]),Zr=h.useCallback((S,A,V="replace",G={})=>{var Dt,er;if(!Te){Ee("Readonly workspace");return}const Q=String(S||"").trim();if(!Q)return;const re=g.current.find(Ft=>Ft.id===Q),ee=On((Dt=re==null?void 0:re.data)==null?void 0:Dt.definitionId),ce=pa(A),de=ee==="html"?id(ce):String(ce||""),ve=re?ac(re.data):"",Pe=V==="append"&&String(ve||"").trim()?`${String(ve).replace(/\s+$/g,"")}
|
|
182
|
+
|
|
183
|
+
${de.trim()}`:de,Oe=ee==="image"?"src":"content",pt=G!=null&&G.reloadDisplay?Date.now():(er=re==null?void 0:re.data)==null?void 0:er.displayReloadKey,Qe=Ft=>{let wn=!1;return(Array.isArray(Ft)?Ft:[]).map(It=>{const rs=String((It==null?void 0:It.name)||""),Oi=String((It==null?void 0:It.type)||"");return rs===Oe||rs==="filePath"||Oi==="text"?wn?{...It,default:"",value:""}:(wn=!0,{...It,default:Pe,value:Pe}):It})},At=g.current.map(Ft=>{var wn,qe;return Ft.id!==Q?Ft:{...Ft,data:{...Ft.data,body:Pe,...pt?{displayReloadKey:pt}:{},inputs:Qe((wn=Ft.data)==null?void 0:wn.inputs),outputs:Qe((qe=Ft.data)==null?void 0:qe.outputs)}}}),Rn=E.current||{},Pr=Rn[Q]&&typeof Rn[Q]=="object"?Rn[Q]:{},xn={...Rn,[Q]:{...Pr,body:Pe,input:Qe(Pr.input),output:Qe(Pr.output)}};E.current=xn,m(At),R(xn),Lr(Ft=>(Ft==null?void 0:Ft.id)===Q?{...Ft,body:Pe}:Ft),(G==null?void 0:G.logChat)!==!1&&hi(Ft=>{var wn;return{...Ft,[Q]:{...Ft[Q]||{},candidateContent:"",messages:[...(wn=Ft[Q])!=null&&wn.messages&&Array.isArray(Ft[Q].messages)?Ft[Q].messages:[],{role:"assistant",text:V==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),bn(At,b.current).catch(Ft=>Ee(String(Ft.message||Ft))),Ee(String((G==null?void 0:G.statusMessage)||"")||(V==="append"?"已追加节点内容":"已替换节点内容"))},[bn,m,Te]),Tc=h.useCallback(async S=>{if(!Te)return Ee("Readonly workspace"),"";if(!wg(S))return Ee("请选择图片文件"),"";try{const A=new FormData;A.set("file",S),A.set("dir","img"),i.flowId&&A.set("flowId",i.flowId),i.flowSource&&A.set("flowSource",i.flowSource),i.archived&&A.set("archived","1");const V=await fetch("/api/workspace/upload",{method:"POST",body:A}),G=await V.json().catch(()=>({}));if(!V.ok)throw new Error(G.error||"上传图片失败");const Q=String(G.path||"").trim();if(!Q)throw new Error("上传图片失败:未返回路径");return await Gn(),Xt(re=>{const ee=new Set(re);for(const ce of qh(Q))ee.delete(ce);return ee}),Ee(`已上传图片 ${Q}`),Q}catch(A){return Ee(String(A.message||A)),""}},[i,Gn,Te]),Rl=h.useCallback(async(S,A)=>{const V=String(S||"").trim();if(!V)return;const G=await Tc(A);G&&Zr(V,G,"replace",{logChat:!1,statusMessage:`已上传图片 ${G}`})},[Zr,Tc]),Dp=h.useCallback((S,A="replace")=>{var Q;const V=String(S||"").trim(),G=String(((Q=Wo[V])==null?void 0:Q.candidateContent)||"").trim();!V||!G||Zr(V,G,A)},[Wo,Zr]),yd=h.useCallback(async(S,A=void 0)=>{var At,Rn,Pr;if(!Te){Ee("Readonly workspace");return}const V=String(S||"").trim();if(!V)return;const G=Wo[V]||{},Q=String(A!==void 0?A:G.draft||"").trim();if(!Q||G.running)return;const re=g.current.find(xn=>xn.id===V);if(!re)return;const ee=On((At=re.data)==null?void 0:At.definitionId)||"markdown",ce=ac(re.data);let de=Xu(ce,ee),ve=pa(ce);if(de)try{ve=await Ju(i,de)}catch(xn){Ee(String(xn.message||xn))}else if(ee!=="image"&&String(ve||"").trim()){const xn=tc(ee,ve);if(xn){Ee(`${xn} 未进入微调。`);return}try{const Dt=await Bb(i,M1(V,re.data),ve);await Gn(),Zr(V,Dt,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已将展示保存为 ${Dt}`}),de=Dt,ve=""}catch(Dt){Ee(String(Dt.message||Dt));return}}const Pe=$q(V,g.current,b.current),Oe={role:"user",text:Q,at:Date.now()},pt=Array.isArray(G.messages)?G.messages:[],Qe=G.sessionId||`nodechat_${Date.now()}_${V.replace(/[^a-z0-9_-]+/gi,"_")}`;hi(xn=>({...xn,[V]:{...G,sessionId:Qe,messages:[...pt,Oe],draft:"",running:!0,error:""}}));try{const xn=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,sessionId:Qe,node:{id:V,label:((Rn=re.data)==null?void 0:Rn.label)||V,definitionId:((Pr=re.data)==null?void 0:Pr.definitionId)||""},nodeKind:ee,currentContent:de?"":ve,sourceContext:Pe,targetFilePath:de,messages:pt,message:Q,model:ms})}),Dt=await xn.json().catch(()=>({}));if(!xn.ok)throw new Error(Dt.error||"节点微调失败");const er=String(Dt.candidateContent||Dt.reply||"").trim(),Ft=!!Dt.directFileEdit,wn=String(Dt.artifactPath||de||"").trim();if(Ft&&wn){const qe=tc(ee,er);if(qe)throw new Error(`${qe} 文件已由 agent 修改,请检查 ${wn}。`);await Gn(),Zr(V,wn,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已按微调描述更新 ${wn}`})}else if(er){const qe=tc(ee,er);if(qe)throw new Error(`${qe} 已取消写入,避免覆盖当前展示文件。`);if(de){const It=await Bb(i,de,er);await Gn(),Zr(V,It,"replace",{logChat:!1,statusMessage:`已按微调描述更新 ${It}`})}else Zr(V,er,"replace",{logChat:!1,statusMessage:"已按微调描述更新展示内容"})}hi(qe=>{var It;return{...qe,[V]:{...qe[V]||{},sessionId:String(Dt.sessionId||Qe),running:!1,candidateContent:"",messages:[...(It=qe[V])!=null&&It.messages&&Array.isArray(qe[V].messages)?qe[V].messages:[...pt,Oe],{role:"assistant",text:er||Ft?wn?`已更新文件 ${wn}。`:"已按你的描述更新当前展示。":"没有生成可更新的内容。",at:Date.now()}]}}})}catch(xn){const Dt=String(xn.message||xn);hi(er=>({...er,[V]:{...er[V]||{},running:!1,error:Dt}})),Ee(Dt)}},[ms,i,Gn,Wo,Zr,Te]),Fp=h.useCallback(async(S,A)=>{if(!Te){Ee("Readonly workspace");return}const V=On(A==null?void 0:A.definitionId)||"markdown",G=ac(A),Q=Xu(G,V);let re=pa(G);if(Q)try{re=await Ju(i,Q)}catch(ve){Ee(String(ve.message||ve));return}if(!String(re||"").trim()){Ee("展示节点没有可保存内容");return}const ee=tc(V,re);if(ee){Ee(`${ee} 未保存文件。`);return}const ce=M1(S,A),de=window.prompt("保存到 workspace 相对路径",ce);if(de)try{const ve=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:de,content:re})}),Pe=await ve.json().catch(()=>({}));if(!ve.ok)throw new Error(Pe.error||"保存文件失败");const Oe=Pe.path||de,pt=wo(i);pt.set("path",Oe);const Qe=await fetch(`/api/workspace/file?${pt.toString()}`);if(!Qe.ok){const At=await Qe.json().catch(()=>({}));throw new Error(At.error||`保存后读取失败:${Oe}`)}await Gn(),lt(At=>iY(At,Oe,String(re||"").length)),Xt(At=>{const Rn=new Set(At);for(const Pr of qh(Oe))Rn.delete(Pr);return Rn}),Zr(S,Oe,"replace",{logChat:!1,statusMessage:`已保存并引用 ${Oe}`}),Ee(`已保存 ${Oe}`)}catch(ve){Ee(String(ve.message||ve))}},[i,Gn,Zr,Te]),zp=h.useCallback(async S=>{var Q,re,ee,ce;const A=String(S||"").trim();if(!A||fn)return;const V=g.current.find(de=>de.id===A);if(!V||!On((Q=V==null?void 0:V.data)==null?void 0:Q.definitionId)){Ee("展示节点不可用");return}Tn(A),_t("");const G=window.open("","_blank");try{await bn(g.current,b.current);const de=String(((re=V.data)==null?void 0:re.label)||((ee=V.data)==null?void 0:ee.displayName)||A).trim()||"AgentFlow Display",ve=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:de,layout:"single",nodeIds:[A]})}),Pe=await ve.json().catch(()=>({}));if(!ve.ok||Pe.ok===!1)throw new Error(Pe.error||"生成展示链接失败");const Oe=new URL(Pe.url||`/display/${((ce=Pe.share)==null?void 0:ce.id)||""}`,window.location.origin).href;dn({...Pe,absoluteUrl:Oe}),Me(""),Ee("已生成 1 天有效的展示链接"),G?G.location.href=Oe:window.location.assign(Oe)}catch(de){G&&G.close();const ve=String(de.message||de);_t(ve),Ee(ve)}finally{Tn("")}},[i,bn,fn]),Hp=h.useCallback((S,A)=>{const V=String(S||"");V&&Lr(G=>{if(!G||G.id!==V)return G;const Q=typeof A=="function"?A(G):A;return!Q||typeof Q!="object"?G:{...G,...Q}})},[]),es=h.useMemo(()=>f.map(S=>{var A,V;return{...S,data:{...S.data,selected:S.selected===!0,modelLists:js,showBodyPreview:!0,isExecuting:_l.has(S.id),nodeStatus:((A=Qr[S.id])==null?void 0:A.status)??null,nodeElapsed:((V=Qr[S.id])==null?void 0:V.elapsed)??null,flowParams:i,readOnly:!Te,onRunWorkspaceNode:md,onStopWorkspaceNode:Op,runningRunNodeId:Uo,skills:dr,skillCollections:Or,onChangeLoadSkillKeys:gi,onRefreshSkills:Aa,mcpServers:De,onChangeLoadMcpNames:$p,onRefreshMcps:gd,onSaveDisplayNodeToFile:Fp,onShareDisplayNode:zp,sharingDisplayNodeId:fn,onUploadWorkspaceImage:Tc,onUploadImageToDisplayNode:Rl,onStatus:Ee,nodeChatActive:ja===S.id,nodeChat:Wo[S.id]||null,onSetDisplayNodeContent:Zr,onToggleNodeChat:co,onCloseNodeChat:()=>jl(""),onUpdateNodeChatDraft:Ia,onSendNodeChat:yd,onApplyNodeChatCandidate:Dp,onSyncNodePropDraft:Hp}}}),[ja,Dp,$p,gi,i,De,js,Wo,f,gd,Aa,md,Uo,Fp,yd,Zr,zp,fn,Or,dr,Op,Hp,co,Ia,Rl,Tc,_l,Qr,Te]),Rc=h.useMemo(()=>new Map(es.map(S=>[S.id,S])),[es]),Yo=h.useMemo(()=>{const S=new Set(L);return x.nodeIds.map((A,V)=>{var ce;const G=Rc.get(A);if(!G||!On((ce=G.data)==null?void 0:ce.definitionId))return null;const Q=eu(G)||{width:520,height:320},re=Pu(x.nodeSizes[A]||Q,{display:!0})||Q,ee=x.nodePositions[A]||{x:180+V*36,y:120+V*28};return{...G,id:R1(A),position:ee,selected:S.has(A),width:re.width,height:re.height,data:{...G.data,sourceNodeId:A,displayPageMode:!0,readOnly:!0,selected:S.has(A),displaySize:re,nodeSize:re}}}).filter(Boolean)},[x,Rc,L]),Go=h.useMemo(()=>es.filter(S=>{var A;return On((A=S==null?void 0:S.data)==null?void 0:A.definitionId)}),[es]),yt=a==="display";h.useEffect(()=>{if(!yt||!x.viewport)return;const S=x.viewport,A=()=>{try{r.setViewport(S,{duration:0})}catch{}},V=window.requestAnimationFrame(()=>window.requestAnimationFrame(A));return()=>window.cancelAnimationFrame(V)},[x.viewport,yt,r]),h.useEffect(()=>{if(yt||!C)return;const S=C,A=()=>{try{r.setViewport(S,{duration:0})}catch{}},V=window.requestAnimationFrame(()=>window.requestAnimationFrame(A));return()=>window.cancelAnimationFrame(V)},[yt,r,C]),h.useEffect(()=>{const S=D.current,A=new Map,V=[];for(const ee of[...es,...Yo]){const ce=Tq(ee);A.set(ee.id,ce),S.get(ee.id)!==ce&&V.push(ee.id)}if(D.current=A,V.length===0)return;const G=()=>V.forEach(ee=>s(ee)),Q=window.requestAnimationFrame(G),re=window.setTimeout(G,80);return()=>{window.cancelAnimationFrame(Q),window.clearTimeout(re)}},[Yo,es,s]);const an=h.useMemo(()=>f.find(S=>S.id===qn)||null,[f,qn]),Ta=h.useRef({id:"",draft:null}),Bp=h.useMemo(()=>{const S=O1(an);return S?JSON.stringify(S):""},[an]);h.useEffect(()=>{if(!an){Ta.current={id:"",draft:null},Lr(null),Mt("");return}const S=O1(an),A=Ta.current;Ta.current={id:an.id,draft:S},Lr(V=>!V||V.id!==an.id||A.id!==an.id||!A.draft?S:pY(V,A.draft,S)),Mt("")},[an==null?void 0:an.id,Bp]);const Lc=h.useCallback((S=!1)=>{if(!ft||!an)return!1;if(!Te)return Mt("Readonly workspace"),Ee("Readonly workspace"),!1;Mt("");const A=D1({nodes:f,edges:y,instances:E.current,selectedNode:an,draft:ft,allowRename:S});return A!=null&&A.error?(Mt(A.error),!1):(!(A!=null&&A.ok)||!A.changed||(E.current=A.instances,R(A.instances),m(A.nodes),v(A.edges),A.nextId!==an.id&&cr(A.nextId),Yt(A.nextId)),!0)},[y,ft,f,an,v,m,Yt,Te]);h.useEffect(()=>{if(!Te||!ft||!an)return;const S=window.setTimeout(()=>{Lc(!1)},350);return()=>window.clearTimeout(S)},[ft==null?void 0:ft.label,ft==null?void 0:ft.role,ft==null?void 0:ft.model,ft==null?void 0:ft.body,JSON.stringify((ft==null?void 0:ft.images)||[]),ft==null?void 0:ft.script,JSON.stringify((ft==null?void 0:ft.inputs)||[]),JSON.stringify((ft==null?void 0:ft.outputs)||[]),Lc,an==null?void 0:an.id,Te]);const Mc=h.useMemo(()=>{const S=new Map(es.map(A=>[A.id,A]));return y.map(A=>{var ve,Pe,Oe,pt;const V=S.get(A.source),G=S.get(A.target),Q=/^output-(\d+)$/.exec(A.sourceHandle||""),re=/^input-(\d+)$/.exec(A.targetHandle||""),ee=V&&Q?(Pe=(ve=V.data)==null?void 0:ve.outputs)==null?void 0:Pe[parseInt(Q[1],10)]:null,ce=G&&re?(pt=(Oe=G.data)==null?void 0:Oe.inputs)==null?void 0:pt[parseInt(re[1],10)]:null,de=ee!=null&&ee.type?rr(ee.type):ce!=null&&ce.type?rr(ce.type):"";return de?{...A,style:{...A.style||{},stroke:de,strokeWidth:2},markerEnd:{type:Hs.ArrowClosed,color:de}}:A})},[y,es]),Xo=yt?Yo:es,Oc=yt?[]:Mc,Xs=h.useMemo(()=>yt?Yo.map(S=>({...S,id:Hx(S.id)})):es,[Yo,es,yt]),yi=h.useCallback(S=>{const A=String(S||"").trim();if(!A)return;const V=yt?R1(A):A;yt?F([A]):(m(Q=>Q.map(re=>({...re,selected:re.id===V}))),v(Q=>Q.map(re=>({...re,selected:!1}))),cr(V));const G=()=>{var ve,Pe,Oe;const Q=r.getNode(V);if(!Q)return;const re=(ve=r.getInternalNode)==null?void 0:ve.call(r,V),ee=((Pe=re==null?void 0:re.measured)==null?void 0:Pe.width)??(re==null?void 0:re.width)??Q.width??260,ce=((Oe=re==null?void 0:re.measured)==null?void 0:Oe.height)??(re==null?void 0:re.height)??Q.height??120,{zoom:de}=r.getViewport();r.setCenter(Q.position.x+ee/2,Q.position.y+ce/2,{zoom:Lq(de),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(G))},[yt,r,v,m]),xr=h.useCallback(()=>{const S=r.getViewport(),A={x:Number(S.x)||0,y:Number(S.y)||0,zoom:Math.min(Math.max(Number(S.zoom)||1,.1),4)};if(yt){const V={..._.current,viewport:A};_.current=V,N(V),Ee("已固定 Display 进入视角")}else H.current=A,T(A),Ee("已固定 Workspace 进入视角");bn(g.current,b.current).catch(V=>Ee(String(V.message||V)))},[yt,r,bn]),xi=h.useMemo(()=>{const S=pe.trim().toLowerCase(),A={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const V of U)S&&![V.id,V.label,V.displayName,V.description].some(G=>String(G||"").toLowerCase().includes(S))||A[nf(V)].push(V);for(const V of Zc)A[V].sort((G,Q)=>G.id.localeCompare(Q.id));return A},[U,pe]),Es=h.useMemo(()=>{const S=ds.trim().toLowerCase();return U.filter(A=>!S||[A.id,A.label,A.displayName,A.description].some(V=>String(V||"").toLowerCase().includes(S))).sort((A,V)=>{const G=Zc.indexOf(nf(A)),Q=Zc.indexOf(nf(V));return G!==Q?G-Q:rf(A).localeCompare(rf(V))}).slice(0,30)},[U,ds]),Ra=h.useMemo(()=>{const S=ds.trim().toLowerCase();return Se.filter(A=>!S||[A.id,A.version,A.displayName,A.name,A.description,...Array.isArray(A.tags)?A.tags:[]].some(V=>String(V||"").toLowerCase().includes(S))).sort((A,V)=>String(A.displayName||A.name||A.id).localeCompare(String(V.displayName||V.name||V.id))).slice(0,30)},[Se,ds]);h.useEffect(()=>{fs(0)},[ds,rt,Wt]),h.useEffect(()=>{if(!rt)return;const S=window.setTimeout(()=>{var A;return(A=fi.current)==null?void 0:A.focus()},0);return()=>window.clearTimeout(S)},[rt]);const Wp=h.useMemo(()=>{const S=Yn.trim().toLowerCase();return S?S2(ur).filter(A=>A.path.toLowerCase().includes(S)):ur},[Yn,ur]),$c=[...(js.cursor||[]).map(S=>({label:`Cursor · ${S.split(" - ")[0]}`,value:`cursor:${S.split(" - ")[0]}`})),...(js.opencode||[]).map(S=>({label:`OpenCode · ${S.split(" - ")[0]}`,value:`opencode:${S.split(" - ")[0]}`})),...(js.claudeCode||[]).map(S=>({label:`Claude · ${S.split(" - ")[0]}`,value:`claude-code:${S.split(" - ")[0]}`}))],Ll=h.useMemo(()=>new Set(sr),[sr]),gn=h.useMemo(()=>{const S=new Map(dr.map(re=>[re.key,re])),A=new Set,V=new Set,G=Or.map(re=>{const ee=pl(re,dr).map(ce=>S.get(ce)).filter(Boolean);for(const ce of ee)A.add(ce.key),V.add(String(ce.name||ce.id||ce.key||"").trim());return{...re,skills:ee}}).filter(re=>re.skills.length>0),Q=dr.filter(re=>{const ee=String(re.name||re.id||re.key||"").trim();return!A.has(re.key)&&!V.has(ee)});return{groups:G,ungrouped:Q}},[Or,dr]);h.useEffect(()=>{di(S=>{let A=!1;const V=new Set(S);for(const G of gn.groups)V.has(G.id)||(V.add(G.id),A=!0);return A?V:S})},[gn.groups]);const Pt=h.useMemo(()=>{const S=f.filter(A=>A.selected);return S.length>0?S:qn?f.filter(A=>A.id===qn):[]},[f,qn]),uo=h.useMemo(()=>Pt.map(S=>S.id),[Pt]),fo=h.useMemo(()=>f.filter(S=>{var A;return On((A=S==null?void 0:S.data)==null?void 0:A.definitionId)}),[f]),Jo=h.useMemo(()=>Pt.filter(S=>{var A;return On((A=S==null?void 0:S.data)==null?void 0:A.definitionId)}).map(S=>S.id),[Pt]),Vp=h.useMemo(()=>{const S=String((yr==null?void 0:yr.username)||(yr==null?void 0:yr.userId)||"").trim();return S?S.slice(0,1).toUpperCase():"?"},[yr]),kt=h.useMemo(()=>new Set(uo),[uo]),Ml=h.useMemo(()=>y.filter(S=>kt.has(S.source)&&kt.has(S.target)),[y,kt]),Dc=h.useCallback(S=>{const A=S==="display"?"display":"workspace";l(A),cr(""),F([]),z(null),Tt(!1),vt(!1);const V=wo(i);A==="display"&&V.set("view","display");const G=`/workspace${V.toString()?`?${V.toString()}`:""}`;window.history.pushState({},"",G)},[i]),Ol=h.useCallback(S=>{var G;const A=String(S||"").trim();if(!A)return;const V=g.current.find(Q=>Q.id===A);if(!V||!On((G=V.data)==null?void 0:G.definitionId)){Ee("展示节点不可用");return}N(Q=>{if(Q.nodeIds.includes(A))return Q;const re=Q.nodeIds.length,ee=eu(V);return{nodeIds:[...Q.nodeIds,A],nodePositions:{...Q.nodePositions,[A]:{x:180+re*36,y:120+re*28}},nodeSizes:{...Q.nodeSizes,...ee?{[A]:ee}:{}}}}),F([A])},[]),$l=h.useCallback(S=>{const A=String(S||"").trim();A&&(N(V=>{const G=V.nodeIds.filter(ee=>ee!==A),Q={...V.nodePositions},re={...V.nodeSizes};return delete Q[A],delete re[A],{nodeIds:G,nodePositions:Q,nodeSizes:re}}),F(V=>V.filter(G=>G!==A)))},[]),xd=h.useCallback(S=>{const A=String(S||"").trim();A&&(_.current.nodeIds.includes(A)?$l(A):Ol(A))},[Ol,$l]),La=h.useMemo(()=>{const S=ae.trim().toLowerCase();return S?Go.filter(A=>{var V,G;return[A.id,(V=A.data)==null?void 0:V.label,(G=A.data)==null?void 0:G.definitionId].filter(Boolean).some(Q=>String(Q).toLowerCase().includes(S))}):Go},[Go,ae]),Fc=h.useMemo(()=>{const S=La.length,A=S<=1?1:S<=4?2:3,V=Array.from({length:A},()=>({height:0,nodes:[]}));for(const G of La){const Q=eu(G)||{width:420,height:260},re=Math.max(1,Number(Q.width)||420),ee=Math.max(1,Number(Q.height)||260),ce=Math.min(26,Math.max(5.5,ee/re*16))+3.2;let de=V[0];for(const ve of V)ve.height<de.height&&(de=ve);de.nodes.push(G),de.height+=ce}return V.map(G=>G.nodes)},[La]),vy=h.useCallback(S=>{var re,ee;const A=x.nodeIds.includes(S.id),V=eu(S)||{width:420,height:260},G=Math.max(1,Math.round(Number(V.width)||420)),Q=Math.max(1,Math.round(Number(V.height)||260));return o.jsxs("button",{type:"button",className:"af-display-picker-card"+(A?" af-display-picker-card--selected":""),style:{"--af-display-picker-card-ratio":`${G} / ${Q}`},onClick:()=>xd(S.id),children:[o.jsx("span",{className:"af-display-picker-card__check","aria-hidden":!0,children:o.jsx("input",{type:"checkbox",checked:A,readOnly:!0,tabIndex:-1})}),o.jsx("span",{className:"af-display-picker-card__preview",children:o.jsx(Gq,{node:S})}),o.jsxs("span",{className:"af-display-picker-card__meta",children:[o.jsx("strong",{children:((re=S.data)==null?void 0:re.label)||S.id}),o.jsxs("small",{children:[On((ee=S.data)==null?void 0:ee.definitionId)," · ",S.id]})]})]},S.id)},[x.nodeIds,xd]),wd=h.useMemo(()=>{const S=pe.trim().toLowerCase();return S?Se.filter(A=>[A.id,A.version,A.displayName,A.name,A.description,...Array.isArray(A.tags)?A.tags:[]].filter(Boolean).some(V=>String(V).toLowerCase().includes(S))):Se},[Se,pe]),bd=h.useCallback((S,A)=>{const V=String(S||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let G=`${V}_${Date.now().toString(36)}`,Q=2;for(;A.has(G);)G=`${V}_${Date.now().toString(36)}_${Q}`,Q+=1;return A.add(G),G},[]),fr=h.useCallback((S,A)=>{var Ft,wn;if(!Te){Ee("Readonly workspace");return}const V=S!=null&&S.snippet&&typeof S.snippet=="object"?S.snippet:{},G=V.instances&&typeof V.instances=="object"?V.instances:{},Q=Object.keys(G);if(Q.length===0)return;const re=new Set(g.current.map(qe=>qe.id)),ee={};for(const qe of Q)ee[qe]=bd(qe,re);const ce=(Ft=V.ui)!=null&&Ft.nodePositions&&typeof V.ui.nodePositions=="object"?V.ui.nodePositions:{},de=(wn=V.ui)!=null&&wn.nodeSizes&&typeof V.ui.nodeSizes=="object"?V.ui.nodeSizes:{},ve=Q.map(qe=>{const It=ce[qe];return{id:qe,x:typeof(It==null?void 0:It.x)=="number"?It.x:0,y:typeof(It==null?void 0:It.y)=="number"?It.y:0}}),Pe=Math.min(...ve.map(qe=>qe.x)),Oe=Math.min(...ve.map(qe=>qe.y));let pt=A||{x:360+g.current.length*24,y:180+g.current.length*18};if(!A){const qe=document.querySelector(".af-workspace-canvas .react-flow");if(qe){const It=qe.getBoundingClientRect();pt=r.screenToFlowPosition({x:It.left+It.width*.48,y:It.top+It.height*.32})}}const Qe={},At={},Rn={};for(const qe of ve){const It=ee[qe.id];Qe[It]={...G[qe.id]||{}},At[It]={x:pt.x+(qe.x-Pe),y:pt.y+(qe.y-Oe)};const rs=de[qe.id];typeof(rs==null?void 0:rs.width)=="number"&&typeof(rs==null?void 0:rs.height)=="number"&&(Rn[It]={width:rs.width,height:rs.height})}const Pr=new Set(Q),xn=(Array.isArray(V.edges)?V.edges:[]).filter(qe=>Pr.has(qe==null?void 0:qe.source)&&Pr.has(qe==null?void 0:qe.target)).map(qe=>({source:ee[qe.source],target:ee[qe.target],sourceHandle:qe.sourceHandle??null,targetHandle:qe.targetHandle??null})),Dt=zx({instances:Qe,edges:xn,ui:{nodePositions:At,nodeSizes:Rn}},U),er=Dt.nodes.map(qe=>({...qe,selected:!0}));E.current={...E.current,...Dt.instances},R(E.current),m(qe=>[...qe.map(It=>({...It,selected:!1})),...er]),v(qe=>[...qe.map(It=>({...It,selected:!1})),...Dt.edges]),Ee(`已添加流程片段:${S.displayName||S.id}`)},[bd,U,r,v,m,Te]),Up=h.useCallback(()=>{var V,G;if(Pt.length<2){Ve("请先在 workspace 画布上选择至少两个节点。"),le("flows");return}const S=Pt[0],A=Pt.length===2?`${((V=S.data)==null?void 0:V.label)||S.id} 片段`:`${((G=S.data)==null?void 0:G.label)||S.id} 等 ${Pt.length} 个节点`;ze({name:A,id:A.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),Bt(""),We(!0),le("flows")},[Pt]),wi=h.useCallback(async()=>{var Q,re;if(Pt.length<2)return;const S=ot.name.trim();if(!S){Bt("请填写片段名称。");return}const A={},V={};for(const ee of Pt){A[ee.id]={x:((Q=ee.position)==null?void 0:Q.x)||0,y:((re=ee.position)==null?void 0:re.y)||0};const ce=eu(ee);ce&&(V[ee.id]=ce)}const G=Ml.map(ee=>({source:ee.source,target:ee.target,sourceHandle:ee.sourceHandle??null,targetHandle:ee.targetHandle??null}));ln(!0),Bt("");try{const ee=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:ot.id,name:S,displayName:S,version:"1.0.0",description:ot.description,snippet:{instances:Cp(Pt,E.current),edges:G,ui:{nodePositions:A,nodeSizes:V}}})}),ce=await ee.json().catch(()=>({}));if(!ee.ok||ce.ok===!1)throw new Error(ce.error||"发布流程片段失败");We(!1),Ee(`流程片段已发布:${ce.id||S}`),Ze(`流程片段已发布:${ce.id||S}`),await Il(),le("flows")}catch(ee){Bt(String(ee.message||ee))}finally{ln(!1)}},[Il,ot,Ml,Pt,Ze]);h.useCallback(()=>{if(fo.length===0){Ee("当前 workspace 没有 display 节点");return}const S=Jo.length>0?Jo:fo.map(V=>V.id),A=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display";Un({title:A,layout:"gallery",nodeIds:S}),_t(""),dn(null),Ne(!0)},[i.flowId,Jo,fo]);const bi=h.useCallback(S=>{Un(A=>{const V=Array.isArray(A.nodeIds)?A.nodeIds:[];return V.includes(S)?{...A,nodeIds:V.filter(G=>G!==S)}:{...A,nodeIds:[...V,S]}})},[]),Kp=h.useCallback(async()=>{var V;const S=on.title.trim(),A=Array.isArray(on.nodeIds)?on.nodeIds:[];if(A.length===0){_t("请选择至少一个 display 节点。");return}nt(!0),_t(""),dn(null);try{await bn(f,y);const G=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:S,layout:on.layout,nodeIds:A})}),Q=await G.json().catch(()=>({}));if(!G.ok||Q.ok===!1)throw new Error(Q.error||"发布展示页失败");const re=new URL(Q.url||`/display/${((V=Q.share)==null?void 0:V.id)||""}`,window.location.origin).href;dn({...Q,absoluteUrl:re}),Ee("展示页已生成")}catch(G){_t(String(G.message||G))}finally{nt(!1)}},[on,y,i,f,bn]),Ma=h.useCallback(async()=>{var A;const S=Array.isArray(x.nodeIds)?x.nodeIds:[];if(S.length===0){_t("请先添加至少一个展示节点。"),Ee("请先添加至少一个展示节点"),vt(!0);return}nt(!0),_t("");try{await bn(f,y);const V=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display",G=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:V,layout:"canvas",nodeIds:S})}),Q=await G.json().catch(()=>({}));if(!G.ok||Q.ok===!1)throw new Error(Q.error||"生成展示链接失败");const re=new URL(Q.url||`/display/${((A=Q.share)==null?void 0:A.id)||""}`,window.location.origin).href;dn({...Q,absoluteUrl:re}),Nr(!0),Ee("展示链接已生成")}catch(V){const G=String(V.message||V);_t(G),Ee(G)}finally{nt(!1)}},[x.nodeIds,y,i,f,bn]),vd=h.useCallback(async()=>{const S=st==null?void 0:st.absoluteUrl;if(!S)return;const A=await Mq(S);Me(A?"copied":"failed"),window.setTimeout(()=>Me(""),1600)},[st==null?void 0:st.absoluteUrl]),Dl=h.useCallback(S=>{m(A=>A.map(V=>V.id===S?{...V,selected:!1}:V)),cr(A=>A===S?"":A)},[m]),Qo=h.useCallback(()=>{const S=Nc.current;if(!S)return;const A=S.getBoundingClientRect(),V=Math.min(420,Math.max(320,A.width+160)),G=12,Q=Math.max(180,A.top-G*2),re=Math.min(560,Q);jc({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-V-12,A.left)),top:Math.max(G,A.top-re-G),width:V,maxHeight:re,zIndex:1e4})},[]);h.useEffect(()=>{if(!mn)return;Qo();const S=V=>{var Q,re;const G=V.target;(Q=Nc.current)!=null&&Q.contains(G)||(re=dd.current)!=null&&re.contains(G)||Bo(!1)},A=V=>{V.key==="Escape"&&Bo(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",A),window.addEventListener("resize",Qo),window.addEventListener("scroll",Qo,!0),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",A),window.removeEventListener("resize",Qo),window.removeEventListener("scroll",Qo,!0)}},[mn,Qo]);const wr=h.useCallback(S=>{var G,Q,re;if(a==="display"){const ee=[];let ce=!1;N(de=>{var Oe,pt;const ve={...de.nodePositions},Pe={...de.nodeSizes};for(const Qe of S||[]){const At=Hx(Qe==null?void 0:Qe.id);if(!(!At||!de.nodeIds.includes(At))){if(Qe.type==="select"){Qe.selected&&ee.push(At);continue}if(Qe.type==="position"&&Qe.position){ve[At]={x:Qe.position.x,y:Qe.position.y},ce=!0;continue}if(Qe.type==="dimensions"&&((Oe=Qe.dimensions)!=null&&Oe.width)&&((pt=Qe.dimensions)!=null&&pt.height)){const Rn=Pu({width:Math.round(Number(Qe.dimensions.width)),height:Math.round(Number(Qe.dimensions.height))},{display:!0});Rn&&(Pe[At]=Rn,ce=!0)}}}return ce?{...de,nodePositions:ve,nodeSizes:Pe}:de}),(S||[]).some(de=>(de==null?void 0:de.type)==="select")&&F(ee);return}if(!Te){const ee=(S||[]).filter(ce=>(ce==null?void 0:ce.type)==="select");ee.length>0&&m(ce=>sg(ee,ce));return}const A=new Map;for(const ee of S||[])if((ee==null?void 0:ee.type)==="dimensions"&&((G=ee.dimensions)!=null&&G.width)&&((Q=ee.dimensions)!=null&&Q.height)){const ce=f.find(Pe=>Pe.id===ee.id),de=!!On((re=ce==null?void 0:ce.data)==null?void 0:re.definitionId),ve=Pu({width:Math.round(Number(ee.dimensions.width)),height:Math.round(Number(ee.dimensions.height))},{display:de});ve&&A.set(ee.id,ve)}const V=Array.from(A.keys());if(m(ee=>sg(S,ee).map(ce=>{var ve;const de=A.get(ce.id);return de?On((ve=ce.data)==null?void 0:ve.definitionId)?{...ce,width:de.width,height:de.height,data:{...ce.data,nodeSize:de,displaySize:de}}:{...ce,width:de.width,height:de.height,data:{...ce.data,nodeSize:de}}:ce})),V.length>0){const ee=()=>V.forEach(ce=>s(ce));window.requestAnimationFrame(ee),window.setTimeout(ee,80)}},[f,m,s,a,Te]),qp=h.useCallback(S=>{if(a!=="display"){if(!Te){const A=(S||[]).filter(V=>(V==null?void 0:V.type)==="select");A.length>0&&v(V=>l0(A,V));return}k(S)}},[k,v,a,Te]),ts=h.useCallback(()=>{const S=document.querySelector(".af-workspace-canvas .react-flow");if(S){const A=S.getBoundingClientRect();return r.screenToFlowPosition({x:A.left+A.width*.48,y:A.top+A.height*.32})}return{x:360+f.length*36,y:180+f.length*28}},[f.length,r]),Zo=h.useCallback(()=>{var S,A,V;if(an){const G=Number(((S=an.measured)==null?void 0:S.width)||an.width||260);return{x:Number(((A=an.position)==null?void 0:A.x)||0)+G+140,y:Number(((V=an.position)==null?void 0:V.y)||0)}}return ts()},[ts,an]),_r=h.useCallback((S,A={})=>{if(!Te)return Ee("Readonly workspace"),null;if(!S)return null;const V=F0(S)||S.id,G=g2(S),Q=A.id||Aq(V,f),re=Uh(S.inputs),ee=Uh(S.outputs),ce={definitionId:V,...G?{marketplaceRef:G}:{},...S.packageId?{marketplacePackageId:S.packageId}:{},...S.version?{marketplaceVersion:S.version}:{},label:A.label||vg(S),role:"normal",body:A.body||"",input:A.inputs||re,output:A.outputs||ee},de={id:Q,type:Ep,position:A.position||ts(),data:{label:ce.label,definitionId:V,...G?{marketplaceRef:G}:{},...S.packageId?{marketplacePackageId:S.packageId}:{},...S.version?{marketplaceVersion:S.version}:{},schemaType:m2(V,S),role:"normal",body:ce.body,inputs:ce.input,outputs:ce.output}},ve={...ip(de,{...E.current,[Q]:ce},U),selected:!0};return m(Pe=>[...Pe.map(Oe=>({...Oe,selected:!1})),ve]),A.openProperties&&cr(Q),Q},[ts,f,U,m,Te]),Oa=h.useCallback(S=>T1(S,g.current),[]),kd=h.useCallback(S=>{if(!Te){Ee("Readonly workspace");return}if(!T1(S,g.current)){Ee("端口类型不匹配,已取消连线");return}z(null),m(A=>gg(A,S)),v(A=>{const V=A.filter(G=>!(G.target===S.target&&G.targetHandle===S.targetHandle));return Jf({...S,markerEnd:{type:Hs.ArrowClosed}},V)})},[v,m,Te]),zc=h.useCallback((S,A)=>{Te&&($.current=_q(A,g.current),z(null))},[Te]),Ot=h.useCallback((S,A)=>{var pt,Qe,At,Rn;if(!Te)return;const V=$.current;if($.current=null,!V||A!=null&&A.toNode)return;const G=Pq(U,V);if(G.length===0){Ee(`没有匹配 ${V.slotType} 端口的节点`);return}const Q=((Qe=(pt=S==null?void 0:S.changedTouches)==null?void 0:pt[0])==null?void 0:Qe.clientX)??(S==null?void 0:S.clientX),re=((Rn=(At=S==null?void 0:S.changedTouches)==null?void 0:At[0])==null?void 0:Rn.clientY)??(S==null?void 0:S.clientY);if(!Number.isFinite(Q)||!Number.isFinite(re))return;const ee=document.querySelector(".af-workspace-canvas .react-flow");if(!ee)return;const ce=ee.getBoundingClientRect(),de=320,ve=Math.min(440,104+G.length*58),Pe=Math.max(12,Math.min(Q-ce.left,ce.width-de-12)),Oe=Math.max(12,Math.min(re-ce.top,ce.height-ve-12));z({left:Pe,top:Oe,flowPosition:r.screenToFlowPosition({x:Q,y:re}),draft:V,candidates:G,query:""})},[U,r,Te]),St=h.useCallback(S=>{if(!Te){Ee("Readonly workspace"),z(null);return}const A=M.current;if(!A||!(S!=null&&S.def))return;const V=_r(S.def,{position:A.flowPosition});if(!V)return;const G=A.draft.handleType==="source"?{source:A.draft.nodeId,sourceHandle:A.draft.handleId,target:V,targetHandle:`input-${S.slotIndex}`}:{source:V,sourceHandle:`output-${S.slotIndex}`,target:A.draft.nodeId,targetHandle:A.draft.handleId};m(Q=>gg(Q,G)),v(Q=>{const re=Q.filter(ee=>!(ee.target===G.target&&ee.targetHandle===G.targetHandle));return Jf({...G,markerEnd:{type:Hs.ArrowClosed}},re)}),z(null)},[_r,v,Te]),Yp=h.useCallback(S=>{S&&(_r(S,{position:Zo()}),Tt(!1),Us(""))},[_r,Zo]),yn=h.useCallback(S=>{S&&(fr(S,Zo()),Tt(!1),Us(""))},[fr,Zo]);h.useEffect(()=>{const S=A=>{var ve;if(A.defaultPrevented)return;const V=WT(A.target)||Sq(A.target);if((A.metaKey||A.ctrlKey)&&A.key.toLowerCase()==="s"){A.preventDefault(),bn().catch(Pe=>Ee(String(Pe.message||Pe)));return}if((A.metaKey||A.ctrlKey)&&A.key.toLowerCase()==="k"){A.preventDefault(),A.stopPropagation(),mi(Pe=>!Pe);return}if(fd)return;if(Cl){(A.key==="Escape"||xg(A))&&(A.preventDefault(),Vo(!1));return}const G=A.key.toLowerCase(),Q=(A.metaKey||A.ctrlKey)&&G==="c",re=(A.metaKey||A.ctrlKey)&&G==="v",ee=V&&Q&&jq(A.target);if(V&&!ee)return;const ce=(A.metaKey||A.ctrlKey)&&!A.shiftKey&&G==="z",de=(A.metaKey||A.ctrlKey)&&(A.shiftKey&&G==="z"||G==="y");if(ce||de){if(yt){A.preventDefault(),A.stopPropagation(),Ee("展示页布局会自动保存");return}if(!Te){A.preventDefault(),Ee("Readonly workspace");return}A.preventDefault(),A.stopPropagation();const Pe=ce?Et():Ac();Ee(Pe?ce?"Undo canvas change":"Redo canvas change":ce?"Nothing to undo":"Nothing to redo");return}if(Q){if(yt)return;const Pe=Ks.current,Oe=(g.current||[]).some(Qe=>Qe==null?void 0:Qe.selected)?g.current:(g.current||[]).map(Qe=>Pe&&Qe.id===Pe?{...Qe,selected:!0}:Qe),pt=LT(Oe,b.current,E.current);pt&&(A.preventDefault(),A.stopPropagation(),W.current=pt,ee&&typeof((ve=A.target)==null?void 0:ve.blur)=="function"&&A.target.blur(),Ee(`Copied ${pt.nodes.length} node${pt.nodes.length>1?"s":""}`));return}if(re){if(yt){A.preventDefault(),A.stopPropagation();return}if(!Te){A.preventDefault(),Ee("Readonly workspace");return}const Pe=MT(W.current,g.current,b.current,E.current);Pe&&(A.preventDefault(),A.stopPropagation(),E.current=Pe.instances,R(Pe.instances),m(Pe.nodes),v(Pe.edges),Ee(`Pasted ${Pe.pastedNodeIds.length} node${Pe.pastedNodeIds.length>1?"s":""}`));return}if(xg(A)&&!A.metaKey&&!A.ctrlKey&&!A.altKey){A.preventDefault(),Vo(!0);return}if(A.key==="a"||A.key==="A"){if(A.metaKey||A.ctrlKey){A.preventDefault(),yt?F(_.current.nodeIds):(m(Pe=>Pe.map(Oe=>({...Oe,selected:!0}))),v(Pe=>Pe.map(Oe=>({...Oe,selected:!1}))));return}if(A.altKey)return;if(yt){A.preventDefault(),vt(!0);return}if(!Te){A.preventDefault(),Ee("Readonly workspace");return}A.preventDefault(),Tt(!0);return}if((A.key==="v"||A.key==="V")&&!A.metaKey&&!A.ctrlKey&&!A.altKey){A.preventDefault(),pd("select");return}if((A.key==="h"||A.key==="H")&&!A.metaKey&&!A.ctrlKey&&!A.altKey){A.preventDefault(),pd("pan");return}(A.key==="f"||A.key==="F")&&!A.metaKey&&!A.ctrlKey&&!A.altKey&&(A.preventDefault(),xr())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[yt,fd,xr,Ac,bn,Cl,v,m,Et,Te]);const pn=h.useCallback(S=>{Xt(A=>{const V=new Set(A);return V.has(S)?V.delete(S):V.add(S),V})},[]),ky=h.useCallback((S,A)=>{S.dataTransfer.effectAllowed="copy",S.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:A.path,name:A.name,type:A.type})),S.dataTransfer.setData("text/plain",A.path)},[]),Js=h.useCallback((S,A)=>{S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("application/agentflow-node",A.id),S.dataTransfer.setData("text/plain",A.id)},[]),vi=h.useCallback(async(S,A)=>{const V=String((S==null?void 0:S.name)||(S==null?void 0:S.path)||"").toLowerCase(),G=V.split(".").pop(),Q=G==="html"?"display_html":G==="csv"||G==="tsv"||G==="json"&&/\b(table|data|rows|report)\b/i.test(V)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(G)?"display_image":"display_markdown",re=U.find(Oe=>Oe.id===Q);if(!re){Ee("展示节点不可用");return}const ee=Q==="display_image";let ce=String(S.path||"");if(!ee){const Oe=wo(i);Oe.set("path",S.path);const pt=await fetch(`/api/workspace/file?${Oe.toString()}`),Qe=await pt.json();if(!pt.ok)throw new Error(Qe.error||"读取文件失败");ce=String(Qe.content||"")}const de=Q==="display_image"?"src":"content",ve=Uh(re.inputs).map(Oe=>Oe.name===de?{...Oe,default:ce,value:ce}:Oe),Pe=Uh(re.outputs).map(Oe=>Oe.name===de?{...Oe,default:ce,value:ce}:Oe);_r(re,{label:S.name||"Display",body:ce,inputs:ve,outputs:Pe,position:A}),Ee(`已创建展示:${S.path}`)},[_r,i,U]),Gp=h.useCallback(S=>{if(!Te){Ee("Readonly workspace");return}vi(S,ts()).catch(A=>Ee(String(A.message||A)))},[vi,ts,Te]),Sd=h.useCallback(S=>{if(!Te){S.preventDefault(),Ee("Readonly workspace");return}const A=S.dataTransfer.getData("application/x-agentflow-workspace-file");if(A){S.preventDefault();let ee;try{ee=JSON.parse(A)}catch{return}if(!(ee!=null&&ee.path))return;const ce=r.screenToFlowPosition({x:S.clientX,y:S.clientY});vi(ee,ce).catch(de=>Ee(String(de.message||de)));return}const V=S.dataTransfer.getData("application/agentflow-snippet");if(V){const ee=Se.find(de=>`${de.id}@${de.version}`===V);if(!ee)return;S.preventDefault();const ce=r.screenToFlowPosition({x:S.clientX,y:S.clientY});fr(ee,ce);return}const G=S.dataTransfer.getData("application/agentflow-node");if(!G)return;const Q=U.find(ee=>ee.id===G);if(!Q)return;S.preventDefault();const re=r.screenToFlowPosition({x:S.clientX,y:S.clientY});_r(Q,{position:re})},[vi,_r,Se,fr,U,r,Te]),Xp=h.useCallback(S=>{if(!Te)return;const A=Array.from(S.dataTransfer.types||[]);!A.includes("application/x-agentflow-workspace-file")&&!A.includes("application/agentflow-node")&&!A.includes("application/agentflow-snippet")||(S.preventDefault(),S.dataTransfer.dropEffect=A.includes("application/agentflow-node")||A.includes("application/agentflow-snippet")?"move":"copy")},[Te]),Fl=h.useCallback(async(S="")=>{if(!Te){Ee("Readonly workspace");return}const A=window.prompt("新文件名",S?`${S}/notes.md`:"notes.md");if(!A)return;const V=S&&!A.includes("/")?`${S}/${A}`:A;try{const G=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:V,content:""})}),Q=await G.json();if(!G.ok)throw new Error(Q.error||"创建文件失败");await Gn(),Xt(re=>{const ee=new Set(re);for(const ce of qh(Q.path||V))ee.delete(ce);return ee}),Ee(`已创建 ${Q.path}`)}catch(G){Ee(String(G.message||G))}},[i,Gn,Te]),Fr=h.useCallback(async(S="")=>{if(!Te){Ee("Readonly workspace");return}const A=window.prompt("新文件夹名",S?`${S}/docs`:"docs");if(!A)return;const V=S&&!A.includes("/")?`${S}/${A}`:A;try{const G=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:V})}),Q=await G.json();if(!G.ok)throw new Error(Q.error||"创建文件夹失败");await Gn(),Xt(re=>{const ee=new Set(re);for(const ce of qh(Q.path||V))ee.delete(ce);return Q.path&&ee.delete(Q.path),ee}),Ee(`已创建 ${Q.path}`)}catch(G){Ee(String(G.message||G))}},[i,Gn,Te]),Mi=h.useCallback(async S=>{if(!Te){Ee("Readonly workspace");return}if(!(!(S!=null&&S.path)||!window.confirm(`删除 ${S.path}?`)))try{const A=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:S.path})}),V=await A.json();if(!A.ok)throw new Error(V.error||"删除失败");Ee(`已删除 ${V.path}`),await Gn()}catch(A){Ee(String(A.message||A))}},[i,Gn,Te]),Jp=h.useCallback(async()=>{if(!Te){Ee("Readonly workspace");return}const S=Li.trim();if(!S||$r)return;const A=Kh(f,y,E.current);Sl(""),tn(!0),bt("workspace"),Cn(V=>[...V,{role:"user",text:S,at:Date.now()}]);try{await bn(f,y);const V=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,prompt:S,outputKind:"markdown",workspaceGraph:A,allowFlowYaml:!1,model:ms,selectedSkills:sr,selectedNodeIds:uo})}),G=await V.json();if(!V.ok)throw new Error(G.error||"生成失败");const Q=String(G.content||"").trim();Cn(re=>[...re,{role:"assistant",text:Q,at:Date.now()}]),await Pa(),Ee("AI 生成完成")}catch(V){const G=String(V.message||V);Cn(Q=>[...Q,{role:"assistant",text:G,error:!0,at:Date.now()}]),Ee(G)}finally{tn(!1)}},[ms,$r,Li,y,i,Pa,f,bt,bn,uo,sr,Te]),ns=Ec.find(S=>S.id===pi)||null,Qp=ns?Array.isArray(ns.messages)?ns.messages:[]:Cc,Nd=ns?ns.status==="running":$r,Zp=ns?ns.status==="running"?`${ns.label} running`:ns.status==="paused"?`${ns.label} paused`:ns.status==="failed"?`${ns.label} failed`:`${ns.label} done`:$r?"Workspace agent running":Cc.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:()=>n("/projects"),"aria-label":"返回",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",title:i.flowId?`${i.flowId} · ${Mr}`:Mr||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",wq,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",onClick:()=>{n(Bf({id:i.flowId,source:i.flowSource||"user",archived:!!i.archived},"pipeline"))},children:"Pipeline"}),o.jsx("button",{type:"button",className:a==="workspace"?"af-view-switch__active":"",onClick:()=>Dc("workspace"),children:"Workspace"}),o.jsx("button",{type:"button",className:a==="display"?"af-view-switch__active":"",onClick:()=>Dc("display"),children:"Display"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[o.jsx("span",{className:"af-workspace-save-status",children:Pc}),yt?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:He||!(st!=null&&st.absoluteUrl)&&x.nodeIds.length===0,onClick:()=>{Me(""),st!=null&&st.absoluteUrl?Nr(!0):Ma()},title:st!=null&&st.absoluteUrl?"查看展示链接":x.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:He?"hourglass_empty":"ios_share"}),He?"生成中":st!=null&&st.absoluteUrl?"展示链接":"生成链接"]}),o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:Go.length===0,onClick:()=>vt(!0),title:Go.length===0?"当前 workspace 没有 display 节点":"选择展示节点 (A)",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"添加展示"]})]}):null,o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>n(Al),"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),children:o.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Pl,onClick:()=>d(!0),"aria-label":e("project:archiveModal.title"),title:e("project:archiveModal.title"),children:o.jsx("span",{className:"material-symbols-outlined",children:"archive"})}),o.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger",disabled:!Pl,onClick:()=>c(!0),"aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Vo(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(Nl?" af-composer-topbar-btn--active":"")+($r?" af-composer-topbar-btn--running":""),disabled:yt,onClick:()=>oo(S=>!S),children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!Te,onClick:()=>bn().catch(S=>Ee(String(S.message||S))),children:"Save"})]})]}),en?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:en}),o.jsx("button",{type:"button",onClick:()=>cn(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(!yt&&(Nl||ft)?" af-workspace-body--drawer":"")+(!yt&&Ca?" af-workspace-body--sidebar-collapsed":"")+(yt?" af-workspace-body--display-mode":""),children:[!yt&&Ca?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:()=>Tt(!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:()=>Ea(!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:()=>Ea(!1),"aria-label":"展开侧边栏",title:(yr==null?void 0:yr.username)||(yr==null?void 0:yr.userId)||"展开侧边栏",children:Vp})]})}):null,yt?null:o.jsxs("aside",{ref:Jt,className:"af-workspace-sidebar"+(hs?" af-workspace-sidebar--resizing":""),"aria-hidden":Ca,style:{"--af-work-files-pane-height":`${Math.round(Cr)}px`},children:[o.jsxs("section",{className:"af-workspace-files-section",children:[o.jsxs("div",{className:"af-workspace-sidebar-head",children:[o.jsx("h2",{children:"Files"}),o.jsxs("div",{className:"af-workspace-sidebar-actions",children:[o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Ea(!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",disabled:!Te,onClick:()=>Fl(""),"aria-label":"新增文件",title:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Te,onClick:()=>Fr(""),"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 Gn(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),o.jsx("input",{className:"af-workspace-search",value:Yn,onChange:S=>qs(S.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",children:o.jsx(j2,{items:Wp,flowParams:i,onOpen:Gp,collapsedDirs:ut,onToggleDir:pn,onCreateFile:Fl,onCreateFolder:Fr,onDelete:Mi,onFileDragStart:ky})})]}),o.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:ir,role:"separator","aria-orientation":"horizontal","aria-label":"调整 Files 和 Palette 区域大小",title:"拖动调整 Files / Palette 高度"}),o.jsxs("section",{className:"af-workspace-nodes-section",children:[o.jsxs("div",{className:"af-node-palette-head af-workspace-node-palette-head",children:[o.jsxs("h2",{className:"af-node-palette-title",children:[o.jsx("span",{children:"Palette"}),o.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),o.jsxs("label",{className:"af-palette-search-wrap",children:[o.jsx("span",{className:"af-visually-hidden",children:xe==="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:pe,onChange:S=>he(S.target.value),placeholder:xe==="flows"?"搜索流程片段...":"搜索节点...","aria-label":xe==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":xe==="nodes",className:"af-palette-tab"+(xe==="nodes"?" af-palette-tab--active":""),onClick:()=>le("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":xe==="flows",className:"af-palette-tab"+(xe==="flows"?" af-palette-tab--active":""),onClick:()=>le("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:xe==="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:Up,disabled:Pt.length<2,title:Pt.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:["已选 ",Pt.length," 节点 / ",Ml.length," 连线"]})]})}),ke?o.jsx("p",{className:"af-err af-palette-list-err",children:ke}):null,oe?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):wd.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:wd.map(S=>{const A=`${S.id}@${S.version}`,V=S.displayName||S.name||S.id,G=S.description||`${S.nodeCount||0} 个节点,${S.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:Q=>{Q.dataTransfer.effectAllowed="move",Q.dataTransfer.setData("application/agentflow-snippet",A),Q.dataTransfer.setData("text/plain",A)},onClick:()=>fr(S),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:V}),o.jsxs("span",{className:"af-palette-card-id",children:[S.id,"@",S.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:[S.nodeCount||0," nodes"]}),o.jsxs("span",{children:[S.edgeCount||0," edges"]})]})]},A)})})]}):o.jsx("p",{className:"af-palette-empty",children:pe.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Zc.map(S=>{var A;return(A=xi[S])!=null&&A.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${S}`,children:[o.jsx("h3",{className:"af-palette-cat",children:S}),o.jsx("div",{className:"af-palette-cards",children:xi[S].map(V=>{const G=I1(V.inputs,"input"),Q=I1(V.outputs,"output"),re=zb(V),ee=rf(V);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:ce=>Js(ce,V),onClick:()=>_r(V),title:re||V.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:P1(S)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:ee}),ee!==V.id?o.jsx("span",{className:"af-palette-card-id",children:V.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((ce,de)=>o.jsxs("span",{className:"af-palette-card-port",title:A1("input",ce,de),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:rr(ce==null?void 0:ce.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:Fx(ce,de)})]},`in-${de}`)),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:[Q.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[Q.shown.map((ce,de)=>o.jsxs("span",{className:"af-palette-card-port",title:A1("output",ce,de),children:[o.jsx("span",{className:"af-palette-card-port-name",children:Fx(ce,de)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:rr(ce==null?void 0:ce.type)}})]},`out-${de}`)),Q.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",Q.hidden]}):null]})]})]})]},V.id)})})]},S):null}),U.length>0&&pe.trim()&&Zc.every(S=>{var A;return!((A=xi[S])!=null&&A.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),o.jsxs("main",{className:"af-workspace-canvas",children:[o.jsx(u0,{className:"af-flow-canvas af-workspace-flow"+(El==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(yt?" af-workspace-flow--display-mode":""),nodes:Xo,edges:Oc,nodeTypes:rY,onNodesChange:wr,onEdgesChange:qp,onConnect:yt?void 0:kd,onConnectStart:yt?void 0:zc,onConnectEnd:yt?void 0:Ot,isValidConnection:yt?void 0:Oa,onNodeClick:(S,A)=>{if(yt){F([Hx(A.id)]);return}if(S.detail>=3){oo(!1),m(V=>V.map(G=>({...G,selected:G.id===A.id}))),v(V=>V.map(G=>({...G,selected:!1}))),cr(A.id);return}qn&&cr(A.id)},onNodeDoubleClick:S=>{S.preventDefault()},onPaneClick:()=>{yt?F([]):cr("")},onDrop:yt?void 0:Sd,onDragOver:yt?void 0:Xp,nodesDraggable:yt?!0:Te,nodesConnectable:yt?!1:Te,edgesReconnectable:yt?!1:Te,deleteKeyCode:yt?null:Te?["Backspace","Delete"]:null,selectionOnDrag:El==="select",panOnDrag:El==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(f0,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!yt&&I?(()=>{var G;const S=String(I.query||"").trim().toLowerCase(),A=S?I.candidates.filter(Q=>{var re,ee,ce;return[(re=Q.def)==null?void 0:re.id,Q.displayLabel,Q.description,(ee=Q.slot)==null?void 0:ee.name,(ce=Q.slot)==null?void 0:ce.type].filter(Boolean).some(de=>String(de).toLowerCase().includes(S))}):I.candidates,V=I.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:I.left,top:I.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:rr((G=I.draft.slot)==null?void 0:G.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",I.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>z(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:I.query,onChange:Q=>z(re=>re&&{...re,query:Q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[A.map(Q=>{var ce,de;const re=Q.displayLabel||((ce=Q.def)==null?void 0:ce.id),ee=Fx(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>St(Q),title:Q.description||Q.def.id,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:re}),re!==Q.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:Q.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:V}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:rr((de=Q.slot)==null?void 0:de.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:ee})]})]},`${Q.def.id}-${Q.slotIndex}`)}),A.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!yt&&!Er?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:()=>Na(!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:Pt.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Pt.map(S=>{var Q,re;const A=String(((Q=S.data)==null?void 0:Q.label)??S.id),V=(re=S.data)!=null&&re.definitionId?String(S.data.definitionId):"",G=V&&V!==A?`${A} · ${S.id} · ${V}`:`${A} · ${S.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:G,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:V||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:A}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>Dl(S.id),"aria-label":`取消选择 ${S.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},S.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:Li,rows:2,onChange:S=>Sl(S.target.value),onKeyDown:S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),Jp())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!Te})}),o.jsxs("div",{className:"af-composer-toolbar",children:[o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:Nc,type:"button",className:"af-composer-skills-button"+(sr.length>0?" af-composer-skills-button--active":""),disabled:$r||!Te,"aria-haspopup":"listbox","aria-expanded":mn,onClick:()=>Bo(S=>!S),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:sr.length>0?`Skills ${sr.length}`:"Skills"})]}),mn&&!$r?Wr.createPortal(o.jsx("div",{ref:dd,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:Rp,children:dr.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[gn.groups.map(S=>{const A=pl(S,dr),V=uP(S,Ll,dr),G=Xr.has(S.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:V==="all",disabled:A.length===0,onChange:Q=>{const re=Q.target.checked;Gr(ee=>re?lP(ee,A):cP(ee,A))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:S.name}),S.builtin?o.jsx("em",{children:"built-in"}):null,V==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":G?`展开 ${S.name}`:`收起 ${S.name}`,onClick:()=>{di(Q=>{const re=new Set(Q);return re.has(S.id)?re.delete(S.id):re.add(S.id),re})},children:[o.jsx("span",{children:S.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:S.skills.map(Q=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Ll.has(Q.key),onChange:re=>{const ee=re.target.checked;Gr(ce=>ee?ce.includes(Q.key)?ce:[...ce,Q.key]:ce.filter(de=>de!==Q.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:Q.name}),Q.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:Q.description}):null]})]},`${S.id}:${Q.key}`))})]},S.id)}),gn.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:gn.ungrouped.length})]}),gn.ungrouped.map(S=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Ll.has(S.key),onChange:A=>{const V=A.target.checked;Gr(G=>V?G.includes(S.key)?G:[...G,S.key]:G.filter(Q=>Q!==S.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:S.name}),S.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:S.description}):null]})]},`ungrouped:${S.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:ms,onChange:S=>zo(S.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),$c.map(S=>o.jsx("option",{value:S.value,children:S.label},S.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(Li.trim()&&!$r?" af-composer-send--active":"")+($r?" af-composer-send--stop":""),disabled:$r||!Li.trim()||!Te,"aria-label":$r?"Running":"Send",onClick:()=>void Jp(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:$r?"sync":"arrow_upward"})})]})]})]})}):yt?null:o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>Na(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})})]}),!yt&&Nl?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:()=>oo(!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"+(pi==="workspace"?" af-composer-session-tab--active":""),onClick:()=>io("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),Ec.map(S=>o.jsx("button",{type:"button",className:"af-composer-session-tab"+(pi===S.id?" af-composer-session-tab--active":"")+(S.status==="running"?" af-composer-session-tab--running":""),onClick:()=>io(S.id),title:S.runNodeId||S.label,children:o.jsx("span",{className:"af-composer-session-label",children:S.label})},S.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(Nd?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Zp}),o.jsx("div",{className:"af-composer-sidebar-thread",children:o.jsx(oY,{messages:Qp,running:Nd,showRunningIndicator:!ns})})]})}):!yt&&ft&&an?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(QT,{draft:ft,setDraft:Lr,definitionId:String(((_s=an.data)==null?void 0:_s.definitionId)||an.id),systemPromptReadonly:String(((ea=an.data)==null?void 0:ea.description)||""),modelLists:js,disabled:!Te,onIdBlur:()=>Lc(!0),onClose:()=>cr(""),onPublishToMarketplace:Ic,error:Fe,ioSlots:{inputs:Array.isArray(ft==null?void 0:ft.inputs)?ft.inputs:[],outputs:Array.isArray(ft==null?void 0:ft.outputs)?ft.outputs:[]}})}):null,o.jsx(KT,{open:Cl,onClose:()=>Vo(!1)}),o.jsx(qT,{open:fd,onClose:()=>mi(!1),onJump:yi,nodes:Xs}),o.jsx(VT,{open:u,onClose:()=>d(!1),flowId:i.flowId||"",flowSource:ao,onArchived:()=>{d(!1),n("/projects?tab=archived")}}),o.jsx(UT,{open:p&&!!i.flowId,onClose:()=>c(!1),flowId:i.flowId||"",flowSource:ao,flowArchived:!!i.archived,onDeleted:async()=>{c(!1),n("/projects")}}),Je?Wr.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:()=>We(!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:ot.name,onChange:S=>{const A=S.target.value;ze(V=>({...V,name:A,id:V.id?V.id:A.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:ot.id,onChange:S=>ze(A=>({...A,id:S.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:ot.description,onChange:S=>ze(A=>({...A,description:S.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Pt.length," 个节点和 ",Ml.length," 条内部连线。"]}),zn?o.jsx("div",{className:"af-flow-snippet-error",children:zn}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>We(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:mt||!ot.name.trim(),onClick:()=>void wi(),children:mt?"发布中...":"发布"})]})]})}),document.body):null,ue?Wr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-share-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:"present_to_all"}),"发布展示页"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Ne(!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:on.title,onChange:S=>Un(A=>({...A,title:S.target.value})),placeholder:"展示页标题",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"布局"}),o.jsxs("select",{className:"af-display-share-select",value:on.layout,onChange:S=>Un(A=>({...A,layout:S.target.value})),children:[o.jsx("option",{value:"gallery",children:"Gallery"}),o.jsx("option",{value:"document",children:"Document"}),o.jsx("option",{value:"slides",children:"Slides"})]})]}),o.jsx("div",{className:"af-display-share-node-list",role:"group","aria-label":"选择展示节点",children:fo.map(S=>{var V,G;const A=Array.isArray(on.nodeIds)&&on.nodeIds.includes(S.id);return o.jsxs("label",{className:"af-display-share-node-row",children:[o.jsx("input",{type:"checkbox",checked:A,onChange:()=>bi(S.id)}),o.jsxs("span",{className:"af-display-share-node-row__main",children:[o.jsx("strong",{children:((V=S.data)==null?void 0:V.label)||S.id}),o.jsxs("small",{children:[On((G=S.data)==null?void 0:G.definitionId)," · ",S.id]})]})]},S.id)})}),st!=null&&st.absoluteUrl?o.jsxs("div",{className:"af-display-share-result",children:[o.jsx("input",{type:"text",readOnly:!0,value:st.absoluteUrl,onFocus:S=>S.target.select()}),o.jsx("button",{type:"button",onClick:()=>window.open(st.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),o.jsx("button",{type:"button",onClick:()=>void vd(),children:we==="copied"?"已复制":we==="failed"?"复制失败":"复制"})]}):null,et?o.jsx("div",{className:"af-flow-snippet-error",children:et}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Ne(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:He||!Array.isArray(on.nodeIds)||on.nodeIds.length===0,onClick:()=>void Kp(),children:He?"生成中...":"生成链接"})]})]})}),document.body):null,Kn?Wr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-link-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:"link"}),"展示链接"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>{Me(""),Nr(!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:[st!=null&&st.absoluteUrl?o.jsxs("div",{className:"af-display-link-modal__url",children:[o.jsx("input",{type:"text",readOnly:!0,value:st.absoluteUrl,onFocus:S=>S.target.select(),autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>window.open(st.absoluteUrl,"_blank","noopener,noreferrer"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),o.jsxs("button",{type:"button",onClick:()=>void vd(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:we==="copied"?"check":"content_copy"}),we==="copied"?"已复制":we==="failed"?"复制失败":"复制"]})]}):o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有生成展示链接"}),et?o.jsx("div",{className:"af-flow-snippet-error",children:et}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>{Me(""),Nr(!1)},children:"关闭"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:He||x.nodeIds.length===0,onClick:()=>void Ma(),children:He?"生成中...":st!=null&&st.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,ct?Wr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-picker-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:"add_to_photos"}),"选择展示节点"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>vt(!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-display-picker-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:ae,onChange:S=>Le(S.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),o.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":Fc.length||1},children:La.length>0?Fc.map((S,A)=>o.jsx("div",{className:"af-display-picker-column",children:S.map(vy)},`display-picker-column-${A}`)):o.jsx("div",{className:"af-display-picker-empty",children:Go.length===0?"当前 Workspace 没有 display 节点":"没有匹配的展示节点"})})]}),o.jsx("div",{className:"af-flow-snippet-modal__foot",children:o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",onClick:()=>vt(!1),children:"完成"})})]})}),document.body):null,!yt&&rt?Wr.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>Tt(!1),children:o.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:S=>S.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":Wt==="nodes",className:"af-workspace-quick-add__tab"+(Wt==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>Zn("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":Wt==="flows",className:"af-workspace-quick-add__tab"+(Wt==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>Zn("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:fi,value:ds,onChange:S=>Us(S.target.value),onKeyDown:S=>{if(S.key==="Escape")S.preventDefault(),Tt(!1);else if(S.key==="ArrowDown"){S.preventDefault();const A=Wt==="flows"?Ra.length:Es.length;fs(V=>Math.min(Math.max(0,A-1),V+1))}else S.key==="ArrowUp"?(S.preventDefault(),fs(A=>Math.max(0,A-1))):S.key==="Tab"?(S.preventDefault(),Zn(A=>A==="nodes"?"flows":"nodes")):S.key==="Enter"&&(S.preventDefault(),Wt==="flows"?yn(Ra[Yr]||Ra[0]):Yp(Es[Yr]||Es[0]))},placeholder:Wt==="flows"?"搜索流程片段...":"搜索节点...","aria-label":Wt==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:Wt==="flows"?Ra.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:oe?"正在加载流程片段...":ke||"没有匹配的流程片段"}):Ra.map((S,A)=>{const V=S.displayName||S.name||S.id,G=S.snippet&&typeof S.snippet=="object"?S.snippet.instances:null,Q=S.snippet&&typeof S.snippet=="object"?S.snippet.edges:null,re=Number.isFinite(Number(S.nodeCount))?Number(S.nodeCount):Object.keys(G||{}).length,ee=Number.isFinite(Number(S.edgeCount))?Number(S.edgeCount):Array.isArray(Q)?Q.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(A===Yr?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>fs(A),onClick:()=>yn(S),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:V}),o.jsxs("span",{className:"af-workspace-quick-add__meta",children:[S.id,S.version?` · v${S.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:S.description||`${re} 节点 / ${ee} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${S.id}@${S.version}`)}):Es.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):Es.map((S,A)=>{const V=nf(S),G=rf(S),Q=zb(S);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(A===Yr?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>fs(A),onClick:()=>Yp(S),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:P1(V)}),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:S.id}),Q?o.jsx("span",{className:"af-workspace-quick-add__desc",children:Q}):null]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:V})]},S.id)})})]})}),document.body):null]})]})}function yY(){return o.jsx(ay,{children:o.jsx(gY,{})})}function xY(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=(e==null?void 0:e.kind)==="image"?"src":"content",r=a=>String((a==null?void 0:a.value)??(a==null?void 0:a.default)??""),s=a=>r(a).trim(),i=t.find(a=>(a==null?void 0:a.name)===n&&s(a))||t.find(a=>(a==null?void 0:a.name)==="filePath"&&s(a))||t.find(a=>(a==null?void 0:a.type)==="text"&&s(a));return String((e==null?void 0:e.body)||(i?r(i):""))}function wY(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function bY(e){let t=String(e||"").replace(/\r\n/g,`
|
|
184
|
+
`).trim();return t.includes(`
|
|
185
|
+
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
186
|
+
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
187
|
+
$2`)),t}function C2(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const a=bY(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const u=a.match(/^result\s*:\s*(.*)$/m);if(u){const p=String(u[1]||"").trim();return p==="|"||p===">"?a.slice((u.index||0)+u[0].length).split(`
|
|
188
|
+
`).filter(f=>/^\s+/.test(f)||!f.trim()).map(f=>f.replace(/^\s{2}/,"")).join(`
|
|
189
|
+
`).replace(/\s+$/g,""):p.replace(/^["']|["']$/g,"")}const d=t.replace(n[0],"").trim();if(d)return d}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const u=l.resultFile||l.result;return typeof u=="string"?u:JSON.stringify(u,null,2)}}catch{}return String(e||"")}function z0(e){let t=C2(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 vY(e){const t=z0(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function kY(e){const t=z0(e);if(!t.trim())return"";const n=`<base target="_self"><script>
|
|
190
|
+
(() => {
|
|
191
|
+
document.addEventListener("click", (event) => {
|
|
192
|
+
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
193
|
+
if (!link) return;
|
|
194
|
+
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
195
|
+
if (!rawHref || rawHref.startsWith("#")) return;
|
|
196
|
+
if (/^(?:javascript|mailto|tel):/i.test(rawHref)) return;
|
|
197
|
+
event.preventDefault();
|
|
198
|
+
window.location.href = link.href;
|
|
199
|
+
}, true);
|
|
200
|
+
})();
|
|
201
|
+
<\/script>`;return/<script\b[^>]*>\s*\(\(\)\s*=>\s*\{\s*document\.addEventListener\("click"/i.test(t)?t:/<head\b[^>]*>/i.test(t)?t.replace(/<head\b([^>]*)>/i,`<head$1>${n}`):/<html\b[^>]*>/i.test(t)?t.replace(/<html\b([^>]*)>/i,`<html$1><head>${n}</head>`):`<!doctype html><html><head>${n}</head><body>${t}</body></html>`}function E2(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=new URLSearchParams;return s.set("id",t),s.set("path",r),n.download&&s.set("download","1"),`/api/display/file/raw?${s.toString()}`}function SY(e,t,n={}){const r=String(e||"").trim();return r?E2(r,t,n):""}function NY({className:e="",children:t}){const n=h.useRef(null),r=h.useRef(null),[s,i]=h.useState({visible:!1,top:0,height:100}),a=h.useCallback(()=>{const p=n.current;if(!p)return;const c=Math.max(1,p.scrollHeight),f=Math.max(1,p.clientHeight),m=c>f+1,y=m?Math.max(12,f/c*100):100,v=Math.max(0,100-y),k=m?Math.min(v,p.scrollTop/Math.max(1,c-f)*v):0;i({visible:m,top:k,height:y})},[]);h.useEffect(()=>{const p=requestAnimationFrame(a),c=n.current;if(!c||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const f=new ResizeObserver(a);f.observe(c);for(const m of Array.from(c.children))f.observe(m);return()=>{cancelAnimationFrame(p),f.disconnect()}},[t,a]);const l=h.useCallback(p=>{const c=n.current;if(!c)return;const f=Math.max(0,c.scrollHeight-c.clientHeight);c.scrollTop=Math.min(1,Math.max(0,p))*f,a()},[a]),u=h.useCallback((p,c=0)=>{const f=r.current;if(!f)return 0;const m=f.getBoundingClientRect(),y=s.height/100*m.height,v=Math.max(1,m.height-y);return(p-m.top-c)/v},[s.height]),d=h.useCallback(p=>{if(!s.visible)return;p.preventDefault(),p.stopPropagation();const c=r.current;if(!c)return;const f=c.getBoundingClientRect(),m=s.top/100*f.height,y=s.height/100*f.height,k=p.clientY>=f.top+m&&p.clientY<=f.top+m+y?p.clientY-f.top-m:y/2;l(u(p.clientY,k));const g=x=>{x.preventDefault(),l(u(x.clientY,k))},b=()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b)};window.addEventListener("pointermove",g),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b)},[u,l,s.height,s.top,s.visible]);return o.jsxs("div",{className:`af-public-display-node__body ${e} nowheel nopan nodrag`,children:[o.jsx("div",{ref:n,className:`af-public-display-node__scroller ${e} nowheel nopan nodrag`,onScroll:a,children:t}),o.jsx("div",{ref:r,className:"af-public-display-scrollbar"+(s.visible?" af-public-display-scrollbar--visible":""),onPointerDown:d,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function Wb({node:e,shareId:t,style:n,bare:r=!1}){const s=xY(e),i=e.kind==="html"?z0(s):C2(s),a=e.kind==="html"?vY(i):"",l=`af-public-display-node__body--${e.kind||"unknown"}`;return o.jsxs("section",{className:`af-public-display-node af-public-display-node--${e.kind||"unknown"}${r?" af-public-display-node--bare":""}`,style:n,children:[r?null:o.jsx("div",{className:"af-public-display-node__head",children:o.jsxs("div",{className:"af-public-display-node__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:wY(e.kind)}),o.jsx("strong",{children:e.label||e.id}),o.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),o.jsx(NY,{className:l,children:a?o.jsx("div",{className:"af-public-display-empty",children:a}):i.trim()?o.jsxs(o.Fragment,{children:[e.kind==="html"?o.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals",srcDoc:kY(i)}):null,e.kind==="image"?o.jsx("img",{src:E2(i,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?o.jsx("div",{className:"af-public-display-markdown",children:o.jsx(O0,{content:i,resolveSrc:(u,d)=>SY(u,t,d)})}):null,e.kind==="chart"?o.jsx(D0,{content:i}):null,e.kind==="table"?o.jsx($0,{content:i}):null,e.kind==="mermaid"||e.kind==="ascii"?o.jsx("pre",{children:i}):null]}):o.jsx("div",{className:"af-public-display-empty",children:"No display content"})})]})}function jY({data:e}){return o.jsx(Wb,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const CY={publicDisplay:jY};function EY(e){const t=String(e||"").split("/").filter(Boolean);return t[0]==="display"&&t[1]?decodeURIComponent(t[1]):new URLSearchParams(window.location.search).get("id")||""}function _Y(e){var s,i;const t=Number(((s=e==null?void 0:e.size)==null?void 0:s.width)||0),n=Number(((i=e==null?void 0:e.size)==null?void 0:i.height)||0),r={};return Number.isFinite(t)&&t>0&&(r.width=`${Math.round(t)}px`),Number.isFinite(n)&&n>0&&(r.height=`${Math.round(n)}px`),Object.keys(r).length>0?r:void 0}function _2(){var l,u,d,p;const{path:e}=Lo(),t=h.useMemo(()=>EY(e),[e]),[n,r]=h.useState({loading:!0,error:"",share:null,nodes:[]});h.useEffect(()=>{let c=!1;async function f(){if(!t){r({loading:!1,error:"Missing display share id",share:null,nodes:[]});return}r(m=>({...m,loading:!0,error:""}));try{const m=await fetch(`/api/display/share?id=${encodeURIComponent(t)}`),y=await m.json().catch(()=>({}));if(!m.ok)throw new Error(y.error||"展示页不存在");c||r({loading:!1,error:"",share:y.share||null,nodes:Array.isArray(y.nodes)?y.nodes:[]})}catch(m){c||r({loading:!1,error:String((m==null?void 0:m.message)||m),share:null,nodes:[]})}}return f(),()=>{c=!0}},[t]);const s=h.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((f,m)=>{const y=f.position&&typeof f.position.x=="number"&&typeof f.position.y=="number"?f.position:{x:120+m*40,y:100+m*32},v=f.size&&typeof f.size.width=="number"&&typeof f.size.height=="number"?f.size:{width:520,height:320};return{id:f.id,type:"publicDisplay",position:y,data:{node:f,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(v.width)||520),height:Math.max(1,Number(v.height)||320)}}}),[t,n.nodes]),i=h.useMemo(()=>{var v;const c=(v=n.share)==null?void 0:v.viewport;if(!c||typeof c!="object")return null;const f=Number(c.x),m=Number(c.y),y=Number(c.zoom);return!Number.isFinite(f)||!Number.isFinite(m)||!Number.isFinite(y)?null:{x:f,y:m,zoom:Math.min(Math.max(y,.1),4)}},[(l=n.share)==null?void 0:l.viewport]);if(n.loading)return o.jsx("main",{className:"af-public-display-page",children:o.jsx("div",{className:"af-public-display-status",children:"Loading..."})});if(n.error)return o.jsx("main",{className:"af-public-display-page",children:o.jsxs("div",{className:"af-public-display-status af-public-display-status--error",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"error"}),o.jsx("span",{children:n.error})]})});const a=String(((u=n.share)==null?void 0:u.layout)||"").trim()||"gallery";if(a!=="canvas"){if(a==="single")return o.jsx("main",{className:"af-public-display-page af-public-display-page--single",children:o.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(f=>o.jsx(Wb,{node:f,shareId:t,style:_Y(f),bare:!0},f.id))})});const c=a==="slides"?"af-public-display-page--slides":a==="document"?"af-public-display-page--document":"af-public-display-page--gallery";return o.jsxs("main",{className:`af-public-display-page ${c}`,children:[o.jsxs("header",{className:"af-public-display-hero",children:[o.jsxs("div",{children:[o.jsx("p",{children:"AgentFlow Display"}),o.jsx("h1",{children:((d=n.share)==null?void 0:d.title)||"AgentFlow Display"})]}),(p=n.share)!=null&&p.expiresAt?o.jsxs("span",{children:["有效期至 ",new Date(n.share.expiresAt).toLocaleString()]}):null]}),o.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(f=>o.jsx(Wb,{node:f,shareId:t},f.id))})]})}return o.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:o.jsx(ay,{children:o.jsx(u0,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:CY,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,noPanClassName:"nopan",noDragClassName:"nodrag",noWheelClassName:"nowheel",panOnScroll:!0,zoomOnScroll:!0,zoomOnPinch:!0,defaultViewport:i||void 0,fitView:!i,fitViewOptions:{padding:.18,duration:180},minZoom:.1,maxZoom:4,proOptions:{hideAttribution:!0},children:o.jsx(f0,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const jt=e=>typeof e=="string",Vd=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},F1=e=>e==null?"":""+e,PY=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},AY=/###/g,z1=e=>e&&e.indexOf("###")>-1?e.replace(AY,"."):e,H1=e=>!e||jt(e),Sf=(e,t,n)=>{const r=jt(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(H1(e))return{};const i=z1(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return H1(e)?{}:{obj:e,k:z1(r[s])}},B1=(e,t,n)=>{const{obj:r,k:s}=Sf(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=Sf(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=Sf(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},IY=(e,t,n,r)=>{const{obj:s,k:i}=Sf(e,t,Object);s[i]=s[i]||[],s[i].push(n)},Sg=(e,t)=>{const{obj:n,k:r}=Sf(e,t);if(n)return n[r]},TY=(e,t,n)=>{const r=Sg(e,n);return r!==void 0?r:Sg(t,n)},P2=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?jt(e[r])||e[r]instanceof String||jt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):P2(e[r],t[r],n):e[r]=t[r]);return e},Xc=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var RY={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const LY=e=>jt(e)?e.replace(/[&<>"'\/]/g,t=>RY[t]):e;class MY{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 OY=[" ",",","?","!",";"],$Y=new MY(20),DY=(e,t,n)=>{t=t||"",n=n||"";const r=OY.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=$Y.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},Vb=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 u=i;u<r.length;++u)if(u!==i&&(l+=n),l+=r[u],a=s[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&u<r.length-1)continue;i+=u-i+1;break}s=a}return s},Ng=e=>e&&e.replace("_","-"),FY={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 jg{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||FY,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:(jt(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new jg(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new jg(this.logger,t)}}var jo=new jg;class hy{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,u]=a;for(let d=0;d<u;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[l,u]=a;for(let d=0;d<u;d++)l.apply(l,[t,...r])})}}class W1 extends hy{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):jt(r)&&i?l.push(...r.split(i)):l.push(r)));const u=Sg(this.data,l);return!u&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),u||!a||!jt(r)?u:Vb(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),B1(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)(jt(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 u=Sg(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?P2(u,r,i):u={...u,...r},B1(this.data,l,u),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 A2={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 V1={};class Cg extends hy{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),PY(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=jo.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&&!DY(t,r,s);if(a&&!l){const u=t.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:t,namespaces:jt(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:jt(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),u=l[l.length-1],d=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(p){const N=n.nsSeparator||this.options.nsSeparator;return s?{res:`${u}${N}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:`${u}${N}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:a}const c=this.resolve(t,n);let f=c&&c.res;const m=c&&c.usedKey||a,y=c&&c.exactUsedKey||a,v=Object.prototype.toString.apply(f),k=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,x=!jt(f)&&typeof f!="boolean"&&typeof f!="number";if(b&&f&&x&&k.indexOf(v)<0&&!(jt(g)&&Array.isArray(f))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const N=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,f,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(c.res=N,c.usedParams=this.getUsedParamsDetails(n),c):N}if(i){const N=Array.isArray(f),_=N?[]:{},C=N?y:m;for(const T in f)if(Object.prototype.hasOwnProperty.call(f,T)){const H=`${C}${i}${T}`;_[T]=this.translate(H,{...n,joinArrays:!1,ns:l}),_[T]===H&&(_[T]=f[T])}f=_}}else if(b&&jt(g)&&Array.isArray(f))f=f.join(g),f&&(f=this.extendTranslation(f,t,n,r));else{let N=!1,_=!1;const C=n.count!==void 0&&!jt(n.count),T=Cg.hasDefaultValue(n),H=C?this.pluralResolver.getSuffix(d,n.count,n):"",L=n.ordinal&&C?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",F=C&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),O=F&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${H}`]||n[`defaultValue${L}`]||n.defaultValue;!this.isValidLookup(f)&&T&&(N=!0,f=O),this.isValidLookup(f)||(_=!0,f=a);const W=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&_?void 0:f,$=T&&O!==f&&this.options.updateMissing;if(_||N||$){if(this.logger.log($?"updateKey":"missingKey",d,u,a,$?O:f),i){const P=this.resolve(a,{...n,keySeparator:!1});P&&P.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let M=[];const I=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&I&&I[0])for(let P=0;P<I.length;P++)M.push(I[P]);else this.options.saveMissingTo==="all"?M=this.languageUtils.toResolveHierarchy(n.lng||this.language):M.push(n.lng||this.language);const z=(P,R,E)=>{const J=T&&E!==f?E:W;this.options.missingKeyHandler?this.options.missingKeyHandler(P,u,R,J,$,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(P,u,R,J,$,n),this.emit("missingKey",P,u,R,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?M.forEach(P=>{const R=this.pluralResolver.getSuffixes(P,n);F&&n[`defaultValue${this.options.pluralSeparator}zero`]&&R.indexOf(`${this.options.pluralSeparator}zero`)<0&&R.push(`${this.options.pluralSeparator}zero`),R.forEach(E=>{z([P],a+E,n[`defaultValue${E}`]||O)})}):z(M,a,O))}f=this.extendTranslation(f,t,n,c,r),_&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${u}:${a}`),(_||N)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}:${a}`:a,N?f:void 0):f=this.options.parseMissingKeyHandler(f))}return s?(c.res=f,c.usedParams=this.getUsedParamsDetails(n),c):f}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=jt(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(d){const f=t.match(this.interpolator.nestingRegexp);p=f&&f.length}let c=r.replace&&!jt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),t=this.interpolator.interpolate(t,c,r.lng||this.language||s.usedLng,r),d){const f=t.match(this.interpolator.nestingRegexp),m=f&&f.length;p<m&&(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 f=arguments.length,m=new Array(f),y=0;y<f;y++)m[y]=arguments[y];return i&&i[0]===m[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${n[0]}`),null):a.translate(...m,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,u=jt(l)?[l]:l;return t!=null&&u&&u.length&&r.applyPostProcessor!==!1&&(t=A2.handle(u,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 jt(t)&&(t=[t]),t.forEach(u=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(u,n),p=d.key;s=p;let c=d.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const f=n.count!==void 0&&!jt(n.count),m=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(jt(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);c.forEach(k=>{this.isValidLookup(r)||(l=k,!V1[`${v[0]}-${k}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(V1[`${v[0]}-${k}`]=!0,this.logger.warn(`key "${s}" for languages "${v.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),v.forEach(g=>{if(this.isValidLookup(r))return;a=g;const b=[p];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(b,p,g,k,n);else{let N;f&&(N=this.pluralResolver.getSuffix(g,n.count,n));const _=`${this.options.pluralSeparator}zero`,C=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(b.push(p+N),n.ordinal&&N.indexOf(C)===0&&b.push(p+N.replace(C,this.options.pluralSeparator)),m&&b.push(p+_)),y){const T=`${p}${this.options.contextSeparator}${n.context}`;b.push(T),f&&(b.push(T+N),n.ordinal&&N.indexOf(C)===0&&b.push(T+N.replace(C,this.options.pluralSeparator)),m&&b.push(T+_))}}let x;for(;x=b.pop();)this.isValidLookup(r)||(i=x,r=this.getResource(g,k,x,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&&!jt(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 Wx=e=>e.charAt(0).toUpperCase()+e.slice(1);class U1{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=jo.create("languageUtils")}getScriptPartFromCode(t){if(t=Ng(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=Ng(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(jt(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]=Wx(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]=Wx(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Wx(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)),jt(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 jt(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))):jt(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let zY=[{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}],HY={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 BY=["v1","v2","v3"],WY=["v4"],K1={zero:0,one:1,two:2,few:3,many:4,other:5},VY=()=>{const e={};return zY.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:HY[t.fc]}})}),e};class UY{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=jo.create("pluralResolver"),(!this.options.compatibilityJSON||WY.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=VY(),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=Ng(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 u=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(u,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)=>K1[s]-K1[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!BY.includes(this.options.compatibilityJSON)}}const q1=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=TY(e,t,n);return!i&&s&&jt(n)&&(i=Vb(e,n,r),i===void 0&&(i=Vb(t,n,r))),i},Vx=e=>e.replace(/\$/g,"$$$$");class KY{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=jo.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:u,formatSeparator:d,unescapeSuffix:p,unescapePrefix:c,nestingPrefix:f,nestingPrefixEscaped:m,nestingSuffix:y,nestingSuffixEscaped:v,nestingOptionsSeparator:k,maxReplaces:g,alwaysFormat:b}=t.interpolation;this.escape=n!==void 0?n:LY,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Xc(i):a||"{{",this.suffix=l?Xc(l):u||"}}",this.formatSeparator=d||",",this.unescapePrefix=p?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=f?Xc(f):m||Xc("$t("),this.nestingSuffix=y?Xc(y):v||Xc(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=g||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,a,l;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=m=>{if(m.indexOf(this.formatSeparator)<0){const g=q1(n,u,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...s,...n,interpolationkey:m}):g}const y=m.split(this.formatSeparator),v=y.shift().trim(),k=y.join(this.formatSeparator).trim();return this.format(q1(n,u,v,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...s,...n,interpolationkey:v})};this.resetRegExp();const p=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,c=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>Vx(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?Vx(this.escape(m)):Vx(m)}].forEach(m=>{for(l=0;i=m.regex.exec(t);){const y=i[1].trim();if(a=d(y),a===void 0)if(typeof p=="function"){const k=p(t,i,s);a=jt(k)?k:""}else if(s&&Object.prototype.hasOwnProperty.call(s,y))a="";else if(c){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${t}`),a="";else!jt(a)&&!this.useRawValueToEscape&&(a=F1(a));const v=m.safeValue(a);if(t=t.replace(i[0],v),c?(m.regex.lastIndex+=a.length,m.regex.lastIndex-=i[0].length):m.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=(u,d)=>{const p=this.nestingOptionsSeparator;if(u.indexOf(p)<0)return u;const c=u.split(new RegExp(`${p}[ ]*{`));let f=`{${c[1]}`;u=c[0],f=this.interpolate(f,a);const m=f.match(/'/g),y=f.match(/"/g);(m&&m.length%2===0&&!y||y.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),d&&(a={...d,...a})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,v),`${u}${p}${f}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,u};for(;s=this.nestingRegexp.exec(t);){let u=[];a={...r},a=a.replace&&!jt(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 p=s[1].split(this.formatSeparator).map(c=>c.trim());s[1]=p.shift(),u=p,d=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!jt(i))return i;jt(i)||(i=F1(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),d&&(i=u.reduce((p,c)=>this.format(p,c,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const qY=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,...u]=a.split(":"),d=u.join(":").trim().replace(/^'+|'+$/g,""),p=l.trim();n[p]||(n[p]=d),d==="false"&&(n[p]=!1),d==="true"&&(n[p]=!0),isNaN(d)||(n[p]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},Jc=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(Ng(r),s),t[a]=l),l(n)}};class YY{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=jo.create("formatter"),this.options=t,this.formats={number:Jc((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:Jc((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:Jc((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:Jc((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:Jc((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()]=Jc(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(u=>u.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,l)].join(this.formatSeparator)}return i.reduce((l,u)=>{const{formatName:d,formatOptions:p}=qY(u);if(this.formats[d]){let c=l;try{const f=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},m=f.locale||f.lng||s.locale||s.lng||r;c=this.formats[d](l,m,{...p,...s,...f})}catch(f){this.logger.warn(f)}return c}else this.logger.warn(`there was no format function for ${d}`);return l},t)}}const GY=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class XY extends hy{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=jo.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={},u={};return t.forEach(d=>{let p=!0;n.forEach(c=>{const f=`${d}|${c}`;!r.reload&&this.store.hasResourceBundle(d,c)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,p=!1,a[f]===void 0&&(a[f]=!0),i[f]===void 0&&(i[f]=!0),u[c]===void 0&&(u[c]=!0)))}),p||(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(u)}}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(u=>{IY(u.loaded,[i],a),GY(u,t),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(d=>{l[d]||(l[d]={});const p=u.loaded[d];p.length&&p.forEach(c=>{l[d][c]===void 0&&(l[d][c]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(u=>!u.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,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const c=this.waitingReads.shift();this.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}if(d&&p&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,a)},i);return}a(d,p)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const d=u(t,n);d&&typeof d.then=="function"?d.then(p=>l(null,p)).catch(l):l(null,d)}catch(d){l(d)}return}return u(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();jt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),jt(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 u={...a,isUpdate:i},d=this.backend.create.bind(this.backend);if(d.length<6)try{let p;d.length===5?p=d(t,n,r,s,u):p=d(t,n,r,s),p&&typeof p.then=="function"?p.then(c=>l(null,c)).catch(l):l(null,p)}catch(p){l(p)}else d(t,n,r,s,l,u)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const Y1=()=>({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]),jt(e[1])&&(t.defaultValue=e[1]),jt(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}}),G1=e=>(jt(e.ns)&&(e.ns=[e.ns]),jt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),jt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Yh=()=>{},JY=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class op extends hy{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=G1(t),this.services={},this.logger=jo,this.modules={external:[]},JY(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&&(jt(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=Y1();this.options={...s,...this.options,...G1(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=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?jo.init(i(this.modules.logger),this.options):jo.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:typeof Intl<"u"&&(p=YY);const c=new U1(this.options);this.store=new W1(this.options.resources,this.options);const f=this.services;f.logger=jo,f.resourceStore=this.store,f.languageUtils=c,f.pluralResolver=new UY(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(f.formatter=i(p),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new KY(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new XY(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(m){for(var y=arguments.length,v=new Array(y>1?y-1:0),k=1;k<y;k++)v[k-1]=arguments[k];t.emit(m,...v)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Cg(this.services,this.options),this.translator.on("*",function(m){for(var y=arguments.length,v=new Array(y>1?y-1:0),k=1;k<y;k++)v[k-1]=arguments[k];t.emit(m,...v)}),this.modules.external.forEach(m=>{m.init&&m.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Yh),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[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(p=>{this[p]=function(){return t.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return t.store[p](...arguments),t}});const u=Vd(),d=()=>{const p=(c,f)=>{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),u.resolve(f),r(c,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initImmediate?d():setTimeout(d,0),u}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Yh;const s=jt(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(u=>a(u)),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=Vd();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=Yh),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"&&A2.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=Vd();this.emit("languageChanging",t);const i=u=>{this.language=u,this.languages=this.services.languageUtils.toResolveHierarchy(u),this.resolvedLanguage=void 0,this.setResolvedLanguage(u)},a=(u,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(u,function(){return r.t(...arguments)})},l=u=>{!t&&!u&&this.services.languageDetector&&(u=[]);const d=jt(u)?u:this.services.languageUtils.getBestMatchFromCodes(u);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,p=>{a(p,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 u;if(typeof l!="object"){for(var d=arguments.length,p=new Array(d>2?d-2:0),c=2;c<d;c++)p[c-2]=arguments[c];u=s.options.overloadTranslationOptionHandler([a,l].concat(p))}else u={...l};u.lng=u.lng||i.lng,u.lngs=u.lngs||i.lngs,u.ns=u.ns||i.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||r||i.keyPrefix);const f=s.options.keySeparator||".";let m;return u.keyPrefix&&Array.isArray(a)?m=a.map(y=>`${u.keyPrefix}${f}${y}`):m=u.keyPrefix?`${u.keyPrefix}${f}${a}`:a,s.t(m,u)};return jt(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,u)=>{const d=this.services.backendConnector.state[`${l}|${u}`];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=Vd();return this.options.ns?(jt(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=Vd();jt(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 U1(Y1());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 op(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Yh;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new op(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 W1(this.store.data,s),i.services.resourceStore=i.store),i.translator=new Cg(i.services,s),i.translator.on("*",function(l){for(var u=arguments.length,d=new Array(u>1?u-1:0),p=1;p<u;p++)d[p-1]=arguments[p];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 qr=op.createInstance();qr.createInstance=op.createInstance;qr.createInstance;qr.dir;qr.init;qr.loadResources;qr.reloadResources;qr.use;qr.changeLanguage;qr.getFixedT;qr.t;qr.exists;qr.setDefaultNamespace;qr.hasLoadedNamespace;qr.loadNamespaces;qr.loadLanguages;function QY(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ap(e){"@babel/helpers - typeof";return ap=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},ap(e)}function ZY(e,t){if(ap(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ap(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function eG(e){var t=ZY(e,"string");return ap(t)=="symbol"?t:t+""}function tG(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,eG(r.key),r)}}function nG(e,t,n){return t&&tG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var I2=[],rG=I2.forEach,sG=I2.slice;function iG(e){return rG.call(sG.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var X1=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,oG=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(!X1.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!X1.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 u=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite;switch(u){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},J1={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=oG(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)}},aG={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=J1.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&J1.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},lG={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 u=i[a].substring(0,l);u===t.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},Ud=null,Q1=function(){if(Ud!==null)return Ud;try{Ud=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Ud=!1}return Ud},cG={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&Q1()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&Q1()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Kd=null,Z1=function(){if(Kd!==null)return Kd;try{Kd=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Kd=!1}return Kd},uG={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&Z1()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Z1()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},dG={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}},fG={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}},pG={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}},hG={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]}},T2=!1;try{document.cookie,T2=!0}catch{}var R2=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];T2||R2.splice(1,1);function mG(){return{order:R2,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var L2=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};QY(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return nG(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=iG(r,this.options||{},mG()),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(aG),this.addDetector(lG),this.addDetector(cG),this.addDetector(uG),this.addDetector(dG),this.addDetector(fG),this.addDetector(pG),this.addDetector(hG)}},{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)}))}}])}();L2.type="languageDetector";const gG={name:"AgentFlow",tagline:"AI Workflow Orchestration"},yG={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},xG={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"},wG={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},bG={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},vG={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},kG={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},SG={app:gG,nav:yG,common:xG,status:wG,nodeTypes:bG,engine:vG,links:kG},NG="Flow Editor",jG="Nodes",CG="Edges",EG="Properties",_G={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"},PG={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}}"},AG={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},IG={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},TG={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"},RG={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)"},LG={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},MG={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},OG={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},$G={node:"Node",text:"Text",file:"File",bool:"Boolean"},DG={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"},FG={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",saveViewport:"Save current entry view",selectAll:"Select all nodes",undo:"Undo canvas change",redo:"Redo canvas change"},zG={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},HG={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."},BG={mainNav:"Main Navigation"},WG={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'},VG={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):
|
|
202
|
+
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
203
|
+
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}}"},UG={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"},KG={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},qG={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}}"},YG={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"},GG={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"},XG={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"},JG={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"},QG={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"},ZG={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},eX={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},tX={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"},nX={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."},rX={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},sX={save:"Save",cancel:"Cancel"},iX={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},oX={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},aX={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"},lX={title:NG,nodes:jG,edges:CG,properties:EG,node:_G,nodeProps:PG,actions:AG,panel:IG,palette:TG,pipeline:RG,status:LG,roles:MG,phases:OG,types:$G,runContext:DG,shortcuts:FG,jumpPalette:zG,emptyCanvas:HG,sidebar:BG,validation:WG,composer:VG,topbar:UG,palette2:KG,run:qG,fileEdit:YG,settings:GG,schedule:XG,history:JG,nodePropsError:QG,placeholder:ZG,time:eX,userCheck:tX,userAsk:nX,toolPrint:rX,provideEdit:sX,runParams:iX,runPreset:oX,runConfig:aX},cX="Settings",uX={engine:"Engine Settings",preferences:"Global Preferences"},dX={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)."},fX={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..."}},pX={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."},hX={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."},mX={title:"Environment Variables",note:"Private to the current signed-in user; overrides service-level env at runtime",noteAdmin:"Configure personal or global env; personal values override global values",saving:"Saving...",key:"Key",value:"Value",scope:"Scope",personal:"Personal",global:"Global",add:"Add",delete:"Delete {{key}}",invalidKey:"Env key must start with a letter or underscore, and only contain letters, numbers, and underscores.",newKey:"New env key",newValue:"Value (be careful with secrets)"},gX={title:"User Allowlist",description:"Only controls which usernames may register or sign in. Users set their own password on first sign-in.",enabled:"Allowlist enabled",open:"Open registration",refreshing:"Refreshing...",saving:"Saving...",file:"File",fileList:"File allowlist",envList:"Environment allowlist",readonly:"Read-only",userCount:"{{count}} users",remove:"Remove {{username}}",emptyFile:"No file allowlist configured. If env allowlist is also empty, every username can register.",emptyEnv:"AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS is not configured",unionHint:"The file allowlist and env allowlist are combined. This only stores usernames, never passwords.",add:"Add"},yX={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},xX={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},wX={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},bX={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."},vX={title:cX,crumb:uX,workspace:dX,cursor:fX,opencode:pX,claudeCode:hX,env:mX,allowlist:gX,system:yX,shortcuts:xX,language:wX,onboarding:bX},kX={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},SX={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)"},NX={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},jX={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},CX={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},EX={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},_X={aiLabels:kX,placeholders:SX,actions:NX,labels:jX,tooltips:CX,rightPanel:EX},PX="Projects",AX="All",IX="Archived",TX="Nodes",RX="My Nodes",LX="My Flows",MX="Skills",OX="Active Projects",$X="Archived Pipelines",DX="Global Nodes",FX="Manage node versions published to the current workspace marketplace, {{count}} total.",zX="Manage flow snippets published to the current workspace marketplace, {{count}} total.",HX="Global Skills",BX="Create New Project",WX="New Pipeline",VX="SEARCH PIPELINES...",UX="SEARCH NODES...",KX="SEARCH FLOW SNIPPETS...",qX="SEARCH SKILLS...",YX="Refresh Resources",GX="Loading pipelines...",XX="Loading global resources...",JX="Filter result: {{count}} items (matching title, description, path and tags)",QX="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",ZX="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",eJ="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",tJ="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",nJ="Executable building blocks for pipeline runtime",rJ="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.",sJ="Published local node packages",iJ="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",oJ="Published flow snippets",aJ="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",lJ="Operating guides for Composer and agents",cJ="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",uJ="No archived projects.",dJ="No active pipelines; archived items are in the Archived tab.",fJ="No global nodes available.",pJ="No marketplace nodes have been published.",hJ="No flow snippets have been published. Select multiple canvas nodes and publish them first.",mJ="No skills available.",gJ="No description.",yJ='No node matches "{{query}}".',xJ='No flow snippet matches "{{query}}".',wJ='No skill matches "{{query}}".',bJ="{{inputs}} in / {{outputs}} out",vJ="Flow Snippet",kJ="{{nodes}} nodes / {{edges}} edges",SJ="Skill",NJ="Node detail",jJ="Flow snippet detail",CJ="Skill detail",EJ="Type",_J="Source",PJ="Package",AJ="Version",IJ="Path",TJ="Editable",RJ="Read only",LJ="Editable",MJ="Schema",OJ="Inputs",$J="Outputs",DJ="Runtime",FJ="Node Body",zJ="Files",HJ="Usage",BJ="No runtime manifest.",WJ="No node body or README.",VJ="No previewable files.",UJ="Select a file to preview.",KJ="Binary file preview is not supported.",qJ="Large file; showing the first 256KB only.",YJ="No pipelines using this node were found.",GJ="Node Management",XJ="Delete Node Version",JJ="Deleting...",QJ="AgentFlow checks all flow references before deleting; installed or used versions are kept.",ZJ="Delete {{id}}@{{version}}? This cannot be undone.",eQ="Deleted {{id}}@{{version}}.",tQ="{{count}} flow(s) still use it.",nQ="Flow Snippet Management",rQ="Delete Flow Snippet",sQ="Deleting...",iQ="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",oQ="Delete {{id}}@{{version}}? This cannot be undone.",aQ="Deleted {{id}}@{{version}}.",lQ="No slots",cQ="Purpose",uQ="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",dQ="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.",fQ="Scale",pQ="Flow Preview",hQ="Edges",mQ="Snippet JSON",gQ="{{count}} more edge(s)",yQ="No previewable nodes.",xQ="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",wQ="SKILL.md Preview",bQ="No preview content available.",vQ="Select a resource to inspect details.",kQ="Failed to load pipeline list.",SQ="No pipelines in current workspace.",NQ="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.",jQ='No pipelines found matching "{{query}}". Try different keywords or clear the search.',CQ="Recent Activity",EQ="No recent activity",_Q="No recent activity matching the keyword",PQ="Recent Run",AQ="Recent Open",IQ={builtin:"Built-in",workspace:"Workspace",user:"User"},TQ={flow:"Flow",global:"Global",marketplace:"Marketplace"},RQ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},LQ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},MQ="Open to edit this pipeline in the node canvas.",OQ={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>"},$Q={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"},DQ={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"},FQ={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"},zQ={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"},HQ={title:PX,all:AX,archived:IX,nodes:TX,myNodes:RX,myFlows:LX,skills:MX,activeProjects:OX,archivedPipelines:$X,globalNodes:DX,myNodesHint:FX,myFlowsHint:zX,globalSkills:HX,createNew:BX,newPipeline:WX,searchPipelines:VX,searchNodes:UX,searchFlows:KX,searchSkills:qX,refreshResources:YX,loadingPipelines:GX,loadingResources:XX,filterResult:JX,archivedHint:QX,activeHint:ZX,nodesHint:eJ,skillsHint:tJ,nodesPurposeTitle:nJ,nodesPurposeDesc:rJ,myNodesPurposeTitle:sJ,myNodesPurposeDesc:iJ,myFlowsPurposeTitle:oJ,myFlowsPurposeDesc:aJ,skillsPurposeTitle:lJ,skillsPurposeDesc:cJ,noArchived:uJ,noActive:dJ,noNodes:fJ,noMyNodes:pJ,noMyFlows:hJ,noSkills:mJ,noDescription:gJ,noNodeMatch:yJ,noFlowSnippetMatch:xJ,noSkillMatch:wJ,nodeSlots:bJ,flowSnippet:vJ,flowSnippetNodes:kJ,skill:SJ,nodeDetail:NJ,flowDetail:jJ,skillDetail:CJ,detailType:EJ,detailSource:_J,detailPackage:PJ,detailVersion:AJ,detailPath:IJ,detailEditable:TJ,readOnly:RJ,editable:LJ,nodeSchema:MJ,nodeInputs:OJ,nodeOutputs:$J,nodeRuntime:DJ,nodeBody:FJ,nodeFiles:zJ,nodeUsage:HJ,noRuntimeManifest:BJ,noNodeBody:WJ,noNodeFiles:VJ,selectNodeFile:UJ,binaryFile:KJ,fileTruncated:qJ,noNodeUsage:YJ,myNodeManagement:GJ,deleteMyNode:XJ,deletingMyNode:JJ,deleteMyNodeHint:QJ,deleteMyNodeConfirm:ZJ,deleteMyNodeSuccess:eQ,deleteMyNodeUsedBy:tQ,myFlowManagement:nQ,deleteMyFlow:rQ,deletingMyFlow:sQ,deleteMyFlowHint:iQ,deleteMyFlowConfirm:oQ,deleteMyFlowSuccess:aQ,noSlots:lQ,resourceMeaning:cQ,nodesMeaning:uQ,myFlowsMeaning:dQ,flowSnippetScale:fQ,flowSnippetPreview:pQ,flowSnippetEdges:hQ,flowSnippetJson:mQ,flowSnippetMoreEdges:gQ,noFlowSnippetPreview:yQ,skillsMeaning:xQ,skillPreview:wQ,skillPreviewEmpty:bQ,selectResource:vQ,loadFailed:kQ,noPipelines:SQ,emptyHint:NQ,noMatch:jQ,recentActivity:CQ,noRecentActivity:EQ,noMatchRecent:_Q,recentRun:PQ,recentOpen:AQ,sourceBadge:IQ,resourceSource:TQ,resourceFilter:RQ,nodeDetailTabs:LQ,defaultCardDesc:MQ,hubCard:OQ,newPipelineModal:$Q,importModal:DQ,deleteModal:FQ,archiveModal:zQ},BQ="Back",WQ="Next",VQ="Skip",UQ="Done",KQ="Start Creating",qQ={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
204
|
+
|
|
205
|
+
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
206
|
+
|
|
207
|
+
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},YQ={intro:`Now you're in the flow editor.
|
|
208
|
+
|
|
209
|
+
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
210
|
+
|
|
211
|
+
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
212
|
+
|
|
213
|
+
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
214
|
+
|
|
215
|
+
The left node panel allows you to freely drag, delete, and adjust connections.`},GQ={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"},XQ={back:BQ,next:WQ,skip:VQ,done:UQ,startCreate:KQ,projects:qQ,flow:YQ,newPipeline:GQ},JQ={name:"AgentFlow",tagline:"AI 工作流编排"},QQ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},ZQ={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},eZ={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},tZ={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},nZ={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},rZ={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},sZ={app:JQ,nav:QQ,common:ZQ,status:eZ,nodeTypes:tZ,engine:nZ,links:rZ},iZ="流程编辑器",oZ="节点",aZ="连线",lZ="属性",cZ={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:"编辑内容"},uZ={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}}"},dZ={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},fZ={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},pZ={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},hZ={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},mZ={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},gZ={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},yZ={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},xZ={node:"节点",text:"文本",file:"文件",bool:"布尔"},wZ={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:"等待"},bZ={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},vZ={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},kZ={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},SZ={mainNav:"主导航"},NZ={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},jZ={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}} 步):
|
|
216
|
+
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
217
|
+
当前:{{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}}"},CZ={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},EZ={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},_Z={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}} 的分支"},PZ={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},AZ={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:"已复制"},IZ={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:"定时配置已保存"},TZ={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},RZ={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},LZ={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},MZ={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},OZ={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},$Z={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},DZ={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},FZ={save:"保存",cancel:"取消"},zZ={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},HZ={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},BZ={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},WZ={title:iZ,nodes:oZ,edges:aZ,properties:lZ,node:cZ,nodeProps:uZ,actions:dZ,panel:fZ,palette:pZ,pipeline:hZ,status:mZ,roles:gZ,phases:yZ,types:xZ,runContext:wZ,shortcuts:bZ,jumpPalette:vZ,emptyCanvas:kZ,sidebar:SZ,validation:NZ,composer:jZ,topbar:CZ,palette2:EZ,run:_Z,fileEdit:PZ,settings:AZ,schedule:IZ,history:TZ,nodePropsError:RZ,placeholder:LZ,time:MZ,userCheck:OZ,userAsk:$Z,toolPrint:DZ,provideEdit:FZ,runParams:zZ,runPreset:HZ,runConfig:BZ},VZ="设置",UZ={engine:"引擎设置",preferences:"全局首选项"},KZ={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},qZ={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},YZ={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},GZ={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},XZ={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},JZ={title:"用户白名单",description:"只控制 username 是否允许注册或登录,密码由用户首次登录时自行设置。",enabled:"白名单已启用",open:"开放注册",refreshing:"刷新中...",saving:"保存中...",file:"文件",fileList:"文件白名单",envList:"环境变量白名单",readonly:"只读",userCount:"{{count}} 个用户",remove:"删除 {{username}}",emptyFile:"未配置文件白名单;如果环境变量也为空,则所有用户可注册。",emptyEnv:"未配置 AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS",unionHint:"文件白名单与环境变量白名单取并集;这里只会保存用户名,不保存密码。",add:"添加"},QZ={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},ZZ={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},eee={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},tee={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},nee={title:VZ,crumb:UZ,workspace:KZ,cursor:qZ,opencode:YZ,claudeCode:GZ,env:XZ,allowlist:JZ,system:QZ,shortcuts:ZZ,language:eee,onboarding:tee},ree={thinking:"思考",result:"结果",reply:"回复",error:"错误"},see={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},iee={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},oee={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},aee={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},lee={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},cee={aiLabels:ree,placeholders:see,actions:iee,labels:oee,tooltips:aee,rightPanel:lee},uee="项目",dee="全部",fee="已归档",pee="Nodes",hee="我的 Nodes",mee="我的流程",gee="Skills",yee="活跃项目",xee="已归档流水线",wee="全局 Nodes",bee="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",vee="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",kee="全局 Skills",See="创建新项目",Nee="新建流水线",jee="搜索流水线…",Cee="搜索 nodes…",Eee="搜索流程片段…",_ee="搜索 skills…",Pee="刷新资源",Aee="加载流水线列表…",Iee="加载全局资源…",Tee="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",Ree="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",Lee="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",Mee="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",Oee="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",$ee="流程运行时的可执行积木",Dee="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",Fee="已发布的本地节点包",zee="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",Hee="已发布的流程片段",Bee="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",Wee="Composer/Agent 的操作指南",Vee="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",Uee="暂无归档项目。",Kee="暂无未归档流水线;已归档项在 Archived 标签中查看。",qee="暂无可用全局 nodes。",Yee="暂无已发布的 marketplace nodes。",Gee="暂无已发布的流程片段。可在画布中选中多个节点后发布。",Xee="暂无可用 skills。",Jee="暂无描述。",Qee="未找到与「{{query}}」匹配的 node。",Zee="未找到与「{{query}}」匹配的流程片段。",ete="未找到与「{{query}}」匹配的 skill。",tte="{{inputs}} in / {{outputs}} out",nte="流程片段",rte="{{nodes}} 节点 / {{edges}} 连线",ste="Skill",ite="Node 详情",ote="流程片段详情",ate="Skill 详情",lte="类型",cte="来源",ute="包",dte="版本",fte="路径",pte="可编辑",hte="只读",mte="可编辑",gte="Schema",yte="输入",xte="输出",wte="Runtime",bte="节点内容",vte="Files",kte="Usage",Ste="暂无 runtime manifest。",Nte="暂无节点正文或 README。",jte="暂无可预览文件。",Cte="请选择文件查看内容。",Ete="二进制文件暂不支持预览。",_te="文件较大,仅显示前 256KB。",Pte="暂未发现使用此 node 的流水线。",Ate="节点管理",Ite="删除节点版本",Tte="删除中…",Rte="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",Lte="确定删除 {{id}}@{{version}}?此操作不可撤销。",Mte="已删除 {{id}}@{{version}}。",Ote="仍有 {{count}} 个 Flow 使用它。",$te="流程片段管理",Dte="删除流程片段",Fte="删除中…",zte="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",Hte="确定删除 {{id}}@{{version}}?此操作不可撤销。",Bte="已删除 {{id}}@{{version}}。",Wte="无槽位",Vte="作用",Ute="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",Kte="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",qte="规模",Yte="流程预览",Gte="连线",Xte="片段 JSON",Jte="还有 {{count}} 条连线",Qte="暂无可预览节点。",Zte="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",ene="SKILL.md 预览",tne="暂无可预览内容。",nne="请选择一个资源查看详情。",rne="未能加载流水线列表。",sne="当前工作区暂无流水线。",ine="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",one="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",ane="最近打开或最近运行",lne="暂无打开或运行记录",cne="暂无与关键词匹配的最近记录",une="最近运行",dne="最近打开",fne={builtin:"内置",workspace:"工作区",user:"用户"},pne={flow:"Flow",global:"Global",marketplace:"Marketplace"},hne={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},mne={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},gne="打开以在节点画布中编辑此流水线。",yne={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},xne={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:"关闭"},wne={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},bne={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},vne={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},kne={title:uee,all:dee,archived:fee,nodes:pee,myNodes:hee,myFlows:mee,skills:gee,activeProjects:yee,archivedPipelines:xee,globalNodes:wee,myNodesHint:bee,myFlowsHint:vee,globalSkills:kee,createNew:See,newPipeline:Nee,searchPipelines:jee,searchNodes:Cee,searchFlows:Eee,searchSkills:_ee,refreshResources:Pee,loadingPipelines:Aee,loadingResources:Iee,filterResult:Tee,archivedHint:Ree,activeHint:Lee,nodesHint:Mee,skillsHint:Oee,nodesPurposeTitle:$ee,nodesPurposeDesc:Dee,myNodesPurposeTitle:Fee,myNodesPurposeDesc:zee,myFlowsPurposeTitle:Hee,myFlowsPurposeDesc:Bee,skillsPurposeTitle:Wee,skillsPurposeDesc:Vee,noArchived:Uee,noActive:Kee,noNodes:qee,noMyNodes:Yee,noMyFlows:Gee,noSkills:Xee,noDescription:Jee,noNodeMatch:Qee,noFlowSnippetMatch:Zee,noSkillMatch:ete,nodeSlots:tte,flowSnippet:nte,flowSnippetNodes:rte,skill:ste,nodeDetail:ite,flowDetail:ote,skillDetail:ate,detailType:lte,detailSource:cte,detailPackage:ute,detailVersion:dte,detailPath:fte,detailEditable:pte,readOnly:hte,editable:mte,nodeSchema:gte,nodeInputs:yte,nodeOutputs:xte,nodeRuntime:wte,nodeBody:bte,nodeFiles:vte,nodeUsage:kte,noRuntimeManifest:Ste,noNodeBody:Nte,noNodeFiles:jte,selectNodeFile:Cte,binaryFile:Ete,fileTruncated:_te,noNodeUsage:Pte,myNodeManagement:Ate,deleteMyNode:Ite,deletingMyNode:Tte,deleteMyNodeHint:Rte,deleteMyNodeConfirm:Lte,deleteMyNodeSuccess:Mte,deleteMyNodeUsedBy:Ote,myFlowManagement:$te,deleteMyFlow:Dte,deletingMyFlow:Fte,deleteMyFlowHint:zte,deleteMyFlowConfirm:Hte,deleteMyFlowSuccess:Bte,noSlots:Wte,resourceMeaning:Vte,nodesMeaning:Ute,myFlowsMeaning:Kte,flowSnippetScale:qte,flowSnippetPreview:Yte,flowSnippetEdges:Gte,flowSnippetJson:Xte,flowSnippetMoreEdges:Jte,noFlowSnippetPreview:Qte,skillsMeaning:Zte,skillPreview:ene,skillPreviewEmpty:tne,selectResource:nne,loadFailed:rne,noPipelines:sne,emptyHint:ine,noMatch:one,recentActivity:ane,noRecentActivity:lne,noMatchRecent:cne,recentRun:une,recentOpen:dne,sourceBadge:fne,resourceSource:pne,resourceFilter:hne,nodeDetailTabs:mne,defaultCardDesc:gne,hubCard:yne,newPipelineModal:xne,importModal:wne,deleteModal:bne,archiveModal:vne},Sne="返回",Nne="下一步",jne="跳过",Cne="完成",Ene="开始创建",_ne={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
218
|
+
|
|
219
|
+
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
220
|
+
|
|
221
|
+
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},Pne={intro:`现在进入流程编辑器。
|
|
222
|
+
|
|
223
|
+
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
224
|
+
|
|
225
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
226
|
+
|
|
227
|
+
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
228
|
+
|
|
229
|
+
左侧节点面板可以自由拖拽、删除和调整连接。`},Ane={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},Ine={back:Sne,next:Nne,skip:jne,done:Cne,startCreate:Ene,projects:_ne,flow:Pne,newPipeline:Ane},Tne={en:{common:SG,flow:lX,settings:vX,composer:_X,project:HQ,onboarding:XQ},zh:{common:sZ,flow:WZ,settings:nee,composer:cee,project:kne,onboarding:Ine}};qr.use(L2).use(kO).init({resources:Tne,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 Rne=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function Lne(e){return qr.changeLanguage(e)}const Ub="agentflow-settings-opencode-plan-v1";function Ux(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 M2(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Mne(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function Gl(e,t="user"){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||typeof r!="object")continue;const s=String(r.key??"").trim(),i=String(r.value??""),a=String(r.id??"").trim()||M2(),u=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:a,key:s,value:i,scope:u})}return n}function eC(e){return Gl(e).map(({key:t,value:n})=>({key:t,value:n}))}function tC(){try{return localStorage.getItem(Ub)??""}catch{return""}}function One(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function nC(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 $ne({authUser:e}){const{t,i18n:n}=In(["common","settings"]),r=n.language||"zh",[s,i]=h.useState(""),[a,l]=h.useState(""),[u,d]=h.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[p,c]=h.useState(""),[f,m]=h.useState(!1),[y,v]=h.useState(!1),[k,g]=h.useState(""),[b,x]=h.useState([]),[N,_]=h.useState(""),[C,T]=h.useState(!1),[H,L]=h.useState(""),[F,O]=h.useState(""),[D,W]=h.useState(!1),[$,M]=h.useState(()=>new Set),[I,z]=h.useState(""),[P,R]=h.useState([]),[E,J]=h.useState(!1),[Z,U]=h.useState(""),[se,pe]=h.useState([]),[he,xe]=h.useState([]),[le,Se]=h.useState(""),[ie,oe]=h.useState(""),[ye,ke]=h.useState(!1),[Ve,Je]=h.useState(!1),[We,ot]=h.useState(""),ze=h.useRef(null),mt=h.useRef(!1),ln=h.useRef(!1),zn=h.useRef(""),Bt=h.useCallback(async()=>{l("");try{const ae=await fetch("/api/ui-context");if(!ae.ok)throw new Error("HTTP "+ae.status);const Le=await ae.json();i(typeof Le.workspaceRoot=="string"?Le.workspaceRoot:"")}catch(ae){l(String(ae.message||ae)),i("")}},[]),en=h.useCallback(async()=>{c(""),m(!0);try{const ae=await fetch("/api/model-lists");if(!ae.ok)throw new Error("HTTP "+ae.status);const Le=await ae.json();d(Ux(Le))}catch(ae){c(String(ae.message||ae))}finally{m(!1)}},[]),cn=h.useCallback(async()=>{_("");try{const ae=await fetch("/api/user-env"),Le=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(typeof Le.error=="string"?Le.error:"HTTP "+ae.status);const rt=Gl(Array.isArray(Le.env)?Le.env:[],"user").map(Zn=>({...Zn,scope:"user"})),Wt=[...e!=null&&e.isAdmin?Gl(Array.isArray(Le.globalEnv)?Le.globalEnv:[],"global").map(Zn=>({...Zn,scope:"global"})):[],...rt];zn.current=JSON.stringify(Wt),x(Wt)}catch(ae){x([]),_(String(ae.message||ae))}finally{ln.current=!0}},[e==null?void 0:e.isAdmin]),un=h.useCallback(async()=>{if(e!=null&&e.isAdmin){J(!0),U("");try{const ae=await fetch("/api/feedback"),Le=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(typeof Le.error=="string"?Le.error:"HTTP "+ae.status);R(Array.isArray(Le.feedback)?Le.feedback:[])}catch(ae){U(String(ae.message||ae))}finally{J(!1)}}},[e==null?void 0:e.isAdmin]),ue=h.useCallback(async()=>{if(e!=null&&e.isAdmin){ke(!0),ot("");try{const ae=await fetch("/api/admin/user-allowlist"),Le=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(typeof Le.error=="string"?Le.error:"HTTP "+ae.status);const rt=Le.allowlist&&typeof Le.allowlist=="object"?Le.allowlist:{};pe(Array.isArray(rt.fileUsers)?rt.fileUsers.map(String):[]),xe(Array.isArray(rt.envUsers)?rt.envUsers.map(String):[]),Se(typeof rt.path=="string"?rt.path:"")}catch(ae){ot(String(ae.message||ae))}finally{ke(!1)}}},[e==null?void 0:e.isAdmin]),Ne=h.useCallback(async ae=>{if(e!=null&&e.isAdmin){Je(!0),ot("");try{const Le=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:ae})}),rt=await Le.json().catch(()=>({}));if(!Le.ok)throw new Error(typeof rt.error=="string"?rt.error:"HTTP "+Le.status);const Tt=rt.allowlist&&typeof rt.allowlist=="object"?rt.allowlist:{};pe(Array.isArray(Tt.fileUsers)?Tt.fileUsers.map(String):[]),xe(Array.isArray(Tt.envUsers)?Tt.envUsers.map(String):[]),Se(typeof Tt.path=="string"?Tt.path:"")}catch(Le){ot(String(Le.message||Le))}finally{Je(!1)}}},[e==null?void 0:e.isAdmin]),He=h.useCallback(async ae=>{const Le=Gl(ae),rt=Le.filter(Wt=>Wt.scope!=="global"),Tt=Le.filter(Wt=>Wt.scope==="global");T(!0),_("");try{const Wt=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:eC(rt),...e!=null&&e.isAdmin?{globalEnv:eC(Tt)}:{}})}),Zn=await Wt.json().catch(()=>({}));if(!Wt.ok)throw new Error(typeof Zn.error=="string"?Zn.error:"HTTP "+Wt.status);const ds=Gl(Array.isArray(Zn.env)?Zn.env:[],"user").map(fs=>({...fs,scope:"user"})),Yr=[...e!=null&&e.isAdmin?Gl(Array.isArray(Zn.globalEnv)?Zn.globalEnv:[],"global").map(fs=>({...fs,scope:"global"})):[],...ds];zn.current=JSON.stringify(Yr),x(Yr)}catch(Wt){_(String(Wt.message||Wt))}finally{T(!1)}},[e==null?void 0:e.isAdmin]),nt=h.useCallback(async()=>{c(""),m(!0);try{const ae=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:I.trim()})}),Le=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(typeof Le.error=="string"?Le.error:"HTTP "+ae.status);d(Ux(Le.modelLists))}catch(ae){c(String(ae.message||ae))}finally{m(!1)}},[I]);h.useEffect(()=>{Bt(),en(),cn(),e!=null&&e.isAdmin&&(un(),ue()),(async()=>{try{const ae=await fetch("/api/agentflow-config");if(ae.ok){const Le=await ae.json(),rt=typeof Le.opencodeProvider=="string"?Le.opencodeProvider:"";z(rt),ze.current=rt;try{localStorage.setItem(Ub,rt)}catch{}}else{const Le=tC();z(Le),ze.current=Le}}catch{const ae=tC();z(ae),ze.current=ae}finally{mt.current=!0}})()},[e==null?void 0:e.isAdmin,Bt,un,en,ue,cn]),h.useEffect(()=>{if(!ln.current||JSON.stringify(Gl(b))===zn.current)return;const Le=setTimeout(()=>{He(b)},350);return()=>clearTimeout(Le)},[b,He]),h.useEffect(()=>{if(!mt.current)return;const ae=I.trim();if(ae===ze.current)return;const Le=setTimeout(()=>{(async()=>{v(!0),g("");try{const rt=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:ae})}),Tt=await rt.json().catch(()=>({}));if(!rt.ok)throw new Error(typeof Tt.error=="string"?Tt.error:"HTTP "+rt.status);ze.current=ae;try{localStorage.setItem(Ub,ae)}catch{}Tt.modelLists&&d(Ux(Tt.modelLists))}catch(rt){g(String(rt.message||rt))}finally{v(!1)}})()},450);return()=>clearTimeout(Le)},[I]);const et=u.cursor.length>0,_t=u.opencode.length>0,st=u.claudeCode.length>0,dn=se.length>0||he.length>0,on=h.useCallback(()=>{var ae;s&&((ae=navigator.clipboard)==null||ae.writeText(s))},[s]),Un=h.useCallback(()=>{const ae=H.trim(),Le=F;if(ae){if(!Mne(ae)){_(t("settings:env.invalidKey"));return}x(rt=>[...rt,{id:M2(),key:ae,value:Le,scope:e!=null&&e.isAdmin&&D?"global":"user"}]),L(""),O("")}},[e==null?void 0:e.isAdmin,D,H,F,t]),fn=h.useCallback(ae=>{x(Le=>Le.filter(rt=>rt.id!==ae))},[]),Tn=h.useCallback((ae,Le)=>{x(rt=>rt.map(Tt=>Tt.id===ae?{...Tt,...Le}:Tt))},[]),Kn=h.useCallback(ae=>{M(Le=>{const rt=new Set(Le);return rt.has(ae)?rt.delete(ae):rt.add(ae),rt})},[]),Nr=h.useCallback(()=>{const ae=ie.trim();if(!ae)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(ae)){ot("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(se.map(rt=>String(rt||"").trim().toLowerCase())).has(ae.toLowerCase())){oe("");return}oe(""),Ne([...se,ae])},[ie,se,Ne]),we=h.useCallback(ae=>{const Le=String(ae||"").trim().toLowerCase();Le&&Ne(se.filter(rt=>String(rt||"").trim().toLowerCase()!==Le))},[se,Ne]),Me=h.useCallback(ae=>{const Le=ae.target.value;Lne(Le)},[]),ct=ae=>{const Le=nC(ae,r);return Le?t("settings:cursor.modelList.fetchedAt",{time:Le}):t("settings:cursor.modelList.never")},vt=ae=>nC(ae,r)||String(ae||"");return o.jsxs("div",{className:"af-settings-page",children:[o.jsx("header",{className:"af-settings-top",children:o.jsxs("div",{className:"af-settings-crumb","aria-label":t("settings:title"),children:[o.jsx("span",{className:"af-settings-crumb-muted",children:t("settings:crumb.engine")}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:t("settings:crumb.preferences")})]})}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("header",{className:"af-settings-hero",children:[o.jsxs("h1",{className:"af-settings-h1",children:[t("common:app.name")," ",t("settings:title")]}),o.jsx("p",{className:"af-settings-lead",children:t("settings:workspace.description")}),a?o.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,p?o.jsx("p",{className:"af-err af-settings-api-hint",children:p}):null,N?o.jsx("p",{className:"af-err af-settings-api-hint",children:N}):null]}),o.jsxs("div",{className:"af-settings-layout",children:[o.jsxs("div",{className:"af-settings-bento",children:[o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--low af-set-workspace",children:[o.jsxs("div",{className:"af-set-card-inner",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("span",{className:"material-symbols-outlined af-set-icon af-set-icon--secondary",children:"folder_managed"}),o.jsx("h2",{className:"af-set-h2",children:t("settings:workspace.title")})]}),o.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:t("settings:workspace.currentPath")}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-workspace-path",className:"af-set-input af-set-input--mono",type:"text",readOnly:!0,value:s,placeholder:t("common:loading")}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:on,"aria-label":t("settings:workspace.copyPath"),disabled:!s,children:o.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),o.jsx("p",{className:"af-set-hint",children:t("settings:workspace.description")})]}),o.jsx("div",{className:"af-set-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"Cursor CLI"}),o.jsx("span",{className:"af-set-badge"+(et?" af-set-badge--ok":" af-set-badge--muted"),children:t(et?"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:et?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(et?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:et?t("settings:cursor.modelList.count",{count:u.cursor.length})+" · "+ct(u.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),et?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:cursor.modelPreviewLabel"),children:u.cursor.join(`
|
|
230
|
+
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>nt(),disabled:f,children:t(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"+(_t?" af-set-badge--ok":" af-set-badge--err"),children:t(_t?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),o.jsx("p",{className:"af-set-p",children:t("settings:opencode.description")}),o.jsxs("div",{children:[o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:t("settings:opencode.provider")}),o.jsx("input",{id:"af-opencode-plan",className:"af-set-input af-set-input--sm af-set-input--mono",type:"text",value:I,onChange:ae=>z(ae.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),y?o.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,k?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:k}):null]}),_t?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:t("settings:cursor.modelList.count",{count:u.opencode.length})+" · "+ct(u.opencodeFetchedAt)}),o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:opencode.modelPreviewLabel"),children:u.opencode.join(`
|
|
231
|
+
`)})]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>nt(),disabled:f,children:t(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:t("settings:claudeCode.title")}),o.jsx("span",{className:"af-set-badge"+(st?" af-set-badge--ok":" af-set-badge--err"),children:t(st?"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:st?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(st?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:st?t("settings:cursor.modelList.count",{count:u.claudeCode.length})+" · "+ct(u.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),st?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:claudeCode.modelPreviewLabel"),children:u.claudeCode.join(`
|
|
232
|
+
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>nt(),disabled:f,children:t(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:t("settings:env.title")})]}),o.jsx("span",{className:"af-set-env-note",children:C?t("settings:env.saving"):e!=null&&e.isAdmin?t("settings:env.noteAdmin"):t("settings:env.note")})]}),o.jsxs("div",{className:"af-set-env-rows"+(e!=null&&e.isAdmin?" af-set-env-rows--admin":""),children:[o.jsxs("div",{className:"af-set-env-row af-set-env-row--header","aria-hidden":!0,children:[o.jsx("span",{children:t("settings:env.key")}),e!=null&&e.isAdmin?o.jsx("span",{children:t("settings:env.scope")}):null,o.jsx("span",{children:t("settings:env.value")}),o.jsx("span",{})]}),b.map(ae=>o.jsxs("div",{className:"af-set-env-row"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",value:ae.key,onChange:Le=>Tn(ae.id,{key:Le.target.value}),"aria-label":t("settings:env.key"),spellCheck:!1})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:ae.scope!=="global"?"is-active":"",onClick:()=>Tn(ae.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:ae.scope==="global"?"is-active":"",onClick:()=>Tn(ae.id,{scope:"global"}),children:t("settings:env.global")})]})}):null,o.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:[o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:$.has(ae.id)?"text":"password",value:ae.value,onChange:Le=>Tn(ae.id,{value:Le.target.value}),placeholder:One(ae.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>Kn(ae.id),"aria-label":$.has(ae.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:$.has(ae.id)?"visibility_off":"visibility"})})]}),o.jsx("div",{className:"af-set-env-actions",children:o.jsx("button",{type:"button",className:"af-set-env-del","aria-label":t("settings:env.delete",{key:ae.key}),onClick:()=>fn(ae.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},ae.id)),o.jsxs("div",{className:"af-set-env-row af-set-env-row--draft"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",placeholder:"KEY_NAME",value:H,onChange:ae=>L(ae.target.value),"aria-label":t("settings:env.newKey")})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:D?"":"is-active",onClick:()=>W(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:D?"is-active":"",onClick:()=>W(!0),children:t("settings:env.global")})]})}):null,o.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:"password",placeholder:t("settings:env.newValue"),value:F,onChange:ae=>O(ae.target.value),"aria-label":t("settings:env.newValue")})}),o.jsx("div",{className:"af-set-env-actions",children:o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Un,disabled:!H.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]})]})]}),e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--allowlist",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:"manage_accounts"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:t("settings:allowlist.title")}),o.jsx("p",{className:"af-set-card-subtitle",children:t("settings:allowlist.description")})]})]}),o.jsx("span",{className:"af-set-badge"+(dn?" af-set-badge--ok":" af-set-badge--muted"),children:t(dn?"settings:allowlist.enabled":"settings:allowlist.open")}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void ue(),disabled:ye,children:t(ye?"settings:allowlist.refreshing":"common:common.refresh")})]}),We?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:We}):null,le?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",o.jsx("code",{children:le})]}):null,o.jsxs("div",{className:"af-allowlist-grid",children:[o.jsxs("div",{className:"af-allowlist-main",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.fileList")}),o.jsx("span",{children:Ve?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:se.length})})]}),o.jsx("div",{className:"af-allowlist-list",children:se.length>0?se.map(ae=>o.jsxs("div",{className:"af-allowlist-row",children:[o.jsx("span",{className:"af-allowlist-name",children:ae}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>we(ae),"aria-label":t("settings:allowlist.remove",{username:ae}),disabled:Ve,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},ae)):o.jsx("div",{className:"af-allowlist-empty",children:t("settings:allowlist.emptyFile")})}),o.jsxs("div",{className:"af-allowlist-add",children:[o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:ie,onChange:ae=>oe(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&Nr()},placeholder:"username",autoComplete:"off"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Nr,disabled:Ve||!ie.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:allowlist.add")]})]})]}),o.jsxs("div",{className:"af-allowlist-side",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.envList")}),o.jsx("span",{children:t("settings:allowlist.readonly")})]}),o.jsx("div",{className:"af-allowlist-env-list",children:he.length>0?he.map(ae=>o.jsx("code",{children:ae},ae)):o.jsx("span",{children:t("settings:allowlist.emptyEnv")})}),o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:t("settings:allowlist.unionHint")})]})]})]}):null,e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--feedback",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"rate_review"})}),o.jsx("h2",{className:"af-set-h2",children:"意见反馈"})]}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void un(),disabled:E,children:E?"刷新中...":"刷新"})]}),Z?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Z}):null,o.jsx("div",{className:"af-feedback-list",children:P.length>0?P.map(ae=>o.jsxs("article",{className:"af-feedback-item",children:[o.jsxs("header",{className:"af-feedback-item__head",children:[o.jsxs("div",{children:[o.jsx("h3",{children:ae.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:ae.username||ae.userId||"unknown"}),o.jsx("span",{children:vt(ae.createdAt)})]})]}),ae.contact?o.jsx("span",{className:"af-feedback-item__contact",children:ae.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:ae.content}),ae.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:ae.pageUrl}):null]},ae.id)):o.jsx("div",{className:"af-feedback-empty",children:E?"正在加载反馈...":"暂无反馈"})})]}):null]}),o.jsxs("aside",{className:"af-settings-rail","aria-label":t("settings:title"),children:[o.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[o.jsxs("div",{className:"af-set-rail-inner",children:[o.jsx("h3",{className:"af-set-rail-h3",children:t("settings:system.title")}),o.jsxs("div",{className:"af-set-health-line",children:[o.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),o.jsx("span",{className:"af-set-health-label",children:t(!a&&!p?"settings:system.normal":"settings:system.abnormal")})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.cursorModels")}),o.jsx("span",{children:u.cursor.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,u.cursor.length>0?12+u.cursor.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.opencodeModels")}),o.jsx("span",{children:u.opencode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,u.opencode.length>0?12+u.opencode.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.claudeCodeModels")}),o.jsx("span",{children:u.claudeCode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,u.claudeCode.length>0?12+u.claudeCode.length*3:4)}%`}})})]})]}),o.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),o.jsxs("div",{className:"af-set-rail-card",children:[o.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:t("settings:language.title")}),o.jsxs("div",{className:"af-set-language-selector",children:[o.jsx("select",{className:"af-set-input af-set-input--sm",value:r,onChange:Me,"aria-label":t("settings:language.description"),children:Rne.map(ae=>o.jsxs("option",{value:ae.code,children:[ae.flag," ",ae.name]},ae.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})]})})]})}function Dne(){const{navigate:e}=Lo(),[t,n]=h.useState(""),[r,s]=h.useState(""),[i,a]=h.useState(!1),[l,u]=h.useState(""),[d,p]=h.useState(!1),c=async f=>{if(f.preventDefault(),!i){a(!0),u("");try{const m=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,content:r,pageUrl:window.location.href})}),y=await m.json().catch(()=>({}));if(!m.ok)throw new Error(y.error||"提交失败");p(!0),n(""),s("")}catch(m){u(String(m.message||m))}finally{a(!1)}}};return o.jsx("main",{className:"af-feedback-page",children:o.jsxs("section",{className:"af-feedback-panel",children:[o.jsxs("div",{className:"af-feedback-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),o.jsx("h1",{children:"意见反馈"}),o.jsx("p",{children:"提交使用中遇到的问题、改进建议或功能需求,管理员会在设置页统一查看。"})]}),o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>e("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]}),d?o.jsxs("div",{className:"af-feedback-success",role:"status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsxs("div",{children:[o.jsx("strong",{children:"已提交"}),o.jsx("span",{children:"感谢反馈,管理员可以在设置页查看这条记录。"})]})]}):null,o.jsxs("form",{className:"af-feedback-form",onSubmit:c,children:[o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{value:t,onChange:f=>n(f.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"反馈内容"}),o.jsx("textarea",{value:r,onChange:f=>s(f.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),l?o.jsx("p",{className:"af-err af-feedback-error",children:l}):null,o.jsx("div",{className:"af-feedback-actions",children:o.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:i||!t.trim()||!r.trim(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:i?"hourglass_empty":"send"}),i?"提交中...":"提交反馈"]})})]})]})})}function O2(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function rC(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:O2(),key:r,value:String(s??""),private:n.has(r)}))}function sC(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 vm(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(`
|
|
233
|
+
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:rC(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:rC(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 Kx(){return vm({name:"",raw:{command:""}})}function Fne(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=sC(e.envRows),s=sC(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 iC(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function oC(e){return e?e.ok?"ok":"error":"unknown"}function aC({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(a,l,u)=>n(t.map(d=>d.id===a?{...d,[l]:u}: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:O2(),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 zne(){var D;const[e,t]=h.useState(""),[n,r]=h.useState([]),[s,i]=h.useState(Kx),[a,l]=h.useState(""),[u,d]=h.useState(!1),[p,c]=h.useState(!1),[f,m]=h.useState(!1),[y,v]=h.useState({}),[k,g]=h.useState(""),[b,x]=h.useState(""),N=h.useMemo(()=>n.find(W=>W.name===a)||null,[a,n]),_=N&&y[N.name]||null,C=h.useCallback(async()=>{d(!0),g("");try{const W=await fetch("/api/mcps"),$=await W.json().catch(()=>({}));if(!W.ok)throw new Error($.error||"MCP HTTP "+W.status);const M=Array.isArray($.servers)?$.servers:[];t(String($.path||"")),r(M),a&&M.some(I=>I.name===a)&&i(vm(M.find(I=>I.name===a)))}catch(W){g(String(W.message||W))}finally{d(!1)}},[a]);h.useEffect(()=>{C()},[C]);const T=()=>{l(""),i(Kx()),x(""),g("")},H=W=>{l(W.name),i(vm(W)),x(""),g("")},L=async(W="")=>{m(!0),g(""),x("");try{const $=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W?{name:W}:{})}),M=await $.json().catch(()=>({}));if(!$.ok)throw new Error(M.error||"检测 MCP 失败");const I=Array.isArray(M.results)?M.results:[];v(z=>{const P={...z};for(const R of I)R!=null&&R.name&&(P[R.name]=R);return P}),x(W?`已检测 ${W}。`:"已检测所有 MCP。")}catch($){g(String($.message||$))}finally{m(!1)}},F=async()=>{c(!0),g(""),x("");try{const W=Fne(s);if(!W.nextName)throw new Error("请填写 MCP 名称");const $=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}),M=await $.json().catch(()=>({}));if(!$.ok)throw new Error(M.error||"保存 MCP 失败");const I=Array.isArray(M.servers)?M.servers:[];r(I),t(String(M.path||e)),l(W.nextName),i(vm(I.find(z=>z.name===W.nextName)||null)),v(z=>{const P={...z};return s.originalName&&s.originalName!==W.nextName&&delete P[s.originalName],delete P[W.nextName],P}),x("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(W){g(String(W.message||W))}finally{c(!1)}},O=async W=>{if(W!=null&&W.name&&window.confirm(`删除 MCP "${W.name}"?`)){c(!0),g(""),x("");try{const $=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W.name})}),M=await $.json().catch(()=>({}));if(!$.ok)throw new Error(M.error||"删除 MCP 失败");r(Array.isArray(M.servers)?M.servers:[]),l(""),i(Kx()),v(I=>{const z={...I};return delete z[W.name],z}),x("已删除。")}catch($){g(String($.message||$))}finally{c(!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:C,disabled:u||p,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>L(),disabled:f||u||p||n.length===0,children:f?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:T,disabled:p,children:"新增 MCP"})]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),o.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 Cursor MCP server。当前配置文件:",o.jsx("span",{className:"af-settings-code",children:e||"~/.cursor/mcp.json"})]})]}),o.jsxs("div",{className:"af-mcp-layout",children:[o.jsxs("section",{className:"af-set-card af-mcp-list-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2",children:"Servers"}),o.jsxs("div",{className:"af-mcp-list-head-actions",children:[o.jsx("span",{className:"af-set-badge af-set-badge--muted",children:n.length}),o.jsxs("button",{type:"button",className:"af-set-btn-mini",onClick:T,disabled:p,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),u?o.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!u?o.jsxs("div",{className:"af-mcp-empty",children:[o.jsx("p",{className:"af-set-p",children:"暂无 MCP server。"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:T,disabled:p,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(W=>o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===W.name?" af-mcp-server-item--active":""),onClick:()=>H(W),children:[o.jsx("span",{className:"material-symbols-outlined",children:W.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:W.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${oC(y[W.name])}`,children:iC(y[W.name])})]}),o.jsx("em",{children:W.url||[W.command,...W.args||[]].filter(Boolean).join(" ")})]})]},W.name))})]}),o.jsxs("section",{className:"af-set-card af-mcp-editor-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:N?"编辑 MCP":"新增 MCP"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),N?o.jsxs("div",{className:"af-mcp-editor-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>L(N.name),disabled:f||p,children:f?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>O(N),disabled:p,children:"删除"})]}):null]}),k?o.jsx("p",{className:"af-mcp-error",children:k}):null,b?o.jsx("p",{className:"af-mcp-status",children:b}):null,_?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${oC(_)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:iC(_)}),o.jsxs("span",{children:[_.elapsedMs||0,"ms"]})]}),_.error?o.jsx("p",{children:_.error}):null,(D=_.tools)!=null&&D.length?o.jsx("div",{className:"af-mcp-tools-list",children:_.tools.map(W=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:W.name}),W.description?o.jsx("span",{children:W.description}):null]},W.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:W=>i($=>({...$,name:W.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:W=>i($=>({...$,type:W.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:W=>i($=>({...$,url:W.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:W=>i($=>({...$,command:W.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:W=>i($=>({...$,argsText:W.target.value})),placeholder:`mcp-server-example
|
|
234
|
+
--flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:W=>i($=>({...$,description:W.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(aC,{title:"Headers",rows:s.headerRows,onChange:W=>i($=>({...$,headerRows:W})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(aC,{title:"Env",rows:s.envRows,onChange:W=>i($=>({...$,envRows:W})),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:W=>i($=>({...$,extraJson:W.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:T,disabled:p,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:F,disabled:p,children:p?"保存中...":"保存 MCP"})]})]})]})]})})]})}const Hne=[{icon:"campaign",title:"首页 Feed 想加一个广告引导",question:"先判断入口、展示位、用户影响面,再决定弹框、浮层还是页面内引导。",context:["查客户端展示位逻辑","查历史需求与配置","查 m09 / Feed PV"],result:"原型 + PRD + TAPD 更新",tone:"pink"},{icon:"manage_search",title:"接到需求但不知道现有逻辑",question:"不用先找研发问一圈,直接从 Likee 代码、知识库、历史文档里拿上下文。",context:["客户端 / 后台 / 前端知识库","接口与配置链路","相关 Git 文档"],result:"背景结论 + 影响范围",tone:"cyan"},{icon:"query_stats",title:"运营要评估活动或入口价值",question:"先查人群规模、页面访问、历史转化,避免凭经验拍优先级。",context:["CK / Hive 查数","自动生成 SQL","指标口径解释"],result:"数据表 + 图表 + 结论",tone:"green"},{icon:"draw",title:"想快速把方案画给团队看",question:"把一句需求变成客户端或 H5 原型,让评审时先讨论体验,不只讨论文字。",context:["Likee 客户端样式","前端页面结构","交互状态与文案"],result:"HTML 原型 + Display 面板",tone:"amber"},{icon:"sync_alt",title:"需求写完后需要同步多个地方",question:"PRD、TAPD、Git 仓库和评审展示保持一致,减少重复复制和漏改。",context:["需求正文","变更记录","MR / 仓库路径"],result:"TAPD 更新 + Git 提交",tone:"violet"},{icon:"monitoring",title:"上线后要看效果和复盘",question:"沿用需求阶段的口径继续查数,把结果沉淀回下一轮需求线索。",context:["上线后 CK / Hive","分页面 / 分人群指标","实验和版本信息"],result:"复盘结论 + 后续建议",tone:"blue"}],Bne=[{label:"Use Case 01",title:"Likee 客户端知识库查询(如广告占位)",images:["/likee-context/usecase-ad-query.png"],trigger:"产品或运营想确认客户端已有逻辑,例如 Likee Android 里有哪些广告占位,以及相关常量和代码位置。",steps:["在「我的流程」加载 Likee Android 流程片段","在子 Agent 节点输入客户端逻辑问题","点击 Run Line,只执行当前链路","在右侧 Markdown Display 查看知识库查询结果"],outputs:["SETTING_ID / PAGE_ID 表格","客户端代码路径与口径说明","可继续用于 PRD 的背景材料"]},{label:"Use Case 02",title:"客户端原型设计",images:["/likee-context/usecase-prototype.png"],trigger:"业务已经明确要在 Likee 首页加入广告引导,需要先把弹框体验画出来给产品、设计、研发评审。",steps:["在 Workspace 打开原型生成流程","加载客户端原型 Skill","在子 Agent 中说明生成一个首页 dialog 弹框","查看 HTML Display 中的手机预览稿"],outputs:["Likee 风格手机原型","弹框文案与按钮状态","可直接用于评审的 Display 面板"]},{label:"Use Case 03",title:"前端 H5 原型设计",images:["/likee-context/usecase-h5-prototype.png"],trigger:"运营活动需要快速产出 Likee 风格 H5 页面,例如幸运转盘、积分排行榜、活动首页或结果页。",steps:["在 Workspace 打开 H5 原型生成流程","加载前端 H5 原型相关 Skill","在子 Agent 中说明活动结构、页面模块和运营规则","查看 HTML Display 中的可交互 H5 原型"],outputs:["Likee 风格 H5 页面","抽奖转盘与排行榜布局","活动规则和状态页","可用于评审的 HTML Display"]},{label:"Use Case 04",title:"CK / Hive 查数与 SQL 生成",images:["/likee-context/usecase-data-query.png"],trigger:"运营或产品需要快速验证一个数据问题,例如找出典型 UID、对比不同日期的视频上传分辨率占比,并保留可复用 SQL。",steps:["在 Workspace 打开查数流程","加载查数相关 Skill","在子 Agent 中说明数据口径、日期和筛选条件","查看 Markdown Display 中的数据结果和查询 SQL"],outputs:["查询结果表格","SQL 语句","口径说明","可继续接入 PRD 或复盘面板的数据结论"]},{label:"Use Case 05",title:"需求文档生成、数据补齐与同步",images:["/likee-context/usecase-prd.png","/likee-context/usecase-sync.png"],trigger:"需求进入评审和落库阶段,需要把 TAPD 信息、Hive 数据、原型内容组织成 PRD,并同步到 TAPD 和 Git 仓库。",steps:["先运行 TAPD / 数据查询节点,拿到迭代、页面 PV 和业务背景","把查询结果和原型 Display 内容接入 PRD 生成子 Agent","在 Markdown Display 查看完整需求文档","把 PRD content 接入 TAPD 更新节点和 Git 仓库提交节点"],outputs:["完整 PRD 文档","项目背景与 Top 页面数据","TAPD 需求更新成功","Git MR 链接"]},{label:"Use Case 06",title:"Display 模式做需求评审面板",images:["/likee-context/usecase-display.png"],trigger:"流程跑完后,需要把 PRD、原型、数据图表、展示位表格放在一个页面里给产品、运营、研发一起看。",steps:["在 Workspace 中完成查数、原型、PRD、同步节点执行","确认 Markdown / HTML / 图表 / 表格展示节点都有结果","切换顶部 DISPLAY 模式","使用生成链接把评审面板发给相关同学"],outputs:["PRD 长文档","客户端原型预览","图表与表格","统一展示链接"]}],Wne=[{name:"likee-client-ui",namespace:"智能助手 / 客户端原型",icon:"phone_iphone",mode:"客户端原型设计",usage:"生成 Likee 客户端风格页面、弹框、Feed 引导、个人页、活动入口等原型,适合产品评审前快速对齐体验。",examples:["首页 dialog 弹框","Feed 内引导","客户端红色主品牌视觉","移动端交互态"],tone:"pink"},{name:"tapd-likee",namespace:"智能助手 / TAPD",icon:"sync",mode:"需求系统交互",usage:"和 TAPD 交互,支持创建、同步、更新需求,把工作区生成的 PRD 或 Markdown 内容回写到需求系统。",examples:["创建 TAPD 需求","更新需求正文","同步处理人和链接","把结果回显到 Display"],tone:"green"},{name:"plain-language-response",namespace:"智能助手 / 回答风格",icon:"record_voice_over",mode:"业务化回答",usage:"用于把回答收敛成产品、运营更容易阅读的解释,避免直接把客户端代码库细节、函数调用链和实现细节暴露太多。",examples:["需求背景解释","代码结论转业务语言","评审材料摘要","减少实现细节噪音"],tone:"cyan"},{name:"create-likee-h5-style-html",namespace:"智能助手 / 前端 H5",icon:"language",mode:"H5 原型设计",usage:"创建 Likee H5 风格原型,适合运营活动、抽奖、排行榜、报告页、反馈表单、创作者认证页、订单列表等页面。",examples:["幸运转盘活动","积分排行榜","活动规则页","结果页和空状态"],tone:"amber"},{name:"analytics",namespace:"数据 / CK & Hive",icon:"query_stats",mode:"查数和 SQL 生成",usage:"面向 CK、Hive 的指标查询和 SQL 生成,适合 PV、UV、转化、分国家、分实验组、典型 UID 等数据问题。",examples:["自动生成 SQL","输出查询结果表","解释指标口径","沉淀复盘数据"],tone:"green"}],Vne=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function Gh({icon:e,title:t,label:n,tone:r="violet"}){return o.jsxs("div",{className:`likee-flow-node likee-flow-node-${r}`,children:[o.jsx("span",{className:"material-symbols-outlined",children:e}),o.jsxs("div",{children:[o.jsx("strong",{children:t}),o.jsx("small",{children:n})]})]})}function Une(){return o.jsxs("div",{className:"likee-workspace-scene","aria-hidden":"true",children:[o.jsx("div",{className:"likee-scene-grid"}),o.jsxs("svg",{className:"likee-scene-lines",viewBox:"0 0 980 560",fill:"none",children:[o.jsx("path",{d:"M96 154 C236 96 330 122 444 194 C552 262 654 260 814 160"}),o.jsx("path",{d:"M118 350 C248 288 344 304 458 372 C578 444 704 420 858 310"}),o.jsx("path",{d:"M472 196 C512 248 524 302 486 372"}),o.jsx("path",{d:"M622 126 C670 198 696 258 682 354"})]}),o.jsx("div",{className:"likee-node-pos likee-node-a",children:o.jsx(Gh,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),o.jsx("div",{className:"likee-node-pos likee-node-b",children:o.jsx(Gh,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),o.jsx("div",{className:"likee-node-pos likee-node-c",children:o.jsx(Gh,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),o.jsx("div",{className:"likee-node-pos likee-node-d",children:o.jsx(Gh,{icon:"sync_alt",title:"TAPD / Git",label:"同步需求与版本资产",tone:"green"})}),o.jsxs("div",{className:"likee-phone-preview",children:[o.jsxs("div",{className:"likee-phone-top",children:[o.jsx("span",{children:"关注"}),o.jsx("strong",{children:"推荐"}),o.jsx("span",{children:"直播"})]}),o.jsxs("div",{className:"likee-phone-card",children:[o.jsx("div",{className:"likee-gift",children:"AD"}),o.jsx("h4",{children:"广告个性化引导弹框"}),o.jsx("p",{children:"保持推荐体验,同时解释权益与关闭路径。"}),o.jsx("button",{children:"继续"}),o.jsx("button",{className:"secondary",children:"稍后"})]})]}),o.jsxs("div",{className:"likee-display-panel",children:[o.jsxs("div",{className:"likee-panel-header",children:[o.jsx("span",{children:"DISPLAY"}),o.jsx("strong",{children:"需求资产面板"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"需求"}),o.jsx("strong",{children:"首页广告个性化引导"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"数据"}),o.jsx("strong",{children:"m09 PV Top 1"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"同步"}),o.jsx("strong",{children:"TAPD + Git MR"})]})]})]})}function km({kicker:e,title:t,children:n}){return o.jsxs("div",{className:"likee-section-copy",children:[o.jsx("p",{className:"likee-section-kicker",children:e}),o.jsx("h2",{children:t}),o.jsx("p",{children:n})]})}function Kne(){return o.jsx("section",{id:"likee-skills",className:"likee-section likee-section-dark",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-two-column-skills",children:[o.jsx(km,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),o.jsx("div",{className:"likee-skill-grid",children:Wne.map(e=>o.jsxs("article",{className:`likee-skill-card likee-skill-${e.tone}`,children:[o.jsxs("div",{className:"likee-skill-head",children:[o.jsx("div",{className:"likee-skill-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.name}),o.jsx("span",{children:e.namespace})]})]}),o.jsx("div",{className:"likee-skill-mode",children:e.mode}),o.jsx("p",{children:e.usage}),o.jsx("div",{className:"likee-skill-examples",children:e.examples.map(t=>o.jsx("strong",{children:t},t))})]},e.name))})]})})}function $2(){return o.jsxs("div",{className:"likee-page",children:[o.jsx("div",{className:"likee-top-actions",children:o.jsxs("a",{href:"/projects",className:"likee-home-link",children:[o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"}),"返回首页"]})}),o.jsxs("section",{className:"likee-hero",children:[o.jsx(Une,{}),o.jsxs("div",{className:"likee-hero-content",children:[o.jsx("p",{className:"likee-eyebrow",children:"LIKEE CONTEXT WORKSPACE"}),o.jsx("h1",{children:"Likee Agent 工作台"}),o.jsx("p",{className:"likee-hero-subtitle",children:"提供 Likee 全局上下文,赋能需求挖掘、书写和运营。"}),o.jsxs("div",{className:"likee-signal-row",children:[o.jsx("span",{children:"查业务逻辑"}),o.jsx("span",{children:"查 CK / Hive"}),o.jsx("span",{children:"生成原型"}),o.jsx("span",{children:"生成 PRD"}),o.jsx("span",{children:"同步 TAPD / Git"})]}),o.jsxs("div",{className:"likee-hero-actions",children:[o.jsxs("a",{href:"/projects",className:"likee-primary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"rocket_launch"}),"立即使用"]}),o.jsxs("a",{href:"#likee-scenarios",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"ads_click"}),"按场景查看"]}),o.jsxs("a",{href:"#likee-usecases",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"view_timeline"}),"查看 Use Cases"]}),o.jsxs("a",{href:"#likee-skills",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),"查看 Skills"]})]})]})]}),o.jsx("section",{id:"likee-scenarios",className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner",children:[o.jsx(km,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),o.jsx("div",{className:"likee-scenario-grid",children:Hne.map(e=>o.jsxs("article",{className:`likee-scenario-card likee-scenario-${e.tone}`,children:[o.jsx("div",{className:"likee-scenario-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.question})]}),o.jsx("div",{className:"likee-scenario-context",children:e.context.map(t=>o.jsx("span",{children:t},t))}),o.jsxs("div",{className:"likee-scenario-result",children:[o.jsx("span",{children:"产出"}),o.jsx("strong",{children:e.result})]})]},e.title))})]})}),o.jsx("section",{id:"likee-usecases",className:"likee-section likee-section-muted",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-usecase-layout",children:[o.jsx(km,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),o.jsx("div",{className:"likee-usecase-stack",children:Bne.map(e=>o.jsxs("article",{className:"likee-usecase-card",children:[o.jsx("div",{className:`likee-usecase-media ${e.images.length>1?"likee-usecase-media-split":""}`,children:e.images.map((t,n)=>o.jsx("img",{src:t,alt:`${e.title} 工作区截图 ${n+1}`,loading:"lazy"},t))}),o.jsxs("div",{className:"likee-usecase-body",children:[o.jsx("div",{className:"likee-usecase-label",children:e.label}),o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.trigger}),o.jsx("ol",{className:"likee-usecase-steps",children:e.steps.map(t=>o.jsx("li",{children:t},t))}),o.jsxs("div",{className:"likee-usecase-output",children:[o.jsx("span",{children:"实际产物"}),o.jsx("div",{children:e.outputs.map(t=>o.jsx("strong",{children:t},t))})]})]})]},e.label))})]})}),o.jsx(Kne,{}),o.jsx("section",{className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[o.jsx(km,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),o.jsx("div",{className:"likee-capability-table",children:Vne.map(([e,t,n])=>o.jsxs("div",{className:"likee-capability-row",children:[o.jsx("span",{children:e}),o.jsx("strong",{children:t}),o.jsx("p",{children:n})]},e))})]})})]})}function D2(e){return t=>typeof t===e}var qne=D2("function"),Yne=e=>e===null,lC=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",cC=e=>!Gne(e)&&!Yne(e)&&(qne(e)||typeof e=="object"),Gne=D2("undefined");function Xne(e,t,n){return rre(n,e,t)?!0:(sre(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?Jne(e,t,n):e instanceof Map&&t instanceof Map?ere(e,t,n):e instanceof Set&&t instanceof Set?nre(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?Qne(e,t):lC(e)&&lC(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?Zne(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():tre(e,t,n))}function _p(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!cC(e)||!t||!cC(t)?!1:Xne(e,t,n)}function Jne(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!_p(e[s],t[s],n))return!1;return!0}function Qne(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 Zne(e,t,n){return e.message===t.message&&e.name===t.name&&_p(e.cause,t.cause,n)}function ere(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(!_p(r[1],t.get(r[0]),n))return!1;return!0}function tre(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)&&!_p(e[i],t[i],n))return!1}return!0}function nre(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 rre(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function sre(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function H0(e,t){return _p(e,t,new WeakMap)}function qx(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function ire(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function ore(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function are(){const e=h.useRef(!0);return e.current?(e.current=!1,!0):e.current}function lre(e,t){const n=are();h.useEffect(()=>{if(!n)return e()},t)}function F2(e){const t=h.useRef(void 0);return h.useEffect(()=>{t.current=e}),t.current}function cre(e,t){const n=h.useRef(t);return H0(t,n.current)||(n.current=t),h.useMemo(e,n.current)}function ure(e){h.useEffect(()=>{e()},[])}function dre(e=0){const[t,n]=h.useState({height:qx()?window.innerHeight:0,width:qx()?window.innerWidth:0}),r=h.useRef(0),s=h.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return h.useEffect(()=>{if(!qx())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),ore(window,"resize",i),()=>{ire(window,"resize",i)}},[]),t}var fre=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],pre=["bigint","boolean","null","number","string","symbol","undefined"];function Pp(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(hre(t))return t}function so(e){return t=>Pp(t)===e}function hre(e){return fre.includes(e)}function od(e){return t=>typeof t===e}function mre(e){return pre.includes(e)}var gre=["innerHTML","ownerDocument","style","attributes","nodeValue"],Ap=e=>Array.isArray(e),yre=e=>Pp(e)==="AsyncGeneratorFunction",xre=so("AsyncFunction"),wre=od("bigint"),bre=e=>e===!0||e===!1,vre=so("Date"),kre=so("Error"),gl=od("function"),Sre=so("GeneratorFunction"),Nre=e=>typeof e=="number"&&Number.isInteger(e),Kb=so("Map"),z2=e=>Number.isNaN(e),B0=e=>e===null,H2=so("Function"),jre=so("Promise"),Cre=so("RegExp"),qb=so("Set"),Ip=od("string"),Ere=od("symbol"),W0=od("undefined"),_re=so("WeakMap"),Pre=so("WeakSet"),V0=e=>B0(e)||W0(e),B2=e=>!W0(e),Are=e=>od("number")(e)&&!z2(e),Ire=e=>Ip(e)&&e.trim().length>0,Tre=e=>{if(!Ip(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},my=e=>!V0(e)&&(gl(e)||typeof e=="object"),W2=e=>{if(Pp(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Rre=e=>B0(e)||mre(typeof e),Lre=e=>Pp(e)==="URL",V2=e=>!V0(e)&&gl(e[Symbol.iterator]),Mre=e=>V2(e)&&gl(e.next)&&gl(e.throw),Ore=e=>gl(e)&&/^class\s/.test(e.toString()),$re=(e,t)=>!Ap(e)||!gl(t)?!1:e.every(n=>t(n)),Dre=e=>my(e)&&!W2(e)&&e.nodeType===1&&Ip(e.nodeName)&&gre.every(t=>t in e),Fre=e=>Ip(e)&&e.length===0||Ap(e)&&e.length===0||my(e)&&!Kb(e)&&!qb(e)&&Object.keys(e).length===0||qb(e)&&e.size===0||Kb(e)&&e.size===0,zre=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,Hre=(e,t)=>Ap(e)?e.indexOf(t)>-1:!1,Bre=(e,t,n)=>{if(!my(e)||!t)return!1;const r=e[t];return gl(n)?n(r):B2(r)};function Lt(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(Ap(e))return"Array";if(H2(e))return"Function";const t=Pp(e);return t||"Object"}Lt.array=Ap;Lt.arrayOf=$re;Lt.asyncGeneratorFunction=yre;Lt.asyncFunction=xre;Lt.bigint=wre;Lt.boolean=bre;Lt.class=Ore;Lt.date=vre;Lt.defined=B2;Lt.domElement=Dre;Lt.empty=Fre;Lt.error=kre;Lt.function=gl;Lt.generator=Mre;Lt.generatorFunction=Sre;Lt.instanceOf=zre;Lt.integer=Nre;Lt.iterable=V2;Lt.map=Kb;Lt.nan=z2;Lt.null=B0;Lt.nullOrUndefined=V0;Lt.nonEmptyString=Ire;Lt.number=Are;Lt.numericString=Tre;Lt.object=my;Lt.oneOf=Hre;Lt.plainFunction=H2;Lt.plainObject=W2;Lt.primitive=Rre;Lt.promise=jre;Lt.propertyOf=Bre;Lt.regexp=Cre;Lt.set=qb;Lt.string=Ip;Lt.symbol=Ere;Lt.undefined=W0;Lt.url=Lre;Lt.weakMap=_re;Lt.weakSet=Pre;var as=Lt;/* v8 ignore next -- @preserve */var Wre=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},Vre=function(e,t){return e+lp(t)},lp=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(Vre,""):Wre(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?lp(e.props.children):""};lp.default=lp;var Ure=lp;const Yx=xl(Ure);var U2={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(_){return _!=="constructor"&&_!=="prototype"&&_!=="__proto__"}function a(_){let C=0;const T=_.length,H=new Array(T);for(C;C<T;++C)H[C]=g(_[C]);return H}function l(_){const C={};if(f&&Object.getPrototypeOf(_)!==t)return f(_);const T=c(_);let H,L,F;for(H=0,L=T.length;H<L;++H)i(F=T[H])&&(C[F]=g(_[F]));return C}function u(_,C){const T=_.length,H=C.length;let L=0;const F=new Array(T+H);for(L;L<T;++L)F[L]=g(_[L]);for(L=0;L<H;++L)F[L+T]=g(C[L]);return F}const d=Object.prototype.propertyIsEnumerable;function p(_){const C=Object.keys(_),T=Object.getOwnPropertySymbols(_);for(let H=0,L=T.length;H<L;++H)d.call(_,T[H])&&C.push(T[H]);return C}const c=s!=null&&s.symbols?p:Object.keys,f=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,m=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),y=(s==null?void 0:s.onlyDefinedProperties)===!0;function v(_){return typeof _!="object"||_===null}const k=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:g,deepmerge:x,getKeys:c,isMergeableObject:m}):u;function g(_){return m(_)?Array.isArray(_)?a(_):l(_):_}function b(_,C){const T={},H=c(_),L=c(C);let F,O,D;for(F=0,O=H.length;F<O;++F)i(D=H[F])&&L.indexOf(D)===-1&&(T[D]=g(_[D]));for(F=0,O=L.length;F<O;++F)if(i(D=L[F]))if(D in _)H.indexOf(D)!==-1&&(f&&m(C[D])&&Object.getPrototypeOf(C[D])!==t?T[D]=f(C[D]):T[D]=x(_[D],C[D]));else{if(y&&typeof C[D]>"u")continue;T[D]=g(C[D])}return T}function x(_,C){if(y&&typeof C>"u")return g(_);const T=Array.isArray(C),H=Array.isArray(_);return v(C)?C:m(_)?T&&H?k(_,C):T!==H?g(C):b(_,C):g(C)}function N(){switch(arguments.length){case 0:return{};case 1:return g(arguments[0]);case 2:return x(arguments[0],arguments[1])}let _;for(let C=0,T=arguments.length;C<T;++C)_=x(_,arguments[C]);return _}return s!=null&&s.all?N:x}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(U2);var Kre=U2.exports;const qre=xl(Kre);var Yre=new Error("Element already at target scroll position"),Gre=new Error("Scroll cancelled"),Xre=Math.min,uC=Date.now,Jre={left:dC("scrollLeft"),top:dC("scrollTop")};function dC(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=Zre);var a=uC(),l=n[e],u=s.ease||Qre,d=isNaN(s.duration)?350:+s.duration,p=!1;return l===r?i(Yre,n[e]):requestAnimationFrame(f),c;function c(){p=!0}function f(m){if(p)return i(Gre,n[e]);var y=uC(),v=Xre(1,(y-a)/d),k=u(v);n[e]=k*(r-l)+l,v<1?requestAnimationFrame(f):requestAnimationFrame(function(){i(null,n[e])})}}}function Qre(e){return .5*(1-Math.cos(Math.PI*e))}function Zre(){}const ese=xl(Jre);var K2={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Nf,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})})(K2);var tse=K2.exports;const q2=xl(tse),nse=["top","right","bottom","left"],fC=["start","end"],pC=nse.reduce((e,t)=>e.concat(t,t+"-"+fC[0],t+"-"+fC[1]),[]),Qu=Math.min,lc=Math.max,Eg=Math.round,Xh=Math.floor,Ao=e=>({x:e,y:e}),rse={left:"right",right:"left",bottom:"top",top:"bottom"};function Yb(e,t,n){return lc(e,Qu(t,n))}function ad(e,t){return typeof e=="function"?e(t):e}function ba(e){return e.split("-")[0]}function Io(e){return e.split("-")[1]}function Y2(e){return e==="x"?"y":"x"}function U0(e){return e==="y"?"height":"width"}function Qa(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function K0(e){return Y2(Qa(e))}function G2(e,t,n){n===void 0&&(n=!1);const r=Io(e),s=K0(e),i=U0(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Pg(a)),[a,Pg(a)]}function sse(e){const t=Pg(e);return[_g(e),t,_g(t)]}function _g(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const hC=["left","right"],mC=["right","left"],ise=["top","bottom"],ose=["bottom","top"];function ase(e,t,n){switch(e){case"top":case"bottom":return n?t?mC:hC:t?hC:mC;case"left":case"right":return t?ise:ose;default:return[]}}function lse(e,t,n,r){const s=Io(e);let i=ase(ba(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(_g)))),i}function Pg(e){const t=ba(e);return rse[t]+e.slice(t.length)}function cse(e){return{top:0,right:0,bottom:0,left:0,...e}}function X2(e){return typeof e!="number"?cse(e):{top:e,right:e,bottom:e,left:e}}function Ag(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 gC(e,t,n){let{reference:r,floating:s}=e;const i=Qa(t),a=K0(t),l=U0(a),u=ba(t),d=i==="y",p=r.x+r.width/2-s.width/2,c=r.y+r.height/2-s.height/2,f=r[l]/2-s[l]/2;let m;switch(u){case"top":m={x:p,y:r.y-s.height};break;case"bottom":m={x:p,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:c};break;case"left":m={x:r.x-s.width,y:c};break;default:m={x:r.x,y:r.y}}switch(Io(t)){case"start":m[a]-=f*(n&&d?-1:1);break;case"end":m[a]+=f*(n&&d?-1:1);break}return m}async function use(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:c="floating",altBoundary:f=!1,padding:m=0}=ad(t,e),y=X2(m),k=l[f?c==="floating"?"reference":"floating":c],g=Ag(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(k)))==null||n?k:k.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:p,strategy:u})),b=c==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},_=Ag(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:x,strategy:u}):b);return{top:(g.top-_.top+y.top)/N.y,bottom:(_.bottom-g.bottom+y.bottom)/N.y,left:(g.left-_.left+y.left)/N.x,right:(_.right-g.right+y.right)/N.x}}const dse=50,fse=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:use},u=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:c}=gC(d,r,u),f=r,m=0;const y={};for(let v=0;v<i.length;v++){const k=i[v];if(!k)continue;const{name:g,fn:b}=k,{x,y:N,data:_,reset:C}=await b({x:p,y:c,initialPlacement:r,placement:f,strategy:s,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});p=x??p,c=N??c,y[g]={...y[g],..._},C&&m<dse&&(m++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(d=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:p,y:c}=gC(d,f,u)),v=-1)}return{x:p,y:c,placement:f,strategy:s,middlewareData:y}},pse=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:u}=t,{element:d,padding:p=0}=ad(e,t)||{};if(d==null)return{};const c=X2(p),f={x:n,y:r},m=K0(s),y=U0(m),v=await a.getDimensions(d),k=m==="y",g=k?"top":"left",b=k?"bottom":"right",x=k?"clientHeight":"clientWidth",N=i.reference[y]+i.reference[m]-f[m]-i.floating[y],_=f[m]-i.reference[m],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let T=C?C[x]:0;(!T||!await(a.isElement==null?void 0:a.isElement(C)))&&(T=l.floating[x]||i.floating[y]);const H=N/2-_/2,L=T/2-v[y]/2-1,F=Qu(c[g],L),O=Qu(c[b],L),D=F,W=T-v[y]-O,$=T/2-v[y]/2+H,M=Yb(D,$,W),I=!u.arrow&&Io(s)!=null&&$!==M&&i.reference[y]/2-($<D?F:O)-v[y]/2<0,z=I?$<D?$-D:$-W:0;return{[m]:f[m]+z,data:{[m]:M,centerOffset:$-M-z,...I&&{alignmentOffset:z}},reset:I}}});function hse(e,t,n){return(e?[...n.filter(s=>Io(s)===e),...n.filter(s=>Io(s)!==e)]:n.filter(s=>ba(s)===s)).filter(s=>e?Io(s)===e||(t?_g(s)!==s:!1):!0)}const mse=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:u,elements:d}=t,{crossAxis:p=!1,alignment:c,allowedPlacements:f=pC,autoAlignment:m=!0,...y}=ad(e,t),v=c!==void 0||f===pC?hse(c||null,m,f):f,k=await u.detectOverflow(t,y),g=((n=a.autoPlacement)==null?void 0:n.index)||0,b=v[g];if(b==null)return{};const x=G2(b,i,await(u.isRTL==null?void 0:u.isRTL(d.floating)));if(l!==b)return{reset:{placement:v[0]}};const N=[k[ba(b)],k[x[0]],k[x[1]]],_=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:b,overflows:N}],C=v[g+1];if(C)return{data:{index:g+1,overflows:_},reset:{placement:C}};const T=_.map(F=>{const O=Io(F.placement);return[F.placement,O&&p?F.overflows.slice(0,2).reduce((D,W)=>D+W,0):F.overflows[0],F.overflows]}).sort((F,O)=>F[1]-O[1]),L=((s=T.filter(F=>F[2].slice(0,Io(F[0])?2:3).every(O=>O<=0))[0])==null?void 0:s[0])||T[0][0];return L!==l?{data:{index:g+1,overflows:_},reset:{placement:L}}:{}}}},gse=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:u,elements:d}=t,{mainAxis:p=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...k}=ad(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=ba(s),b=Qa(l),x=ba(l)===l,N=await(u.isRTL==null?void 0:u.isRTL(d.floating)),_=f||(x||!v?[Pg(l)]:sse(l)),C=y!=="none";!f&&C&&_.push(...lse(l,v,y,N));const T=[l,..._],H=await u.detectOverflow(t,k),L=[];let F=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&L.push(H[g]),c){const $=G2(s,a,N);L.push(H[$[0]],H[$[1]])}if(F=[...F,{placement:s,overflows:L}],!L.every($=>$<=0)){var O,D;const $=(((O=i.flip)==null?void 0:O.index)||0)+1,M=T[$];if(M&&(!(c==="alignment"?b!==Qa(M):!1)||F.every(P=>Qa(P.placement)===b?P.overflows[0]>0:!0)))return{data:{index:$,overflows:F},reset:{placement:M}};let I=(D=F.filter(z=>z.overflows[0]<=0).sort((z,P)=>z.overflows[1]-P.overflows[1])[0])==null?void 0:D.placement;if(!I)switch(m){case"bestFit":{var W;const z=(W=F.filter(P=>{if(C){const R=Qa(P.placement);return R===b||R==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(R=>R>0).reduce((R,E)=>R+E,0)]).sort((P,R)=>P[1]-R[1])[0])==null?void 0:W[0];z&&(I=z);break}case"initialPlacement":I=l;break}if(s!==I)return{reset:{placement:I}}}return{}}}},yse=new Set(["left","top"]);async function xse(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=ba(n),l=Io(n),u=Qa(n)==="y",d=yse.has(a)?-1:1,p=i&&u?-1:1,c=ad(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:y}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return l&&typeof y=="number"&&(m=l==="end"?y*-1:y),u?{x:m*p,y:f*d}:{x:f*d,y:m*p}}const wse=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,u=await xse(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:i+u.y,data:{...u,placement:a}}}}},bse=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:u={fn:g=>{let{x:b,y:x}=g;return{x:b,y:x}}},...d}=ad(e,t),p={x:n,y:r},c=await i.detectOverflow(t,d),f=Qa(ba(s)),m=Y2(f);let y=p[m],v=p[f];if(a){const g=m==="y"?"top":"left",b=m==="y"?"bottom":"right",x=y+c[g],N=y-c[b];y=Yb(x,y,N)}if(l){const g=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=v+c[g],N=v-c[b];v=Yb(x,v,N)}const k=u.fn({...t,[m]:y,[f]:v});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[m]:a,[f]:l}}}}}};function gy(){return typeof window<"u"}function ld(e){return J2(e)?(e.nodeName||"").toLowerCase():"#document"}function oi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Oo(e){var t;return(t=(J2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function J2(e){return gy()?e instanceof Node||e instanceof oi(e).Node:!1}function to(e){return gy()?e instanceof Element||e instanceof oi(e).Element:!1}function Sa(e){return gy()?e instanceof HTMLElement||e instanceof oi(e).HTMLElement:!1}function yC(e){return!gy()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof oi(e).ShadowRoot}function Tp(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=no(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function vse(e){return/^(table|td|th)$/.test(ld(e))}function yy(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const kse=/transform|translate|scale|rotate|perspective|filter/,Sse=/paint|layout|strict|content/,Ul=e=>!!e&&e!=="none";let Gx;function q0(e){const t=to(e)?no(e):e;return Ul(t.transform)||Ul(t.translate)||Ul(t.scale)||Ul(t.rotate)||Ul(t.perspective)||!Y0()&&(Ul(t.backdropFilter)||Ul(t.filter))||kse.test(t.willChange||"")||Sse.test(t.contain||"")}function Nse(e){let t=yl(e);for(;Sa(t)&&!Zu(t);){if(q0(t))return t;if(yy(t))return null;t=yl(t)}return null}function Y0(){return Gx==null&&(Gx=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Gx}function Zu(e){return/^(html|body|#document)$/.test(ld(e))}function no(e){return oi(e).getComputedStyle(e)}function xy(e){return to(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function yl(e){if(ld(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yC(e)&&e.host||Oo(e);return yC(t)?t.host:t}function Q2(e){const t=yl(e);return Zu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Sa(t)&&Tp(t)?t:Q2(t)}function cp(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Q2(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=oi(s);if(i){const l=Gb(a);return t.concat(a,a.visualViewport||[],Tp(s)?s:[],l&&n?cp(l):[])}else return t.concat(s,cp(s,[],n))}function Gb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Z2(e){const t=no(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Sa(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=Eg(n)!==i||Eg(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function G0(e){return to(e)?e:e.contextElement}function Au(e){const t=G0(e);if(!Sa(t))return Ao(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=Z2(t);let a=(i?Eg(n.width):n.width)/r,l=(i?Eg(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const jse=Ao(0);function eR(e){const t=oi(e);return!Y0()||!t.visualViewport?jse:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Cse(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==oi(e)?!1:t}function wc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=G0(e);let a=Ao(1);t&&(r?to(r)&&(a=Au(r)):a=Au(e));const l=Cse(i,n,r)?eR(i):Ao(0);let u=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,p=s.width/a.x,c=s.height/a.y;if(i){const f=oi(i),m=r&&to(r)?oi(r):r;let y=f,v=Gb(y);for(;v&&r&&m!==y;){const k=Au(v),g=v.getBoundingClientRect(),b=no(v),x=g.left+(v.clientLeft+parseFloat(b.paddingLeft))*k.x,N=g.top+(v.clientTop+parseFloat(b.paddingTop))*k.y;u*=k.x,d*=k.y,p*=k.x,c*=k.y,u+=x,d+=N,y=oi(v),v=Gb(y)}}return Ag({width:p,height:c,x:u,y:d})}function wy(e,t){const n=xy(e).scrollLeft;return t?t.left+n:wc(Oo(e)).left+n}function tR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-wy(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Ese(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=Oo(r),l=t?yy(t.floating):!1;if(r===a||l&&i)return n;let u={scrollLeft:0,scrollTop:0},d=Ao(1);const p=Ao(0),c=Sa(r);if((c||!c&&!i)&&((ld(r)!=="body"||Tp(a))&&(u=xy(r)),c)){const m=wc(r);d=Au(r),p.x=m.x+r.clientLeft,p.y=m.y+r.clientTop}const f=a&&!c&&!i?tR(a,u):Ao(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+p.x+f.x,y:n.y*d.y-u.scrollTop*d.y+p.y+f.y}}function _se(e){return Array.from(e.getClientRects())}function Pse(e){const t=Oo(e),n=xy(e),r=e.ownerDocument.body,s=lc(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=lc(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+wy(e);const l=-n.scrollTop;return no(r).direction==="rtl"&&(a+=lc(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const xC=25;function Ase(e,t){const n=oi(e),r=Oo(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,u=0;if(s){i=s.width,a=s.height;const p=Y0();(!p||p&&t==="fixed")&&(l=s.offsetLeft,u=s.offsetTop)}const d=wy(r);if(d<=0){const p=r.ownerDocument,c=p.body,f=getComputedStyle(c),m=p.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,y=Math.abs(r.clientWidth-c.clientWidth-m);y<=xC&&(i-=y)}else d<=xC&&(i+=d);return{width:i,height:a,x:l,y:u}}function Ise(e,t){const n=wc(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Sa(e)?Au(e):Ao(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,u=s*i.x,d=r*i.y;return{width:a,height:l,x:u,y:d}}function wC(e,t,n){let r;if(t==="viewport")r=Ase(e,n);else if(t==="document")r=Pse(Oo(e));else if(to(t))r=Ise(t,n);else{const s=eR(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ag(r)}function nR(e,t){const n=yl(e);return n===t||!to(n)||Zu(n)?!1:no(n).position==="fixed"||nR(n,t)}function Tse(e,t){const n=t.get(e);if(n)return n;let r=cp(e,[],!1).filter(l=>to(l)&&ld(l)!=="body"),s=null;const i=no(e).position==="fixed";let a=i?yl(e):e;for(;to(a)&&!Zu(a);){const l=no(a),u=q0(a);!u&&l.position==="fixed"&&(s=null),(i?!u&&!s:!u&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Tp(a)&&!u&&nR(e,a))?r=r.filter(p=>p!==a):s=l,a=yl(a)}return t.set(e,r),r}function Rse(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?yy(t)?[]:Tse(t,this._c):[].concat(n),r],l=wC(t,a[0],s);let u=l.top,d=l.right,p=l.bottom,c=l.left;for(let f=1;f<a.length;f++){const m=wC(t,a[f],s);u=lc(m.top,u),d=Qu(m.right,d),p=Qu(m.bottom,p),c=lc(m.left,c)}return{width:d-c,height:p-u,x:c,y:u}}function Lse(e){const{width:t,height:n}=Z2(e);return{width:t,height:n}}function Mse(e,t,n){const r=Sa(t),s=Oo(t),i=n==="fixed",a=wc(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const u=Ao(0);function d(){u.x=wy(s)}if(r||!r&&!i)if((ld(t)!=="body"||Tp(s))&&(l=xy(t)),r){const m=wc(t,!0,i,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else s&&d();i&&!r&&s&&d();const p=s&&!r&&!i?tR(s,l):Ao(0),c=a.left+l.scrollLeft-u.x-p.x,f=a.top+l.scrollTop-u.y-p.y;return{x:c,y:f,width:a.width,height:a.height}}function Xx(e){return no(e).position==="static"}function bC(e,t){if(!Sa(e)||no(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Oo(e)===n&&(n=n.ownerDocument.body),n}function rR(e,t){const n=oi(e);if(yy(e))return n;if(!Sa(e)){let s=yl(e);for(;s&&!Zu(s);){if(to(s)&&!Xx(s))return s;s=yl(s)}return n}let r=bC(e,t);for(;r&&vse(r)&&Xx(r);)r=bC(r,t);return r&&Zu(r)&&Xx(r)&&!q0(r)?n:r||Nse(e)||n}const Ose=async function(e){const t=this.getOffsetParent||rR,n=this.getDimensions,r=await n(e.floating);return{reference:Mse(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $se(e){return no(e).direction==="rtl"}const Dse={convertOffsetParentRelativeRectToViewportRelativeRect:Ese,getDocumentElement:Oo,getClippingRect:Rse,getOffsetParent:rR,getElementRects:Ose,getClientRects:_se,getDimensions:Lse,getScale:Au,isElement:to,isRTL:$se};function sR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Fse(e,t){let n=null,r;const s=Oo(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),i();const d=e.getBoundingClientRect(),{left:p,top:c,width:f,height:m}=d;if(l||t(),!f||!m)return;const y=Xh(c),v=Xh(s.clientWidth-(p+f)),k=Xh(s.clientHeight-(c+m)),g=Xh(p),x={rootMargin:-y+"px "+-v+"px "+-k+"px "+-g+"px",threshold:lc(0,Qu(1,u))||1};let N=!0;function _(C){const T=C[0].intersectionRatio;if(T!==u){if(!N)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}T===1&&!sR(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(_,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(_,x)}n.observe(e)}return a(!0),i}function vC(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:u=!1}=r,d=G0(e),p=s||i?[...d?cp(d):[],...t?cp(t):[]]:[];p.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const c=d&&l?Fse(d,n):null;let f=-1,m=null;a&&(m=new ResizeObserver(g=>{let[b]=g;b&&b.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),n()}),d&&!u&&m.observe(d),t&&m.observe(t));let y,v=u?wc(e):null;u&&k();function k(){const g=wc(e);v&&!sR(v,g)&&n(),v=g,y=requestAnimationFrame(k)}return n(),()=>{var g;p.forEach(b=>{s&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),c==null||c(),(g=m)==null||g.disconnect(),m=null,u&&cancelAnimationFrame(y)}}const zse=wse,Hse=mse,Bse=bse,Wse=gse,kC=pse,Vse=(e,t,n)=>{const r=new Map,s={platform:Dse,...n},i={...s.platform,_c:r};return fse(e,t,{...s,platform:i})};var Use=typeof document<"u",Kse=function(){},Sm=Use?h.useLayoutEffect:Kse;function Ig(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(!Ig(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)&&!Ig(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function iR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function SC(e,t){const n=iR(e);return Math.round(t*n)/n}function Jx(e){const t=h.useRef(e);return Sm(()=>{t.current=e}),t}function NC(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:u,open:d}=e,[p,c]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=h.useState(r);Ig(f,r)||m(r);const[y,v]=h.useState(null),[k,g]=h.useState(null),b=h.useCallback(P=>{P!==C.current&&(C.current=P,v(P))},[]),x=h.useCallback(P=>{P!==T.current&&(T.current=P,g(P))},[]),N=i||y,_=a||k,C=h.useRef(null),T=h.useRef(null),H=h.useRef(p),L=u!=null,F=Jx(u),O=Jx(s),D=Jx(d),W=h.useCallback(()=>{if(!C.current||!T.current)return;const P={placement:t,strategy:n,middleware:f};O.current&&(P.platform=O.current),Vse(C.current,T.current,P).then(R=>{const E={...R,isPositioned:D.current!==!1};$.current&&!Ig(H.current,E)&&(H.current=E,Wr.flushSync(()=>{c(E)}))})},[f,t,n,O,D]);Sm(()=>{d===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,c(P=>({...P,isPositioned:!1})))},[d]);const $=h.useRef(!1);Sm(()=>($.current=!0,()=>{$.current=!1}),[]),Sm(()=>{if(N&&(C.current=N),_&&(T.current=_),N&&_){if(F.current)return F.current(N,_,W);W()}},[N,_,W,F,L]);const M=h.useMemo(()=>({reference:C,floating:T,setReference:b,setFloating:x}),[b,x]),I=h.useMemo(()=>({reference:N,floating:_}),[N,_]),z=h.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const R=SC(I.floating,p.x),E=SC(I.floating,p.y);return l?{...P,transform:"translate("+R+"px, "+E+"px)",...iR(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:E}},[n,l,I.floating,p.x,p.y]);return h.useMemo(()=>({...p,update:W,refs:M,elements:I,floatingStyles:z}),[p,W,M,I,z])}const qse=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?kC({element:r.current,padding:s}).fn(n):{}:r?kC({element:r,padding:s}).fn(n):{}}}},jC=(e,t)=>{const n=zse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yse=(e,t)=>{const n=Bse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gse=(e,t)=>{const n=Wse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xse=(e,t)=>{const n=Hse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jse=(e,t)=>{const n=qse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qse={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},Zse={beaconOptions:{offset:-18}},oR={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},eie={isFixed:!1,locale:oR,placement:"bottom"},tie={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Ut={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},Ar={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"},Ue={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},vo={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},zt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},nie="react-joyride-portal";function rie(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function xu(...e){return qre({all:!0,isMergeableObject:t=>!(!as.plainObject(t)||h.isValidElement(t))})(...e)}function aR(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function oa(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Yx(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(h.isValidElement(e)&&!Object.values(e.props).length&&aR(e.type)==="function")try{i=oa(e.type({}),t)}catch{i=Yx(n)}else i=Yx(n);return i}function Tr(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 sie(e,t){const n=rie(t);return{...e,...n}}function up(){}function iie(e){return Object.keys(e)}function Tg(e,...t){if(!as.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 CC(e,...t){if(!as.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 Xb(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(aR(e)==="string")return r(e);if(!h.isValidElement(e))return e;const{children:s}=e.props;if(as.string(s)&&s.includes("{current}"))return h.cloneElement(e,{children:r(s)});if(Array.isArray(s))return h.cloneElement(e,{children:s.map(i=>typeof i=="string"?r(i):Xb(i,t,n))});if(as.function(e.type)&&!Object.values(e.props).length)try{return Xb(e.type({}),t,n)}catch{return e}return e}function EC(e){return iie(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function X0(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function _C(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 J0(e){return e?e.getBoundingClientRect():null}function oie(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 _i(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 aie(e,t,n){const r=J0(e),s=cd(e),i=s?!s.isSameNode($s()):!1,a=n??ud(e);let l=0,u=(r==null?void 0:r.top)??0;return i&&a?u=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!a&&(u+=l),s.isSameNode($s())||(u+=$s().scrollTop)),Math.floor(u-t)}function cd(e,t){if(!e)return $s();const n=q2(e);if(n){if(n.isSameNode($s()))return t?document:$s();if(!(n.scrollHeight>n.offsetHeight))return $s()}return n}function lie(e){const t=e.getBoundingClientRect(),n=$s(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function cie(e,t){if(!e)return 0;const n=q2(e)??$s(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=J0(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let u=e.getBoundingClientRect().top+l;if(a&&(lR(e)||uie(e))){const p=e.getBoundingClientRect(),c=p.top-((s==null?void 0:s.top)??0),f=c+p.height,m=n.clientHeight,y=m*.2;c>=y&&f<=m-y?u=i:u=c+i}const d=Math.floor(u-t-r);return d<0?0:d}function uie(e){return e.offsetParent!==document.body}function lR(e){if(!e)return!1;const t=cd(e);return t?!t.isSameNode($s()):!1}function ud(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?ud(e.parentNode,t):!1}function Jh(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 PC(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==Ue.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?cd(s):$s(),l=a?!a.isSameNode($s()):!1;return(r.isFixed||ud(s))&&!l?!1:a.scrollHeight>a.clientHeight}function $s(){return document.scrollingElement??document.documentElement}function AC(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(a=>{const{scrollTop:l}=r,u=e>l?e-l:l-e;s=ese.top(r,e,{duration:u<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function die(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 cR={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Qh={...cR,borderRadius:4,padding:8};function fie(e,t){const{styles:n}=e,r=xu(n??{},t.styles??{});let{width:s}=t;X0()&&(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 xu({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...cR,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(${die(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:{...Qh,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Qh,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Qh,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Qh,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 pie=["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 Q0(e,t){if(!t)return null;const n=xu(eie,CC(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=xu(Qse,e.options??{},CC(t,...pie)),s=fie(e,{...n,...r}),i=xu(Zse,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:xu(oR,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:hie(r.spotlightPadding),styles:s}}function hie(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 mie(e,t,n){const{action:r}=t,s=n&&[Ut.PREV,Ut.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function uR(e,t=!1){return as.plainObject(e)?e.target?!0:(Tr(t,"tour","target is missing from the step"),!1):(Tr(t,"tour","step must be an object"),!1)}function dR(e,t=!1){return as.array(e)?e.every(n=>uR(n,t)):(Tr(t,"tour","steps must be an array"),!1)}var gie=class{constructor(e){tr(this,"beaconPosition",null);tr(this,"debug");tr(this,"eventListeners",new Map);tr(this,"listeners",new Set);tr(this,"props");tr(this,"snapshot");tr(this,"state");tr(this,"steps");tr(this,"tooltipPosition",null);tr(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});tr(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);tr(this,"getServerSnapshot",()=>this.snapshot);tr(this,"getSnapshot",()=>this.snapshot);tr(this,"getEventState",()=>Tg(this.snapshot,"positioned"));tr(this,"getState",()=>Tg(this.snapshot,"positioned"));tr(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Tr(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Ue.BEACON_BEFORE||this.state.lifecycle===Ue.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)});tr(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});tr(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});tr(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)}});tr(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));tr(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,!H0(s,l)){this.snapshot=Object.freeze({...l});for(const u of this.listeners)u(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=as.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,as.number(t)&&Tr(this.debug,"tour","initialStepIndex is ignored in controlled mode")):as.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&Tr(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Ut.INIT,controlled:s,index:i,lifecycle:Ue.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?zt.READY:zt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===zt.WAITING&&e.size>0?{...e,status:zt.RUNNING}:e}getStep(e){return Q0(this.props,this.steps[e??this.state.index])}};function yie(e){return new gie(e)}function IC(e,t){return Math.min(Math.max(e,0),t)}function xie(e,t,n){const r=h.useRef(t),s=h.useRef(n);return r.current=t,s.current=n,h.useMemo(()=>{const i=()=>e.current.getSnapshot();return{close:(k=null)=>{const{index:g,status:b}=i();b===zt.RUNNING&&e.current.updateState({action:Ut.CLOSE,index:g+1,origin:k,lifecycle:Ue.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:k=>{const{controlled:g,size:b,status:x}=i();if(g){Tr(r.current,"tour","go() is not supported in controlled mode");return}x===zt.RUNNING&&e.current.updateState({action:Ut.GO,index:k,lifecycle:Ue.COMPLETE,positioned:!1,scrolling:!1,status:k<b?x:zt.FINISHED,waiting:!1})},info:()=>Tg(e.current.getSnapshot(),"positioned"),next:k=>{const{index:g,size:b,status:x}=i();x===zt.RUNNING&&e.current.updateState({action:Ut.NEXT,index:IC(g+1,b),lifecycle:Ue.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:k}=i();k===zt.RUNNING&&e.current.updateState({action:Ut.UPDATE,lifecycle:Ue.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:k=>{const{index:g,size:b,status:x}=i();x===zt.RUNNING&&e.current.updateState({action:Ut.PREV,index:IC(g-1,b),lifecycle:Ue.COMPLETE,origin:k,positioned:!1,scrolling:!1,waiting:!1})},reset:(k=!1)=>{const{controlled:g}=i();if(g){Tr(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Ut.RESET,index:0,lifecycle:Ue.INIT,positioned:!1,scrolling:!1,status:k?zt.RUNNING:zt.READY,waiting:!1})},skip:k=>{const{status:g}=i();g===zt.RUNNING&&e.current.updateState({action:Ut.SKIP,lifecycle:Ue.COMPLETE,origin:k,positioned:!1,scrolling:!1,status:zt.SKIPPED,waiting:!1})},start:k=>{const{index:g,size:b}=i();s.current(),e.current.updateState({action:Ut.START,index:as.number(k)?k:g,lifecycle:Ue.INIT,positioned:!1,scrolling:!1,status:b?zt.RUNNING:zt.WAITING,waiting:!1},!0)},stop:(k=!1)=>{const{index:g,status:b}=i();[zt.FINISHED,zt.SKIPPED].includes(b)||e.current.updateState({action:Ut.STOP,index:g+(k?1:0),lifecycle:Ue.COMPLETE,positioned:!1,scrolling:!1,status:zt.PAUSED,waiting:!1})}}},[e])}const wie=new Set(["origin","positioned"]);function bie(e,t){const n=h.useRef(null);h.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Tr(!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 u of Object.keys(s))s[u]!==i[u]&&!wie.has(u)&&(a[u]={from:i[u],to:s[u]},(u==="status"||u==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||Tr(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function vie(e,t,n){const r=h.useRef(e),s=h.useRef(t);return r.current=e,s.current=t,h.useCallback((i,a,l)=>{var d;const u={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(d=r.current)==null||d.call(r,u,s.current),n.current.dispatch(u,s.current)},[n])}function Ua(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 kie(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:u}=e,{action:d,index:p,lifecycle:c,positioned:f,scrolling:m,size:y,status:v}=a,k=F2(l)??null,g=h.useRef(null),b=h.useRef(i),x=h.useRef(a),N=h.useRef(s),_=h.useRef(l),C=h.useRef(k),T=h.useRef(n),H=h.useRef(null),L=h.useRef(null),F=h.useRef(null);b.current=i,x.current=a,N.current=s,_.current=l,C.current=k,T.current=n;const O=()=>{H.current&&(clearInterval(H.current),H.current=null),L.current=null,F.current&&(F.current.cancel(),F.current=null)};h.useEffect(()=>{if(!N.current)return;const{hasChangedTo:D}=Ua(x.current,N.current);(D("action",[Ut.NEXT,Ut.PREV,Ut.SKIP,Ut.CLOSE])||g.current===Ut.CLOSE&&d===Ut.START)&&(g.current=d)},[d]),h.useEffect(()=>{if(!N.current)return()=>{O()};const{hasChanged:D}=Ua(x.current,N.current),W=_.current;if(D("index")&&O(),v!==zt.RUNNING||!W||c!==Ue.INIT)return()=>{O()};const{hasChangedTo:$}=Ua(x.current,N.current);$("status",zt.RUNNING)&&[zt.IDLE,zt.READY,zt.PAUSED].includes(N.current.status)&&r(Ar.TOUR_START,W),u.current.cleanupPositionData();const{debug:M}=b.current;if(W.before&&!F.current){Tr(M,`step:${p}`,"before()",W),F.current={cancel:()=>{}},u.current.updateState({waiting:!0}),r(Ar.STEP_BEFORE_HOOK,W,{action:g.current??x.current.action});const I=()=>{F.current=null,u.current.updateState({action:g.current??x.current.action,waiting:!1,lifecycle:Ue.READY})},z=new AbortController,P=W.beforeTimeout;F.current={cancel:()=>z.abort()};const R=P?setTimeout(()=>{z.signal.aborted||(Tr(M,`step:${p}`,"before()","timed out",`${P}ms`),z.abort(),t(W,"before_hook"),r(Ar.ERROR,W,{error:new Error("Step before hook timed out")}),I())},P):null;W.before({...u.current.getState(),action:g.current??u.current.getState().action,step:W}).then(()=>{z.signal.aborted||(R&&clearTimeout(R),I())}).catch(E=>{z.signal.aborted||(R&&clearTimeout(R),t(W,"before_hook"),r(Ar.ERROR,W,{error:E instanceof Error?E:new Error(String(E))}),I())})}else if(!F.current){H.current&&L.current!==W.target&&O();const I=_i(W.target);if(I&&Jh(I))O(),u.current.updateState({action:g.current??Ut.UPDATE,lifecycle:Ue.READY,waiting:!1});else if(W.targetWaitTimeout===0)u.current.updateState({action:g.current??Ut.UPDATE,lifecycle:Ue.READY,waiting:!1});else if(!H.current){const{targetWaitTimeout:z}=W,P=Date.now();L.current=W.target,Tr(M,`step:${p}`,"polling","started",`${z}ms`),u.current.updateState({waiting:!0}),H.current=setInterval(()=>{const R=_i(W.target),E=Date.now()-P,J=E>=z;(R&&Jh(R)||J)&&(Tr(M,`step:${p}`,"polling",R&&Jh(R)?"found":"timed out",`${E}ms`),O(),u.current.updateState({action:g.current??Ut.UPDATE,lifecycle:Ue.READY,waiting:!1}))},100)}}return()=>{O()}},[t,r,p,c,v,u]),h.useEffect(()=>{if(!N.current)return;const{hasChanged:D,hasChangedTo:W,previous:$}=Ua(x.current,N.current),M=_.current;if(!M)return;const I=_i(M.target),z=!!I;if(z&&Jh(I)){if(W("lifecycle",Ue.READY)&&$.lifecycle===Ue.INIT&&r(Ar.STEP_BEFORE,M,{action:g.current??x.current.action}),W("lifecycle",Ue.READY)){const P=x.current,R=mie(M,P,b.current.continuous)?Ue.TOOLTIP:Ue.BEACON,E=_i(M.scrollTarget??M.spotlightTarget??M.target),J=PC({isFirstStep:P.index===0,scrollToFirstStep:b.current.scrollToFirstStep,step:M,target:E,targetLifecycle:R}),Z=R===Ue.TOOLTIP?Ue.TOOLTIP_BEFORE:Ue.BEACON_BEFORE;Tr(b.current.debug,`step:${p}`,"scroll",J?"needed":"skipped"),u.current.updateState({action:Ut.UPDATE,lifecycle:Z,scrolling:J})}}else if(x.current.status===zt.RUNNING&&c!==Ue.INIT&&c!==Ue.COMPLETE&&D("lifecycle")){Tr(b.current.debug,`step:${p}`,z?"Target not visible":"Target not mounted",M),t(M,"target_not_found"),r(Ar.TARGET_NOT_FOUND,M);const P=x.current;P.controlled||u.current.updateState({action:Ut.UPDATE,index:P.index+(P.action===Ut.PREV?-1:1),lifecycle:Ue.INIT})}},[t,r,p,c,u]),h.useEffect(()=>{if(!N.current)return;const{hasChangedTo:D,previous:W}=Ua(x.current,N.current),$=_.current,M=C.current;if($&&D("lifecycle",Ue.TOOLTIP_BEFORE)&&W.lifecycle===Ue.BEACON){const P=_i($.scrollTarget??$.spotlightTarget??$.target);if(PC({isFirstStep:x.current.index===0,scrollToFirstStep:b.current.scrollToFirstStep,step:$,target:P,targetLifecycle:Ue.TOOLTIP})){u.current.updateState({scrolling:!0,positioned:!1});return}}const I=c===Ue.BEACON_BEFORE||c===Ue.TOOLTIP_BEFORE;if($&&I&&!m){const P=c===Ue.TOOLTIP_BEFORE?Ue.TOOLTIP:Ue.BEACON;u.current.updateState({action:Ut.UPDATE,lifecycle:P})}$&&D("lifecycle",Ue.BEACON)&&r(Ar.BEACON,$),$&&D("lifecycle",Ue.TOOLTIP)&&r(Ar.TOOLTIP,$);const z=x.current;if((z.status===zt.RUNNING||z.controlled&&z.status===zt.PAUSED&&$)&&M&&D("lifecycle",Ue.COMPLETE)&&W.lifecycle===Ue.TOOLTIP&&(r(Ar.STEP_AFTER,M,{action:g.current??Ut.UPDATE,index:W.index??z.index,lifecycle:z.lifecycle}),M.after)){r(Ar.STEP_AFTER_HOOK,M,{action:g.current??Ut.UPDATE,index:W.index??z.index,lifecycle:z.lifecycle});try{M.after({...u.current.getState(),action:g.current??Ut.UPDATE,index:W.index??z.index,lifecycle:z.lifecycle,step:M})}catch{}}},[r,c,f,m,u]),h.useEffect(()=>{if(!N.current)return;const{hasChangedTo:D,previous:W}=Ua(x.current,N.current),$=_.current,M=C.current;y&&!$&&c===Ue.INIT&&u.current.updateState({action:Ut.UPDATE,lifecycle:Ue.COMPLETE,status:zt.FINISHED}),!x.current.controlled&&v===zt.RUNNING&&D("lifecycle",Ue.COMPLETE)&&p<y&&u.current.updateState({action:Ut.UPDATE,lifecycle:Ue.INIT}),D("lifecycle",Ue.COMPLETE)&&p>=y&&u.current.updateState({action:Ut.UPDATE,lifecycle:Ue.COMPLETE,status:zt.FINISHED});const I=$??M??Q0(b.current,b.current.steps[p-1]);if(I&&D("status",[zt.FINISHED,zt.SKIPPED])){let z;$?z=p:M?z=W.index??p:z=p-1,r(Ar.TOUR_END,I,{index:z}),x.current.controlled||T.current.reset(),g.current=null}$&&D("action",Ut.STOP)&&(g.current=null,r(Ar.TOUR_STATUS,$)),$&&D("action",Ut.RESET)&&(r(Ar.TOUR_STATUS,$),g.current=null)},[d,r,p,c,y,v,u])}function Sie({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:u,steps:d}=n,p=h.useRef(void 0),c=h.useRef(r),f=h.useRef(e);c.current=r,f.current=e,h.useEffect(()=>{const m=p.current;if(p.current=n,!m||n===m)return;const{hasChanged:y}=Ua(n,m);if(H0(m.steps,d)||(dR(d,i)?s.current.setSteps(d):(Tr(i,"tour","Steps are not valid",d),t(Ar.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),y("run"))l?s.current.getState().size&&f.current.start(u??a):f.current.stop();else if(as.number(u)&&y("stepIndex")){const v=as.number(m.stepIndex)&&m.stepIndex<u?Ut.NEXT:Ut.PREV;[zt.FINISHED,zt.SKIPPED].includes(c.current.status)||s.current.updateState({action:v,index:u,lifecycle:Ue.INIT,positioned:!1},!0)}},[i,t,a,n,l,u,d,s])}function Nie(e,t){var l,u,d,p;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===Ue.BEACON_BEFORE&&(n!=null&&n.placement)){const c=jie(n);["bottom"].includes(n.placement)||(a+=Math.floor(c-s))}else if(r===Ue.TOOLTIP_BEFORE){const{placement:c}=i;if(c==="top"){const f=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,m=(u=i.floatingOptions)!=null&&u.hideArrow?0:i.arrowSize,y=i.offset+i.spotlightPadding.top+m;a-=f+y}else if(c==="left"||c==="right"){const f=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,m=((p=_i(i.target))==null?void 0:p.getBoundingClientRect().height)??0,y=s+i.spotlightPadding.top+m/2-f/2;y<s&&(a-=s-y)}}return Math.max(0,a)}function jie(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 Cie({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:u,scrolling:d,status:p}=r,c=h.useRef(null),f=h.useRef(r),m=h.useRef(t),y=h.useRef(n),v=h.useRef(s);f.current=r,m.current=t,y.current=n,v.current=s,h.useEffect(()=>()=>{var k;(k=c.current)==null||k.call(c)},[]),h.useEffect(()=>{var _;if(!m.current||!v.current)return;const{hasChangedTo:k}=Ua(f.current,m.current),g=v.current,{debug:b}=y.current,{scrollDuration:x}=g,N=l===Ue.BEACON_BEFORE||l===Ue.TOOLTIP_BEFORE;if(p===zt.RUNNING&&N&&d&&k("positioned",!0)){const C=_i(g.scrollTarget??g.spotlightTarget??g.target),T=i.current.getPositionData("beacon"),H=cd(C),L=H?!H.isSameNode($s()):!1;(_=c.current)==null||_.call(c),(async()=>{if(L&&!ud(H)){const z=$s(),P=lie(H),R={initial:z.scrollTop,target:P,element:z,duration:x};e(Ar.SCROLL_START,g,{scroll:R});const{cancel:E,promise:J}=AC(P,{element:z,duration:x});c.current=E,await J,e(Ar.SCROLL_END,g,{scroll:R})}const O=Math.floor(cie(C,g.scrollOffset))||0,D=L?O:Nie(O,{beaconPosition:T,lifecycle:l,scrollOffset:g.scrollOffset,step:g});Tr(b,`step:${a}`,"scroll",L?"custom":"document",`${O} → ${D}`);const W=H,$={initial:W.scrollTop,target:D,element:W,duration:x};e(Ar.SCROLL_START,g,{scroll:$});const{cancel:M,promise:I}=AC(D,{element:W,duration:x});c.current=M,await I,e(Ar.SCROLL_END,g,{scroll:$}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,u,d,p,i])}function Eie(e){const t=cre(()=>sie(tie,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,u=h.useRef(yie(t)),d=CA.useSyncExternalStore(u.current.subscribe,u.current.getSnapshot,u.current.getServerSnapshot),[p,c]=h.useState([]),f=h.useCallback((_,C)=>{c(T=>[...T,{reason:C,step:_}])},[]),m=h.useCallback(()=>{c([])},[]);bie(u,n);const y=xie(u,n,m),v=vie(s,y,u),{index:k,size:g,status:b}=d,x=F2(d),N=h.useMemo(()=>Q0(t,l[k]),[k,t,l]);return ure(()=>{i&&g&&dR(l,n)&&y.start(a??r)}),lre(()=>{i&&g&&b===zt.IDLE&&u.current.updateState({status:zt.READY})},[i,g,b]),Sie({controls:y,emitEvent:v,props:t,state:d,store:u}),kie({addFailure:f,controls:y,emitEvent:v,previousState:x,props:t,state:d,step:N,store:u}),Cie({emitEvent:v,previousState:x,props:t,state:d,step:N,store:u}),{controls:y,failures:p,mergedProps:t,state:d,step:N,store:u}}function _ie(e){const[t,n]=h.useState(null);return h.useEffect(()=>{let r=null,s=!1;if(e)if(as.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=nie,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Pie={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Aie({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(h.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return up;const u=document.createElement("style");return u.id="joyride-loader-animation",e&&u.setAttribute("nonce",e),u.appendChild(document.createTextNode(`
|
|
235
|
+
@keyframes joyride-loader-spin {
|
|
236
|
+
to { transform: rotate(360deg); }
|
|
237
|
+
}
|
|
238
|
+
`)),document.head.appendChild(u),()=>{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 u=n;l=at.createElement(u,{step:t})}else l=at.createElement("div",{style:{...Pie,height:s,width:i,borderTopColor:t.primaryColor}});return at.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const Iie={height:0,isFixed:!1,left:0,top:0,width:0};function qd(e,t){const n=_i(e);if(!n)return Iie;const r=J0(n),s=ud(n),i=aie(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 Tie(e,t,n){const[r,s]=h.useState(()=>qd(e,t)),i=h.useRef(void 0),a=h.useRef(null),l=h.useRef(n),u=h.useRef(null),d=h.useCallback(()=>{clearTimeout(i.current),i.current=window.setTimeout(()=>{s(c=>{const f=qd(e,t);return c.top===f.top&&c.left===f.left&&c.width===f.width&&c.height===f.height&&c.isFixed===f.isFixed?c:f})},100)},[e,t]);h.useEffect(()=>{let c=null;const f=y=>{a.current=cd(y,!0),a.current&&a.current.addEventListener("scroll",d,{passive:!0}),window.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),typeof ResizeObserver<"u"&&(u.current=new ResizeObserver(d),u.current.observe(y)),s(qd(e,t))},m=_i(e);return m?f(m):(c=new MutationObserver(()=>{const y=_i(e);y&&(c==null||c.disconnect(),c=null,f(y))}),c.observe(document.body,{childList:!0,subtree:!0})),()=>{var y;c==null||c.disconnect(),a.current&&a.current.removeEventListener("scroll",d),window.removeEventListener("scroll",d),window.removeEventListener("resize",d),(y=u.current)==null||y.disconnect(),clearTimeout(i.current)}},[e,t,d]),h.useEffect(()=>{l.current&&!n&&s(qd(e,t)),l.current=n},[n,e,t]);let p=r;return l.current&&!n&&(p=qd(e,t)),p}function Rie(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function TC(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 Lie=[Ue.BEACON_BEFORE,Ue.BEACON];function Mie(e){var I,z;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:u,scrolling:d,spotlightPadding:p,spotlightRadius:c,spotlightTarget:f,styles:m,target:y,waiting:v}=e,k=dre(),g=Tie(f??y,p,d||v),b=h.useRef(null),x=(s===Ue.TOOLTIP||s===Ue.TOOLTIP_BEFORE)&&l!=="center",[N,_]=h.useState(!1),C=u?(I=b.current)==null?void 0:I.offsetParent:null,T=(C==null?void 0:C.clientWidth)??k.width,H=(C==null?void 0:C.clientHeight)??oie()??k.height,L=((z=m.overlay)==null?void 0:z.backgroundColor)??"rgba(0, 0, 0, 0.5)",F=h.useMemo(()=>{const{backgroundColor:P,mixBlendMode:R,...E}=m.overlay;return{height:H,pointerEvents:"none",...E}},[H,m.overlay]),O=x&&!d&&!v;h.useEffect(()=>{O?requestAnimationFrame(()=>_(!0)):_(!1)},[O]);const D=n&&Lie.includes(s),W=!n&&s!==Ue.TOOLTIP;if(r||!v&&(D||W))return null;let $="";if(O)if(u&&C){const P=_i(f??y);if(P){const R=_C(P),E=_C(C);$=TC(R.left-E.left-p.left,R.top-E.top-p.top,P.offsetWidth+p.left+p.right,P.offsetHeight+p.top+p.bottom,c)}}else $=TC(g.left,g.top,g.width,g.height,c);const M=Rie(T,H,$);return at.createElement("div",{ref:b,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:F},at.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:H,left:0,position:g.isFixed?"fixed":"absolute",top:0,width:T}},at.createElement("path",{d:M,fill:L,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),$&&at.createElement("path",{d:$,fill:L,style:{opacity:N?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),$&&Object.keys(m.spotlight).length>0&&at.createElement("path",{d:$,fill:"none",style:{pointerEvents:"none"},...m.spotlight})))}function fR(e){const{children:t,element:n}=e;return n?Wr.createPortal(t,n):null}const Oie='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function $ie(e,t){const n=h.useRef(null);h.useEffect(()=>{if(!e)return up;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(Oie)],{shiftKey:l}=i;if(!a.length)return;i.preventDefault();let u=document.activeElement?a.indexOf(document.activeElement):0;u===-1||!l&&u+1===a.length?u=0:l&&u===0?u=a.length-1:u+=l?-1:1,a[u].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 da(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 Die(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...da(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...da(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...da(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...da(e,t,n)};default:return null}}function Fie(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...da(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...da(e,r,n)};case"left":return{right:-n,top:t.y??0,...da(e,r,n)};case"right":return{left:-n,top:t.y??0,...da(e,r,n)};default:return{}}}function zie({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let u=null;if(l){if(!da(r,n,i))return null;u=at.createElement("span",{style:{flexShrink:0}},at.createElement(l,{base:n,placement:r,size:i}))}else{const d=Die(r,n,i);if(!d)return null;u=at.createElement("svg",{height:d.height,width:d.width,xmlns:"http://www.w3.org/2000/svg"},at.createElement("polygon",{fill:"currentColor",points:d.points}))}return at.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...Fie(r,s,i,n),...s?{}:{visibility:"hidden"}}},u)}function Hie(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:u,size:d,step:p,styles:c}=e,f=h.useRef(null),m=!!t;h.useEffect(()=>{if(m||document.getElementById("joyride-beacon-animation"))return up;const k=document.createElement("style");k.id="joyride-beacon-animation",a&&k.setAttribute("nonce",a),k.appendChild(document.createTextNode(`
|
|
239
|
+
@keyframes joyride-beacon-inner {
|
|
240
|
+
20% {
|
|
241
|
+
opacity: 0.9;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
90% {
|
|
245
|
+
opacity: 0.7;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@keyframes joyride-beacon-outer {
|
|
250
|
+
0% {
|
|
251
|
+
transform: scale(1);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
45% {
|
|
255
|
+
opacity: 0.7;
|
|
256
|
+
transform: scale(0.75);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
100% {
|
|
260
|
+
opacity: 0.9;
|
|
261
|
+
transform: scale(1);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
`)),document.head.appendChild(k);const g=setTimeout(()=>{as.domElement(f.current)&&u&&f.current.focus()},0);return()=>{clearTimeout(g);const b=document.getElementById("joyride-beacon-animation");b!=null&&b.parentNode&&b.parentNode.removeChild(b)}},[m,a,u]);const y=oa(i.open);let v;if(t){const k=t;v=at.createElement(k,{continuous:n,index:r,isLastStep:s,size:d,step:p})}else v=at.createElement("span",{style:c.beacon},at.createElement("span",{style:c.beaconOuter}),at.createElement("span",{style:c.beaconInner}));return at.createElement("button",{ref:f,"aria-label":y,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:c.beaconWrapper,title:y,type:"button"},v)}function Bie({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return at.createElement("button",{style:i,type:"button",...t},at.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"},at.createElement("g",null,at.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 Wie(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:u}=e,{buttons:d,content:p,styles:c,title:f}=l,m={};d.includes("primary")&&(m.primary=at.createElement("button",{"data-testid":"button-primary",style:c.buttonPrimary,type:"button",...i})),d.includes("skip")&&!s&&(m.skip=at.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:c.buttonSkip,type:"button",...a})),d.includes("back")&&r>0&&(m.back=at.createElement("button",{"data-testid":"button-back",style:c.buttonBack,type:"button",...t})),m.close=d.includes("close")&&at.createElement(Bie,{"data-testid":"button-close",styles:c.buttonClose,...n});const y=f?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":oa(p),"aria-describedby":"joyride-tooltip-content"};return at.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:c.tooltip,...u,...y},at.createElement("div",{style:c.tooltipContainer},f&&at.createElement("h4",{id:"joyride-tooltip-title",style:c.tooltipTitle},f),at.createElement("div",{id:"joyride-tooltip-content",style:c.tooltipContent},p)),d.some(v=>v==="back"||v==="primary"||v==="skip")&&at.createElement("div",{style:c.tooltipFooter},at.createElement("div",{style:c.tooltipFooterSpacer},m.skip),m.back,m.primary),m.close)}function Vie(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=g=>{g.preventDefault(),n.prev(vo.BUTTON_BACK)},u=g=>{g.preventDefault(),a.closeButtonAction==="skip"?n.skip(vo.BUTTON_CLOSE):n.close(vo.BUTTON_CLOSE)},d=g=>{if(g.preventDefault(),!t){n.close(vo.BUTTON_PRIMARY);return}n.next(vo.BUTTON_PRIMARY)},p=g=>{g.preventDefault(),n.skip(vo.BUTTON_SKIP)},c=()=>{const{back:g,close:b,last:x,next:N,nextWithProgress:_,skip:C}=a.locale,T=oa(g),H=oa(b),L=oa(x),F=oa(N),O=oa(C);let D=b,W=H;if(t){if(D=N,W=F,a.showProgress&&!s){const $=oa(_,{step:r+1,steps:i});D=Xb(_,r+1,i),W=$}s&&(D=x,W=L)}return{backProps:{"aria-label":T,children:g,"data-action":"back",onClick:l,role:"button",title:T},closeProps:{"aria-label":H,children:b,"data-action":"close",onClick:u,role:"button",title:H},primaryProps:{"aria-label":W,children:D,"data-action":"primary",onClick:d,role:"button",title:W},skipProps:{"aria-label":O,children:C,"data-action":"skip",onClick:p,role:"button",title:O},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:f,beaconComponent:m,tooltipComponent:y,...v}=a;let k;if(y){const g=y;k=at.createElement(g,{...c(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:v})}else k=at.createElement(Wie,{...c(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:v});return k}function Uie(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function Kie(e,t,n){var r,s;return e?[Xse()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[Gse({crossAxis:!1,fallbackPlacements:Uie(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function qie(e){var R,E,J,Z,U;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:u,setTooltipRef:d,shouldScroll:p,size:c,step:f,target:m,updateState:y}=e,v=h.useRef(null),k=h.useRef({}),g=h.useRef({}),b=f.placement==="center",x=f.placement==="auto",N=h.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})}),[]),_=h.useMemo(()=>lR(m)?cd(m):void 0,[m]),C=h.useMemo(()=>ud(m),[m]),T=h.useMemo(()=>_?{boundary:_,rootBoundary:"viewport"}:{},[_]),H=b||x?"bottom":f.placement,L=b?"fixed":((R=f.floatingOptions)==null?void 0:R.strategy)??(f.isFixed||C?"fixed":"absolute"),F=h.useMemo(()=>{var se,pe,he,xe;return b?[{name:"center",fn:({rects:le})=>({x:(window.innerWidth-le.floating.width)/2,y:(window.innerHeight-le.floating.height)/2})}]:[jC(({placement:le})=>{var oe;let Se="right";le.startsWith("top")?Se="top":le.startsWith("bottom")?Se="bottom":le.startsWith("left")&&(Se="left");const ie=f.spotlightTarget?0:f.spotlightPadding[Se];return f.offset+ie+((oe=f.floatingOptions)!=null&&oe.hideArrow?0:f.arrowSize)},[f.offset,f.spotlightPadding,f.spotlightTarget,f.arrowSize,(se=f.floatingOptions)==null?void 0:se.hideArrow]),...Kie(x,f,H),Yse({padding:10,...T,...(pe=f.floatingOptions)==null?void 0:pe.shiftOptions}),...(he=f.floatingOptions)!=null&&he.hideArrow?[]:[Jse({element:v,padding:f.arrowSpacing},[f.arrowSpacing,f.arrowBase])],...((xe=f.floatingOptions)==null?void 0:xe.middleware)??[]]},[b,f,x,H,T]),O=NC({...b?{elements:{reference:N}}:{},placement:H,strategy:L,middleware:F}),D=NC({strategy:L,placement:f.beaconPlacement??(x||b?"bottom":f.placement),middleware:h.useMemo(()=>{var se,pe;return[jC(((pe=(se=f.floatingOptions)==null?void 0:se.beaconOptions)==null?void 0:pe.offset)??-18)]},[(J=(E=f.floatingOptions)==null?void 0:E.beaconOptions)==null?void 0:J.offset]),whileElementsMounted:vC});g.current=O.middlewareData,k.current=D.middlewareData,h.useEffect(()=>{var he;const{floating:se,reference:pe}=O.elements;if(!(!pe||!se||s!==Ue.TOOLTIP))return vC(pe,se,O.update,(he=f.floatingOptions)==null?void 0:he.autoUpdate)},[s,O.update,(Z=f.floatingOptions)==null?void 0:Z.autoUpdate,f.target,O.elements]),h.useEffect(()=>{!b&&m&&O.refs.setReference(m),m&&D.refs.setReference(m)},[D.refs,b,m,O.refs]),h.useEffect(()=>{O.isPositioned&&u("tooltip",{placement:O.placement,x:O.x??0,y:O.y??0,middlewareData:g.current})},[u,O.isPositioned,O.placement,O.x,O.y]),h.useEffect(()=>{D.isPositioned&&u("beacon",{placement:D.placement,x:D.x??0,y:D.y??0,middlewareData:k.current})},[u,D.isPositioned,D.placement,D.x,D.y]);const W=f.zIndex+100,$=h.useCallback(se=>{se.type==="mouseenter"&&f.beaconTrigger!=="hover"||y({lifecycle:Ue.TOOLTIP_BEFORE,positioned:!1})},[f.beaconTrigger,y]),M=h.useCallback(se=>{se&&(O.refs.setFloating(se),d(se))},[O.refs,d]),{arrow:I,floater:z}=f.styles;let P=null;if(s===Ue.TOOLTIP||s===Ue.TOOLTIP_BEFORE){const se=EC({...z,...O.floatingStyles,zIndex:W,opacity:a&&O.isPositioned?1:0,...!a&&{transition:"none"}});P=at.createElement("div",{ref:M,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:se},at.createElement(Vie,{continuous:t,controls:n,index:r,isLastStep:r+1===c,size:c,step:f}),!b&&!((U=f.floatingOptions)!=null&&U.hideArrow)&&at.createElement(zie,{arrowComponent:f.arrowComponent,arrowRef:v,base:f.arrowBase,placement:O.placement,position:O.middlewareData.arrow,size:f.arrowSize,styles:I}))}else(s===Ue.BEACON||s===Ue.BEACON_BEFORE)&&(P=at.createElement("div",{ref:D.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:EC({...D.floatingStyles,zIndex:W})},at.createElement(Hie,{beaconComponent:f.beaconComponent,continuous:t,index:r,isLastStep:r+1===c,locale:f.locale,nonce:i,onInteract:$,shouldFocus:p,size:c,step:f,styles:f.styles})));return at.createElement(fR,{element:l},P)}function Yie(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:u,size:d,step:p,updateState:c}=e,[f,m]=h.useState(null);$ie(p.disableFocusTrap?null:f,"[data-action=primary]");const y=_i(p.target),v=s===Ue.TOOLTIP;return!uR(p)||!as.domElement(y)?null:at.createElement(qie,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:v,portalElement:a,setPositionData:l,setTooltipRef:m,shouldScroll:u,size:d,step:p,target:y,updateState:c})}function Gie({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:u,scrollToFirstStep:d}=t,p=_ie(u),{index:c,lifecycle:f,status:m}=n,y=m===zt.RUNNING,[v,k]=h.useState(!1),g=h.useRef(null),b=(r==null?void 0:r.loaderDelay)??0;h.useEffect(()=>(n.waiting?b===0?k(!0):g.current=setTimeout(()=>{k(!0)},b):k(!1),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[b,n.waiting]),h.useEffect(()=>{if(!y)return;const _=C=>{!r||f!==Ue.TOOLTIP||C.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(vo.KEYBOARD):e.close(vo.KEYBOARD))};return document.body.addEventListener("keydown",_,{passive:!0}),()=>{document.body.removeEventListener("keydown",_)}},[e,y,f,r]);const x=h.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(vo.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(vo.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!y)return null;const N=n.action===Ut.START&&!r.skipBeacon&&r.placement!=="center";return at.createElement(at.Fragment,null,f!==Ue.INIT&&at.createElement(Yie,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:p,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(c!==0||d),step:r,updateState:s.current.updateState}),at.createElement(fR,{element:p},at.createElement(at.Fragment,null,v&&at.createElement(Aie,{nonce:l,step:r}),!N&&at.createElement(Mie,{...r,continuous:i,lifecycle:f,onClickOverlay:x,portalElement:u?p:null,scrolling:n.scrolling,waiting:n.waiting}))))}function Xie(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=Eie(e);return{controls:t,failures:n,on:h.useCallback((l,u)=>a.current.on(l,u),[a]),state:h.useMemo(()=>Tg(s,"positioned"),[s]),step:i,Tour:X0()?at.createElement(Gie,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function Jie(e){const{Tour:t}=Xie(e);return t}function Qie(e){return X0()?at.createElement(Jie,e):null}function Zie(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 eoe(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function toe(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const Qx="af:onboarding";function noe({page:e,hasNodes:t=!1}){const{t:n}=In(),[r,s]=h.useState(!1),[i,a]=h.useState([]),l=h.useRef(null),u=h.useMemo(()=>e==="projects"?Zie(n):t?eoe(n):toe(n),[e,t,n]);return h.useEffect(()=>{const d=localStorage.getItem(Qx);console.log("[Onboarding] localStorage:",d);const p=d?JSON.parse(d):{};if(console.log("[Onboarding] progress:",p,"page:",e),p.completed||p[e]){console.log("[Onboarding] skipped - already done"),s(!1),a([]);return}console.log("[Onboarding] starting with steps:",u),a(u),s(!0)},[e,t,u]),h.useEffect(()=>{if(!r)return;const d=p=>{var y;const c=p.target.closest("button");if(!c||!c.closest(".react-joyride__tooltip"))return;const m=(y=c.textContent)==null?void 0:y.trim();if(m===n("onboarding:done")||m===n("onboarding:startCreate")||m===n("onboarding:skip")){const v=localStorage.getItem(Qx)||"{}",k=JSON.parse(v);m===n("onboarding:skip")?(k.projects=!0,k.flow=!0,k.completed=!0):k[e]=!0,localStorage.setItem(Qx,JSON.stringify(k)),a([]),s(!1),e==="projects"&&(m===n("onboarding:done")||m===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(Qie,{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 roe(){const{navigate:e,path:t}=Lo(),[n,r]=h.useState([]),[s,i]=h.useState(!1);if(h.useEffect(()=>{let p=!1;const c=async()=>{try{const m=await fetch("/api/pipeline-recent-runs");if(!m.ok)return;const y=await m.json();if(p)return;const v=Array.isArray(y.runs)?y.runs:[];r(v.filter(k=>k&&k.status==="running"))}catch{}};c();const f=window.setInterval(c,3e3);return()=>{p=!0,window.clearInterval(f)}},[]),n.length===0)return null;const a=p=>{const c=new URLSearchParams({flowId:p.flowId,flowSource:p.flowSource||"workspace"});e(`/flow?${c.toString()}`),i(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,u=(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(p=>o.jsxs("button",{type:"button",className:"af-run-indicator__item"+(p.flowId===u?" af-run-indicator__item--current":""),onClick:()=>a(p),title:`${p.flowId} · ${p.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:p.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:p.runId.slice(0,12)})]},`${p.flowId}:${p.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>d?a(n[0]):i(p=>!p),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`})]})]})}function pR(e){return e==="/likee-context"||e==="/likee_context"}class soe extends h.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 ioe({authUser:e}){const{path:t}=Lo();return t==="/projects"||t==="/"?o.jsx(Uc,{authUser:e}):t==="/nodes"?o.jsx(Uc,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?o.jsx(Uc,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?o.jsx(Uc,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?o.jsx(Uc,{authUser:e,resourceKind:"skills"}):t==="/mcps"?o.jsx(zne,{}):t==="/flow"?o.jsx(z7,{}):t==="/workspace"?o.jsx(yY,{}):t.startsWith("/display")?o.jsx(_2,{}):t==="/settings"?o.jsx($ne,{authUser:e}):t==="/feedback"?o.jsx(Dne,{}):pR(t)?o.jsx($2,{}):o.jsx(Uc,{})}function ooe({children:e}){const[t,n]=h.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=h.useState(""),[i,a]=h.useState(""),[l,u]=h.useState(!1),[d,p]=h.useState(""),c=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}),p(y.error?String(y.error):"")}catch(m){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),p(String(m.message||m))}};h.useEffect(()=>{c()},[]);const f=async m=>{m.preventDefault(),u(!0),p("");try{const y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),v=await y.json().catch(()=>({}));if(!y.ok)throw new Error(v.error||"登录失败");n({loading:!1,authenticated:!0,user:v.user||null,setupRequired:!1})}catch(y){p(String(y.message||y))}finally{u(!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:f,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:m=>s(m.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:m=>a(m.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 aoe({authUser:e,onLogout:t}){const{path:n}=Lo(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(noe,{page:r?"flow":"projects"}):null,r?null:o.jsx(PO,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(ioe,{authUser:e})}),o.jsx(roe,{})]})}function loe(){return o.jsx(soe,{children:o.jsx(uO,{children:o.jsx(coe,{})})})}function coe(){const{path:e}=Lo();return e.startsWith("/display")?o.jsx(_2,{}):pR(e)?o.jsx($2,{}):o.jsx(ooe,{children:({user:t,onLogout:n})=>o.jsx(aoe,{authUser:t,onLogout:n})})}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 RC=document.querySelector('link[rel="icon"]');RC&&(RC.href=G_);Zx.createRoot(document.getElementById("root")).render(o.jsx(at.StrictMode,{children:o.jsx(loe,{})}));
|